Mercurial > public > sg101
diff media/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js @ 217:237710206167
Update TinyMCE to 3.3.6
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 01 Jun 2010 04:49:29 +0000 |
parents | 149c3567fec1 |
children | 6ed2932901fa |
line wrap: on
line diff
--- a/media/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js Sun May 30 20:51:41 2010 +0000 +++ b/media/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js Tue Jun 01 04:49:29 2010 +0000 @@ -27,7 +27,7 @@ * @param {string} url Absolute URL to where the plugin is located. */ init : function(ed) { - var t = this; + var t = this, lastRng; t.editor = ed; @@ -42,13 +42,26 @@ ed.onContextMenu.add(function(ed, e) { if (!e.ctrlKey) { + // Restore the last selection since it was removed + if (lastRng) + ed.selection.setRng(lastRng); + t._getMenu(ed).showMenu(e.clientX, e.clientY); Event.add(ed.getDoc(), 'click', hide); Event.cancel(e); } }); - function hide() { + function hide(ed, e) { + lastRng = null; + + // Since the contextmenu event moves + // the selection we need to store it away + if (e && e.button == 2) { + lastRng = ed.selection.getRng(); + return; + } + if (t._menu) { t._menu.removeAll(); t._menu.destroy();