0

我正在进行协作编辑并将 html-text-collab-ext 用于 html textareas。下面是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], uid, 'subject')
        });
        const selectionManager = textEditor.selectionManager();

});

我收到错误为Uncaught TypeError: Cannot read property 'CollaborativeTextEditor' of undefined

4

0 回答 0