includes/clientside/tinymce/plugins/contextmenu/editor_plugin_src.js
changeset 543 dffcbfbc4e59
parent 459 31c23016ab62
child 588 20484deb89cd
equal deleted inserted replaced
542:5841df0ab575 543:dffcbfbc4e59
     1 /**
     1 /**
     2  * $Id: editor_plugin_src.js 618 2008-02-21 13:13:32Z spocke $
     2  * $Id: editor_plugin_src.js 755 2008-03-29 19:14:42Z 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 
    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