Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): track readOnly in ref so handleClick sees current mode

justin2879021f895c
diff --git a/apps/web/src/components/activity/comment-editor.tsx b/apps/web/src/components/activity/comment-editor.tsx
index 33e7d57f3..28ea55643 100644
--- a/apps/web/src/components/activity/comment-editor.tsx
+++ b/apps/web/src/components/activity/comment-editor.tsx
@@ -219,6 +219,8 @@ export default function CommentEditor({
const onCancelShortcutRef = useRef(onCancelShortcut);
onSubmitShortcutRef.current = onSubmitShortcut;
onCancelShortcutRef.current = onCancelShortcut;
+ const readOnlyRef = useRef(readOnly);
+ readOnlyRef.current = readOnly;
const pendingImageInsertRef = useRef<{
editor: Editor;
range?: SlashRange;
@@ -737,7 +739,7 @@ export default function CommentEditor({
return true;
},
handleClick: (_view, _pos, event) => {
- if (!readOnly) return false;
+ if (!readOnlyRef.current) return false;
const target = event.target as HTMLElement;
const anchor = target.closest("a");
if (anchor?.href) {