Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(board): unable to create by clicking outside
Elian Doran3b06845a7125
diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsxindex c99a6f1a09..2e8add6b42 100644--- a/apps/client/src/widgets/collections/board/index.tsx+++ b/apps/client/src/widgets/collections/board/index.tsx@@ -228,7 +228,7 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilin}) {const inputRef = useRef<any>(null);const dismissOnNextRefreshRef = useRef(false);- const shouldSave = useRef(false);+ const shouldDismiss = useRef(false);useEffect(() => {inputRef.current?.focus();@@ -254,12 +254,12 @@ export function TitleEditor({ currentValue, placeholder, save, dismiss, multilinonKeyDown={(e: TargetedKeyboardEvent<HTMLInputElement | HTMLTextAreaElement>) => {if (e.key === "Enter" || e.key === "Escape") {e.preventDefault();- shouldSave.current = (e.key === "Enter");+ shouldDismiss.current = (e.key === "Escape");e.currentTarget.blur();}}}onBlur={(newValue) => {- if (shouldSave.current && newValue.trim() && (newValue !== currentValue || isNewItem)) {+ if (!shouldDismiss.current && newValue.trim() && (newValue !== currentValue || isNewItem)) {save(newValue);dismissOnNextRefreshRef.current = true;} else {