FIX TinyMCE context menu displaying default dialogs instead of our one

This commit is contained in:
Hamish Friedlander 2013-01-31 16:39:00 +13:00
parent 6f937745b0
commit 4681673896

View File

@ -39,6 +39,19 @@
jQuery('#' + this.id).entwine('ss').openMediaDialog();
});
// Replace the mceAdvLink and mceLink commands with the sslink command, and
// the mceAdvImage and mceImage commands with the ssmedia command
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val, a){
if (cmd == 'mceAdvLink' || cmd == 'mceLink'){
ed.execCommand('sslink', ui, val, a);
a.terminate = true;
}
else if (cmd == 'mceAdvImage' || cmd == 'mceImage'){
ed.execCommand('ssmedia', ui, val, a);
a.terminate = true;
}
});
// Disable link button when no link is selected
ed.onNodeChange.add(function(ed, cm, n, co) {
cm.setDisabled('sslink', co && n.nodeName != 'A');