aieditor-team / AiEditor

AiEditor is a next-generation rich text editor for AI.
https://AiEditor.dev
GNU Lesser General Public License v2.1
1.03k stars 99 forks source link

更新最新版本,拼音全拼输入法 输入中文,会将敲入的拼音也带入富文本中 #50

Closed yin2017168 closed 1 month ago

yin2017168 commented 3 months ago

详情可见附件视频

https://github.com/aieditor-team/AiEditor/assets/26922373/65b736e0-df7b-439b-8b50-196e37de56fb

麻烦看一下怎么解决,谢谢

ych-1 commented 2 months ago
<script setup lang="ts">
import { AiEditor } from 'aieditor'
import 'aieditor/dist/style.css'
import type { CSSProperties } from 'vue'
import { onMounted, onUnmounted, ref } from 'vue'

const doing = ref(false)
const divRef = ref()
let aiEditor: AiEditor | null = null

function change() {
  if (doing.value) {
    return
  }
  // do something
}

onMounted(() => {
  aiEditor = new AiEditor({
    element: divRef.value as Element,
    placeholder: "点击输入内容...",
    content: 'AiEditor 是一个面向 AI 的开源富文本编辑器。 ',
    onChange: () => {
      change()
    },
  })
})

onUnmounted(() => {
  aiEditor && aiEditor.destroy();
})

function onCompositionEnd() {
  doing.value = false
  change()
}
</script>

<template>
  <div ref="divRef" @compositionstart="doing = true" @compositionend="onCompositionEnd" />
</template>
yangfuhai commented 1 month ago

最新版本测试无法复现。