Ckeditor make the dialog element readonly or disable

I need the URL entry box in the Link dialog box to be read-only or disabled. The field is filled when the user selects a file from the server.

Another user posted this link as a solution http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ui.dialog.uiElement.html#disable , but there is no example, and I cannot figure out how to implement it.

Link Upload Dialog Window

+4
source share
4 answers

In the onLoad handler of the dialog, you can disable it as follows:

this.getContentElement("info", "url").disable(); 
+2
source

I understood. I added this.getInputElement (). SetAttribute ('readOnly', true); to the onload function in ckeditor \ plugins \ links \ dialogs \ link.js. Before I added it to ckeditor \ _source \ plugins \ links \ dialogs \ link.js. I still like the example of using the disable function CKEDITOR.ui.dialog.uiElement if anyone has it.

+1
source

This is what I ended up doing. I wrote it in the js file instead of the plugin file, but I don’t think that would make a difference. I am using the built-in version of 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(); } } }); 
+1
source

You can disable url field with only one line

 CKEDITOR.dialog.getCurrent().getContentElement('info','txtUrl').disable() 
+1
source

Source: https://habr.com/ru/post/1440076/


All Articles