v1.0
只读模式 group, 分享 评论更多问题 博客标签总是存在一个
This commit is contained in:
26
public/tinymce/plugins/contextmenu/plugin.js
Normal file → Executable file
26
public/tinymce/plugins/contextmenu/plugin.js
Normal file → Executable file
@ -11,13 +11,28 @@
|
||||
/*global tinymce:true */
|
||||
|
||||
tinymce.PluginManager.add('contextmenu', function(editor) {
|
||||
var menu;
|
||||
var menu, contextmenuNeverUseNative = editor.settings.contextmenu_never_use_native;
|
||||
|
||||
editor.on('contextmenu', function(e) {
|
||||
var contextmenu;
|
||||
var contextmenu, doc = editor.getDoc();
|
||||
|
||||
// Block TinyMCE menu on ctrlKey
|
||||
if (e.ctrlKey && !contextmenuNeverUseNative) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
/**
|
||||
* WebKit/Blink on Mac has the odd behavior of selecting the target word or line this causes
|
||||
* issues when for example inserting images see: #7022
|
||||
*/
|
||||
if (tinymce.Env.mac && tinymce.Env.webkit) {
|
||||
if (e.button == 2 && doc.caretRangeFromPoint) {
|
||||
editor.selection.setRng(doc.caretRangeFromPoint(e.x, e.y));
|
||||
}
|
||||
}
|
||||
|
||||
contextmenu = editor.settings.contextmenu || 'link image inserttable | cell row column deletetable';
|
||||
|
||||
// Render menu
|
||||
@ -48,12 +63,7 @@ tinymce.PluginManager.add('contextmenu', function(editor) {
|
||||
menu = new tinymce.ui.Menu({
|
||||
items: items,
|
||||
context: 'contextmenu'
|
||||
});
|
||||
|
||||
// allow css to target this special menu
|
||||
menu.addClass('contextmenu');
|
||||
|
||||
menu.renderTo(document.body);
|
||||
}).addClass('contextmenu').renderTo();
|
||||
|
||||
editor.on('remove', function() {
|
||||
menu.remove();
|
||||
|
Reference in New Issue
Block a user