forked from 57u/custom-dropdown-ckeditor4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the strinsert plugin. This file lives in ckeditor/plugins/strinsert/plugin.js
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* @license Copyright © 2013 Stuart Sillitoe <stuart@vericode.co.uk> | ||
* This work is mine, and yours. You can modify it as you wish. | ||
* | ||
* Stuart Sillitoe | ||
* stuartsillitoe.co.uk | ||
* | ||
*/ | ||
|
||
CKEDITOR.plugins.add('strinsert', | ||
{ | ||
requires : ['richcombo'], | ||
init : function( editor ) | ||
{ | ||
// array of strings to choose from that'll be inserted into the editor | ||
var strings = []; | ||
strings.push(['@@FAQ::displayList()@@', 'FAQs', 'FAQs']); | ||
strings.push(['@@Glossary::displayList()@@', 'Glossary', 'Glossary']); | ||
strings.push(['@@CareerCourse::displayList()@@', 'Career Courses', 'Career Courses']); | ||
strings.push(['@@CareerProfile::displayList()@@', 'Career Profiles', 'Career Profiles']); | ||
|
||
// add the menu to the editor | ||
editor.ui.addRichCombo('strinsert', | ||
{ | ||
label: 'Insert Content', | ||
title: 'Insert Content', | ||
voiceLabel: 'Insert Content', | ||
className: 'cke_format', | ||
multiSelect:false, | ||
panel: | ||
{ | ||
css: [ editor.config.contentsCss, CKEDITOR.skin.getPath('editor') ], | ||
voiceLabel: editor.lang.panelVoiceLabel | ||
}, | ||
|
||
init: function() | ||
{ | ||
this.startGroup( "Insert Content" ); | ||
for (var i in strings) | ||
{ | ||
this.add(strings[i][0], strings[i][1], strings[i][2]); | ||
} | ||
}, | ||
|
||
onClick: function( value ) | ||
{ | ||
editor.focus(); | ||
editor.fire( 'saveSnapshot' ); | ||
editor.insertHtml(value); | ||
editor.fire( 'saveSnapshot' ); | ||
} | ||
}); | ||
} | ||
}); |