Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions MonacoEditorComponent/CodeEditor/CodeEditorPresenter.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ public CodeEditorPresenter()
{
Debug.WriteLine("CodeEditorPresenter()");
Content = _element = BrowserHtmlElement.CreateHtmlElement("monaco-" + this.GetHashCode(), "div");

LayoutUpdated += (s, e) =>
{
if (ParentCodeEditor is not null && ParentCodeEditor.IsEditorLoaded)
{
NativeMethods.RefreshLayout(_element.ElementId);
}
};
}

public string ElementId => _element.ElementId;
Expand Down Expand Up @@ -115,8 +107,6 @@ public async Task Launch()

Debug.WriteLine($"InitializeMonaco({this.GetHashCode():X8})");
await NativeMethods.InitializeMonaco(this, _element.ElementId, $"{UNO_BOOTSTRAP_WEBAPP_BASE_PATH}{UNO_BOOTSTRAP_APP_BASE}");

NativeMethods.RefreshLayout(_element.ElementId);
}
catch (Exception e)
{
Expand All @@ -134,9 +124,6 @@ static partial class NativeMethods

[JSImport("globalThis.createMonacoEditor")]
public static partial Task InitializeMonaco([JSMarshalAs<JSType.Any>] object managedOwner, string elementId, string baseUri);

[JSImport("globalThis.refreshLayout")]
public static partial void RefreshLayout(string elementId);
}
}
}
10 changes: 4 additions & 6 deletions MonacoEditorComponent/ts-helpermethods/asyncCallbackHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ const initializeMonacoEditor = (managedOwner: any, element: any) => {
// console.debug("Changing theme");
changeTheme(element, theme, getThemeIsHighContrast(element));

// Update Monaco Size when we receive a window resize event
// console.debug("Listen for resize events on the window and resize the editor");
window.addEventListener("resize", () => {
{
editor.layout();
}
// Listen for parent element size changes
const resizeObserver = new ResizeObserver(() => {
editor.layout();
});
resizeObserver.observe(element);

// Disable WebView Scrollbar so Monaco Scrollbar can do heavy lifting
document.body.style.overflow = 'hidden';
Expand Down
Loading