#鸿蒙学习大百科#如何监听RichEditor添加输入法输入内容前和完成输入后可触发的回调?

如何监听RichEditor添加输入法输入内容前和完成输入后可触发的回调?

HarmonyOS
2024-10-26 09:20:19
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
自封的不算
RichEditor(this.options)
  .onReady(() => {
    this.controller.addTextSpan('输入法输入内容前,触发回调。\n输入法完成输入后,触发回调。' , {
      style: {
        fontColor: Color.Black,
        fontSize: 15
      }
    })
  })
  .aboutToIMEInput((value: RichEditorInsertValue) => {
    this.controller1.addTextSpan('输入法输入内容前,触发回调:\n'+JSON.stringify(value), {
      style: {
        fontColor: Color.Gray,
        fontSize: 10
      }
    })
    return true;
  })
  .onIMEInputComplete((value: RichEditorTextSpanResult) => {
    this.controller1.addTextSpan('输入法完成输入后,触发回调:\n'+ JSON.stringify(value), {
      style: {
        fontColor: Color.Gray,
        fontSize: 10
      }
    })
    return true;
  })
  .width(300)
  .height(50)
Text('查看回调内容:').fontSize(10).fontColor(Color.Gray).width(300)
RichEditor(this.options1)
  .width(300)
  .height(70)
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
分享
微博
QQ
微信
回复
2024-10-26 16:45:05
相关问题
如何监听输入法输入内容变化?
1307浏览 • 1回复 待解决
HarmonyOS如何监听输入法显示隐藏
1501浏览 • 1回复 待解决
HarmonyOS 自带输入法输入问题
1123浏览 • 1回复 待解决
HarmonyOS 输入法光标控制
1115浏览 • 1回复 待解决