1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Handle known bug (monaco-editor issue No 2382)

- handles "Uncaught (in promise) Canceled: Canceled"
This commit is contained in:
Steve-Mcl 2021-05-01 11:40:43 +01:00
parent dc3e04456c
commit a72bdfdacc

View File

@ -148,6 +148,20 @@ RED.editor.codeEditor.monaco = (function() {
function init(options) {
//Handles "Uncaught (in promise) Canceled: Canceled"
//@see https://github.com/microsoft/monaco-editor/issues/2382
//This is fixed in commit microsoft/vscode@49cad9a however it is not yet present monaco-editor
//Remove the below addEventListener once monaco-editor V0.23.1 or greater is published
window.addEventListener('unhandledrejection', (evt) => {
if(evt && evt.reason && evt.reason.stack) {
if (evt.reason.name === 'Canceled' && evt.reason.stack.indexOf('vendor/monaco/dist') >= 0) {
evt.preventDefault();
evt.stopImmediatePropagation();
}
}
});
options = options || {};
window.MonacoEnvironment = window.MonacoEnvironment || {};
window.MonacoEnvironment.getWorkerUrl = function (moduleId, label) {