The onShow stuff works fine, but when I hit "OK" after editing an existing "gallery" element, nothing changes about the <gallery> tag. (According to Firebug, there's no Javascript errors involved at any point.)
What am I doing wrong? Spent ages trying absolutely anything, but nothing works..
What am I doing wrong? Spent ages trying absolutely anything, but nothing works..
title: 'Gallery Properties',
minWidth: 400,
minHeight: 100,
contents :
[
{
id : 'tab1',
label : 'Basic Settings',
elements :
[
{
type : 'text',
id : 'cols',
label : 'cols',
setup : function( element )
{
this.setValue( element.getAttribute( "cols" ) );
},
commit : function( element )
{
element.setAttribute( "cols", this.getValue() );
}
},
{
type : 'text',
id : 'height',
label : 'height',
setup : function( element )
{
this.setValue( element.getAttribute( "height" ) );
},
commit : function( element )
{
element.setAttribute( "height", this.getValue() );
}
}
]
}
],
onShow : function()
{
delete this.element;
var editor = this.getParentEditor();
var fake = editor.getSelection().getSelectedElement();
var element = editor.restoreRealElement(fake);
if (element) {
this.insertMode = false;
} else {
element = editor.document.createElement('gallery');
this.insertMode = true;
}
this.element = element;
this.setupContent(element);
},
onOk : function()
{
var editor = this.getParentEditor();
if (this.insertMode) editor.insertElement(this.element);
this.commitContent(this.element);
}
Re: My plugin just *won't* commit
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Re: My plugin just *won't* commit
Re: My plugin just *won't* commit
return { title : 'Gallery Properties', minWidth : 400, minHeight : 200, contents : [ { id : 'tab1', label : 'Basic Settings', elements : [ { type : 'text', id : 'cols', label : 'cols', setup : function( element ) { this.setValue( element.getAttribute( "cols" ) ); }, commit : function( element ) { element.setAttribute( "cols", this.getValue() ); } }, { type : 'text', id : 'height', label : 'height', setup : function( element ) { this.setValue( element.getAttribute( "height" ) ); }, commit : function( element ) { element.setAttribute( "height", this.getValue() ); } } ] } ], onShow : function() { delete this.element; var editor = this.getParentEditor(); var fake = this.getSelectedElement(); if (fake) { var element = editor.restoreRealElement(fake); this.insertMode = false; } else { var element = editor.document.createElement('gallery'); this.insertMode = true; } this.element = element; this.setupContent(element); }, onOk : function() { var editor = this.getParentEditor(); if (this.insertMode) editor.insertElement(this.element); this.commitContent(this.element); } };Re: My plugin just *won't* commit
CKEDITOR.dialog.add('alek_gallery', function(editor) { return { title: 'Gallery', minWidth: 350, minHeight: 250, onShow: function () { if (Alek.galleryList.length == 0) { CKEDITOR.dialog.getCurrent().hide(); alert('No galleries have been created yet.'); return false; } this.fake = this.getSelectedElement(); if (this.fake) { this.setupContent(this.getParentEditor().restoreRealElement(this.fake)); } }, onOk: function () { var attributes = {}; this.commitContent(attributes); var element = new CKEDITOR.dom.element('alek_gallery'); for (var x in attributes) { if (attributes[x] != '') element.setAttribute(x, attributes[x]); } var editor = this.getParentEditor(); var newFake = editor.createFakeElement(element, 'cke_alek_gallery', 'alek_gallery', true); if (this.fake) { newFake.replace(this.fake); editor.getSelection().selectElement(newFake); } else { editor.insertElement(newFake); } }, contents: [{ id: 'info', label: 'Gallery', title: 'Gallery', elements: [ { type: 'hbox', widths: ['50%', '50%'], children: [ { id: 'id', label: 'Gallery', type: 'select', items: Alek.galleryList, setup: function(element) { this.setValue(element.getAttribute(this.id)); }, commit: function(attributes) { attributes[this.id] = this.getValue(); } }, { id: 'folder', type: 'text', label: 'Source folder', setup: function(element) { this.setValue(element.getAttribute(this.id)); }, commit: function(attributes) { attributes[this.id] = this.getValue(); } } ] }, { type: 'hbox', widths: ['50%', '50%'], children: [ { id: 'thumb_width', type: 'text', label: 'Thumb width', setup: function(element) { this.setValue(element.getAttribute(this.id)); }, commit: function(attributes) { attributes[this.id] = this.getValue(); } }, { id: 'thumb_height', type: 'text', label: 'Thumb height', setup: function(element) { this.setValue(element.getAttribute(this.id)); }, commit: function(attributes) { attributes[this.id] = this.getValue(); } } ] }, { type: 'hbox', widths: ['50%', '50%'], children: [ { id: 'width', type: 'text', label: 'Full image width', setup: function(element) { this.setValue(element.getAttribute(this.id)); }, commit: function(attributes) { attributes[this.id] = this.getValue(); } }, { id: 'height', type: 'text', label: 'Full image height', setup: function(element) { this.setValue(element.getAttribute(this.id)); }, commit: function(attributes) { attributes[this.id] = this.getValue(); } } ] } ] }] }; });Only thing I'm still messing with is how to make the fake image element non-resizable.
Re: My plugin just *won't* commit
Customer and Community Manager, CKSource
Follow us on: Facebook, Twitter, LinkedIn
If you think you found a bug in CKEditor, read this!
Re: My plugin just *won't* commit
all