Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#9877 closed New Feature (invalid)

Disable Image Properties dialog without having to unload forms

Reported by: morfanaion Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

It appears the current practice for disabling the Image Dialog is to unload the image plugin. However, because the forms plugin uses the image plugin as well, you also need to unload that. This is where I am having my problem. I have written a plugin for adding images that fits better with my CMS, so I don't want my users to be able to use the original images dialog. However, although I can remove the button on the toolbar, I still get the properties dialog if I double click the image. I also need the forms plugin, because I want to allow my users to be able to make forms as well. I'd like to see a config option that completely disables the image dialog, without the requirement to unload the forms plugin.

Change History (2)

comment:1 Changed 7 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
  1. There are two plugins using image plugin image and imageButton.
  2. You can remove it but if you need forms plugin and its imageButton plugin you can't.

Solution:

  1. You have to hide both toolbar buttons image and imagebutton and introduce your button by defining your own toolbar definition (Checkout toolbar sample and don't forget that now toolbar defines its place in toolbar). Let's say that your custom dialog is "find":
    var editor = CKEDITOR.replace( 'editor1', {			
    toolbar: [{ name: 'editing', groups: [ 'find'], items: [ 'Find', 'Replace', '-', 'mybutton' ] },
    { name: 'forms', items: [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', /*'ImageButton'*/, 'HiddenField' ] },
    { name: 'insert', items: [ /*'Image',*/ 'Flash', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak', 'Iframe' ] }	]});
    
  1. Next you have to define double click function that will show custom dialog instead of default ones.
    editor.on( 'doubleclick', function( evt ) {
    	var element = evt.data.element;
    		if ( element.is( 'img' ) && !element.data( 'cke-realelement' ) && !element.isReadOnly() ){					
    		evt.data.dialog = 'find';					
    	}	
    }, null, null, 100000) ;//priority has to be higher than image priority.
    
  2. Don't forget that if you want to have both - custom image and custom imageButton you have to write your plugin to handle both (Link plugin shows how it can be done - it is used as link,unlink and anchor). By default image button code is in forms plugin which in your case is not the way to go - unless you want to modify core plugin which would require qithub version.

comment:2 Changed 6 years ago by Jakub Ś

It seems that there really is a problem with this - #10430. I will link this ticket there.

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy