mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 14:43:06 +08:00
feat: bug fixes (#2084)
* handle enter in inline code * fix: duplicate comment cache * track link nodes (backlinks) * fix en-US translation * fix internal a-links * overrides * 0.71.1
This commit is contained in:
@@ -65,6 +65,11 @@ export function useCreateCommentMutation() {
|
||||
) as InfiniteData<IPagination<IComment>> | undefined;
|
||||
|
||||
if (cache && cache.pages.length > 0) {
|
||||
const alreadyExists = cache.pages.some((page) =>
|
||||
page.items.some((c) => c.id === newComment.id),
|
||||
);
|
||||
if (alreadyExists) return;
|
||||
|
||||
const lastIdx = cache.pages.length - 1;
|
||||
queryClient.setQueryData(RQ_KEY(newComment.pageId), {
|
||||
...cache,
|
||||
|
||||
@@ -142,6 +142,25 @@ export const mainExtensions = [
|
||||
}),
|
||||
];
|
||||
},
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
Enter: ({ editor }) => {
|
||||
const { from, to } = editor.state.selection;
|
||||
if (from !== to) return false;
|
||||
if (!editor.isActive("code")) return false;
|
||||
|
||||
const $from = editor.state.doc.resolve(from);
|
||||
const codeType = editor.state.schema.marks.code;
|
||||
const nodeAfter = $from.nodeAfter;
|
||||
|
||||
if (nodeAfter && codeType.isInSet(nodeAfter.marks)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return editor.chain().unsetCode().splitBlock().run();
|
||||
},
|
||||
};
|
||||
},
|
||||
}),
|
||||
SharedStorage,
|
||||
Heading,
|
||||
|
||||
Reference in New Issue
Block a user