微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

未捕获的类型错误:无法读取未定义的属性“CollaborativeTextEditor”

如何解决未捕获的类型错误:无法读取未定义的属性“CollaborativeTextEditor”

正在进行协作编辑,并将 html-text-collab-ext 用于 html 文本区域。下面是 updateContent.tsx 文件

function updateCursorText(range: any[],uid: any,text: string) {
    if (range) {
      doc.submitPresence({
        path: [text],type: 'text0',subpresence: {
          user: uid,c: 0,s: [range]
        }
      });
    }
  }
useEffect(() => {
    if (subjectRef.current) {
      const subjectElem = subjectRef.current.getInputElement();
      doc.subscribe(() => {
        subjectElem.addEventListener('focus',() => {
          console.log("focus")
          updateCursorText(
            [subjectElem.selectionStart,subjectElem.selectionStart],uid,'subject'
          );
        });
        const textEditor = new HtmlTextCollabExt.CollaborativeTextEditor({
          control: subjectElem,onSelectionChanged: (selection: { anchor: any; target: any; }) =>
            updateCursorText([selection.anchor,selection.target],'subject')
        });
        const selectionManager = textEditor.selectionManager();

});

我收到的错误未捕获的类型错误:无法读取未定义的属性“CollaborativeTextEditor”

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。