Opened 13 years ago

Last modified 12 years ago

#7103 confirmed Task

api_dialog sample could be improved

Reported by: Wiktor Walc Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: Cc:


The api_dialog sample shows some interesting things that can be done with CKEditor dialog, but some of them are not working as one would expect or simply do not show something that could be considered as useful.

  1. "Adding dialog window tabs – "My Tab" in the "Link" dialog window."
    • we have an extra tab in the Link dialog, but values from this tab are not used at all when inserting / editing a link
    • same with "My Custom Field"

For me this sample is not very useful, because it does not show how actually one could modify the link itself using values taken from those extra fields added to the dialog.

Perhaps instead of using plain text fields in "My Tab" (we already have one - "My Custom Field") we could offer there a select field where user could select a link from a predefined set of links. Such "tab" could be called "My Link Browser" instead of "My tab". Selecting a link could result in filling the "Url" field automatically and setting focus to "Link Info" tab.

  1. "Creating a custom dialog window – "My Dialog" dialog window opened with the "My Dialog" toolbar button."
    • we could call insertText or insertHtml to insert entered text, right now one can type something there and when closing the dialog nothing else happens.

Change History (2)

comment:1 Changed 13 years ago by davh@…

The example is rather useless because it is not POSSIBLE to save those values anywhere.

I have added this to link.js in onOk, right above the "if (data.adv)"

// Custom attributes.
if ( data.customAttr )
 var custAttr = function( inputName )
  var value = data.customAttr[ inputName ];
  if ( value )
    attributes[inputName] = value;
    removeAttributes.push( inputName );
 for(attr in data.customAttr)

Then the fields in could have a similar commit function to these

commit: function(data){
 if (!data.customAttr)
   data.customAttr = {};
 data.customAttr['whatever'] = this.getValue();

I havent come up with a nice way to do the setup though... It looks very hackish (but atleast this can be done without hacking the source)

setup: function(v) {
 if (this._.dialog._.selectedElement)
Last edited 13 years ago by davh@… (previous) (diff)

comment:2 Changed 12 years ago by Jakub Ś

Status: newconfirmed
Type: New FeatureTask

I think this should be treated more in terms of a task then a feature request :)

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy