问题描述
我正在进行协作编辑,并将 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 (将#修改为@)