14 |
14 |
15 t.editor = ed; |
15 t.editor = ed; |
16 t.onContextMenu = new tinymce.util.Dispatcher(this); |
16 t.onContextMenu = new tinymce.util.Dispatcher(this); |
17 |
17 |
18 ed.onContextMenu.add(function(ed, e) { |
18 ed.onContextMenu.add(function(ed, e) { |
19 t._getMenu(ed).showMenu(e.clientX, e.clientY); |
19 if (!e.ctrlKey) { |
20 Event.cancel(e); |
20 t._getMenu(ed).showMenu(e.clientX, e.clientY); |
|
21 Event.add(document, 'click', hide); |
|
22 Event.cancel(e); |
|
23 } |
21 }); |
24 }); |
22 |
25 |
23 function hide() { |
26 function hide() { |
24 if (t._menu) { |
27 if (t._menu) { |
25 t._menu.removeAll(); |
28 t._menu.removeAll(); |
26 t._menu.destroy(); |
29 t._menu.destroy(); |
|
30 Event.remove(document, 'click', hide); |
27 } |
31 } |
28 }; |
32 }; |
29 |
33 |
30 ed.onMouseDown.add(hide); |
34 ed.onMouseDown.add(hide); |
31 ed.onKeyDown.add(hide); |
35 ed.onKeyDown.add(hide); |
32 Event.add(document, 'click', hide); |
36 }, |
|
37 |
|
38 getInfo : function() { |
|
39 return { |
|
40 longname : 'Contextmenu', |
|
41 author : 'Moxiecode Systems AB', |
|
42 authorurl : 'http://tinymce.moxiecode.com', |
|
43 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu', |
|
44 version : tinymce.majorVersion + "." + tinymce.minorVersion |
|
45 }; |
33 }, |
46 }, |
34 |
47 |
35 _getMenu : function(ed) { |
48 _getMenu : function(ed) { |
36 var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2; |
49 var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2; |
37 |
50 |