@@ -54,9 +54,15 @@ const HelmetProject = ({
54
54
55
55
const _handleClickNewScenario = ( ) => {
56
56
const promptCreation = ( previousError ) => {
57
- vex . dialog . prompt ( {
57
+ vex . dialog . open ( {
58
58
message : ( previousError ? previousError : "" ) + "Anna uuden skenaarion nimike:" ,
59
- placeholder : '' ,
59
+ input : `
60
+ <div class="vex-custom-field-wrapper">
61
+ <div class="vex-custom-input-wrapper">
62
+ <input name="scenarioName" type="text" value="" autofocus />
63
+ </div>
64
+ </div>
65
+ ` ,
60
66
callback : ( inputScenarioName ) => {
61
67
let error = "" ;
62
68
// Check for cancel button press
@@ -78,7 +84,31 @@ const HelmetProject = ({
78
84
}
79
85
}
80
86
} ) ;
81
- document . getElementsByName ( "vex" ) [ 0 ] . focus ( ) ;
87
+ /* vex.dialog.prompt({
88
+ message: (previousError ? previousError : "") + "Anna uuden skenaarion nimike:",
89
+ placeholder: '',
90
+ callback: (inputScenarioName) => {
91
+ let error = "";
92
+ // Check for cancel button press
93
+ if (inputScenarioName === false) {
94
+ return;
95
+ }
96
+ // Check input for initial errors
97
+ if (inputScenarioName === "") {
98
+ error = "Nimike on pakollinen, tallennettavaa tiedostonime\u00e4 varten. ";
99
+ }
100
+ if (scenarios.map((s) => s.name).includes(inputScenarioName)) {
101
+ error = "Nimike on jo olemassa, valitse toinen nimi tai poista olemassa oleva ensin. ";
102
+ }
103
+ // Handle recursively any input errors (mandated by the async library since prompt isn't natively supported in Electron)
104
+ if (error) {
105
+ promptCreation(error);
106
+ } else {
107
+ _createScenario(inputScenarioName);
108
+ }
109
+ }
110
+ }); */
111
+ // document.getElementsByName("vex")[0].focus();
82
112
} ;
83
113
promptCreation ( ) ;
84
114
} ;
0 commit comments