Hi,
I'm writing plugin which add attribut "rel" to link. But i have a problem with ticking checkbox if rel is already added (after saving content (reload ckeditor) and again selecting link.)
I don't have problem witch detecting if rel is added but i don't no how to tick checkbox.
this.setValue(true) - doesn't work
This all code:
I'm writing plugin which add attribut "rel" to link. But i have a problem with ticking checkbox if rel is already added (after saving content (reload ckeditor) and again selecting link.)
I don't have problem witch detecting if rel is added but i don't no how to tick checkbox.
this.setValue(true) - doesn't work
onShow : function()
{
var element = editor.getSelection().getStartElement();
if(element.getAttribute('rel')=='clearbox[gallery=gal]')
{
this.setValue(true);
}
else this.setValue(false);
},
This all code:
CKEDITOR.dialog.add( 'clearbox', function( editor )
{
return {
title : 'Dodaj do galerii',
minWidth : 450,
minHeight : 80,
contents : [
{
id : 'tab1',
label : 'First Tab',
title : 'First Tab',
elements : [
{
id : 'text',
type : 'html',
html :'Do you want to add clearbox?'
},
{
id : 'input0',
type : 'html',
html :'<input type="checkbox" name="clearbox" /> YES',
onShow : function()
{
var element = editor.getSelection().getStartElement();
if(element.getAttribute('rel')=='clearbox[gallery=gal]')
{
this.setValue(true);
}
else this.setValue(false);
},
onChange : function()
{
var element = editor.getSelection().getStartElement();
if (this.getValue()=='false')
{
element.setAttribute( 'rel', 'clearbox[gallery=gal]' );
this.setValue(true);
}
else
{
element.removeAttribute( 'rel' );
this.setValue(false);
}
}
}
]
}
]
};
} );

Re: Writing plugin + checkbox
http://dev.ckeditor.com/ticket/4890