add getSchema & getHtml utility functions to generate HTML from a ProseMirror/tiptap document, without an Editor instance
This commit is contained in:
38
docs/src/demos/Api/Schema/index.vue
Normal file
38
docs/src/demos/Api/Schema/index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<pre>{{ this.html }}</pre>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { generateHtml } from '@tiptap/core'
|
||||
import { defaultExtensions } from '@tiptap/vue-starter-kit'
|
||||
|
||||
export default {
|
||||
|
||||
data() {
|
||||
return {
|
||||
doc: {
|
||||
'type': 'document',
|
||||
'content': [{
|
||||
'type': 'paragraph',
|
||||
'attrs': {
|
||||
'align': 'left'
|
||||
},
|
||||
'content': [{
|
||||
'type': 'text',
|
||||
'text': 'My sample text'
|
||||
}]
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
html() {
|
||||
const extensions = defaultExtensions()
|
||||
|
||||
return generateHtml(this.doc, extensions)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user