2009-11-21 03:36:34 +01:00
|
|
|
(function() {
|
2009-12-16 06:54:10 +01:00
|
|
|
tinymce.PluginManager.requireLangPack("ssbuttons");
|
2009-11-21 03:36:34 +01:00
|
|
|
var each = tinymce.each;
|
|
|
|
|
|
|
|
tinymce.create('tinymce.plugins.SSButtons', {
|
|
|
|
/**
|
|
|
|
* Returns information about the plugin as a name/value array.
|
|
|
|
* The current keys are longname, author, authorurl, infourl and version.
|
|
|
|
*
|
|
|
|
* @returns Name/value array containing information about the plugin.
|
|
|
|
* @type Array
|
|
|
|
*/
|
|
|
|
getInfo : function() {
|
|
|
|
return {
|
|
|
|
longname : 'Special buttons for SilverStripe CMS',
|
|
|
|
author : 'Sam Minnée',
|
|
|
|
authorurl : 'http://www.siverstripe.com/',
|
|
|
|
infourl : 'http://www.silverstripe.com/',
|
|
|
|
version : "1.0"
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
init : function(ed, url) {
|
|
|
|
ed.addButton('sslink', {title : ed.getLang('tinymce_ssbuttons.insertlink'), cmd : 'sslink', 'class' : 'mce_link'});
|
|
|
|
ed.addButton('ssimage', {title : ed.getLang('tinymce_ssbuttons.insertimage'), cmd : 'ssimage', 'class' : 'mce_image'});
|
|
|
|
ed.addButton('ssflash', {title : ed.getLang('tinymce_ssbuttons.insertflash'), cmd : 'ssflash', 'class' : 'mce_flash', 'image': url + '/img/flash.gif'});
|
|
|
|
|
|
|
|
ed.addCommand("sslink", function(ed) {
|
2012-01-04 18:06:22 +01:00
|
|
|
jQuery('#Form_EditorToolbarLinkForm').entwine('ss').open();
|
2009-11-21 03:36:34 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
ed.addCommand("ssimage", function(ed) {
|
2011-04-05 11:06:34 +02:00
|
|
|
jQuery('#Form_EditorToolbarImageForm')[0].open();
|
2009-11-21 03:36:34 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
ed.addCommand("ssflash", function(ed) {
|
2011-04-05 11:06:34 +02:00
|
|
|
jQuery('#Form_EditorToolbarFlashForm')[0].open();
|
2009-11-21 03:36:34 +01:00
|
|
|
});
|
2011-04-05 11:06:34 +02:00
|
|
|
|
2012-01-04 23:33:12 +01:00
|
|
|
ed.onNodeChange.add(function(ed, cm, n, co) {
|
|
|
|
cm.setDisabled('sslink', co && n.nodeName != 'A');
|
|
|
|
cm.setActive('sslink', n.nodeName == 'A' && !n.name);
|
|
|
|
|
2012-01-04 18:06:22 +01:00
|
|
|
jQuery('Form_EditorToolbarLinkForm').entwine('ss').respondToNodeChange();
|
2009-11-21 03:36:34 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Adds the plugin class to the list of available TinyMCE plugins
|
2009-12-16 06:54:10 +01:00
|
|
|
tinymce.PluginManager.add("ssbuttons", tinymce.plugins.SSButtons);
|
2009-11-21 03:36:34 +01:00
|
|
|
})();
|