lk-code / winui.monaco-editor

The Monaco Editor for WinUI 3
MIT License
12 stars 4 forks source link

Added OnContentChanged Event #41

Closed LightJack05 closed 9 months ago

LightJack05 commented 9 months ago

I added an OnContentChanged event. In addition to that, I had to also add:

I also cleaned up some code I previously commited.

lk-code commented 9 months ago

hi @LightJack05

thanks for your work. There currently seems to be a problem with the code. In the test app, I enter any text directly in the editor. When I then load the content via the "GetEditorContent" button, the text is empty. The MonacoEditor property is empty and does not show the actual content.

lk-code commented 9 months ago

I did a little more testing. It seems that the logic no longer works when I have loaded the programming languages and selected one.

Can you try to recreate the behavior?

  1. enter text
  2. get editor content
  3. text is loaded correctly
  4. load languages
  5. Select any language (e.g. csharp)
  6. Repeat 1. and 2.
  7. text is no longer loaded.
LightJack05 commented 9 months ago

@lk-code Hi, sorry for being MIA, reproduced it. Gonna look into it.

LightJack05 commented 9 months ago

@lk-code Think I got it fixed. The SetLanguageAsync method seems to break the event handler for some reason.

lk-code commented 9 months ago

I'll have to see what exactly the problem is at some point. Right now it works, but it's just a workaround :/

LightJack05 commented 9 months ago

@lk-code Yeah not an ideal solution, but as far as I can tell its down to Monaco itself, not the C# around it... I dont know enough about JS to say anything more exact...