1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
init : function(ed, url) {
var t = this;
t.editor = ed;
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
ed.addCommand('mceCodeHighLight', function() {
ed.windowManager.open({
file : url + '/dialog.htm',
width : 450 + parseInt(ed.getLang('codehighlight.delta_width', 0)),
height : 400 + parseInt(ed.getLang('codehighlight.delta_height', 0)),
inline : 1
}, {
plugin_url : url, // Plugin absolute URL
some_custom_arg : 'custom arg' // Custom argument
});
});
// Register example button
ed.addButton('codehighlight', {
title : 'codehighlight.desc',
cmd : 'mceCodeHighLight',
image : url + '/img/codehighlight.png'
});
// Add a node change handler, selects the button in the UI when a image is selected
ed.onNodeChange.add(function(ed, cm, n) {
cm.setActive('codehighlight', n.nodeName == 'IMG');
});
ed.onVisualAid.add(t._visualAid, t);
},
// Private methods
_visualAid : function(ed, e, s) {
var dom = ed.dom;
tinymce.each(dom.select('pre', e), function(e) {
if (s)
dom.addClass(e, 'mceItemMedia mceItem');
else
dom.removeClass(e, 'mceItemMedia mceItem');
});
}, |
Partager