From: Benoît Pin Date: Tue, 29 Jul 2014 14:01:22 +0000 (+0200) Subject: Canevas pour un nouveau plugin d'application de styles basés sur des classes css... X-Git-Url: https://scm.cri.mines-paristech.fr/git/ckeditor.git/commitdiff_plain/1badda86f23d981e3cc8d73cf04b7463a531c482?hp=e26345ed9b0afe560d7f06d8cbbc9698eba433d2 Canevas pour un nouveau plugin d'application de styles basés sur des classes css et indépendant des éléments. --- 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()); + +} )();