🎨 Modify code block logic
This commit is contained in:
@@ -4,6 +4,7 @@ import * as prettier from "prettier/standalone";
|
||||
import { getActiveNoteBlock } from "./state";
|
||||
import { getLanguage } from "./lang-parser/languages";
|
||||
import { SupportedLanguage } from "./types";
|
||||
import { USER_EVENTS } from "./annotation";
|
||||
|
||||
export const formatBlockContent = (view) => {
|
||||
if (!view || view.state.readOnly)
|
||||
@@ -87,7 +88,7 @@ export const formatBlockContent = (view) => {
|
||||
},
|
||||
selection: EditorSelection.cursor(currentBlockFrom + Math.min(formattedContent.cursorOffset, formattedContent.formatted.length)),
|
||||
scrollIntoView: true,
|
||||
userEvent: "input"
|
||||
userEvent: USER_EVENTS.INPUT
|
||||
});
|
||||
|
||||
return true;
|
||||
@@ -100,4 +101,4 @@ export const formatBlockContent = (view) => {
|
||||
// 执行异步格式化
|
||||
performFormat();
|
||||
return true; // 立即返回 true,表示命令已开始执行
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user