@typefox/monaco-editor-react 7.3.0-next.4 → 7.3.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +51 -42
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +48 -41
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to npm module [@typefox/monaco-editor-react](https://www.npmjs.com/package/@typefox/monaco-editor-react) are documented in this file.
|
|
4
4
|
|
|
5
|
-
## [7.3.0-next.
|
|
5
|
+
## [7.3.0-next.5] - 2025-11-13
|
|
6
6
|
|
|
7
7
|
- Fixed re-rendering issues with React StrictMode [#986](https://github.com/TypeFox/monaco-languageclient/pull/986).
|
|
8
|
-
- Updated to `monaco-languageclient@10.3.0-next.
|
|
8
|
+
- Updated to `monaco-languageclient@10.3.0-next.5`.
|
|
9
9
|
- Updated all `@codingame/monaco-vscode` packages to `22.1.9`.
|
|
10
10
|
|
|
11
11
|
## [7.2.0] - 2025-10-20
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACrG,OAAO,EAAE,KAAK,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAgC,KAAK,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAC;AAC1I,OAAO,KAAK,EAAE,EAAE,KAAK,aAAa,EAAqB,MAAM,OAAO,CAAC;AAErE,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,mBAAmB,CAAC,EAAE,CAAC,sBAAsB,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC/E,iBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACpD,0BAA0B,CAAC,EAAE,CAAC,UAAU,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACzE,aAAa,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;IACpD,iBAAiB,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;IACpD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAChC,CAAA;AAkED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA4P7D,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License. See LICENSE in the package root for license information.
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
import { LogLevel } from '@codingame/monaco-vscode-api';
|
|
6
|
-
import * as monaco from '@codingame/monaco-vscode-editor-api';
|
|
7
6
|
import { ConsoleLogger } from 'monaco-languageclient/common';
|
|
8
7
|
import { EditorApp } from 'monaco-languageclient/editorApp';
|
|
9
8
|
import { LanguageClientManager } from 'monaco-languageclient/lcwrapper';
|
|
@@ -17,7 +16,7 @@ const haveEditorService = () => {
|
|
|
17
16
|
};
|
|
18
17
|
const logger = new ConsoleLogger(LogLevel.Debug);
|
|
19
18
|
const runQueue = [];
|
|
20
|
-
let
|
|
19
|
+
let runQueueLock = true;
|
|
21
20
|
let intervalId = undefined;
|
|
22
21
|
const addQueue = (id, func) => {
|
|
23
22
|
debugLogging('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>');
|
|
@@ -28,30 +27,23 @@ const addQueue = (id, func) => {
|
|
|
28
27
|
const executeQueue = async () => {
|
|
29
28
|
console.log(`Queue size: ${runQueue.length}`);
|
|
30
29
|
if (runQueue.length > 0) {
|
|
31
|
-
|
|
30
|
+
runQueueLock = true;
|
|
32
31
|
while (runQueue.length > 0) {
|
|
33
32
|
const lengthBefore = runQueue.length;
|
|
34
33
|
const queueObj = runQueue.shift();
|
|
35
34
|
debugLogging('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<');
|
|
36
35
|
debugLogging(`QUEUE ${queueObj?.id} start: SIZE before: ${lengthBefore}`, true);
|
|
37
|
-
|
|
38
|
-
await queueObj?.func();
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
queueLock = false;
|
|
42
|
-
debugLogging(`QUEUE ${queueObj?.id} ERROR: SIZE after: ${runQueue.length}`);
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
36
|
+
await queueObj?.func();
|
|
45
37
|
debugLogging(`QUEUE ${queueObj?.id} end: SIZE after: ${runQueue.length}`);
|
|
46
38
|
}
|
|
47
|
-
|
|
39
|
+
runQueueLock = false;
|
|
48
40
|
}
|
|
49
41
|
};
|
|
50
42
|
const kickQueue = () => {
|
|
51
43
|
if (intervalId === undefined && runQueue.length > 0) {
|
|
52
44
|
intervalId = setInterval(async () => {
|
|
53
|
-
debugLogging('Checking queue...' +
|
|
54
|
-
if (!
|
|
45
|
+
debugLogging('Checking queue...' + runQueueLock);
|
|
46
|
+
if (!runQueueLock) {
|
|
55
47
|
await executeQueue();
|
|
56
48
|
stopQueue();
|
|
57
49
|
}
|
|
@@ -86,6 +78,8 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
86
78
|
onError(error);
|
|
87
79
|
}
|
|
88
80
|
else {
|
|
81
|
+
debugLogging(`INTERCEPTED Error: ${error}. Stopping queue...`);
|
|
82
|
+
runQueueLock = false;
|
|
89
83
|
throw error;
|
|
90
84
|
}
|
|
91
85
|
};
|
|
@@ -115,7 +109,7 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
115
109
|
await apiWrapper.start();
|
|
116
110
|
onVscodeApiInitDone?.(apiWrapper);
|
|
117
111
|
debugLogging('GLOBAL INIT DONE', true);
|
|
118
|
-
|
|
112
|
+
runQueueLock = false;
|
|
119
113
|
}
|
|
120
114
|
catch (error) {
|
|
121
115
|
performErrorHandling(error);
|
|
@@ -123,6 +117,11 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
123
117
|
};
|
|
124
118
|
globalInitFunc();
|
|
125
119
|
}
|
|
120
|
+
else if (envEnhanced.vscodeApiInitialised === true) {
|
|
121
|
+
if (runQueueLock && intervalId !== undefined) {
|
|
122
|
+
runQueueLock = false;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
126
125
|
};
|
|
127
126
|
const editorInitFunc = async () => {
|
|
128
127
|
try {
|
|
@@ -162,28 +161,33 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
162
161
|
}
|
|
163
162
|
};
|
|
164
163
|
const configProcessedFunc = () => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
if (editorAppConfigRef.current?.editorOptions !== undefined && editorAppRef.current) {
|
|
175
|
-
if (!editorAppRef.current.isDiffEditor()) {
|
|
176
|
-
editorAppRef.current.getEditor()?.updateOptions(editorAppConfigRef.current.editorOptions);
|
|
164
|
+
try {
|
|
165
|
+
debugLogging('CONFIG PROCESSED', true);
|
|
166
|
+
if (!launchingRef.current) {
|
|
167
|
+
if (editorAppConfigRef.current?.codeResources !== undefined && editorAppRef.current) {
|
|
168
|
+
editorAppRef.current.updateCodeResources(editorAppConfigRef.current.codeResources);
|
|
169
|
+
editorAppRef.current.updateCode({
|
|
170
|
+
modified: editorAppConfigRef.current.codeResources.modified?.text,
|
|
171
|
+
original: editorAppConfigRef.current.codeResources.original?.text
|
|
172
|
+
});
|
|
177
173
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
if (editorAppConfigRef.current?.editorOptions !== undefined && editorAppRef.current) {
|
|
175
|
+
if (!editorAppRef.current.isDiffEditor()) {
|
|
176
|
+
editorAppRef.current.getEditor()?.updateOptions(editorAppConfigRef.current.editorOptions);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (editorAppConfigRef.current?.diffEditorOptions !== undefined && editorAppRef.current) {
|
|
180
|
+
if (editorAppRef.current.isDiffEditor()) {
|
|
181
|
+
editorAppRef.current.getDiffEditor()?.updateOptions(editorAppConfigRef.current.diffEditorOptions);
|
|
182
|
+
}
|
|
182
183
|
}
|
|
183
184
|
}
|
|
185
|
+
onConfigProcessed?.(editorAppRef.current);
|
|
186
|
+
debugLogging('CONFIG PROCESSED: Done', true);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
performErrorHandling(error);
|
|
184
190
|
}
|
|
185
|
-
onConfigProcessed?.(editorAppRef.current);
|
|
186
|
-
debugLogging('CONFIG PROCESSED: Done', true);
|
|
187
191
|
};
|
|
188
192
|
useEffect(() => {
|
|
189
193
|
// fast-fail
|
|
@@ -252,17 +256,22 @@ export const MonacoEditorReactComp = (props) => {
|
|
|
252
256
|
// this part runs on unmount (componentWillUnmount)
|
|
253
257
|
return () => {
|
|
254
258
|
const disposeFunc = async () => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
try {
|
|
260
|
+
// dispose editor if used
|
|
261
|
+
debugLogging('DISPOSE', true);
|
|
262
|
+
if (editorAppRef.current !== undefined) {
|
|
263
|
+
await editorAppRef.current.dispose();
|
|
264
|
+
editorAppRef.current = undefined;
|
|
265
|
+
onDisposeEditor?.();
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
debugLogging('DISPOSE: EditorApp is not disposed', true);
|
|
269
|
+
}
|
|
270
|
+
debugLogging('DISPOSE DONE', true);
|
|
261
271
|
}
|
|
262
|
-
|
|
263
|
-
|
|
272
|
+
catch (error) {
|
|
273
|
+
performErrorHandling(error);
|
|
264
274
|
}
|
|
265
|
-
debugLogging('DISPOSE DONE', true);
|
|
266
275
|
};
|
|
267
276
|
addQueue('dispose', disposeFunc);
|
|
268
277
|
};
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAA2C,MAAM,iCAAiC,CAAC;AACrG,OAAO,EAA6B,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACnG,OAAO,EAAE,4BAA4B,EAA8B,sBAAsB,E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,CAAC;oBACD,yBAAyB;oBACzB,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;oBAE9B,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;wBACrC,MAAM,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;wBACrC,YAAY,CAAC,OAAO,GAAG,SAAS,CAAC;wBACjC,eAAe,EAAE,EAAE,CAAC;oBACxB,CAAC;yBAAM,CAAC;wBACJ,YAAY,CAAC,oCAAoC,EAAE,IAAI,CAAC,CAAC;oBAC7D,CAAC;oBACD,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;gBACvC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACb,oBAAoB,CAAC,KAAc,CAAC,CAAC;gBACzC,CAAC;YAAA,CACJ,CAAC;YACF,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAAA,CACpC,CAAC;IAAA,CACL,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE,CAAC;QACZ,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC9B,CAAC;IAAA,CACJ,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACH,6BACI,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,GACtB,CACL,CAAC;AAAA,CACL,CAAC"}
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* ------------------------------------------------------------------------------------------ */
|
|
5
5
|
|
|
6
6
|
import { LogLevel } from '@codingame/monaco-vscode-api';
|
|
7
|
-
import * as monaco from '@codingame/monaco-vscode-editor-api';
|
|
8
7
|
import { ConsoleLogger } from 'monaco-languageclient/common';
|
|
9
8
|
import { EditorApp, type EditorAppConfig, type TextContents } from 'monaco-languageclient/editorApp';
|
|
10
9
|
import { type LanguageClientConfig, LanguageClientManager } from 'monaco-languageclient/lcwrapper';
|
|
@@ -39,7 +38,7 @@ const haveEditorService = () => {
|
|
|
39
38
|
const logger = new ConsoleLogger(LogLevel.Debug);
|
|
40
39
|
|
|
41
40
|
const runQueue: Array<{id: string, func: () => Promise<void>}> = [];
|
|
42
|
-
let
|
|
41
|
+
let runQueueLock = true;
|
|
43
42
|
let intervalId: number | unknown | undefined = undefined;
|
|
44
43
|
|
|
45
44
|
const addQueue = (id: string, func: () => Promise<void>) => {
|
|
@@ -53,30 +52,24 @@ const executeQueue = async () => {
|
|
|
53
52
|
console.log(`Queue size: ${runQueue.length}`);
|
|
54
53
|
|
|
55
54
|
if (runQueue.length > 0) {
|
|
56
|
-
|
|
55
|
+
runQueueLock = true;
|
|
57
56
|
while (runQueue.length > 0) {
|
|
58
57
|
const lengthBefore = runQueue.length;
|
|
59
58
|
const queueObj = runQueue.shift();
|
|
60
59
|
debugLogging('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<');
|
|
61
60
|
debugLogging(`QUEUE ${queueObj?.id} start: SIZE before: ${lengthBefore}`, true);
|
|
62
|
-
|
|
63
|
-
await queueObj?.func();
|
|
64
|
-
} catch (error) {
|
|
65
|
-
queueLock = false;
|
|
66
|
-
debugLogging(`QUEUE ${queueObj?.id} ERROR: SIZE after: ${runQueue.length}`);
|
|
67
|
-
throw error;
|
|
68
|
-
}
|
|
61
|
+
await queueObj?.func();
|
|
69
62
|
debugLogging(`QUEUE ${queueObj?.id} end: SIZE after: ${runQueue.length}`);
|
|
70
63
|
}
|
|
71
|
-
|
|
64
|
+
runQueueLock = false;
|
|
72
65
|
}
|
|
73
66
|
};
|
|
74
67
|
|
|
75
68
|
const kickQueue = () => {
|
|
76
69
|
if (intervalId === undefined && runQueue.length > 0) {
|
|
77
70
|
intervalId = setInterval(async () => {
|
|
78
|
-
debugLogging('Checking queue...' +
|
|
79
|
-
if (!
|
|
71
|
+
debugLogging('Checking queue...' + runQueueLock);
|
|
72
|
+
if (!runQueueLock) {
|
|
80
73
|
await executeQueue();
|
|
81
74
|
stopQueue();
|
|
82
75
|
}
|
|
@@ -129,6 +122,8 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
129
122
|
if (onError) {
|
|
130
123
|
onError(error);
|
|
131
124
|
} else {
|
|
125
|
+
debugLogging(`INTERCEPTED Error: ${error}. Stopping queue...`);
|
|
126
|
+
runQueueLock = false;
|
|
132
127
|
throw error;
|
|
133
128
|
}
|
|
134
129
|
};
|
|
@@ -165,12 +160,16 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
165
160
|
|
|
166
161
|
debugLogging('GLOBAL INIT DONE', true);
|
|
167
162
|
|
|
168
|
-
|
|
163
|
+
runQueueLock = false;
|
|
169
164
|
} catch (error) {
|
|
170
165
|
performErrorHandling(error as Error);
|
|
171
166
|
}
|
|
172
167
|
};
|
|
173
168
|
globalInitFunc();
|
|
169
|
+
} else if (envEnhanced.vscodeApiInitialised === true) {
|
|
170
|
+
if (runQueueLock && intervalId !== undefined) {
|
|
171
|
+
runQueueLock = false;
|
|
172
|
+
}
|
|
174
173
|
}
|
|
175
174
|
};
|
|
176
175
|
|
|
@@ -213,28 +212,32 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
213
212
|
};
|
|
214
213
|
|
|
215
214
|
const configProcessedFunc = () => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
if (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (editorAppConfigRef.current?.editorOptions !== undefined && editorAppRef.current) {
|
|
226
|
-
if (!editorAppRef.current.isDiffEditor()) {
|
|
227
|
-
editorAppRef.current.getEditor()?.updateOptions(editorAppConfigRef.current.editorOptions as monaco.editor.IEditorOptions);
|
|
215
|
+
try {
|
|
216
|
+
debugLogging('CONFIG PROCESSED', true);
|
|
217
|
+
if (!launchingRef.current) {
|
|
218
|
+
if (editorAppConfigRef.current?.codeResources !== undefined && editorAppRef.current) {
|
|
219
|
+
editorAppRef.current.updateCodeResources(editorAppConfigRef.current.codeResources);
|
|
220
|
+
editorAppRef.current.updateCode({
|
|
221
|
+
modified: editorAppConfigRef.current.codeResources.modified?.text,
|
|
222
|
+
original: editorAppConfigRef.current.codeResources.original?.text
|
|
223
|
+
});
|
|
228
224
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
if (editorAppConfigRef.current?.editorOptions !== undefined && editorAppRef.current) {
|
|
226
|
+
if (!editorAppRef.current.isDiffEditor()) {
|
|
227
|
+
editorAppRef.current.getEditor()?.updateOptions(editorAppConfigRef.current.editorOptions);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (editorAppConfigRef.current?.diffEditorOptions !== undefined && editorAppRef.current) {
|
|
231
|
+
if (editorAppRef.current.isDiffEditor()) {
|
|
232
|
+
editorAppRef.current.getDiffEditor()?.updateOptions(editorAppConfigRef.current.diffEditorOptions);
|
|
233
|
+
}
|
|
233
234
|
}
|
|
234
235
|
}
|
|
236
|
+
onConfigProcessed?.(editorAppRef.current);
|
|
237
|
+
debugLogging('CONFIG PROCESSED: Done', true);
|
|
238
|
+
} catch (error) {
|
|
239
|
+
performErrorHandling(error as Error);
|
|
235
240
|
}
|
|
236
|
-
onConfigProcessed?.(editorAppRef.current);
|
|
237
|
-
debugLogging('CONFIG PROCESSED: Done', true);
|
|
238
241
|
};
|
|
239
242
|
|
|
240
243
|
useEffect(() => {
|
|
@@ -309,17 +312,21 @@ export const MonacoEditorReactComp: React.FC<MonacoEditorProps> = (props) => {
|
|
|
309
312
|
// this part runs on unmount (componentWillUnmount)
|
|
310
313
|
return () => {
|
|
311
314
|
const disposeFunc = async () => {
|
|
312
|
-
|
|
313
|
-
|
|
315
|
+
try {
|
|
316
|
+
// dispose editor if used
|
|
317
|
+
debugLogging('DISPOSE', true);
|
|
314
318
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
if (editorAppRef.current !== undefined) {
|
|
320
|
+
await editorAppRef.current.dispose();
|
|
321
|
+
editorAppRef.current = undefined;
|
|
322
|
+
onDisposeEditor?.();
|
|
323
|
+
} else {
|
|
324
|
+
debugLogging('DISPOSE: EditorApp is not disposed', true);
|
|
325
|
+
}
|
|
326
|
+
debugLogging('DISPOSE DONE', true);
|
|
327
|
+
} catch (error) {
|
|
328
|
+
performErrorHandling(error as Error);
|
|
321
329
|
}
|
|
322
|
-
debugLogging('DISPOSE DONE', true);
|
|
323
330
|
};
|
|
324
331
|
addQueue('dispose', disposeFunc);
|
|
325
332
|
};
|