From 4f31eed71a9a389aa56e986b0e7d7ee5d83404c5 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Tue, 12 Mar 2024 14:08:37 +0800 Subject: [PATCH] =?UTF-8?q?style(editor):=20use-plugin=20ts=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/type.ts | 7 +++++-- playground/src/pages/Editor.vue | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/type.ts b/packages/editor/src/type.ts index 5ce8589a..c63bfd40 100644 --- a/packages/editor/src/type.ts +++ b/packages/editor/src/type.ts @@ -681,11 +681,14 @@ export interface TreeNodeData { } export type AsyncBeforeHook, C extends Record any>> = { - [K in Value[number]]?: (...args: Parameters) => Promise>; + [K in Value[number]]?: (...args: Parameters) => Promise> | Parameters; }; export type AsyncAfterHook, C extends Record any>> = { - [K in Value[number]]?: (result: Awaited>, ...args: Parameters) => ReturnType; + [K in Value[number]]?: ( + result: Awaited>, + ...args: Parameters + ) => ReturnType | Awaited>; }; export type SyncBeforeHook, C extends Record any>> = { diff --git a/playground/src/pages/Editor.vue b/playground/src/pages/Editor.vue index 3e06bf62..f5420adc 100644 --- a/playground/src/pages/Editor.vue +++ b/playground/src/pages/Editor.vue @@ -227,7 +227,7 @@ asyncLoadJs(`${VITE_ENTRY_PATH}/ds-value/index.umd.cjs`).then(() => { save(); editorService.usePlugin({ - beforeDoAdd: async (config: MNode, parent: MContainer) => { + beforeDoAdd: (config: MNode, parent: MContainer) => { if (config.type === 'overlay') { config.style = { ...config.style,