Custom CKEditor plugin button not showing -
feel should have been able track 1 downwards already. need create custom plugin ckeditor (i'm using 4.3.1). started used guide found here (http://docs.ckeditor.com/#!/guide/plugin_sdk_sample_1). downloaded code , set in ckeditor\plugins folder. so, have ckeditor\plugins\abbr. i'm not sure i'm doing, button not showing in toolbar. code below. questions are, should define "abbr" plugin? do in _edit.cshtml page i'm defining stylesheetparser? or set in config.js? given setup below shouldn't button show next source button? need include in config.js or plugin code take care of that?
been doing little playing around , show if utilize total toolbar, not when customize it.
config.js
ckeditor.editorconfig = function (config) { config.toolbar = 'mytoolbar'; config.forcepasteasplaintext = true; //config.extraplugins = 'abbr'; config.ignoreemptyparagraph = 'true' config.toolbar_mytoolbar = [ { name: 'document', items: ['preview', 'print'] }, { name: 'clipboard', items: ['cut', 'copy', 'pastetext', '-', 'undo', 'redo'] }, { name: 'editing', items: ['find', 'replace', '-', 'selectall', '-', 'spellchecker', 'scayt'] }, { name: 'basicstyles', items : [ 'bold','italic','subscript','superscript','-','removeformat' ] }, '/', { name: 'insert', items: ['table', 'specialchar'] }, { name: 'styles', items : [ 'styles'] } , { name: 'source', items: ['source', '-', 'abbr'] } ]; }; _edit.cshtml
@html.textareafor(e => e.narrative, 10, 10, null) <script type="text/javascript"> ckeditor.replace('narrative', { extraplugins: 'stylesheetparser,abbr', // stylesheet contents. contentscss: '@href("~/content/"+@model.cssfile)', stylesheetparser_skipselectors: '', disablenativespellchecker: false, // not load default styles configuration. stylesset: [], height: '600px', width: '100%' }); </script> plugin.js
ckeditor.plugins.add( 'abbr', { // register icons. icons: 'abbr', // plugin initialization logic goes within method. init: function( editor ) { // define editor command opens our dialog. editor.addcommand( 'abbr', new ckeditor.dialogcommand( 'abbrdialog' ) ); // create toolbar button executes above command. editor.ui.addbutton( 'abbr', { // text part of button (if available) , tooptip. label: 'insert abbreviation', // command execute on click. command: 'abbr', // button placement in toolbar (toolbar grouping name). toolbar: 'source' }); // register our dialog file. this.path plugin folder path. ckeditor.dialog.add( 'abbrdialog', this.path + 'dialogs/abbr.js' ); } }); ckeditor
No comments:
Post a Comment