Hi, I've got a problem with a plugin I've created for CKEditor and even though I've seen similar posts on different forums, none of the answers there has helped me. I posted the question earlier on stackoverflow, but I thought maybe someone here would be better to ask.
The background is that I have created a plugin for adding images and video into my CKEDitor instance. What I have also done is to create context menus for these objects, i.e. both videos and images has a 'Properties' dialog available when they are right-clicked, and this in turns opens a dialog window.
And this is where the problem arises!
The images and videos are adjusted by the user inputting which size he or she wants the media to be and in what relation to the text the elements should be placed. Both these options are chosen by Select dropdowns with four and five options respectively.
I have created my dialogs, and the basics of them work fine, but the problem I am having is that the dropdown list for my Selects won't populate with a default chosen value.
One of my select dropdowns, notice that I've also tried to have the items defined by a list (a 2D array containing image size as option and values that are used later on) and then use the setup function to use on of them as default:
id : 'id',
type : 'select',
label : 'Storlek',
validate : CKEDITOR.dialog.validate.notEmpty( 'Error message' ),
required : true,
items : [],
setup : function ( element)
{
this.setValue( element );
},
My onShow-function for getting the setup element, notice that I am getting a new, sorted list every time I open a dialog window, and these outputs are correct in regard to the values of the image/video:
onShow : function()
{
var sel = editor.getSelection(),
element = sel.getStartElement();
sizeList = getSizeList(editor);
this.element = sizeList;
this.setupContent( this.element );
},
One peculiar aspect of this is also that when I enter the edit dialog for an image, the items displayed in the Select list corresponds to the data of the image - just what I want! BUT, when I try to edit another image, it displays the values of the previously edited image. Which seems to imply that the operations of the setup function doesn't do what it is supposed to. It might not seem like much, but I've tried every single way (that I can think of) to get this to work, but still no dice.
Any help would be greatly appreciated!