我需要能够将“链接对话框”窗口中的 URL 输入字段设置为只读或禁用它。当用户从服务器选择文件时,该字段将被填充。
另一位用户将此链接发布为解决方案,http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ui.dialog.uiElement.html#disable 但没有示例,我无法弄清楚如何实现它.
我需要能够将“链接对话框”窗口中的 URL 输入字段设置为只读或禁用它。当用户从服务器选择文件时,该字段将被填充。
另一位用户将此链接发布为解决方案,http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ui.dialog.uiElement.html#disable 但没有示例,我无法弄清楚如何实现它.
在对话框的 onLoad 处理程序中,您可以通过以下方式禁用它:
this.getContentElement("info", "url").disable();
这就是我最终要做的。我把它写在我的 js 文件而不是插件文件中,但我认为这不会有什么不同。我正在使用内联 ckeditor 版本 4.0.2
CKEDITOR.on('dialogDefinition', function(event) {
var dialogName = event.data.name;
var dialogDefinition = event.data.definition;
//some code here
if(dialogName == 'flash'){ // flash dialog box name
//some code here
dialogDefinition.onShow = function () {
this.getContentElement("info","width").disable(); // info is the name of the tab and width is the id of the element inside the tab
this.getContentElement("info","height").disable();
}
}
});
您可以仅通过一行禁用 url 字段
CKEDITOR.dialog.getCurrent().getContentElement('info','txtUrl').disable()
我得到了它。我添加了 this.getInputElement().setAttribute('readOnly', true); 到 ckeditor\plugins\links\dialogs\link.js 中的 onload 函数。在我将它添加到 ckeditor\_source\plugins\links\dialogs\link.js 之前。我仍然想要一个如何使用 CKEDITOR.ui.dialog.uiElement 禁用功能的示例,如果有人有的话。