From 5a47c3a191df247504a40deb49f1131f13953cdf Mon Sep 17 00:00:00 2001 From: prr <3099672575@qq.com> Date: Mon, 25 Nov 2024 10:42:28 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Aword=E8=BF=BD=E5=8A=A0=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/editor/core/command/CommandAdapt.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/word/src/editor/core/command/CommandAdapt.ts b/packages/word/src/editor/core/command/CommandAdapt.ts index c1b3154..03098c9 100644 --- a/packages/word/src/editor/core/command/CommandAdapt.ts +++ b/packages/word/src/editor/core/command/CommandAdapt.ts @@ -652,19 +652,9 @@ export class CommandAdapt { } this.search(content) this.replace(content + payload, true) - // if (operate && content) { - // window.parent.postMessage( - // { - // type: 'aiCreater', - // data: content, - // action: operate - // }, - // '*' - // ) - // } return content } - public aiEdit(operate: string | null) { + public aiEdit(operate: string | null, question?: string) { console.log('ai edit:', operate) const isDisabled = this.draw.isReadonly() || this.draw.isDisabled() if (isDisabled) return @@ -675,7 +665,19 @@ export class CommandAdapt { content += el.value }) this.search(content) - if (operate && content) { + if (operate && operate == 'creation_ask') { + window.parent.postMessage( + { + type: 'aiCreater', + data: { + title: question, + category: content + }, + action: operate + }, + '*' + ) + } else if (operate && content) { window.parent.postMessage( { type: 'aiCreater', @@ -1212,8 +1214,6 @@ export class CommandAdapt { if(aiArticle == true) { if (!payload) return } else { - // console.log('zero:', new RegExp(`${ZERO}`, 'g').test(payload)) - if (!payload || new RegExp(`${ZERO}`, 'g').test(payload)) return } // if (!payload || (isZero && aiArticle)) return