-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Form posts incomplete data after 10lines #14
Comments
Hey @rliebling thanks for looking into it. The monaco editor and phx-change aren't playing nice together so I recommend https://github.com/BeaconCMS/live_monaco_editor#fetching-the-editor-value instead to fetch the editor content value. I'd like to make it work but I'm afraid that may require deeper changes to Phoenix or even the Monaco editor, making such feature not viable. But before ruling it out it's worth investigating a bit more. |
@leandrocp thanks for the reply (as well as for the project). I haven't had much time but did try looking at this code, the livebook code and the monaco code. I will try to spend more time soon. Meanwhile, can you help me understand how this project (
anyway, appreciate any insight/pointers you might have, and happy to followup on my own when i find time. Of course, i might also just resort to explicitly fetching the editor value as you already suggested :) |
It's actually a bit more complicated :D |
AFAIK it's impossible to avoid the change event if you place the editor inside of the form, one alternative is to have the editor sitting outside of the form, with an extra attribute on the form which is a hidden input in the form you proxy events to. I have this working locally and do not have the error anymore with missing out on the editor contents. |
@kernel-io a PR adding a new example in https://github.com/BeaconCMS/live_monaco_editor#usage is welcome! |
I'll see if I get time soon :). Have made my own components so not technically using LME anymore. But will be easy enough to add changes to the this. |
To help with that problem I've released a new version with a new I'm closing this one for now but feel free to reopen it or add more comments. Thanks! |
I can reproduce this by running
iex -S mix dev
in this project. If you edit thefile_c
box adding up to 10 lines all works fine. but, as soon as you add an 11th line incomplete data is sent to thehandle_event
call (and output in theiex -S mix dev
console. basically you get the 11th line onwards. It seems like the editor is using 10line windows of text to serialize as part of the form data.I am willing to investigate this more, but am rather confused right now on how this is supposed to work. Does this project (the elixir project) do anything to make the form stuff work? Or, does the monaco editor keep some textarea or other form element in sync with the text of the monaco editor so that
live_monaco_editor
does not need to do anything? If so, then this seems to be an issue with the underlying monaco editor - which I believe is the case, although it may be intended behavior.Again, starting this as a discussion. And, it may well be a case of user-error, although i hoped the
iex -S mix dev
eliminated that chance. thanks in advance for any help/guidance you can provide!The text was updated successfully, but these errors were encountered: