|
37 | 37 | @textChange="handleTextChange"
|
38 | 38 | :theme="selectedTheme"
|
39 | 39 | :toolbar="selectedToolbar"
|
| 40 | + :modules="myModules" |
40 | 41 | >
|
41 | 42 | </QuillEditor>
|
42 | 43 | </div>
|
43 | 44 | </div>
|
44 | 45 | </template>
|
45 | 46 |
|
46 | 47 | <script lang="ts">
|
47 |
| -import { Quill } from "@vueup/vue-quill"; |
48 |
| -import { Delta } from "types-quill-delta"; |
49 |
| -import { defineComponent, watch, ref } from "vue"; |
50 |
| -import VOptions from "../VOptions.vue"; |
51 |
| -import { deltaContent } from "./delta-content"; |
| 48 | +import { defineComponent, watch, ref } from 'vue' |
| 49 | +import VOptions from '../VOptions.vue' |
| 50 | +import { deltaContent } from './delta-content' |
| 51 | +import BlotFormatter from 'quill-blot-formatter' |
52 | 52 |
|
53 | 53 | export default defineComponent({
|
54 | 54 | components: { VOptions },
|
55 | 55 | setup: () => {
|
56 |
| - const myEditor = ref(); |
57 |
| -
|
58 |
| - const myContent = ref(deltaContent); |
59 |
| -
|
60 |
| - const myHTML = ref<string>(""); |
61 |
| - let myQuill: Quill | null = null; |
62 |
| -
|
63 |
| - const handleReady = (quill: Quill) => { |
64 |
| - myQuill = quill; |
65 |
| - }; |
66 |
| -
|
67 |
| - const handleTextChange = (a: Delta, b: Delta, c: any) => { |
68 |
| - myHTML.value = myQuill?.root.innerHTML as string; |
69 |
| - }; |
70 |
| -
|
71 |
| - const clickMe = () => { |
72 |
| - myHTML.value = myQuill?.root.innerHTML as string; |
73 |
| - console.log(myQuill?.root.innerHTML); |
74 |
| - }; |
| 56 | + const myEditor = ref() |
| 57 | + const myContent = ref(deltaContent) |
| 58 | + const myModules = [ |
| 59 | + 'blotFormatter', |
| 60 | + BlotFormatter, |
| 61 | + { |
| 62 | + /* options */ |
| 63 | + }, |
| 64 | + ] |
75 | 65 |
|
76 | 66 | // ============ OPTIONS =====================
|
77 |
| - const selectedTheme = ref<string>("snow"); |
78 |
| - const selectedToolbar = ref<string>("essential"); |
| 67 | + const selectedTheme = ref<string>('snow') |
| 68 | + const selectedToolbar = ref<string>('essential') |
79 | 69 |
|
80 | 70 | watch([selectedTheme, selectedToolbar], () => {
|
81 |
| - myEditor.value.reinit(); |
82 |
| - }); |
| 71 | + myEditor.value.reinit() |
| 72 | + }) |
83 | 73 |
|
84 | 74 | return {
|
85 | 75 | selectedTheme,
|
86 | 76 | selectedToolbar,
|
87 | 77 | // ---------------
|
88 | 78 | myEditor,
|
89 |
| - clickMe, |
90 | 79 | myContent,
|
91 |
| - myHTML, |
92 |
| - handleReady, |
93 |
| - handleTextChange, |
94 |
| - }; |
| 80 | + myModules, |
| 81 | + } |
95 | 82 | },
|
96 |
| -}); |
| 83 | +}) |
97 | 84 | </script>
|
98 | 85 |
|
99 | 86 | <style>
|
|
0 commit comments