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
1 changed files with 14 additions and 0 deletions

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) {