Javascript 如何在TinyMCE中修改注释中的属性
我正在尝试修改TinyMCE中注释的Javascript 如何在TinyMCE中修改注释中的属性,javascript,annotations,tinymce,wysiwyg,tinymce-plugins,Javascript,Annotations,Tinymce,Wysiwyg,Tinymce Plugins,我正在尝试修改TinyMCE中注释的数据作者。文件说: TinyMCE注释API提供添加、修改和删除注释的功能;侦听文本选择事件并检索具有相同注释名称的所有注释 我已经使用 editor.annotator.annotate('comment', { uid: id, author: name }); 输出: 建议 在该代码中,我已成功地对所选单词进行了注释,但在某些情况下,我希望更改注释单词的作者,以下是我的代码: editor.annotator.annot
数据作者
。文件说:
TinyMCE注释API提供添加、修改和删除注释的功能;侦听文本选择事件并检索具有相同注释名称的所有注释
我已经使用
editor.annotator.annotate('comment', {
uid: id,
author: name
});
输出:建议
在该代码中,我已成功地对所选单词进行了注释,但在某些情况下,我希望更改注释单词的作者,以下是我的代码:
editor.annotator.annotate('comment', {
uid: id,
author: newName
});
输出:建议
我想既然选定的单词已经被注释了,通过使用上面的代码,我可以更改作者。但它只是在原始的span
中创建另一个span
我想要的只是从某个事件的其他值编辑或更改数据mce annotation author
值
有没有人尝试过这个问题或者有过这样的经历?多谢各位 我找到了解决办法 您只需使用 我的更改特定注释器属性的解决方案:
const comments = editor.annotator.getAll(this.name);
const comment = comments[id][0];
comment.setAttribute('data-mce-annotation-author', newName);
editor.save();