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.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) {
|
2012-02-08 21:43:45 +01:00
|
|
|
jQuery('#Form_EditorToolbarMediaForm').entwine('ss').open();
|
2009-11-21 03:36:34 +01:00
|
|
|
});
|
2011-04-05 11:06:34 +02:00
|
|
|
|
2012-02-08 21:43:45 +01:00
|
|
|
// Disable link button when no link is selected
|
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);
|
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
|
|
|
})();
|