PHP Classes

File: public/js/tinymce/src/plugins/contextmenu/src/main/js/ui/ContextMenu.js

Recommend this page to a friend!
  Classes of Abed Nego Ragil Putra   GoLavaCMS   public/js/tinymce/src/plugins/contextmenu/src/main/js/ui/ContextMenu.js   Download  
File: public/js/tinymce/src/plugins/contextmenu/src/main/js/ui/ContextMenu.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: GoLavaCMS
Publish content on Web pages with SEO support
Author: By
Last change:
Date: 6 years ago
Size: 1,787 bytes
 

Contents

Class file image Download
/** * ContextMenu.js * * Released under LGPL License. * Copyright (c) 1999-2017 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ define( 'tinymce.plugins.contextmenu.ui.ContextMenu', [ 'tinymce.core.ui.Factory', 'tinymce.core.util.Tools', 'tinymce.plugins.contextmenu.api.Settings' ], function (Factory, Tools, Settings) { var renderMenu = function (editor, visibleState) { var menu, contextmenu, items = []; contextmenu = Settings.getContextMenu(editor); Tools.each(contextmenu.split(/[ ,]/), function (name) { var item = editor.menuItems[name]; if (name === '|') { item = { text: name }; } if (item) { item.shortcut = ''; // Hide shortcuts items.push(item); } }); for (var i = 0; i < items.length; i++) { if (items[i].text === '|') { if (i === 0 || i === items.length - 1) { items.splice(i, 1); } } } menu = Factory.create('menu', { items: items, context: 'contextmenu', classes: 'contextmenu' }).renderTo(); menu.on('hide', function (e) { if (e.control === this) { visibleState.set(false); } }); editor.on('remove', function () { menu.remove(); menu = null; }); return menu; }; var show = function (editor, pos, visibleState, menu) { if (menu.get() === null) { menu.set(renderMenu(editor, visibleState)); } else { menu.get().show(); } menu.get().moveTo(pos.x, pos.y); visibleState.set(true); }; return { show: show }; } );