equal
deleted
inserted
replaced
1 /** |
1 /** |
2 * $Id: editor_plugin_src.js 755 2008-03-29 19:14:42Z spocke $ |
2 * $Id: editor_plugin_src.js 848 2008-05-15 11:54:40Z spocke $ |
3 * |
3 * |
4 * @author Moxiecode |
4 * @author Moxiecode |
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
6 */ |
6 */ |
7 |
7 |
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 if (!e.ctrlKey) { |
19 if (!e.ctrlKey) { |
20 t._getMenu(ed).showMenu(e.clientX, e.clientY); |
20 t._getMenu(ed).showMenu(e.clientX, e.clientY); |
21 Event.add(document, 'click', hide); |
21 Event.add(ed.getDoc(), 'click', hide); |
22 Event.cancel(e); |
22 Event.cancel(e); |
23 } |
23 } |
24 }); |
24 }); |
25 |
25 |
26 function hide() { |
26 function hide() { |
27 if (t._menu) { |
27 if (t._menu) { |
28 t._menu.removeAll(); |
28 t._menu.removeAll(); |
29 t._menu.destroy(); |
29 t._menu.destroy(); |
30 Event.remove(document, 'click', hide); |
30 Event.remove(ed.getDoc(), 'click', hide); |
31 } |
31 } |
32 }; |
32 }; |
33 |
33 |
34 ed.onMouseDown.add(hide); |
34 ed.onMouseDown.add(hide); |
35 ed.onKeyDown.add(hide); |
35 ed.onKeyDown.add(hide); |
55 |
55 |
56 p1 = DOM.getPos(ed.getContentAreaContainer()); |
56 p1 = DOM.getPos(ed.getContentAreaContainer()); |
57 p2 = DOM.getPos(ed.getContainer()); |
57 p2 = DOM.getPos(ed.getContainer()); |
58 |
58 |
59 m = ed.controlManager.createDropMenu('contextmenu', { |
59 m = ed.controlManager.createDropMenu('contextmenu', { |
60 offset_x : p1.x, |
60 offset_x : p1.x + ed.getParam('contextmenu_offset_x', 0), |
61 offset_y : p1.y, |
61 offset_y : p1.y + ed.getParam('contextmenu_offset_y', 0), |
62 /* vp_offset_x : p2.x, |
|
63 vp_offset_y : p2.y,*/ |
|
64 constrain : 1 |
62 constrain : 1 |
65 }); |
63 }); |
66 |
64 |
67 t._menu = m; |
65 t._menu = m; |
68 |
66 |