Merge branch 'main' of github.com:ueberdosis/tiptap-next into main
This commit is contained in:
@@ -82,7 +82,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
mainFile() {
|
mainFile() {
|
||||||
const file = this.files
|
const file = this.files
|
||||||
.find(item => item.path.endsWith('.vue') || item.path.endsWith('.jsx'))
|
.find(item => item.path.endsWith('index.vue') || item.path.endsWith('.jsx'))
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return
|
return
|
||||||
@@ -122,7 +122,7 @@ export default {
|
|||||||
.filter(item => {
|
.filter(item => {
|
||||||
return ['vue', 'jsx', 'scss'].includes(item.extension)
|
return ['vue', 'jsx', 'scss'].includes(item.extension)
|
||||||
})
|
})
|
||||||
.sortBy(item => item.path.split('/').length)
|
.sortBy(item => item.path.split('/').length && !item.path.endsWith('index.vue'))
|
||||||
.toArray()
|
.toArray()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<editor-content :editor="editor" />
|
||||||
<editor-content :editor="editor" />
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Editor } from '@tiptap/core'
|
import { Editor } from '@tiptap/core'
|
||||||
import EditorContent from './EditorContent.ts'
|
import { EditorContent } from '@tiptap/vue'
|
||||||
|
import { defaultExtensions } from '@tiptap/starter-kit'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -15,15 +14,9 @@ export default {
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
value: {
|
value: {
|
||||||
type: [String, Object],
|
type: String,
|
||||||
default: '',
|
default: '',
|
||||||
},
|
},
|
||||||
|
|
||||||
extensions: {
|
|
||||||
type: Array,
|
|
||||||
required: true,
|
|
||||||
default: () => [],
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@@ -32,9 +25,21 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
watch: {
|
||||||
|
value(value) {
|
||||||
|
const isSame = this.editor.getHTML() === value
|
||||||
|
|
||||||
|
if (isSame) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.editor.commands.setContent(this.value, false)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.editor = new Editor({
|
this.editor = new Editor({
|
||||||
extensions: this.extensions,
|
extensions: defaultExtensions(),
|
||||||
content: this.value,
|
content: this.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1,26 +1,50 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<full-editor v-model="content" :extensions="extensions" />
|
<editor v-model="content" />
|
||||||
<div>
|
|
||||||
{{ content }}
|
<div class="content">
|
||||||
|
<h3>Content</h3>
|
||||||
|
<pre><code>{{ content }}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { FullEditor } from '@tiptap/vue'
|
import Editor from './Editor'
|
||||||
import { defaultExtensions } from '@tiptap/starter-kit'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
FullEditor,
|
Editor,
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
extensions: defaultExtensions(),
|
|
||||||
content: '<p>A Vue.js wrapper component for tiptap to use <code>v-model</code>.</p>',
|
content: '<p>A Vue.js wrapper component for tiptap to use <code>v-model</code>.</p>',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.content {
|
||||||
|
padding: 1rem 0 0;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 1rem 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
border-radius: 5px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
code {
|
||||||
|
display: block;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
padding: 0.75rem 1rem;
|
||||||
|
background-color:#e9ecef;
|
||||||
|
color: #495057;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
export * from '@tiptap/core'
|
export * from '@tiptap/core'
|
||||||
export { default as VueRenderer } from './VueRenderer'
|
export { default as VueRenderer } from './VueRenderer'
|
||||||
export { default as EditorContent } from './components/EditorContent'
|
export { default as EditorContent } from './components/EditorContent'
|
||||||
export { default as FullEditor } from './components/FullEditor.vue'
|
|
||||||
|
|||||||
Reference in New Issue
Block a user