fix: Comment gutter mark default enabled (#12977)

This commit is contained in:
Tom Moor authored and GitHub committed 2026-07-12 23:05:22 +02:00
1 parent f800c399b3
commit 69fdebd573
2 files changed
+14 -2

No files matched your search

+3 -1
View File
@@ -6,6 +6,7 @@ import Extension from "@shared/editor/lib/Extension";
import { changedDescendants } from "@shared/editor/lib/changedDescendants";
import { isRemoteTransaction } from "@shared/editor/lib/multiplayer";
import { EditorStyleHelper } from "@shared/editor/styles/EditorStyleHelper";
import { UserPreferenceDefaults } from "@shared/constants";
import { UserPreference } from "@shared/types";
import { CommentGutter as CommentGutterComponent } from "../components/CommentGutter";
@@ -25,7 +26,8 @@ export default class CommentGutter extends Extension {
get plugins() {
const isEnabled = () =>
!!this.editor.props.userPreferences?.[UserPreference.CommentsInGutter];
this.editor.props.userPreferences?.[UserPreference.CommentsInGutter] ??
UserPreferenceDefaults[UserPreference.CommentsInGutter];
const handleClickCommentMark = (commentId: string) =>
this.editor.props.onClickCommentMark?.(commentId);
+11 -1
View File
@@ -156,6 +156,16 @@ function DocumentEditor(props: Props, ref: React.ForwardedRef<SharedEditor>) {
[comments, user?.id, props.id, setFocusedCommentId]
);
// Focus a comment and open the sidebar when its mark or gutter marker is
// clicked.
const handleClickCommentMark = React.useCallback(
(commentId: string) => {
setFocusedCommentId(commentId);
ui.set({ rightSidebar: "comments" });
},
[setFocusedCommentId, ui]
);
// Soft delete the Comment model when associated mark is totally removed.
const handleRemoveComment = React.useCallback(
async (commentId: string) => {
@@ -245,7 +255,7 @@ function DocumentEditor(props: Props, ref: React.ForwardedRef<SharedEditor>) {
userId={user?.id}
focusedCommentId={focusedComment?.id}
onClickCommentMark={
commentingEnabled && can.comment ? setFocusedCommentId : undefined
commentingEnabled && can.comment ? handleClickCommentMark : undefined
}
onCreateCommentMark={
commentingEnabled && can.comment ? handleDraftComment : undefined