setContent with HTML?
See original GitHub issueI’m trying to do a setContent function to pre-populate the text the user entered in a “create” phase. This text has markup in it, and the markup is showing in the element as text, rather than formatting the text as I’d like it to. I’ve not been able to find documentation on how I might get the text to show up as marked-up HTML rather than just text.
My setContent function
setContent() { this.$refs.editor_low.setContent({ type: 'doc', content: [{ type: 'paragraph', content: [ { type: 'text', text: this.form.low_criteria, }, ], }], }); }
Editor code:
<editor :extensions="extensions" @update="onUpdateLowCriteria" ref="editor_low"> <div slot="menubar" slot-scope="{ nodes, marks }"> <div v-if="nodes && marks" class="border-bottom mb-2"> <component-menubar :nodes="nodes" :marks="marks"></component-menubar> </div> </div> <div slot="content" slot-scope="props"></div> </editor>
`
- There is little planning in place.
- A top down approach is used almost exclusively.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top GitHub Comments
Hey @llhilton,
then you have to pass an more complex json to
setContent()
:With v0.13.0 it’s also possible to pass a string to
setContent()
. Maybe that’s easier in your case.@duhaime here’s the code for one of our tiptap nodes (
DataTag.js
)