🎨 Modify code block logic

This commit is contained in:
2025-11-17 22:11:16 +08:00
parent 59db8dd177
commit a08c0d8448
11 changed files with 156 additions and 65 deletions

View File

@@ -6,6 +6,7 @@
import { EditorSelection, SelectionRange } from "@codemirror/state";
import { blockState } from "./state";
import { LANGUAGES } from "./lang-parser/languages";
import { USER_EVENTS } from "./annotation";
interface LineBlock {
from: number;
@@ -131,7 +132,7 @@ function moveLine(state: any, dispatch: any, forward: boolean): boolean {
changes,
scrollIntoView: true,
selection: EditorSelection.create(ranges, state.selection.mainIndex),
userEvent: "move.line"
userEvent: USER_EVENTS.MOVE_LINE
}));
return true;
@@ -157,4 +158,4 @@ export const moveLineUp = ({ state, dispatch }: { state: any; dispatch: any }):
*/
export const moveLineDown = ({ state, dispatch }: { state: any; dispatch: any }): boolean => {
return moveLine(state, dispatch, true);
};
};