我试图在CKEdit中删除'Link'对话框的'Display Text'部分。
现在的样子:https://i.stack.imgur.com/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');
}
然而,结果是这样的:https://i.stack.imgur.com/Iihxd.png
"显示文本"字段按预期被删除,但出现了许多不同的字段。似乎是根据您在"链接类型"下拉列表中选择的内容显示的字段。
Chrome的控制台也抛出了一个错误:
link.js?t=G87E:24 Uncaught TypeError: Cannot read property 'getElement' of undefined
我怎么能解决这个问题(最好不搞乱源代码)?
欢呼
你可以使用Configuration helper插件来隐藏它,但是你应该提交一个票据,因为大多数人不会想要这个字段(他们在最新的"次要"版本中添加了这个字段,但他们甚至没有考虑到CKEditor 5: http://ckeditor.com/blog/CKEditor-Biweekly-for-October-5-2016)
他们应该调整新的代码,使它不会失败,如果人们已经删除了字段,因为他们不想要它。