1 CKEDITOR.plugins.add( 'widgetcommon', {
4 icons: 'widgetcommonQuotebox,widgetcommonBox',
13 init: function( editor ) {
15 // Configurable settings
16 var allowedFull = editor.config.widgetcommon_allowedFull != undefined ? editor.config.widgetcommon_allowedFull :
17 'div(!row,two-col-left,two-col-right,accordion,two-col,three-col){width};' +
18 'div(!columns,col-xs-12,col-sm-3,col-sm-9,col-sidebar,col-main,col-1,col-2,col-3,panel,panel-default,panel-heading,panel-body)';
19 var allowedWidget = editor.config.widgetcommon_allowedWidget != undefined ? editor.config.widgetcommon_allowedFull :
20 'p br ul ol li a strong em img[!src,alt,width,height]';
21 var allowedText = editor.config.widgetcommon_allowedText != undefined ? editor.config.widgetcommon_allowedFull :
22 'p br ul ol li strong em';
23 var allowedTitle = editor.config.widgetcommon_allowedTitle != undefined ? editor.config.widgetcommon_allowedTitle :
26 //allowedWidget = 'img[!src,alt,width,height]';
27 //allowedText = allowedWidget;
29 var showButtons = editor.config.widgetcommonShowButtons != undefined ? editor.config.widgetcommonShowButtons : true;
32 editor.widgets.add( 'widgetcommonBox', {
34 button: showButtons ? 'Add box' : undefined,
37 '<div class="panel panel-default">' +
38 '<div class="panel-heading box-title">Title</h2></div>' +
39 '<div class="panel-body box-content">Content</div>' +
44 selector: '.box-title',
45 allowedContent: allowedTitle
48 selector: '.box-content',
49 allowedContent: allowedWidget
53 allowedContent: allowedFull,
55 upcast: function( element ) {
56 return element.name == 'div' && element.hasClass( 'two-col-right' );
62 editor.widgets.add( 'widgetcommonQuotebox', {
64 button: showButtons ? 'Add Quotebox' : undefined,
67 '<div class="row quotebox">' +
68 '<div class="row quote">Quote</div>' +
69 '<div class="row byline">— Person</div>' +
75 allowedContent: allowedFull
79 allowedContent: allowedTitle
83 allowedContent: allowedFull,
85 upcast: function( element ) {
86 return element.name == 'div' && element.hasClass( 'quotebox' );
91 // Append the widget's styles when in the CKEditor edit page,
92 // added for better user experience.
93 // Assign or append the widget's styles depending on the existing setup.
94 if (typeof editor.config.contentsCss == 'object') {
95 editor.config.contentsCss.push(CKEDITOR.getUrl(this.path + 'contents.css'));
99 editor.config.contentsCss = [editor.config.contentsCss, CKEDITOR.getUrl(this.path + 'contents.css')];