Skip to content

Commit 34b7550

Browse files
committed
chore: 🎨 add and update demo editor
1 parent df52903 commit 34b7550

File tree

7 files changed

+89
-6
lines changed

7 files changed

+89
-6
lines changed

demo/package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"serve": "vite preview"
88
},
99
"dependencies": {
10+
"quill-blot-formatter": "^1.0.5",
1011
"vue": "^3.0.5"
1112
},
1213
"devDependencies": {

demo/src/App.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<template>
22
<BasicExample />
3+
<AddModules />
4+
<ContentType />
35
</template>
46

57
<script lang="ts">
68
import { defineComponent } from 'vue'
7-
import BasicExample from './components/BasicExample.vue'
9+
import BasicExample from './examples/BasicExample.vue'
10+
import AddModules from './examples/AddModules.vue'
11+
import ContentType from './examples/ContentType.vue'
812
913
export default defineComponent({
1014
name: 'App',
1115
components: {
1216
BasicExample,
17+
AddModules,
18+
ContentType,
1319
},
1420
})
1521
</script>

demo/src/examples/AddModules.vue

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<template>
2+
<h1>Add Modules</h1>
3+
<QuillEditor v-model:content="content" :modules="modules" toolbar="full" />
4+
</template>
5+
6+
<script lang="ts">
7+
import { ref, defineComponent } from 'vue'
8+
import { QuillEditor, Delta, Module } from '@vueup/vue-quill'
9+
import BlotFormatter from 'quill-blot-formatter'
10+
import '@vueup/vue-quill/../dist/vue-quill.snow.css'
11+
12+
export default defineComponent({
13+
components: {
14+
QuillEditor,
15+
},
16+
setup: () => {
17+
const modules: Module = [
18+
'blotFormatter',
19+
BlotFormatter,
20+
{
21+
/* options */
22+
},
23+
]
24+
const content = ref<Delta>(
25+
new Delta([
26+
{ insert: 'Gandalf', attributes: { bold: true } },
27+
{ insert: ' the ' },
28+
{ insert: 'Grey', attributes: { color: '#ccc' } },
29+
])
30+
)
31+
32+
return { content, modules }
33+
},
34+
})
35+
</script>
36+

demo/src/examples/BasicExample.vue

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<template>
2+
<h1>Basic Example</h1>
3+
<QuillEditor v-model:content="content" />
4+
</template>
5+
6+
<script lang="ts">
7+
import { ref, defineComponent } from 'vue'
8+
import { QuillEditor, Delta } from '@vueup/vue-quill'
9+
import '@vueup/vue-quill/../dist/vue-quill.snow.css'
10+
11+
export default defineComponent({
12+
components: {
13+
QuillEditor,
14+
},
15+
setup: () => {
16+
const content = ref<Delta>(
17+
new Delta([
18+
{ insert: 'Gandalf', attributes: { bold: true } },
19+
{ insert: ' the ' },
20+
{ insert: 'Grey', attributes: { color: '#ccc' } },
21+
])
22+
)
23+
24+
return { content }
25+
},
26+
})
27+
</script>
28+

demo/src/components/BasicExample.vue renamed to demo/src/examples/ContentType.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<h1>BasicEditor</h1>
2+
<h1>Content Type</h1>
33
<QuillEditor v-model:content="contentDelta" contentType="delta" />
44
<pre>{{ contentDelta }}</pre>
55
<QuillEditor v-model:content="contentHTML" contentType="html" />
@@ -27,9 +27,7 @@ export default defineComponent({
2727
)
2828
const contentHTML = ref('<h1>This is html header</h1>')
2929
const contentText = ref('This is just plain text')
30-
setTimeout(() => {
31-
contentText.value = 'COOOOOOOK'
32-
}, 3000)
30+
3331
return { contentDelta, contentHTML, contentText }
3432
},
3533
})

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
}
1414
],
1515
"workspaces": [
16-
"packages/*"
16+
"packages/*",
17+
"demo"
1718
],
1819
"repository": {
1920
"type": "git",

0 commit comments

Comments
 (0)