Browse Source

fix:word追加修复

master
prr 6 months ago
parent
commit
5a47c3a191
  1. 28
      packages/word/src/editor/core/command/CommandAdapt.ts

28
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

Loading…
Cancel
Save