问题
My current Image Properties dialog box only has the Image Info
and Link
tabs available. I want to change this dialog box so that:
- I want to remove the Width, Height, Border, HSpace, VSpace, Alignment, and Preview elements from the
Image Info
screen - I want to remove the
Link
tab - I want to enable the
Upload
tab so that users can choose an image file that resides on their local computer
I've been doing lots of searches but can't understand how to do the above at all. Any pointers please? I am using CKEditor 4.4.6 Standard.
回答1:
Okay, here's the code on how handle the Image dialog:
CKEDITOR.on('dialogDefinition', function(ev) {
var dialogName = ev.data.name;
var dialogDefinition = ev.data.definition;
if (dialogName == 'image') {
var infoTab = dialogDefinition.getContents( 'info' );
infoTab.remove( 'txtBorder' ); //Remove Element Border From Tab Info
infoTab.remove( 'txtHSpace' ); //Remove Element Horizontal Space From Tab Info
infoTab.remove( 'txtVSpace' ); //Remove Element Vertical Space From Tab Info
infoTab.remove( 'txtWidth' ); //Remove Element Width From Tab Info
infoTab.remove( 'txtHeight' ); //Remove Element Height From Tab Info
//Remove tab Link
dialogDefinition.removeContents( 'Link' );
}
});
For point 3, the default CKEditor doesn't contain Image Browsing Facility... And this mean that the upload and browse button will not appear...
There is 3 options here, and you can see my comment on this page: link on how you can do this.
回答2:
The following resources might be helpful:
- The Dialog Windows HOWTO section in CKEditor developer documentation.
- The Using CKEditor Dialog API sample (it is also available in your local CKEditor package) -- check its source code for how the changes are done.
- The Developer Tools plugin which shows you the names and IDs of all CKEditor dialog window elements.
来源:https://stackoverflow.com/questions/28356098/how-do-i-configure-the-image-properties-dialog-box-in-ckeditor