Created
September 6, 2012 13:04
-
-
Save s4553711/3656034 to your computer and use it in GitHub Desktop.
CKeditor Plugin: Combo
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
CKEDITOR.plugins.add( 'tokens', | |
{ | |
requires : ['richcombo'], //, 'styles' ], | |
init : function( editor ) | |
{ | |
var config = editor.config, | |
lang = editor.lang.format; | |
// Gets the list of tags from the settings. | |
var tags = []; //new Array(); | |
//this.add('value', 'drop_text', 'drop_label'); | |
tags[0]=["[contact_name]", "Name", "Name"]; | |
tags[1]=["[contact_email]", "email", "email"]; | |
tags[2]=["[contact_user_name]", "User name", "User name"]; | |
// Create style objects for all defined styles. | |
editor.ui.addRichCombo( 'tokens', | |
{ | |
label : "Insert tokens", | |
title :"Insert tokens", | |
voiceLabel : "Insert tokens", | |
className : 'cke_format', | |
multiSelect : false, | |
panel : | |
{ | |
css : [ config.contentsCss, CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ], | |
voiceLabel : lang.panelVoiceLabel | |
}, | |
init : function() | |
{ | |
this.startGroup( "Tokens" ); | |
//this.add('value', 'drop_text', 'drop_label'); | |
for (var this_tag in tags){ | |
this.add(tags[this_tag][0], tags[this_tag][1], tags[this_tag][2]); | |
} | |
}, | |
onClick : function( value ) | |
{ | |
editor.focus(); | |
editor.fire( 'saveSnapshot' ); | |
editor.insertHtml(value); | |
editor.fire( 'saveSnapshot' ); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment