4 * Copyright, Moxiecode Systems AB
5 * Released under LGPL License.
7 * License: http://www.tinymce.com/license
8 * Contributing: http://www.tinymce.com/contributing
11 /*global tinymce:true */
13 tinymce.PluginManager.add('contextmenu', function(editor) {
16 editor.on('contextmenu', function(e) {
21 contextmenu = editor.settings.contextmenu || 'link image inserttable | cell row column deletetable';
27 tinymce.each(contextmenu.split(/[ ,]/), function(name) {
28 var item = editor.menuItems[name];
35 item.shortcut = ''; // Hide shortcuts
40 for (var i = 0; i < items.length; i++) {
41 if (items[i].text == '|') {
42 if (i === 0 || i == items.length - 1) {
48 menu = new tinymce.ui.Menu({
50 context: 'contextmenu'
53 menu.renderTo(document.body);
59 var pos = {x: e.pageX, y: e.pageY};
62 pos = tinymce.DOM.getPos(editor.getContentAreaContainer());
67 menu.moveTo(pos.x, pos.y);
69 editor.on('remove', function() {