Hi all,
trying make plugin which will handle LABEL tag and want add button for it into form plugin.
I've get template code from FORM tag, some stuff was removed from that code.
also I've add code into form plugin.js
and finally add button into config.js
But still no button in toolbar. What I'm doing wrong, can someone help me please.
trying make plugin which will handle LABEL tag and want add button for it into form plugin.
I've get template code from FORM tag, some stuff was removed from that code.
CKEDITOR.dialog.add('label', function(a){ return { title: a.lang.label.title, minWidth: 350, minHeight: 200, onShow: function(){ var e = this; delete e.form; var c = e.getParentEditor().getSelection().getStartElement(), d = c && c.getAscendant('label', true); if (d) { e.form = d; e.setupContent(d); } }, onOk: function(){ var c, d = this.form, e = !d; if (e) { c = this.getParentEditor(); d = c.document.createElement('label'); d.append(c.document.createElement('br')); } if (e) c.insertElement(d); this.commitContent(d); }, onLoad: function(){ function c(e){ this.setValue(e.getAttribute(this.id) || ''); }; function d(e){ var f = this; if (f.getValue()) e.setAttribute(f.id, f.getValue()); else e.removeAttribute(f.id); }; this.foreach(function(e){ if (b[e.id]) { e.setup = c; e.commit = d; } }); }, contents: [{ id: 'info', label: a.lang.label.name, title: a.lang.label.name, elements: [{ id: 'txtName', type: 'text', label: a.lang.common.name, 'default': '', accessKey: 'N', setup: function(c){ this.setValue(c.getAttribute('_cke_saved_name') || c.getAttribute('name') || ''); }, commit: function(c){ if (this.getValue()) c.setAttribute('_cke_saved_name', this.getValue()); else { c.removeAttribute('_cke_saved_name'); c.removeAttribute('name'); } } }] }] }; });
also I've add code into form plugin.js
addButtonCommand( 'Checkbox', 'checkbox', dialogPath + 'checkbox.js' );
label : { label : lang.label.title, command : 'label', group : 'label' }
if ( name == 'label' ) return { label : CKEDITOR.TRISTATE_OFF };
and finally add button into config.js
config.toolbar_Forms = [ ['Source','-','Save','Preview'], ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField', '-', [b]'Label'[/b]], '/', ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], ['Link','Unlink','Anchor'], ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'], '/', ['Format','TextColor','BGColor'],['Maximize', 'ShowBlocks','-','About'] ];
But still no button in toolbar. What I'm doing wrong, can someone help me please.
Re: new plugin for LABEL tag
I hope you could benefit from this guide:
viewtopic.php?p=40125#p40125