From 468167389636a6b3f05ea4bdd47a0c10327e470b Mon Sep 17 00:00:00 2001 From: Hamish Friedlander Date: Thu, 31 Jan 2013 16:39:00 +1300 Subject: [PATCH] FIX TinyMCE context menu displaying default dialogs instead of our one --- thirdparty/tinymce_ssbuttons/editor_plugin_src.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/thirdparty/tinymce_ssbuttons/editor_plugin_src.js b/thirdparty/tinymce_ssbuttons/editor_plugin_src.js index 43e71cc52..6169922c6 100644 --- a/thirdparty/tinymce_ssbuttons/editor_plugin_src.js +++ b/thirdparty/tinymce_ssbuttons/editor_plugin_src.js @@ -38,7 +38,20 @@ ed.addCommand('ssmedia', function(ed) { 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');