-
Notifications
You must be signed in to change notification settings - Fork 6
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
How to update value
when model
data is updated.
#6
Comments
SOLVED IT! or not ... see my comment below. Turns out this fix throws Ember errors. Add the following ...
locale: 'en-US',
valueDidChange: Ember.observer('value', function() {
console.log('--------------- valueDidChange() ------------------');
let thisEditor = this.get('editor');
let editorValue = thisEditor.getValue();
if(this.value !== editorValue) {
console.log('NOT THE SAME!');
thisEditor.setValue(this.value);
}
}),
didInsertElement(){
... I'll put in a Pull Request later. |
@dirkdirk ok |
@dirkdirk I have try your problem myself,it looks like your pull request pull 7 can solve this problem, but it's recommended that component should use |
@zhyq0826 Good work my friend! My fix threw warnings about double rendering that Ember didn't like. Your fix works perfectly so far. If you don't hear from me again, it means it's working fine. Thanks! |
@zhyq0826 Bug fix ... On line 24 of your code To fix this, use this.get('_editor').setValue(get(this.attrs.value.value, 'content')); Pull requested. |
I have a route that displays a simditor editor. It loads fine the first time the route is called, but when the model's data changes, the editor's value does not change.
app/router.js
app/routes/items/item.js
app/templates/items/item.hbs
Rendering
localhost:4200/items/3
displays the text for item_id 3 in the Simditor editor as expected. But then going directly tolocalhost:4200/items/7
still displays the text for item_id 3.If instead, one goes to
localhost:4200/items
and then tolocalhost:4200/items/7
, the text for item_id 7 is displayed in Simditor as expected.I suspect it has to do with Simditor not being destroyed when staying on the
items/item_id
route. Changing routes and going back to theitems/items_id
route, destroys the component and rerenders it.Is there a way to manually destroy all instances of Simditor on some hook like
beforeModel
? And then manually force the component to rerender?Or is there another / better solution?
The text was updated successfully, but these errors were encountered: