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

fix(TextEditor): reset the editor, if an empty value is set #510

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/shared/components/ncEditor/NcEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ export default {
watch: {
text(value) {
if (value.trim() !== this.localValue.trim()) {
this.editor.setContent(value, false)
this.localValue = value

// reset editor if content is empty
// otherwise the (empty) content will not be updated
if (value === '') {
this.setupEditor()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to destroy possibly existing instances using this before:

this?.editor?.destroy()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is what happens first in method this.setupEditor(), why do I have to do it before twice?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, then I misread the diff somehow

} else {
this.editor.setContent(value)
}
}
},
},
Expand Down
Loading