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