From 1badda86f23d981e3cc8d73cf04b7463a531c482 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Benoi=CC=82t=20Pin?= Date: Tue, 29 Jul 2014 16:01:22 +0200 Subject: [PATCH] =?utf8?q?Canevas=20pour=20un=20nouveau=20plugin=20d'appli?= =?utf8?q?cation=20de=20styles=20bas=C3=A9s=20sur=20des=20classes=20css=20?= =?utf8?q?et=20ind=C3=A9pendant=20des=20=C3=A9l=C3=A9ments.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- skins/ckeditor/config.js | 4 +-- skins/ckeditor/plugins/plinn_styles/plugin.js | 35 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 skins/ckeditor/plugins/plinn_styles/plugin.js diff --git a/skins/ckeditor/config.js b/skins/ckeditor/config.js index dea13f2..9aeb8f7 100644 --- a/skins/ckeditor/config.js +++ b/skins/ckeditor/config.js @@ -11,7 +11,7 @@ CKEDITOR.editorConfig = function( config ) // toolbar config.toolbar = [ - { name: 'styles', items : [ 'Styles','Format', 'Font', 'FontSize' ] }, + { name: 'styles', items : [ 'PlinnStyles','Format', 'Font', 'FontSize' ] }, { name: 'colors', items : [ 'TextColor', 'BGColor' ] }, { name: 'document', items : [ 'Maximize', 'ShowBlocks', 'Source'] }, { name: 'editing', items : [ 'Find','Replace', '-', 'SelectAll'] }, @@ -36,7 +36,7 @@ CKEDITOR.editorConfig = function( config ) config.filebrowserWindowWidth = 801; config.attachmentBrowserConnectorUrl = CKEDITOR.basePath + 'plugins/plinn_image/connectors/plinn/connector'; config.imageMaxDefaultDimension = 500 ; // image inserted will be cropped at this size. - config.extraPlugins = 'plinn_image,codemirror'; + config.extraPlugins = 'plinn_image,plinn_styles,codemirror'; config.stylesSet = 'plinn_styles:' + CKEDITOR.basePath + 'plinn_ckeditor_styles.js'; }; \ No newline at end of file diff --git a/skins/ckeditor/plugins/plinn_styles/plugin.js b/skins/ckeditor/plugins/plinn_styles/plugin.js new file mode 100644 index 0000000..009e5d2 --- /dev/null +++ b/skins/ckeditor/plugins/plinn_styles/plugin.js @@ -0,0 +1,35 @@ +( function() { + +var PlinnStylesCombo = function(editor) { + this.label = 'Styles'; + this.title = 'CSS Styles'; + this.toolbar = 'styles,10'; + this.panel = { + css : [CKEDITOR.skin.getPath( 'editor' )].concat(editor.config.contentsCss), + multiSelect : true, + attributes : {'aria-label': this.title} + }; +}; + + +var PlinnStylePlugin = function() { + this.requires = 'richcombo'; +}; + +PlinnStylePlugin.prototype.init = function(editor) { + var psc = new PlinnStylesCombo(editor); + editor.ui.addRichCombo('PlinnStyles', psc); + editor.on('stylesSet', this.onStylesSet); +}; + +PlinnStylePlugin.prototype.onStylesSet = function(evt) { + var stylesDefinitions = evt.data.styles; + if (!stylesDefinitions) { return; } + +}; + + +// main +CKEDITOR.plugins.add( 'plinn_styles', new PlinnStylePlugin()); + +} )(); -- 2.20.1