-
Notifications
You must be signed in to change notification settings - Fork 34
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
selects all text on every change ( when used in an Elm app ) #24
Comments
Thanks for reporting :) However, I'm not sure whether it's a bug or a feature ;), as this is the default behavior of Ace editor. // juicyAceEditor.value = val; // without select all
juicyAceEditor.editor.setValue( val, 1 ); For sure it's worth mentioning in README. I'll try to get some closer look to the latest Ace API, maybe I'd find something cleaner. Any other comments are more than welcome :) |
I am not sure you understand what is happening.
I am not programmatically setting the value, I am just typing into it the
editor.
Every time I press a key, the entire text is selected.
Then, when I press another key, the entire text is replaced with the single
character from the second key.
This is surely not the intended behaviour of the editor!
This is what is fixed by the change.
Anyway, I was just experimenting with web components in Elm, I will
probably not continue with ace-editor
because I have no control over the editor when used as a web-component in
Elm.
It was all I could do to get text-in and text-out when it changes.
There is no way that I can see to get the "editor object" and call the
methods on it from Elm.
Anyway, thanks so much for your reply -- keep up the good work.
…On Fri, Mar 31, 2017 at 7:07 PM, Tomek Wytrębowicz ***@***.*** > wrote:
Thanks for reportin :)
I think it's not related to Elm, it happens in lots of our use cases.
However, I'm not sure whether it's a bug or a feature ;), as this is the
default behavior of Ace editor.
Simply juicyAceEditor.value = 'smth' <=> aceEditor.setValue('smth'). If
you want to achieve non-default behavior you can always do as you
mentioned:|
juicyAceEditor.editor.setValue( val, 1 );
For sure it's worth mentioning in README. I'll try to get some closer look
to the latest Ace API, maybe I'd find something cleaner.
Any other comments are more than welcome :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#24 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAUTNq0rje0DZRiUmLG00e3UmU7kxxjMks5rrYc4gaJpZM4MwK-P>
.
--
Nick Perkins
|
I'm running into this same issue, though I am using lit-html. I imagine the problem is coming from the way both Elm and lit-html are handling the dom. We might both be setting the value property every time there is a change to the editor. Anyway, this is a large issue for me as well. I'm using lit-html, setting the value property of the editor on each change to the contents of the editor, I'm seeing all sorts of strange behavior from the editor, it is very broken |
Maybe try add a Object.defineProperty(yourEditor, 'value', {
set(val) { yourEditor.setValue(val, 1) }
}); |
...i fixed it by doing this:
this.editor.setValue( val, 1 );
Not sure if my problem is related to Elm or not...
The text was updated successfully, but these errors were encountered: