mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
parent
da787a9993
commit
6503498f0a
@ -165,7 +165,13 @@ RED.editor.codeEditor.monaco = (function() {
|
|||||||
//Handles orphaned models
|
//Handles orphaned models
|
||||||
//ensure loaded models that are not explicitly destroyed by a call to .destroy() are disposed
|
//ensure loaded models that are not explicitly destroyed by a call to .destroy() are disposed
|
||||||
RED.events.on("editor:close",function() {
|
RED.events.on("editor:close",function() {
|
||||||
let models = window.monaco ? monaco.editor.getModels() : null;
|
if (!window.monaco) { return; }
|
||||||
|
const editors = window.monaco.editor.getEditors()
|
||||||
|
const orphanEditors = editors.filter(editor => editor && !document.body.contains(editor.getDomNode()))
|
||||||
|
orphanEditors.forEach(editor => {
|
||||||
|
editor.dispose();
|
||||||
|
});
|
||||||
|
let models = monaco.editor.getModels()
|
||||||
if(models && models.length) {
|
if(models && models.length) {
|
||||||
console.warn("Cleaning up monaco models left behind. Any node that calls createEditor() should call .destroy().")
|
console.warn("Cleaning up monaco models left behind. Any node that calls createEditor() should call .destroy().")
|
||||||
for (let index = 0; index < models.length; index++) {
|
for (let index = 0; index < models.length; index++) {
|
||||||
@ -1124,6 +1130,7 @@ RED.editor.codeEditor.monaco = (function() {
|
|||||||
|
|
||||||
$(el).remove();
|
$(el).remove();
|
||||||
$(toolbarRow).remove();
|
$(toolbarRow).remove();
|
||||||
|
ed.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
ed.resize = function resize() {
|
ed.resize = function resize() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user