pxx-vue-quill 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,413 @@
1
+ /*!
2
+ * PxxVueQuill pxx-vue-quill v0.0.0-development
3
+ * https://vueup.github.io/vue-quill/
4
+ *
5
+ * Includes quill v1.3.7
6
+ * https://quilljs.com/
7
+ *
8
+ * Copyright (c) 2025 Pxx-Team
9
+ * Released under the MIT license
10
+ * Date: 2025-08-20T07:28:26.289Z
11
+ */
12
+ import Quill from 'quill';
13
+ export { default as Quill } from 'quill';
14
+ import Delta from 'quill-delta';
15
+ export { default as Delta } from 'quill-delta';
16
+ import { defineComponent, onMounted, onBeforeUnmount, ref, watch, nextTick, h } from 'vue';
17
+ import BlotFormatter from 'quill-blot-formatter';
18
+
19
+ const toolbarOptions = {
20
+ full: [
21
+ // ['bold', 'italic', 'underline', 'strike'], // toggled buttons
22
+ ['bold', 'italic', 'underline'],
23
+ [{ list: 'ordered' }, { list: 'bullet' }],
24
+ // [{ direction: 'rtl' }], // text direction
25
+ // [{ size: ['small', false, 'large', 'huge'] }], // custom dropdown
26
+ // [{ header: [1, 2, 3, 4, 5, 6, false] }],
27
+ [{ color: [] }, { background: [] }],
28
+ // [{ font: [] }],
29
+ // [{ align: [] }],
30
+ ['image'],
31
+ // ['clean'], // remove formatting button
32
+ ],
33
+ };
34
+
35
+ const QuillEditor = defineComponent({
36
+ name: 'QuillEditor',
37
+ inheritAttrs: false,
38
+ props: {
39
+ content: {
40
+ type: [String, Object],
41
+ },
42
+ contentType: {
43
+ type: String,
44
+ default: 'delta',
45
+ validator: (value) => {
46
+ return ['delta', 'html', 'text'].includes(value);
47
+ },
48
+ },
49
+ enable: {
50
+ type: Boolean,
51
+ default: true,
52
+ },
53
+ readOnly: {
54
+ type: Boolean,
55
+ default: false,
56
+ },
57
+ placeholder: {
58
+ type: String,
59
+ required: false,
60
+ },
61
+ theme: {
62
+ type: String,
63
+ default: 'snow',
64
+ validator: (value) => {
65
+ return ['snow', 'bubble', ''].includes(value);
66
+ },
67
+ },
68
+ toolbar: {
69
+ type: [String, Array, Object, Boolean],
70
+ required: false,
71
+ validator: (value) => {
72
+ if (!value)
73
+ return false;
74
+ if (typeof value === 'string' && value !== '') {
75
+ return value.charAt(0) === '#'
76
+ ? true
77
+ : Object.keys(toolbarOptions).indexOf(value) !== -1;
78
+ }
79
+ return true;
80
+ },
81
+ },
82
+ modules: {
83
+ type: Object,
84
+ required: false,
85
+ default: () => {
86
+ return {
87
+ name: 'blotFormatter',
88
+ module: BlotFormatter,
89
+ };
90
+ },
91
+ },
92
+ options: {
93
+ type: Object,
94
+ required: false,
95
+ },
96
+ globalOptions: {
97
+ type: Object,
98
+ required: false,
99
+ },
100
+ },
101
+ emits: [
102
+ 'textChange',
103
+ 'selectionChange',
104
+ 'editorChange',
105
+ 'update:content',
106
+ 'focus',
107
+ 'blur',
108
+ 'ready',
109
+ 'ocr',
110
+ 'math',
111
+ ],
112
+ setup: (props, ctx) => {
113
+ onMounted(() => {
114
+ initialize();
115
+ });
116
+ onBeforeUnmount(() => {
117
+ quill = null;
118
+ });
119
+ let quill;
120
+ let options;
121
+ const editor = ref();
122
+ // Register Module if not already registered
123
+ const registerModule = (moduleName, module) => {
124
+ // For Quill 1.x, we can't check if module is already registered
125
+ // So we'll just register it directly
126
+ Quill.register(moduleName, module);
127
+ };
128
+ // Initialize Quill
129
+ const initialize = () => {
130
+ var _a, _b;
131
+ if (!editor.value)
132
+ return;
133
+ // Create new Quill instance
134
+ quill = new Quill(editor.value, options);
135
+ // 初始隐藏toolbar
136
+ const toolbar = (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
137
+ if (toolbar) {
138
+ toolbar.style.display = 'none';
139
+ }
140
+ const icons = Quill.import('ui/icons');
141
+ icons['ocr'] = `
142
+ <svg viewBox="0 0 18 18">
143
+ <path d="M3 3h12v12H3z" fill="none" stroke="currentColor" stroke-width="1.5"/>
144
+ <path d="M6 7h6M6 9h6M6 11h4" stroke="currentColor" stroke-width="1"/>
145
+ </svg>
146
+ `;
147
+ icons['custom-button'] = `
148
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><defs><clipPath id="master_svg0_6759_139354"><rect x="0" y="0" width="18" height="18" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_6759_139354)"><g><path d="M15.423694,15.049834L15.424264,15.049264Q15.508656,14.964872,15.554328,14.85461Q15.6,14.744348,15.6,14.625Q15.6,14.565905,15.58847,14.507944Q15.576942,14.449986,15.554328,14.395388Q15.531713,14.340792,15.498882,14.291656Q15.466051,14.242521,15.424265,14.200735Q15.382479,14.158949,15.333343,14.126117Q15.284206,14.093286,15.229609,14.070671Q15.175013,14.048058,15.117053,14.036528Q15.059094,14.025,15,14.025Q14.880652,14.025,14.77039,14.070672Q14.660128,14.116344,14.575736,14.200736L13.626472,15.150001L4.4485275,15.150001L10.174264,9.424264Q10.2160501,9.3824773,10.2488813,9.3333416Q10.281712500000001,9.2842059,10.304327,9.229609499999999Q10.3269415,9.175012599999999,10.3384705,9.117054Q10.349999,9.0590944,10.349999,8.999999500000001Q10.349999,8.9409046,10.3384705,8.8829451Q10.3269415,8.8249855,10.304327,8.7703896Q10.281712500000001,8.715793099999999,10.2488813,8.6666574Q10.2160501,8.6175222,10.174264,8.575736L4.4485282,2.85000002L13.626472,2.85000002L14.575395,3.7989223L14.575736,3.7992642Q14.660127,3.8836554999999997,14.77039,3.9293277Q14.880651,3.9749999000000003,15,3.975Q15.059094,3.9749999000000003,15.117054,3.9634712Q15.175013,3.9519422,15.229609,3.9293275999999997Q15.284206,3.906713,15.333342,3.8738817Q15.382478,3.8410504000000003,15.424264,3.7992641000000003Q15.466051,3.7574776,15.498882,3.7083421000000003Q15.531713,3.6592064,15.554328,3.60461Q15.576942,3.5500134,15.588472,3.4920541Q15.6,3.4340948,15.6,3.375Q15.6,3.2556524,15.554328,3.1453898000000002Q15.508656,3.03512704,15.424264,2.9507357499999998L15.423856,2.9503274L14.299264,1.82573593Q14.214872,1.7413445699999999,14.10461,1.69567227Q13.994347,1.64999998,13.875,1.64999998L3,1.64999998Q2.88065257,1.64999998,2.77038994,1.69567227Q2.66012731,1.7413445699999999,2.57573593,1.82573593Q2.53394958,1.8675223,2.50111824,1.91665789Q2.46828693,1.96579346,2.44567233,2.02038996Q2.42305773,2.07498647,2.41152894,2.13294582Q2.4000000999999997,2.190905161,2.40000004,2.25Q2.4000000999999997,2.309094839,2.41152889,2.36705418Q2.42305773,2.42501353,2.44567233,2.47961004Q2.46828693,2.53420654,2.50111827,2.58334213Q2.53394958,2.6324777,2.57573593,2.67426407L8.9014721,9L2.57573593,15.325736Q2.49134457,15.410126,2.44567227,15.520389Q2.39999998,15.630651,2.39999998,15.75Q2.39999998,15.809094,2.41152883,15.867053Q2.42305768,15.925013,2.44567233,15.979609Q2.46828693,16.034204000000003,2.50111827,16.08334Q2.53394958,16.132476,2.57573593,16.174263Q2.6175223,16.216048999999998,2.66665787,16.24888Q2.71579343,16.281712,2.77038994,16.304327Q2.82498646,16.326940999999998,2.88294581,16.33847Q2.940905157,16.349998,3,16.349999L13.875,16.349999Q13.994347,16.349998,14.104609,16.304326Q14.214872,16.258654,14.299264,16.174264L15.423694,15.049834Z" fill-rule="evenodd" fill="#333333" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>
149
+ `;
150
+ options = composeOptions();
151
+ // Register modules
152
+ if (props.modules) {
153
+ if (Array.isArray(props.modules)) {
154
+ for (const module of props.modules) {
155
+ registerModule(`modules/${module.name}`, module.module);
156
+ }
157
+ }
158
+ else {
159
+ registerModule(`modules/${props.modules.name}`, props.modules.module);
160
+ }
161
+ }
162
+ // Create new Quill instance
163
+ quill = new Quill(editor.value, options);
164
+ // Set editor content
165
+ setContents(props.content);
166
+ // Set event handlers
167
+ quill.on('text-change', handleTextChange);
168
+ quill.on('selection-change', handleSelectionChange);
169
+ quill.on('editor-change', handleEditorChange);
170
+ // Remove editor class when theme changes
171
+ if (props.theme !== 'bubble')
172
+ editor.value.classList.remove('ql-bubble');
173
+ if (props.theme !== 'snow')
174
+ editor.value.classList.remove('ql-snow');
175
+ // Fix clicking the quill toolbar is detected as blur event
176
+ (_b = quill
177
+ .getModule('toolbar')) === null || _b === void 0 ? void 0 : _b.container.addEventListener('mousedown', (e) => {
178
+ e.preventDefault();
179
+ });
180
+ // Emit ready event
181
+ ctx.emit('ready', quill);
182
+ };
183
+ // Compose Options
184
+ const composeOptions = () => {
185
+ const clientOptions = {};
186
+ if (props.theme !== '')
187
+ clientOptions.theme = props.theme;
188
+ if (props.readOnly)
189
+ clientOptions.readOnly = props.readOnly;
190
+ if (props.placeholder)
191
+ clientOptions.placeholder = props.placeholder;
192
+ if (props.toolbar && props.toolbar !== '') {
193
+ clientOptions.modules = {
194
+ toolbar: {
195
+ container: [
196
+ ...toolbarOptions.full,
197
+ ['ocr'],
198
+ [{ 'custom-button': true }], // 自定义按钮
199
+ ],
200
+ handlers: {
201
+ ocr: function () {
202
+ // 按钮点击逻辑
203
+ console.log('ocr');
204
+ ctx.emit('ocr');
205
+ },
206
+ math: function () {
207
+ // 按钮点击逻辑
208
+ ctx.emit('math');
209
+ },
210
+ },
211
+ },
212
+ };
213
+ }
214
+ if (props.modules) {
215
+ const modules = (() => {
216
+ var _a, _b;
217
+ const modulesOption = {};
218
+ if (Array.isArray(props.modules)) {
219
+ for (const module of props.modules) {
220
+ modulesOption[module.name] = (_a = module.options) !== null && _a !== void 0 ? _a : {};
221
+ }
222
+ }
223
+ else {
224
+ modulesOption[props.modules.name] = (_b = props.modules.options) !== null && _b !== void 0 ? _b : {};
225
+ }
226
+ return modulesOption;
227
+ })();
228
+ clientOptions.modules = Object.assign({}, clientOptions.modules, modules);
229
+ }
230
+ return Object.assign({}, props.globalOptions, props.options, clientOptions);
231
+ };
232
+ const maybeClone = (delta) => {
233
+ return typeof delta === 'object' && delta ? delta.slice() : delta;
234
+ };
235
+ const deltaHasValuesOtherThanRetain = (delta) => {
236
+ return Object.values(delta.ops).some((v) => !v.retain || Object.keys(v).length !== 1);
237
+ };
238
+ // Doesn't need reactivity, but does need to be cloned to avoid deep mutations always registering as equal
239
+ let internalModel;
240
+ const internalModelEquals = (against) => {
241
+ if (typeof internalModel === typeof against) {
242
+ if (against === internalModel) {
243
+ return true;
244
+ }
245
+ // Ref/Proxy does not support instanceof, so do a loose check
246
+ if (typeof against === 'object' &&
247
+ against &&
248
+ typeof internalModel === 'object' &&
249
+ internalModel) {
250
+ return !deltaHasValuesOtherThanRetain(internalModel.diff(against));
251
+ }
252
+ }
253
+ return false;
254
+ };
255
+ const handleTextChange = (delta, oldContents, source) => {
256
+ internalModel = maybeClone(getContents());
257
+ // Update v-model:content when text changes
258
+ if (!internalModelEquals(props.content)) {
259
+ ctx.emit('update:content', internalModel);
260
+ }
261
+ ctx.emit('textChange', { delta, oldContents, source });
262
+ };
263
+ const isEditorFocus = ref();
264
+ const handleSelectionChange = (range, oldRange, source) => {
265
+ var _a;
266
+ // Set isEditorFocus if quill.hasFocus()
267
+ isEditorFocus.value = !!(quill === null || quill === void 0 ? void 0 : quill.hasFocus());
268
+ // 动态显示/隐藏toolbar
269
+ const toolbar = (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
270
+ if (toolbar) {
271
+ if (isEditorFocus.value) {
272
+ toolbar.style.display = 'block';
273
+ }
274
+ else {
275
+ toolbar.style.display = 'none';
276
+ }
277
+ }
278
+ ctx.emit('selectionChange', { range, oldRange, source });
279
+ };
280
+ watch(isEditorFocus, (focus) => {
281
+ if (focus)
282
+ ctx.emit('focus', editor);
283
+ else
284
+ ctx.emit('blur', editor);
285
+ });
286
+ const handleEditorChange = (...args) => {
287
+ if (args[0] === 'text-change')
288
+ ctx.emit('editorChange', {
289
+ name: args[0],
290
+ delta: args[1],
291
+ oldContents: args[2],
292
+ source: args[3],
293
+ });
294
+ if (args[0] === 'selection-change')
295
+ ctx.emit('editorChange', {
296
+ name: args[0],
297
+ range: args[1],
298
+ oldRange: args[2],
299
+ source: args[3],
300
+ });
301
+ };
302
+ const getEditor = () => {
303
+ return editor.value;
304
+ };
305
+ const getToolbar = () => {
306
+ var _a;
307
+ return (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
308
+ };
309
+ const getQuill = () => {
310
+ if (quill)
311
+ return quill;
312
+ else
313
+ throw `The quill editor hasn't been instantiated yet,
314
+ make sure to call this method when the editor ready
315
+ or use v-on:ready="onReady(quill)" event instead.`;
316
+ };
317
+ const getContents = (index, length) => {
318
+ if (props.contentType === 'html') {
319
+ return getHTML();
320
+ }
321
+ else if (props.contentType === 'text') {
322
+ return getText(index, length);
323
+ }
324
+ return quill === null || quill === void 0 ? void 0 : quill.getContents(index, length);
325
+ };
326
+ const setContents = (content, source = 'api') => {
327
+ const normalizedContent = !content
328
+ ? props.contentType === 'delta'
329
+ ? new Delta()
330
+ : ''
331
+ : content;
332
+ if (props.contentType === 'html') {
333
+ setHTML(normalizedContent);
334
+ }
335
+ else if (props.contentType === 'text') {
336
+ setText(normalizedContent, source);
337
+ }
338
+ else {
339
+ quill === null || quill === void 0 ? void 0 : quill.setContents(normalizedContent, source);
340
+ }
341
+ internalModel = maybeClone(normalizedContent);
342
+ };
343
+ const getText = (index, length) => {
344
+ var _a;
345
+ return (_a = quill === null || quill === void 0 ? void 0 : quill.getText(index, length)) !== null && _a !== void 0 ? _a : '';
346
+ };
347
+ const setText = (text, source = 'api') => {
348
+ quill === null || quill === void 0 ? void 0 : quill.setText(text, source);
349
+ };
350
+ const getHTML = () => {
351
+ var _a;
352
+ return (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
353
+ };
354
+ const setHTML = (html) => {
355
+ if (quill)
356
+ quill.root.innerHTML = html;
357
+ };
358
+ const pasteHTML = (html, source = 'api') => {
359
+ const delta = quill === null || quill === void 0 ? void 0 : quill.clipboard.convert(html);
360
+ if (delta)
361
+ quill === null || quill === void 0 ? void 0 : quill.setContents(delta, source);
362
+ };
363
+ const focus = () => {
364
+ quill === null || quill === void 0 ? void 0 : quill.focus();
365
+ };
366
+ const reinit = () => {
367
+ nextTick(() => {
368
+ var _a;
369
+ if (!ctx.slots.toolbar && quill)
370
+ (_a = quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container.remove();
371
+ initialize();
372
+ });
373
+ };
374
+ watch(() => props.content, (newContent) => {
375
+ if (!quill || !newContent || internalModelEquals(newContent))
376
+ return;
377
+ // Restore the selection and cursor position after updating the content
378
+ const selection = quill.getSelection();
379
+ if (selection) {
380
+ nextTick(() => quill === null || quill === void 0 ? void 0 : quill.setSelection(selection));
381
+ }
382
+ setContents(newContent);
383
+ }, { deep: true });
384
+ watch(() => props.enable, (newValue) => {
385
+ if (quill)
386
+ quill.enable(newValue);
387
+ });
388
+ return {
389
+ editor,
390
+ getEditor,
391
+ getToolbar,
392
+ getQuill,
393
+ getContents,
394
+ setContents,
395
+ getHTML,
396
+ setHTML,
397
+ pasteHTML,
398
+ focus,
399
+ getText,
400
+ setText,
401
+ reinit,
402
+ };
403
+ },
404
+ render() {
405
+ var _a, _b;
406
+ return [
407
+ (_b = (_a = this.$slots).toolbar) === null || _b === void 0 ? void 0 : _b.call(_a),
408
+ h('div', { ref: 'editor', ...this.$attrs }),
409
+ ];
410
+ },
411
+ });
412
+
413
+ export { QuillEditor };
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * PxxVueQuill pxx-vue-quill v0.0.0-development
3
+ * https://vueup.github.io/vue-quill/
4
+ *
5
+ * Includes quill v1.3.7
6
+ * https://quilljs.com/
7
+ *
8
+ * Copyright (c) 2025 Pxx-Team
9
+ * Released under the MIT license
10
+ * Date: 2025-08-20T07:28:26.289Z
11
+ */
12
+ import e from"quill";export{default as Quill}from"quill";import t from"quill-delta";export{default as Delta}from"quill-delta";import{defineComponent as o,onMounted as l,onBeforeUnmount as n,ref as r,watch as i,nextTick as a,h as s}from"vue";import d from"quill-blot-formatter";const u={full:[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]}],["image"]]},c=o({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object]},contentType:{type:String,default:"delta",validator:e=>["delta","html","text"].includes(e)},enable:{type:Boolean,default:!0},readOnly:{type:Boolean,default:!1},placeholder:{type:String,required:!1},theme:{type:String,default:"snow",validator:e=>["snow","bubble",""].includes(e)},toolbar:{type:[String,Array,Object,Boolean],required:!1,validator:e=>!!e&&("string"!=typeof e||""===e||("#"===e.charAt(0)||-1!==Object.keys(u).indexOf(e)))},modules:{type:Object,required:!1,default:()=>({name:"blotFormatter",module:d})},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready","ocr","math"],setup:(o,s)=>{let d,c;l((()=>{v()})),n((()=>{d=null}));const m=r(),p=(t,o)=>{e.register(t,o)},v=()=>{var t,l;if(!m.value)return;d=new e(m.value,c);const n=null===(t=null==d?void 0:d.getModule("toolbar"))||void 0===t?void 0:t.container;n&&(n.style.display="none");const r=e.import("ui/icons");if(r.ocr='\n <svg viewBox="0 0 18 18">\n <path d="M3 3h12v12H3z" fill="none" stroke="currentColor" stroke-width="1.5"/>\n <path d="M6 7h6M6 9h6M6 11h4" stroke="currentColor" stroke-width="1"/>\n </svg>\n ',r["custom-button"]='\n <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><defs><clipPath id="master_svg0_6759_139354"><rect x="0" y="0" width="18" height="18" rx="0"/></clipPath></defs><g clip-path="url(#master_svg0_6759_139354)"><g><path d="M15.423694,15.049834L15.424264,15.049264Q15.508656,14.964872,15.554328,14.85461Q15.6,14.744348,15.6,14.625Q15.6,14.565905,15.58847,14.507944Q15.576942,14.449986,15.554328,14.395388Q15.531713,14.340792,15.498882,14.291656Q15.466051,14.242521,15.424265,14.200735Q15.382479,14.158949,15.333343,14.126117Q15.284206,14.093286,15.229609,14.070671Q15.175013,14.048058,15.117053,14.036528Q15.059094,14.025,15,14.025Q14.880652,14.025,14.77039,14.070672Q14.660128,14.116344,14.575736,14.200736L13.626472,15.150001L4.4485275,15.150001L10.174264,9.424264Q10.2160501,9.3824773,10.2488813,9.3333416Q10.281712500000001,9.2842059,10.304327,9.229609499999999Q10.3269415,9.175012599999999,10.3384705,9.117054Q10.349999,9.0590944,10.349999,8.999999500000001Q10.349999,8.9409046,10.3384705,8.8829451Q10.3269415,8.8249855,10.304327,8.7703896Q10.281712500000001,8.715793099999999,10.2488813,8.6666574Q10.2160501,8.6175222,10.174264,8.575736L4.4485282,2.85000002L13.626472,2.85000002L14.575395,3.7989223L14.575736,3.7992642Q14.660127,3.8836554999999997,14.77039,3.9293277Q14.880651,3.9749999000000003,15,3.975Q15.059094,3.9749999000000003,15.117054,3.9634712Q15.175013,3.9519422,15.229609,3.9293275999999997Q15.284206,3.906713,15.333342,3.8738817Q15.382478,3.8410504000000003,15.424264,3.7992641000000003Q15.466051,3.7574776,15.498882,3.7083421000000003Q15.531713,3.6592064,15.554328,3.60461Q15.576942,3.5500134,15.588472,3.4920541Q15.6,3.4340948,15.6,3.375Q15.6,3.2556524,15.554328,3.1453898000000002Q15.508656,3.03512704,15.424264,2.9507357499999998L15.423856,2.9503274L14.299264,1.82573593Q14.214872,1.7413445699999999,14.10461,1.69567227Q13.994347,1.64999998,13.875,1.64999998L3,1.64999998Q2.88065257,1.64999998,2.77038994,1.69567227Q2.66012731,1.7413445699999999,2.57573593,1.82573593Q2.53394958,1.8675223,2.50111824,1.91665789Q2.46828693,1.96579346,2.44567233,2.02038996Q2.42305773,2.07498647,2.41152894,2.13294582Q2.4000000999999997,2.190905161,2.40000004,2.25Q2.4000000999999997,2.309094839,2.41152889,2.36705418Q2.42305773,2.42501353,2.44567233,2.47961004Q2.46828693,2.53420654,2.50111827,2.58334213Q2.53394958,2.6324777,2.57573593,2.67426407L8.9014721,9L2.57573593,15.325736Q2.49134457,15.410126,2.44567227,15.520389Q2.39999998,15.630651,2.39999998,15.75Q2.39999998,15.809094,2.41152883,15.867053Q2.42305768,15.925013,2.44567233,15.979609Q2.46828693,16.034204000000003,2.50111827,16.08334Q2.53394958,16.132476,2.57573593,16.174263Q2.6175223,16.216048999999998,2.66665787,16.24888Q2.71579343,16.281712,2.77038994,16.304327Q2.82498646,16.326940999999998,2.88294581,16.33847Q2.940905157,16.349998,3,16.349999L13.875,16.349999Q13.994347,16.349998,14.104609,16.304326Q14.214872,16.258654,14.299264,16.174264L15.423694,15.049834Z" fill-rule="evenodd" fill="#333333" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>\n ',c=h(),o.modules)if(Array.isArray(o.modules))for(const e of o.modules)p(`modules/${e.name}`,e.module);else p(`modules/${o.modules.name}`,o.modules.module);d=new e(m.value,c),O(o.content),d.on("text-change",b),d.on("selection-change",w),d.on("editor-change",x),"bubble"!==o.theme&&m.value.classList.remove("ql-bubble"),"snow"!==o.theme&&m.value.classList.remove("ql-snow"),null===(l=d.getModule("toolbar"))||void 0===l||l.container.addEventListener("mousedown",(e=>{e.preventDefault()})),s.emit("ready",d)},h=()=>{const e={};if(""!==o.theme&&(e.theme=o.theme),o.readOnly&&(e.readOnly=o.readOnly),o.placeholder&&(e.placeholder=o.placeholder),o.toolbar&&""!==o.toolbar&&(e.modules={toolbar:{container:[...u.full,["ocr"],[{"custom-button":!0}]],handlers:{ocr:function(){console.log("ocr"),s.emit("ocr")},math:function(){s.emit("math")}}}}),o.modules){const t=(()=>{var e,t;const l={};if(Array.isArray(o.modules))for(const n of o.modules)l[n.name]=null!==(e=n.options)&&void 0!==e?e:{};else l[o.modules.name]=null!==(t=o.modules.options)&&void 0!==t?t:{};return l})();e.modules=Object.assign({},e.modules,t)}return Object.assign({},o.globalOptions,o.options,e)},g=e=>"object"==typeof e&&e?e.slice():e;let Q;const f=e=>{if(typeof Q==typeof e){if(e===Q)return!0;if("object"==typeof e&&e&&"object"==typeof Q&&Q)return t=Q.diff(e),!Object.values(t.ops).some((e=>!e.retain||1!==Object.keys(e).length))}var t;return!1},b=(e,t,l)=>{Q=g(L()),f(o.content)||s.emit("update:content",Q),s.emit("textChange",{delta:e,oldContents:t,source:l})},y=r(),w=(e,t,o)=>{var l;y.value=!!(null==d?void 0:d.hasFocus());const n=null===(l=null==d?void 0:d.getModule("toolbar"))||void 0===l?void 0:l.container;n&&(n.style.display=y.value?"block":"none"),s.emit("selectionChange",{range:e,oldRange:t,source:o})};i(y,(e=>{s.emit(e?"focus":"blur",m)}));const x=(...e)=>{"text-change"===e[0]&&s.emit("editorChange",{name:e[0],delta:e[1],oldContents:e[2],source:e[3]}),"selection-change"===e[0]&&s.emit("editorChange",{name:e[0],range:e[1],oldRange:e[2],source:e[3]})},L=(e,t)=>"html"===o.contentType?M():"text"===o.contentType?T(e,t):null==d?void 0:d.getContents(e,t),O=(e,l="api")=>{const n=e||("delta"===o.contentType?new t:"");"html"===o.contentType?q(n):"text"===o.contentType?C(n,l):null==d||d.setContents(n,l),Q=g(n)},T=(e,t)=>{var o;return null!==(o=null==d?void 0:d.getText(e,t))&&void 0!==o?o:""},C=(e,t="api")=>{null==d||d.setText(e,t)},M=()=>{var e;return null!==(e=null==d?void 0:d.root.innerHTML)&&void 0!==e?e:""},q=e=>{d&&(d.root.innerHTML=e)};return i((()=>o.content),(e=>{if(!d||!e||f(e))return;const t=d.getSelection();t&&a((()=>null==d?void 0:d.setSelection(t))),O(e)}),{deep:!0}),i((()=>o.enable),(e=>{d&&d.enable(e)})),{editor:m,getEditor:()=>m.value,getToolbar:()=>{var e;return null===(e=null==d?void 0:d.getModule("toolbar"))||void 0===e?void 0:e.container},getQuill:()=>{if(d)return d;throw'The quill editor hasn\'t been instantiated yet,\n make sure to call this method when the editor ready\n or use v-on:ready="onReady(quill)" event instead.'},getContents:L,setContents:O,getHTML:M,setHTML:q,pasteHTML:(e,t="api")=>{const o=null==d?void 0:d.clipboard.convert(e);o&&(null==d||d.setContents(o,t))},focus:()=>{null==d||d.focus()},getText:T,setText:C,reinit:()=>{a((()=>{var e;!s.slots.toolbar&&d&&(null===(e=d.getModule("toolbar"))||void 0===e||e.container.remove()),v()}))}}},render(){var e,t;return[null===(t=(e=this.$slots).toolbar)||void 0===t?void 0:t.call(e),s("div",{ref:"editor",...this.$attrs})]}});export{c as QuillEditor};