Skip to content
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

Open
nickperkinslondon opened this issue Mar 31, 2017 · 4 comments
Open

Comments

@nickperkinslondon
Copy link

...i fixed it by doing this:
this.editor.setValue( val, 1 );
Not sure if my problem is related to Elm or not...

@tomalec
Copy link
Member

tomalec commented Mar 31, 2017

Thanks for reporting :)
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.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 :)

@nickperkinslondon
Copy link
Author

nickperkinslondon commented Apr 1, 2017 via email

@warpech warpech added this to the Juicy elements support milestone Apr 7, 2018
@lastmjs
Copy link

lastmjs commented May 1, 2018

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

@alshakero
Copy link
Contributor

alshakero commented May 3, 2018

Maybe try add a setter to the value property?

Object.defineProperty(yourEditor, 'value', {
	set(val) { yourEditor.setValue(val, 1) }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants