diff --git a/packages/ui/src/components/MonacoEditor.vue b/packages/ui/src/components/MonacoEditor.vue index 1a41f4052..de6c8cb20 100644 --- a/packages/ui/src/components/MonacoEditor.vue +++ b/packages/ui/src/components/MonacoEditor.vue @@ -12,11 +12,13 @@ const props = withDefaults( value?: monaco.editor.IStandaloneEditorConstructionOptions['value'] language?: monaco.editor.IStandaloneEditorConstructionOptions['language'] options?: Partial + actions?: monaco.editor.IActionDescriptor[] }>(), { value: '', language: 'json', options: () => ({}), + actions: () => [], }, ) @@ -24,7 +26,7 @@ const emit = defineEmits<{ (e: 'update', value: string, event: monaco.editor.IModelContentChangedEvent): void }>() -const { value, language, options } = toRefs(props) +const { value, language, options, actions } = toRefs(props) const editorRef = ref(null) // The editor cannot use ref, using ref will cause the editor to completely freeze when calling getValue or setValue @@ -107,6 +109,10 @@ function initMonacoEditor() { emit('update', editorValue, event) } }) + + actions.value.forEach((action) => { + editor!.addAction(action) + }) } watch(value, (newValue) => { diff --git a/packages/ui/src/components/script/function/Editor.vue b/packages/ui/src/components/script/function/Editor.vue index 4fc0bee6d..44772166f 100644 --- a/packages/ui/src/components/script/function/Editor.vue +++ b/packages/ui/src/components/script/function/Editor.vue @@ -1,5 +1,6 @@