我正在尝试删除 CKEdit 中“链接”对话框的“显示文本”部分。
这是它目前的样子:/image/lgTuV.png
我尝试编辑“config.js”文件来删除它,如下所示:
if (dialogName == 'link') {
// Remove the 'Advanced' and 'Target' tabs from the 'Link' dialog.
dialogDefinition.removeContents('advanced');
dialogDefinition.removeContents('target');
// Get a reference to the 'Link Info' tab.
var infoTab = dialogDefinition.getContents('info');
// Remove unnecessary widgets from the 'Link Info' tab.
infoTab.remove('linkDisplayText');
}
但是,结果如下所示:/image/Iihxd.png
“显示文本”字段已按预期删除,但出现了许多不同的字段。似乎是根据您在“链接类型”下拉列表中选择的内容显示的字段。
Chrome 的控制台也抛出错误:
link.js?t=G87E:24 Uncaught TypeError: Cannot read property 'getElement' of undefined
如何解决这个问题(最好不要弄乱源代码)?
干杯
最佳答案
您可以使用Configuration helper plugin隐藏它,但您应该提交一张票,因为大多数人都不需要该字段(他们在最新的“次要”版本中添加了该字段,但他们甚至没有考虑 CKEditor 5: http://ckeditor.com/blog/CKEditor-Biweekly-for-October-5-2016 )
他们应该调整新代码,这样即使人们因为不想要该字段而删除了该字段,代码也不会失败。
关于javascript - CKEditor:从 'Display Text' 对话框中删除 'Link' 会导致意外行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39918368/