【发布时间】:2022-11-25 05:29:56
【问题描述】:
我正在开发一个简单的 CKEditor5 插件。插件的一部分是这样执行的“命令”:
execute(options) {
const contentItemUtils = this.editor.plugins.get('ContentItemUtils');
const contentItemElement = contentItemUtils.getClosestSelectedContentItemElement(this.editor.model.document.selection);
this.editor.model.change(writer => {
writer.setAttribute('width', options.width, contentItemElement);
});
}
当我调用writer.setAttribute时出现问题。我总是收到这样的错误:
CKEditor错误:属性操作属性存在{“节点”:{“属性”:{“contentId”:“CORE08954D2EBB7042799E0A059DC90703DD”,“contentName”:“巴黎”,“contentType”:“目的地”,“contentTypeDisplay”:“目的地”,“contentViewing”:“草稿” "categoryLayout":"overview","detailPageId":"","alignment":""},"name":"contentItem"},"key":"width"}
我正在尝试做的事情——将模型属性设置为新值——看起来相当简单。
更新已经有值的模型属性是否有限制?
【问题讨论】: