mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-24 02:35:41 +00:00
Bug 1527898 - Override find and replace commands when disableSearchAddon is true; r=gl.
This is an hotfix for the bug, which we want to uplift. A better fix will happen in Bug 1527903. Depends on D19963 Differential Revision: https://phabricator.services.mozilla.com/D19965 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
d0dfd717b5
commit
fbd29e33c8
@ -433,6 +433,19 @@ Editor.prototype = {
|
||||
|
||||
if (!this.config.disableSearchAddon) {
|
||||
this._initSearchShortcuts(win);
|
||||
} else {
|
||||
// Hotfix for Bug 1527898. We should remove those overrides as part of Bug 1527903.
|
||||
Object.assign(win.CodeMirror.commands, {
|
||||
find: null,
|
||||
findPersistent: null,
|
||||
findPersistentNext: null,
|
||||
findPersistentPrev: null,
|
||||
findNext: null,
|
||||
findPrev: null,
|
||||
clearSearch: null,
|
||||
replace: null,
|
||||
replaceAll: null,
|
||||
});
|
||||
}
|
||||
|
||||
editors.set(this, cm);
|
||||
|
@ -33,6 +33,7 @@ support-files =
|
||||
[browser_editor_alt_b_f.js]
|
||||
[browser_editor_basic.js]
|
||||
[browser_editor_cursor.js]
|
||||
[browser_editor_disableSearchAddon.js]
|
||||
[browser_editor_find_again.js]
|
||||
[browser_editor_goto_line.js]
|
||||
[browser_editor_history.js]
|
||||
|
@ -0,0 +1,35 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Ensure disableSearchAddon config works as expected in the source editor.
|
||||
|
||||
const isMacOS = Services.appinfo.OS === "Darwin";
|
||||
const {LocalizationHelper} = require("devtools/shared/l10n");
|
||||
const L10N = new LocalizationHelper("devtools/client/locales/sourceeditor.properties");
|
||||
|
||||
const FIND_KEY = L10N.getStr("find.key");
|
||||
const REPLACE_KEY = L10N.getStr(isMacOS ? "replaceAllMac.key" : "replaceAll.key");
|
||||
|
||||
add_task(async function() {
|
||||
const { ed, win } = await setup({
|
||||
disableSearchAddon: true,
|
||||
});
|
||||
|
||||
const edDoc = ed.container.contentDocument;
|
||||
const edWin = edDoc.defaultView;
|
||||
|
||||
await promiseWaitForFocus();
|
||||
ed.focus();
|
||||
|
||||
synthesizeKeyShortcut(FIND_KEY, edWin);
|
||||
const searchInput = edDoc.querySelector("input[type=search]");
|
||||
ok(!searchInput, "the search input is not displayed");
|
||||
|
||||
synthesizeKeyShortcut(REPLACE_KEY, edWin);
|
||||
const replaceInput = edDoc.querySelector(".CodeMirror-dialog > input");
|
||||
ok(!replaceInput, "the replace input is not displayed");
|
||||
|
||||
teardown(ed, win);
|
||||
});
|
Loading…
Reference in New Issue
Block a user