2009-11-21 03:36:34 +01:00
|
|
|
(function() {
|
2012-04-11 18:36:32 +02:00
|
|
|
|
|
|
|
// TinyMCE will stop loading if it encounters non-existent external script file
|
|
|
|
// when included through tiny_mce_gzip.php. Only load the external lang package if it is available.
|
|
|
|
var availableLangs = ['en', 'de'];
|
|
|
|
if(jQuery.inArray(tinymce.settings.language, availableLangs) != -1) {
|
|
|
|
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-04-12 22:26:04 +02:00
|
|
|
jQuery('#' + this.id).entwine('ss').openLinkDialog();
|
2009-11-21 03:36:34 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
ed.addCommand("ssimage", function(ed) {
|
2012-04-12 22:26:04 +02:00
|
|
|
jQuery('#' + this.id).entwine('ss').openMediaDialog();
|
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
|
|
|
})();
|