RAGHUNATH

RAGHUNATH

  • 1.6k
  • 62
  • 48k

how to edit custom template of widget plugin in CkEditor

Apr 23 2014 2:44 AM
I need to add a widget plugin to my editor. and in that template i have created table template,but the problem is i can able add a table but cells in that table cannot edited. i think there is problem on editable..


------------------------------------------------------------------------
can anybody help me
-------------------
CKEDITOR.plugins.add('simplebox', {
requires: 'widget',
icons: 'simplebox',
init: function (editor) {
editor.widgets.add('simplebox', {
button: 'Create a simple box',
template:
'<table class="simplebox" style="width:350px; float:left" cellspacing="0"
cellpadding="0" border="1">' +
'<tr class="simplebox-content" >' +
'<td class="simplebox-content" >&nbsp;</td>' +
'<td class="simplebox-content" >&nbsp;</td>' +
'<td class="simplebox-content" >&nbsp;</td>' +
'</tr>' +
'<tr class="simplebox-content" >' +
'<td class="simplebox-content" >&nbsp;</td>' +
'<td class="simplebox-content" >&nbsp;</td>' +
'<td class="simplebox-content" >&nbsp;</td>' +
'</tr>' +
'<tr class="simplebox-content">' +
'<td class="simplebox-content" >&nbsp;</td>' +
'<td class="simplebox-content" >&nbsp;</td>' +
'<td class="simplebox-content" >&nbsp;</td>' +
'</tr>' +
'</table>'+
'<br/>',
editables: {
title: {
selector: '.simplebox-title',
allowedContent: 'br strong em'
},
content: {
selector: 'td.simplebox-content',
allowedContent: 'p br ul ol li strong em'
}
},
allowedContent:
'table(!simplebox);tr(!simplebox-content);td(!simplebox-content)',
requiredContent: 'table(simplebox)',
upcast: function (element) {
return element.name == 'table' && element.hasClass('simplebox');
}
});
}
});