@vueup/vue-quill 1.3.0 → 1.4.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.
- package/dist/vue-quill.cjs.js +70 -10
- package/dist/vue-quill.cjs.prod.js +3 -3
- package/dist/vue-quill.d.ts +11 -4
- package/dist/vue-quill.esm-browser.js +13923 -13856
- package/dist/vue-quill.esm-browser.prod.js +3 -3
- package/dist/vue-quill.esm-bundler.js +68 -11
- package/dist/vue-quill.esm-bundler.prod.js +3 -3
- package/dist/vue-quill.global.js +16716 -16647
- package/dist/vue-quill.global.prod.js +3 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VueQuill @vueup/vue-quill v1.
|
|
2
|
+
* VueQuill @vueup/vue-quill v1.4.0
|
|
3
3
|
* https://vueup.github.io/vue-quill/
|
|
4
4
|
*
|
|
5
5
|
* Includes quill v2.0.2 || >=2.0.4 <3
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) 2026 Ahmad Luthfi Masruri
|
|
9
9
|
* Released under the MIT license
|
|
10
|
-
* Date: 2026-06-
|
|
10
|
+
* Date: 2026-06-02T00:10:10.011Z
|
|
11
11
|
*/
|
|
12
|
-
import Quill from 'quill';
|
|
13
|
-
export { default as Quill } from 'quill';
|
|
14
12
|
import Delta from 'quill-delta';
|
|
15
13
|
export { default as Delta } from 'quill-delta';
|
|
16
14
|
import { defineComponent, h, onMounted, onBeforeUnmount, ref, watch, nextTick } from 'vue';
|
|
@@ -46,6 +44,58 @@ const toolbarOptions = {
|
|
|
46
44
|
],
|
|
47
45
|
};
|
|
48
46
|
|
|
47
|
+
let loadedQuill;
|
|
48
|
+
let quillLoadPromise;
|
|
49
|
+
let pendingRegistrations = [];
|
|
50
|
+
const isBrowser = () => typeof document !== 'undefined';
|
|
51
|
+
const replayPendingRegistrations = (Quill) => {
|
|
52
|
+
const registrations = pendingRegistrations;
|
|
53
|
+
pendingRegistrations = [];
|
|
54
|
+
for (const args of registrations) {
|
|
55
|
+
Quill.register(...args);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const loadQuill = async () => {
|
|
59
|
+
if (loadedQuill)
|
|
60
|
+
return loadedQuill;
|
|
61
|
+
if (!isBrowser()) {
|
|
62
|
+
throw new Error('@vueup/vue-quill: Quill can only be loaded in a browser environment.');
|
|
63
|
+
}
|
|
64
|
+
quillLoadPromise !== null && quillLoadPromise !== void 0 ? quillLoadPromise : (quillLoadPromise = import('quill').then(({ default: Quill }) => {
|
|
65
|
+
loadedQuill = Quill;
|
|
66
|
+
replayPendingRegistrations(Quill);
|
|
67
|
+
return Quill;
|
|
68
|
+
}));
|
|
69
|
+
return quillLoadPromise;
|
|
70
|
+
};
|
|
71
|
+
const getLoadedQuill = () => loadedQuill;
|
|
72
|
+
const getQuillOrThrow = () => {
|
|
73
|
+
if (loadedQuill)
|
|
74
|
+
return loadedQuill;
|
|
75
|
+
throw new Error('@vueup/vue-quill: Quill is not loaded yet. Use loadQuill() in a browser-only lifecycle hook, or access the Quill instance from the ready event.');
|
|
76
|
+
};
|
|
77
|
+
const Quill = new Proxy(function QuillProxy() { }, {
|
|
78
|
+
get(_target, property) {
|
|
79
|
+
if (property === 'register') {
|
|
80
|
+
return (...args) => {
|
|
81
|
+
if (loadedQuill) {
|
|
82
|
+
return loadedQuill.register(...args);
|
|
83
|
+
}
|
|
84
|
+
pendingRegistrations.push(args);
|
|
85
|
+
if (isBrowser())
|
|
86
|
+
void loadQuill();
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
const Quill = getQuillOrThrow();
|
|
90
|
+
const value = Quill[property];
|
|
91
|
+
return typeof value === 'function' ? value.bind(Quill) : value;
|
|
92
|
+
},
|
|
93
|
+
construct(_target, args) {
|
|
94
|
+
const Quill = getQuillOrThrow();
|
|
95
|
+
return new Quill(...args);
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
|
|
49
99
|
const QuillEditor = defineComponent({
|
|
50
100
|
name: 'QuillEditor',
|
|
51
101
|
inheritAttrs: false,
|
|
@@ -115,16 +165,19 @@ const QuillEditor = defineComponent({
|
|
|
115
165
|
],
|
|
116
166
|
setup: (props, ctx) => {
|
|
117
167
|
onMounted(() => {
|
|
118
|
-
|
|
168
|
+
isUnmounted = false;
|
|
169
|
+
void initialize();
|
|
119
170
|
});
|
|
120
171
|
onBeforeUnmount(() => {
|
|
121
172
|
quill = null;
|
|
173
|
+
isUnmounted = true;
|
|
122
174
|
});
|
|
175
|
+
let isUnmounted = false;
|
|
123
176
|
let quill;
|
|
124
177
|
let options;
|
|
125
178
|
const editor = ref();
|
|
126
179
|
// Register Module if not already registered
|
|
127
|
-
const registerModule = (moduleName, module) => {
|
|
180
|
+
const registerModule = (Quill, moduleName, module) => {
|
|
128
181
|
const quillImports = Quill.imports;
|
|
129
182
|
if (quillImports && moduleName in quillImports) {
|
|
130
183
|
return;
|
|
@@ -132,20 +185,24 @@ const QuillEditor = defineComponent({
|
|
|
132
185
|
Quill.register(moduleName, module);
|
|
133
186
|
};
|
|
134
187
|
// Initialize Quill
|
|
135
|
-
const initialize = () => {
|
|
188
|
+
const initialize = async () => {
|
|
136
189
|
var _a, _b;
|
|
137
190
|
if (!editor.value)
|
|
138
191
|
return;
|
|
192
|
+
const editorElement = editor.value;
|
|
193
|
+
const Quill = await loadQuill();
|
|
194
|
+
if (isUnmounted || !editor.value || editor.value !== editorElement)
|
|
195
|
+
return;
|
|
139
196
|
options = composeOptions();
|
|
140
197
|
// Register modules
|
|
141
198
|
if (props.modules) {
|
|
142
199
|
if (Array.isArray(props.modules)) {
|
|
143
200
|
for (const module of props.modules) {
|
|
144
|
-
registerModule(`modules/${module.name}`, module.module);
|
|
201
|
+
registerModule(Quill, `modules/${module.name}`, module.module);
|
|
145
202
|
}
|
|
146
203
|
}
|
|
147
204
|
else {
|
|
148
|
-
registerModule(`modules/${props.modules.name}`, props.modules.module);
|
|
205
|
+
registerModule(Quill, `modules/${props.modules.name}`, props.modules.module);
|
|
149
206
|
}
|
|
150
207
|
}
|
|
151
208
|
// Create new Quill instance
|
|
@@ -345,7 +402,7 @@ const QuillEditor = defineComponent({
|
|
|
345
402
|
var _a, _b;
|
|
346
403
|
if (!ctx.slots.toolbar && quill)
|
|
347
404
|
(_b = (_a = getToolbarModule()) === null || _a === void 0 ? void 0 : _a.container) === null || _b === void 0 ? void 0 : _b.remove();
|
|
348
|
-
initialize();
|
|
405
|
+
void initialize();
|
|
349
406
|
});
|
|
350
407
|
};
|
|
351
408
|
watch(() => props.content, (newContent) => {
|
|
@@ -387,4 +444,4 @@ const QuillEditor = defineComponent({
|
|
|
387
444
|
},
|
|
388
445
|
});
|
|
389
446
|
|
|
390
|
-
export { QuillEditor };
|
|
447
|
+
export { Quill, QuillEditor, getLoadedQuill, loadQuill };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VueQuill @vueup/vue-quill v1.
|
|
2
|
+
* VueQuill @vueup/vue-quill v1.4.0
|
|
3
3
|
* https://vueup.github.io/vue-quill/
|
|
4
4
|
*
|
|
5
5
|
* Includes quill v2.0.2 || >=2.0.4 <3
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) 2026 Ahmad Luthfi Masruri
|
|
9
9
|
* Released under the MIT license
|
|
10
|
-
* Date: 2026-06-
|
|
10
|
+
* Date: 2026-06-02T00:10:10.011Z
|
|
11
11
|
*/
|
|
12
|
-
import e from"quill
|
|
12
|
+
import e from"quill-delta";export{default as Delta}from"quill-delta";import{defineComponent as t,h as o,onMounted as n,onBeforeUnmount as l,ref as r,watch as i,nextTick as a}from"vue";const s={essential:[[{header:[1,2,3,4,5,6,!1]}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}],["blockquote","code-block","link"],[{color:[]},"clean"]],minimal:[[{header:1},{header:2}],["bold","italic","underline"],[{list:"ordered"},{list:"bullet"},{align:[]}]],full:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["link","video","image"],["clean"]]};let u,d,c=[];const m=()=>"undefined"!=typeof document,b=async()=>{if(u)return u;if(!m())throw new Error("@vueup/vue-quill: Quill can only be loaded in a browser environment.");return null!=d||(d=import("quill").then(({default:e})=>(u=e,(e=>{const t=c;c=[];for(const o of t)e.register(...o)})(e),e))),d},p=()=>u,f=()=>{if(u)return u;throw new Error("@vueup/vue-quill: Quill is not loaded yet. Use loadQuill() in a browser-only lifecycle hook, or access the Quill instance from the ready event.")},v=new Proxy(function(){},{get(e,t){if("register"===t)return(...e)=>{if(u)return u.register(...e);c.push(e),m()&&b()};const o=f(),n=o[t];return"function"==typeof n?n.bind(o):n},construct:(e,t)=>new(f())(...t)}),h=t({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],required:!1,validator:e=>"string"!=typeof e||""===e||("#"===e.charAt(0)||-1!==Object.keys(s).indexOf(e))},modules:{type:Object,required:!1},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready"],setup:(t,o)=>{n(()=>{c=!1,f()}),l(()=>{u=null,c=!0});let u,d,c=!1;const m=r(),p=(e,t,o)=>{const n=e.imports;n&&t in n||e.register(t,o)},f=async()=>{var e,n;if(!m.value)return;const l=m.value,r=await b();if(!c&&m.value&&m.value===l){if(d=v(),t.modules)if(Array.isArray(t.modules))for(const e of t.modules)p(r,`modules/${e.name}`,e.module);else p(r,`modules/${t.modules.name}`,t.modules.module);u=new r(m.value,d),C(t.content),u.on("text-change",O),u.on("selection-change",q),u.on("editor-change",x),"bubble"!==t.theme&&m.value.classList.remove("ql-bubble"),"snow"!==t.theme&&m.value.classList.remove("ql-snow"),null===(n=null===(e=y())||void 0===e?void 0:e.container)||void 0===n||n.addEventListener("mousedown",e=>{e.preventDefault()}),o.emit("ready",u)}},v=()=>{const e={};if(""!==t.theme&&(e.theme=t.theme),t.readOnly&&(e.readOnly=t.readOnly),t.placeholder&&(e.placeholder=t.placeholder),t.toolbar&&""!==t.toolbar&&(e.modules={toolbar:(()=>{if("object"==typeof t.toolbar)return t.toolbar;if("string"==typeof t.toolbar){return"#"===t.toolbar.charAt(0)?t.toolbar:s[t.toolbar]}})()}),t.modules){const o=(()=>{var e,o;const n={};if(Array.isArray(t.modules))for(const l of t.modules)n[l.name]=null!==(e=l.options)&&void 0!==e?e:{};else n[t.modules.name]=null!==(o=t.modules.options)&&void 0!==o?o:{};return n})();e.modules=Object.assign({},e.modules,o)}return Object.assign({},t.globalOptions,t.options,e)},h=e=>"object"==typeof e&&e?e.slice():e,y=()=>null==u?void 0:u.getModule("toolbar");let g;const w=e=>{if(typeof g==typeof e){if(e===g)return!0;if("object"==typeof e&&e&&"object"==typeof g&&g)return t=g.diff(e),!Object.values(t.ops).some(e=>!e.retain||1!==Object.keys(e).length)}var t;return!1},O=(e,n,l)=>{g=h(j()),w(t.content)||o.emit("update:content",g),o.emit("textChange",{delta:e,oldContents:n,source:l})},T=r(),q=(e,t,n)=>{T.value=!!(null==u?void 0:u.hasFocus()),o.emit("selectionChange",{range:e,oldRange:t,source:n})};i(T,e=>{o.emit(e?"focus":"blur",m)});const x=(...e)=>{"text-change"===e[0]&&o.emit("editorChange",{name:e[0],delta:e[1],oldContents:e[2],source:e[3]}),"selection-change"===e[0]&&o.emit("editorChange",{name:e[0],range:e[1],oldRange:e[2],source:e[3]})},j=(e,o)=>"html"===t.contentType?L():"text"===t.contentType?k(e,o):null==u?void 0:u.getContents(e,o),C=(o,n="api")=>{const l=o||("delta"===t.contentType?new e:"");"html"===t.contentType?S(l):"text"===t.contentType?A(l,n):null==u||u.setContents(l,n),g=h(l)},k=(e,t)=>{var o;return null!==(o=null==u?void 0:u.getText(e,t))&&void 0!==o?o:""},A=(e,t="api")=>{null==u||u.setText(e,t)},L=()=>{var e;return null!==(e=null==u?void 0:u.root.innerHTML)&&void 0!==e?e:""},S=e=>{u&&(u.root.innerHTML=e)};return i(()=>t.content,e=>{if(!u||!e||w(e))return;const t=u.getSelection();t&&a(()=>null==u?void 0:u.setSelection(t)),C(e)},{deep:!0}),i(()=>t.enable,e=>{u&&u.enable(e)}),{editor:m,getEditor:()=>m.value,getToolbar:()=>{var e;return null===(e=y())||void 0===e?void 0:e.container},getQuill:()=>{if(u)return u;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:j,setContents:C,getHTML:L,setHTML:S,pasteHTML:(e,t="api")=>{const o=null==u?void 0:u.clipboard.convert({html:e});o&&(null==u||u.setContents(o,t))},focus:()=>{null==u||u.focus()},getText:k,setText:A,reinit:()=>{a(()=>{var e,t;!o.slots.toolbar&&u&&(null===(t=null===(e=y())||void 0===e?void 0:e.container)||void 0===t||t.remove()),f()})}}},render(){var e,t;return[null===(t=(e=this.$slots).toolbar)||void 0===t?void 0:t.call(e),o("div",{ref:"editor",...this.$attrs})]}});export{v as Quill,h as QuillEditor,p as getLoadedQuill,b as loadQuill};
|