Skip to content

Commit a44708c

Browse files
Merge pull request #1313 from RohitKushvaha01/fix-keyboard-shortcut-leaks
fix. keyboard shortcuts leaks into ace editor
2 parents b98b1f2 + 92d1cc5 commit a44708c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/dialogs/prompt.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ import appSettings from "lib/settings";
1919
* @param {PromptOptions} options
2020
* @returns {Promise<string|number|null>} Returns null if cancelled
2121
*/
22+
2223
export default function prompt(
2324
message,
2425
defaultValue,
2526
type = "text",
2627
options = {},
2728
) {
29+
const commands = editorManager.editor.commands;
30+
const originalExec = commands.exec;
31+
32+
commands.exec = () => {}; // Disable all shortcuts
33+
2834
return new Promise((resolve) => {
2935
const inputType = type === "textarea" ? "textarea" : "input";
3036
type = type === "filename" ? "text" : type;
@@ -50,6 +56,7 @@ export default function prompt(
5056
hide();
5157
let { value } = input;
5258
if (type === "number") value = +value;
59+
5360
resolve(value);
5461
},
5562
});
@@ -151,6 +158,7 @@ export default function prompt(
151158
}
152159

153160
function hide() {
161+
commands.exec = originalExec;
154162
actionStack.remove("prompt");
155163
system.setInputType(appSettings.value.keyboardMode);
156164
hidePrompt();

0 commit comments

Comments
 (0)