My App has a few grammar modes defined in global vars:
var ins_mode = AceGrammar.getMode({
"RegExpID": "RE::",
"Style": {
//...
});
var ycd_mode = AceGrammar.getMode({
"RegExpID": "RE::",
"Style": {
//...
});
var aoi3_mode = AceGrammar.getMode({
"RegExpID": "RE::",
"Style": {
//...
});
var mmd_mode = AceGrammar.getMode({
"RegExpID": "RE::",
"Style": {
//...
});
When I try to set the editor to a different mode, ace.js gave me this error:
let modeStr = getMode() //This return either "ins_mode", "ycd_mode" ... in string
myAceEditor.session.setMode(window[modeStr]);
ace.js?nocache=nonce_1_1657893450835_623:11570
Uncaught ReferenceError: window is not defined
at ace.js?nocache=nonce_1_1657893450835_623:11570:5
at ace.js?nocache=nonce_1_1657893450835_623:11585:3
(anonymous) @ ace.js?nocache=nonce_1_1657893450835_623:11570
(anonymous) @ ace.js?nocache=nonce_1_1657893450835_623:11585

I think it is because I pass global value to the editor.session.setMode(), and somehow it would mess with ace.js window global object.
Is there anyway that I can set editor to a different AceGrammar mode without produce this error?
My App has a few grammar modes defined in global vars:
When I try to set the editor to a different mode,
ace.jsgave me this error:ace.js?nocache=nonce_1_1657893450835_623:11570 Uncaught ReferenceError: window is not defined at ace.js?nocache=nonce_1_1657893450835_623:11570:5 at ace.js?nocache=nonce_1_1657893450835_623:11585:3 (anonymous) @ ace.js?nocache=nonce_1_1657893450835_623:11570 (anonymous) @ ace.js?nocache=nonce_1_1657893450835_623:11585I think it is because I pass global value to the
editor.session.setMode(), and somehow it would mess withace.jswindow global object.Is there anyway that I can set editor to a different
AceGrammarmode without produce this error?