From af41d646dd694f3f9334ff6c040dbd265aa584db Mon Sep 17 00:00:00 2001 From: tophf Date: Mon, 31 Jul 2017 19:39:10 +0300 Subject: [PATCH] Don't show editor.contextDelete option in FF; #128 --- background/background.js | 2 +- edit/edit.js | 16 ++++++++++++---- options.html | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/background/background.js b/background/background.js index 2bb57e80..5026fa53 100644 --- a/background/background.js +++ b/background/background.js @@ -127,7 +127,7 @@ contextMenus = Object.assign({ title: 'openStylesManager', click: browserCommands.openManage, }, -}, prefs.get('editor.contextDelete') && { +}, !FIREFOX && prefs.get('editor.contextDelete') && { 'editor.contextDelete': { title: 'editDeleteText', type: 'normal', diff --git a/edit/edit.js b/edit/edit.js index 59ce6fbe..ff29c0d5 100644 --- a/edit/edit.js +++ b/edit/edit.js @@ -373,7 +373,9 @@ function setupCodeMirror(textarea, index) { hotkeyRerouter.setState(false); wrapper.classList.add('CodeMirror-active'); }); - cm.on('mousedown', (cm, event) => toggleContextMenuDelete.call(cm, event)); + if (!FIREFOX) { + cm.on('mousedown', (cm, event) => toggleContextMenuDelete.call(cm, event)); + } let lastClickTime = 0; const resizeGrip = wrapper.appendChild(template.resizeGrip.cloneNode(true)); @@ -1340,9 +1342,15 @@ function initHooks() { document.querySelector('#lint h2').addEventListener('click', toggleLintReport); } - document.querySelectorAll( - 'input:not([type]), input[type="text"], input[type="search"], input[type="number"]') - .forEach(e => e.addEventListener('mousedown', toggleContextMenuDelete)); + if (!FIREFOX) { + $$([ + 'input:not([type])', + 'input[type="text"]', + 'input[type="search"]', + 'input[type="number"]', + ].join(',') + ).forEach(e => e.addEventListener('mousedown', toggleContextMenuDelete)); + } setupGlobalSearch(); setCleanGlobal(); diff --git a/options.html b/options.html index c673ac44..9e65acb1 100644 --- a/options.html +++ b/options.html @@ -95,7 +95,7 @@ -