diff --git a/src/renderer/main/user-interface/LineEditor.svelte b/src/renderer/main/user-interface/LineEditor.svelte index f921b98fe..c0308481f 100644 --- a/src/renderer/main/user-interface/LineEditor.svelte +++ b/src/renderer/main/user-interface/LineEditor.svelte @@ -110,6 +110,30 @@ beforeUpdate(() => { editor?.layout(); }); + + // Save a reference to the original ResizeObserver + const OriginalResizeObserver = window.ResizeObserver; + + // Create a new ResizeObserver constructor + window.ResizeObserver = function (callback) { + const wrappedCallback = (entries, observer) => { + window.requestAnimationFrame(() => { + callback(entries, observer); + }); + }; + + // Create an instance of the original ResizeObserver + // with the wrapped callback + return new OriginalResizeObserver(wrappedCallback); + }; + + // Copy over static methods, if any + for (let staticMethod in OriginalResizeObserver) { + if (OriginalResizeObserver.hasOwnProperty(staticMethod)) { + window.ResizeObserver[staticMethod] = + OriginalResizeObserver[staticMethod]; + } + } @@ -119,6 +143,7 @@ class="{$$props.class} grid grid-cols-1 w-full h-full items-center" >
{}} on:mousedown|preventDefault={() => {}} bind:this={monaco_block}