getValue/setValuewhile vue-editor still using it
and type definition is not updated.
No code using removed method
Hi guy, I am using this editor in my application too.Could you show me some example code that getting the value of the content?
I wrap it in my component and I've tried
console.log(this.$refs.editor.getHtml);
Every time it prints 'undefined' in console.
It's already documented right here: Instance methods
this.$refs.toastuiEditor.invoke('getHtml');
Anyway the best way to ask these kind of questions it's to open another issue with the question label 馃憤
It's already documented right here: Instance methods
this.$refs.toastuiEditor.invoke('getHtml');Anyway the best way to ask these kind of questions it's to open another issue with the question label 馃憤
Thank you very much , this help me a lot.
Btw,I have already open an issue before this comment.
I get this Error Uncaught TypeError: t.editor.getValue is not a function if v-model="editorContent" is set to the component. How can I fix it?
I'm currently listening the change event as a workaround
<Editor ref="editor" @change="onEditorChange" />
And then assign the document content to a data property:
methods: {
onEditorChange() {
this.content = this.$refs.editor.invoke('getMarkdown')
},
}
Note that you can invoke any available method, such as getHtml
@pepeloper Thank you.
I implemented it in the same way
onChange(event: any) {
const markdownText = this.invoke('getMarkdown')
this.$emit(
'input',
(typeof this.value === 'undefined' || this.value === null) &&
markdownText === ''
? this.value
: markdownText,
)
},
invoke(tuiMethodName: string) {
return this.$refs.toastuiEditor.invoke(tuiMethodName)
}
However, if v-model does not work, we need to check the case, when value is undefined or null. It will otherwise change undefined and null values to empty string ''
This issue has been automatically marked as inactive because there hasn鈥檛 been much going on it lately. It is going to be closed after 7 days. Thanks!
This issue will be closed due to inactivity. Thanks for your contribution!
Most helpful comment
Thank you very much , this help me a lot.
Btw,I have already open an issue before this comment.