🎨 Optimize code

This commit is contained in:
2025-11-17 23:14:58 +08:00
parent a08c0d8448
commit 991a89147e
10 changed files with 136 additions and 224 deletions

View File

@@ -6,6 +6,7 @@
import { EditorSelection, SelectionRange } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { getNoteBlockFromPos } from "./state";
import { codeBlockEvent, CONTENT_EDIT } from "./annotation";
import { USER_EVENTS } from "./annotation";
interface LineBlock {
@@ -88,7 +89,8 @@ export const deleteLine = (view: EditorView): boolean => {
changes,
selection,
scrollIntoView: true,
userEvent: USER_EVENTS.DELETE_LINE
userEvent: USER_EVENTS.DELETE_LINE,
annotations: [codeBlockEvent.of(CONTENT_EDIT)],
});
return true;
@@ -128,7 +130,8 @@ export const deleteLineCommand = ({ state, dispatch }: { state: any; dispatch: a
changes,
selection,
scrollIntoView: true,
userEvent: USER_EVENTS.DELETE_LINE
userEvent: USER_EVENTS.DELETE_LINE,
annotations: [codeBlockEvent.of(CONTENT_EDIT)],
}));
return true;