From e5e20a4dbbf70a746e8eea7597f71fd49f138853 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Wed, 12 Nov 2025 22:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=99=A8=E8=A1=A8=E5=8D=95=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../List/components/TemplateEditor.tsx | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/Deploy/NotificationTemplate/List/components/TemplateEditor.tsx b/frontend/src/pages/Deploy/NotificationTemplate/List/components/TemplateEditor.tsx index 892f70a4..1c88ad0d 100644 --- a/frontend/src/pages/Deploy/NotificationTemplate/List/components/TemplateEditor.tsx +++ b/frontend/src/pages/Deploy/NotificationTemplate/List/components/TemplateEditor.tsx @@ -162,7 +162,13 @@ export const TemplateEditor: React.FC = ({ // 设置自动完成 monaco.languages.registerCompletionItemProvider('freemarker', { - provideCompletionItems: (model, position) => { + // 使用宽松的类型以兼容不同版本的 monaco 类型定义 + provideCompletionItems: ( + model: any, + position: any, + context?: any, + token?: any + ) => { const suggestions = [ // FreeMarker 指令 ...['if', 'list', 'assign', 'include', 'macro'].map(keyword => ({ @@ -183,7 +189,7 @@ export const TemplateEditor: React.FC = ({ })) ]; - return { suggestions }; + return { suggestions } as any; // 兼容 CompletionList 类型 } }); } @@ -192,8 +198,12 @@ export const TemplateEditor: React.FC = ({ registerFreeMarker(); }, [variables]); - const handleEditorDidMount = (editor: editor.IStandaloneCodeEditor) => { - editorRef.current = editor; + const handleEditorDidMount = ( + ed: editor.IStandaloneCodeEditor, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + monacoInstance?: unknown + ) => { + editorRef.current = ed; }; const getVariableTypeColor = (type: string) => { @@ -220,11 +230,11 @@ export const TemplateEditor: React.FC = ({