File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff 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+
2223export 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 ( ) ;
You can’t perform that action at this time.
0 commit comments