@vueup/vue-quill 1.0.0-beta.4 → 1.0.0-beta.8

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.
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * VueQuill @vueup/vue-quill v1.0.0-beta.4
2
+ * VueQuill @vueup/vue-quill v1.0.0-beta.8
3
3
  * https://vueup.github.io/vue-quill/
4
4
  *
5
5
  * Includes quill v1.3.7
6
6
  * https://quilljs.com/
7
7
  *
8
- * Copyright (c) 2021 Ahmad Luthfi Masruri
8
+ * Copyright (c) 2022 Ahmad Luthfi Masruri
9
9
  * Released under the MIT license
10
- * Date: 2021-05-06T22:00:43.368Z
10
+ * Date: 2022-02-17T08:01:57.735Z
11
11
  */
12
12
  'use strict';
13
13
 
@@ -17,7 +17,7 @@ var Quill = require('quill');
17
17
  var quillDelta = require('quill-delta');
18
18
  var vue = require('vue');
19
19
 
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e['default'] : e; }
20
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
21
21
 
22
22
  var Quill__default = /*#__PURE__*/_interopDefaultLegacy(Quill);
23
23
  var quillDelta__default = /*#__PURE__*/_interopDefaultLegacy(quillDelta);
@@ -271,7 +271,7 @@ const QuillEditor = vue.defineComponent({
271
271
  };
272
272
  const setContents = (content, source = 'api') => {
273
273
  if (props.contentType === 'html') {
274
- setHTML(content, source);
274
+ setHTML(content);
275
275
  }
276
276
  else if (props.contentType === 'text') {
277
277
  setText(content, source);
@@ -291,7 +291,11 @@ const QuillEditor = vue.defineComponent({
291
291
  var _a;
292
292
  return (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
293
293
  };
294
- const setHTML = (html, source = 'api') => {
294
+ const setHTML = (html) => {
295
+ if (quill)
296
+ quill.root.innerHTML = html;
297
+ };
298
+ const pasteHTML = (html, source = 'api') => {
295
299
  const delta = quill === null || quill === void 0 ? void 0 : quill.clipboard.convert(html);
296
300
  if (delta)
297
301
  quill === null || quill === void 0 ? void 0 : quill.setContents(delta, source);
@@ -304,11 +308,13 @@ const QuillEditor = vue.defineComponent({
304
308
  initialize();
305
309
  });
306
310
  };
307
- vue.watch(() => props.content, (newContent) => {
308
- if (!quill || !newContent || newContent === props.content)
309
- return;
310
- setContents(newContent);
311
- });
311
+ // watch(
312
+ // () => props.content,
313
+ // (newContent, oldContents) => {
314
+ // if (!quill || !newContent || newContent === oldContents) return
315
+ // setContents(newContent)
316
+ // }
317
+ // )
312
318
  vue.watch(() => props.enable, (newValue) => {
313
319
  if (quill)
314
320
  quill.enable(newValue);
@@ -322,6 +328,7 @@ const QuillEditor = vue.defineComponent({
322
328
  setContents,
323
329
  getHTML,
324
330
  setHTML,
331
+ pasteHTML,
325
332
  getText,
326
333
  setText,
327
334
  reinit,
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * VueQuill @vueup/vue-quill v1.0.0-beta.4
2
+ * VueQuill @vueup/vue-quill v1.0.0-beta.8
3
3
  * https://vueup.github.io/vue-quill/
4
4
  *
5
5
  * Includes quill v1.3.7
6
6
  * https://quilljs.com/
7
7
  *
8
- * Copyright (c) 2021 Ahmad Luthfi Masruri
8
+ * Copyright (c) 2022 Ahmad Luthfi Masruri
9
9
  * Released under the MIT license
10
- * Date: 2021-05-06T22:00:43.368Z
10
+ * Date: 2022-02-17T08:01:57.735Z
11
11
  */
12
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("quill"),t=require("quill-delta"),o=require("vue");function l(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var n=l(e),r=l(t);const i={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"]]},a=o.defineComponent({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object],default:()=>{}},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(i).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:(e,t)=>{let l,r;o.onMounted((()=>{d()})),o.onBeforeUnmount((()=>{l=null}));const a=o.ref(),d=()=>{var o;if(a.value){if(r=s(),e.modules)if(Array.isArray(e.modules))for(const t of e.modules)n.register(`modules/${t.name}`,t.module);else n.register(`modules/${e.modules.name}`,e.modules.module);l=new n(a.value,r),p(e.content),l.on("text-change",u),l.on("selection-change",b),l.on("editor-change",m),"bubble"!==e.theme&&a.value.classList.remove("ql-bubble"),"snow"!==e.theme&&a.value.classList.remove("ql-snow"),null===(o=l.getModule("toolbar"))||void 0===o||o.container.addEventListener("mousedown",(e=>{e.preventDefault()})),t.emit("ready",l)}},s=()=>{const t={};if(""!==e.theme&&(t.theme=e.theme),e.readOnly&&(t.readOnly=e.readOnly),e.placeholder&&(t.placeholder=e.placeholder),e.toolbar&&""!==e.toolbar&&(t.modules={toolbar:(()=>{if("object"==typeof e.toolbar)return e.toolbar;if("string"==typeof e.toolbar){return"#"===e.toolbar.charAt(0)?e.toolbar:i[e.toolbar]}})()}),e.modules){const o=(()=>{var t,o;const l={};if(Array.isArray(e.modules))for(const n of e.modules)l[n.name]=null!==(t=n.options)&&void 0!==t?t:{};else l[e.modules.name]=null!==(o=e.modules.options)&&void 0!==o?o:{};return l})();Object.assign(t.modules,o)}return Object.assign({},e.globalOptions,e.options,t)},u=(e,o,l)=>{t.emit("update:content",h()),t.emit("textChange",{delta:e,oldContents:o,source:l})},c=o.ref(),b=(e,o,n)=>{c.value=!!(null==l?void 0:l.hasFocus()),t.emit("selectionChange",{range:e,oldRange:o,source:n})};o.watch(c,(e=>{t.emit(e?"focus":"blur",a)}));const m=(...e)=>{"text-change"===e[0]&&t.emit("editorChange",{name:e[0],delta:e[1],oldContents:e[2],source:e[3]}),"selection-change"===e[0]&&t.emit("editorChange",{name:e[0],range:e[1],oldRange:e[2],source:e[3]})},h=(t,o)=>"html"===e.contentType?f():"text"===e.contentType?g(t,o):null==l?void 0:l.getContents(t,o),p=(t,o="api")=>{"html"===e.contentType?y(t,o):"text"===e.contentType?v(t,o):null==l||l.setContents(t,o)},g=(e,t)=>{var o;return null!==(o=null==l?void 0:l.getText(e,t))&&void 0!==o?o:""},v=(e,t="api")=>{null==l||l.setText(e,t)},f=()=>{var e;return null!==(e=null==l?void 0:l.root.innerHTML)&&void 0!==e?e:""},y=(e,t="api")=>{const o=null==l?void 0:l.clipboard.convert(e);o&&(null==l||l.setContents(o,t))};return o.watch((()=>e.content),(t=>{l&&t&&t!==e.content&&p(t)})),o.watch((()=>e.enable),(e=>{l&&l.enable(e)})),{editor:a,getEditor:()=>a.value,getToolbar:()=>{var e;return null===(e=null==l?void 0:l.getModule("toolbar"))||void 0===e?void 0:e.container},getQuill:()=>{if(l)return l;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:h,setContents:p,getHTML:f,setHTML:y,getText:g,setText:v,reinit:()=>{o.nextTick((()=>{var e;!t.slots.toolbar&&l&&(null===(e=l.getModule("toolbar"))||void 0===e||e.container.remove()),d()}))}}},render(){var e,t;return[null===(t=(e=this.$slots).toolbar)||void 0===t?void 0:t.call(e),o.h("div",{ref:"editor",...this.$attrs})]}});exports.Quill=n,exports.Delta=r,exports.QuillEditor=a;
12
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("quill"),t=require("quill-delta"),o=require("vue");function l(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var n=l(e),r=l(t);const i={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"]]},a=o.defineComponent({name:"QuillEditor",inheritAttrs:!1,props:{content:{type:[String,Object],default:()=>{}},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(i).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:(e,t)=>{let l,r;o.onMounted((()=>{d()})),o.onBeforeUnmount((()=>{l=null}));const a=o.ref(),d=()=>{var o;if(a.value){if(r=s(),e.modules)if(Array.isArray(e.modules))for(const t of e.modules)n.register(`modules/${t.name}`,t.module);else n.register(`modules/${e.modules.name}`,e.modules.module);l=new n(a.value,r),h(e.content),l.on("text-change",u),l.on("selection-change",b),l.on("editor-change",m),"bubble"!==e.theme&&a.value.classList.remove("ql-bubble"),"snow"!==e.theme&&a.value.classList.remove("ql-snow"),null===(o=l.getModule("toolbar"))||void 0===o||o.container.addEventListener("mousedown",(e=>{e.preventDefault()})),t.emit("ready",l)}},s=()=>{const t={};if(""!==e.theme&&(t.theme=e.theme),e.readOnly&&(t.readOnly=e.readOnly),e.placeholder&&(t.placeholder=e.placeholder),e.toolbar&&""!==e.toolbar&&(t.modules={toolbar:(()=>{if("object"==typeof e.toolbar)return e.toolbar;if("string"==typeof e.toolbar){return"#"===e.toolbar.charAt(0)?e.toolbar:i[e.toolbar]}})()}),e.modules){const o=(()=>{var t,o;const l={};if(Array.isArray(e.modules))for(const n of e.modules)l[n.name]=null!==(t=n.options)&&void 0!==t?t:{};else l[e.modules.name]=null!==(o=e.modules.options)&&void 0!==o?o:{};return l})();Object.assign(t.modules,o)}return Object.assign({},e.globalOptions,e.options,t)},u=(e,o,l)=>{t.emit("update:content",p()),t.emit("textChange",{delta:e,oldContents:o,source:l})},c=o.ref(),b=(e,o,n)=>{c.value=!!(null==l?void 0:l.hasFocus()),t.emit("selectionChange",{range:e,oldRange:o,source:n})};o.watch(c,(e=>{t.emit(e?"focus":"blur",a)}));const m=(...e)=>{"text-change"===e[0]&&t.emit("editorChange",{name:e[0],delta:e[1],oldContents:e[2],source:e[3]}),"selection-change"===e[0]&&t.emit("editorChange",{name:e[0],range:e[1],oldRange:e[2],source:e[3]})},p=(t,o)=>"html"===e.contentType?f():"text"===e.contentType?g(t,o):null==l?void 0:l.getContents(t,o),h=(t,o="api")=>{"html"===e.contentType?y(t):"text"===e.contentType?v(t,o):null==l||l.setContents(t,o)},g=(e,t)=>{var o;return null!==(o=null==l?void 0:l.getText(e,t))&&void 0!==o?o:""},v=(e,t="api")=>{null==l||l.setText(e,t)},f=()=>{var e;return null!==(e=null==l?void 0:l.root.innerHTML)&&void 0!==e?e:""},y=e=>{l&&(l.root.innerHTML=e)};return o.watch((()=>e.enable),(e=>{l&&l.enable(e)})),{editor:a,getEditor:()=>a.value,getToolbar:()=>{var e;return null===(e=null==l?void 0:l.getModule("toolbar"))||void 0===e?void 0:e.container},getQuill:()=>{if(l)return l;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:p,setContents:h,getHTML:f,setHTML:y,pasteHTML:(e,t="api")=>{const o=null==l?void 0:l.clipboard.convert(e);o&&(null==l||l.setContents(o,t))},getText:g,setText:v,reinit:()=>{o.nextTick((()=>{var e;!t.slots.toolbar&&l&&(null===(e=l.getModule("toolbar"))||void 0===e||e.container.remove()),d()}))}}},render(){var e,t;return[null===(t=(e=this.$slots).toolbar)||void 0===t?void 0:t.call(e),o.h("div",{ref:"editor",...this.$attrs})]}});exports.Quill=n,exports.Delta=r,exports.QuillEditor=a;
@@ -1,8 +1,16 @@
1
+ import { AllowedComponentProps } from 'vue';
2
+ import { ComponentCustomProps } from 'vue';
3
+ import { ComponentOptionsMixin } from 'vue';
4
+ import { DefineComponent } from 'vue';
1
5
  import Delta from 'quill-delta';
6
+ import { ExtractPropTypes } from 'vue';
2
7
  import { PropType } from 'vue';
3
8
  import Quill from 'quill';
4
9
  import { QuillOptionsStatic } from 'quill';
10
+ import { Ref } from 'vue';
5
11
  import { Sources } from 'quill';
12
+ import { VNodeProps } from 'vue';
13
+
6
14
  export { Delta }
7
15
 
8
16
  declare type Module = {
@@ -10,82 +18,124 @@ declare type Module = {
10
18
  module: any;
11
19
  options?: object;
12
20
  };
21
+
13
22
  export { Quill }
14
23
 
15
- export declare const QuillEditor: import("vue").DefineComponent<{
16
- content: {
17
- type: PropType<string | Delta>;
18
- default: () => void;
19
- };
20
- contentType: {
21
- type: PropType<"delta" | "html" | "text">;
22
- default: string;
23
- validator: (value: string) => boolean;
24
- };
25
- enable: {
26
- type: BooleanConstructor;
27
- default: boolean;
28
- };
29
- readOnly: {
30
- type: BooleanConstructor;
31
- default: boolean;
32
- };
33
- placeholder: {
34
- type: StringConstructor;
35
- required: false;
36
- };
37
- theme: {
38
- type: PropType<"" | "snow" | "bubble">;
39
- default: string;
40
- validator: (value: string) => boolean;
41
- };
42
- toolbar: {
43
- type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
44
- required: false;
45
- validator: (value: string | unknown) => boolean;
46
- };
47
- modules: {
48
- type: PropType<Module | Module[]>;
49
- required: false;
50
- };
51
- options: {
52
- type: PropType<QuillOptionsStatic>;
53
- required: false;
54
- };
55
- globalOptions: {
56
- type: PropType<QuillOptionsStatic>;
57
- required: false;
58
- };
24
+ export declare const QuillEditor: DefineComponent< {
25
+ content: {
26
+ type: PropType<string | Delta>;
27
+ default: () => void;
28
+ };
29
+ contentType: {
30
+ type: PropType<"delta" | "html" | "text">;
31
+ default: string;
32
+ validator: (value: string) => boolean;
33
+ };
34
+ enable: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ readOnly: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ placeholder: {
43
+ type: StringConstructor;
44
+ required: false;
45
+ };
46
+ theme: {
47
+ type: PropType<"" | "snow" | "bubble">;
48
+ default: string;
49
+ validator: (value: string) => boolean;
50
+ };
51
+ toolbar: {
52
+ type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
53
+ required: false;
54
+ validator: (value: string | unknown) => boolean;
55
+ };
56
+ modules: {
57
+ type: PropType<Module | Module[]>;
58
+ required: false;
59
+ };
60
+ options: {
61
+ type: PropType<QuillOptionsStatic>;
62
+ required: false;
63
+ };
64
+ globalOptions: {
65
+ type: PropType<QuillOptionsStatic>;
66
+ required: false;
67
+ };
68
+ }, {
69
+ editor: Ref<Element | undefined>;
70
+ getEditor: () => Element;
71
+ getToolbar: () => Element;
72
+ getQuill: () => Quill;
73
+ getContents: (index?: number | undefined, length?: number | undefined) => string | Delta | undefined;
74
+ setContents: (content: string | Delta, source?: Sources) => void;
75
+ getHTML: () => string;
76
+ setHTML: (html: string) => void;
77
+ pasteHTML: (html: string, source?: Sources) => void;
78
+ getText: (index?: number | undefined, length?: number | undefined) => string;
79
+ setText: (text: string, source?: Sources) => void;
80
+ reinit: () => void;
81
+ }, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, ("textChange" | "selectionChange" | "editorChange" | "update:content" | "focus" | "blur" | "ready")[], "textChange" | "selectionChange" | "editorChange" | "update:content" | "focus" | "blur" | "ready", VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<ExtractPropTypes< {
82
+ content: {
83
+ type: PropType<string | Delta>;
84
+ default: () => void;
85
+ };
86
+ contentType: {
87
+ type: PropType<"delta" | "html" | "text">;
88
+ default: string;
89
+ validator: (value: string) => boolean;
90
+ };
91
+ enable: {
92
+ type: BooleanConstructor;
93
+ default: boolean;
94
+ };
95
+ readOnly: {
96
+ type: BooleanConstructor;
97
+ default: boolean;
98
+ };
99
+ placeholder: {
100
+ type: StringConstructor;
101
+ required: false;
102
+ };
103
+ theme: {
104
+ type: PropType<"" | "snow" | "bubble">;
105
+ default: string;
106
+ validator: (value: string) => boolean;
107
+ };
108
+ toolbar: {
109
+ type: (StringConstructor | ObjectConstructor | ArrayConstructor)[];
110
+ required: false;
111
+ validator: (value: string | unknown) => boolean;
112
+ };
113
+ modules: {
114
+ type: PropType<Module | Module[]>;
115
+ required: false;
116
+ };
117
+ options: {
118
+ type: PropType<QuillOptionsStatic>;
119
+ required: false;
120
+ };
121
+ globalOptions: {
122
+ type: PropType<QuillOptionsStatic>;
123
+ required: false;
124
+ };
125
+ }>> & {
126
+ onTextChange?: ((...args: any[]) => any) | undefined;
127
+ onSelectionChange?: ((...args: any[]) => any) | undefined;
128
+ onEditorChange?: ((...args: any[]) => any) | undefined;
129
+ "onUpdate:content"?: ((...args: any[]) => any) | undefined;
130
+ onFocus?: ((...args: any[]) => any) | undefined;
131
+ onBlur?: ((...args: any[]) => any) | undefined;
132
+ onReady?: ((...args: any[]) => any) | undefined;
59
133
  }, {
60
- editor: import("vue").Ref<Element | undefined>;
61
- getEditor: () => Element;
62
- getToolbar: () => Element;
63
- getQuill: () => Quill;
64
- getContents: (index?: number | undefined, length?: number | undefined) => string | Delta | undefined;
65
- setContents: (content: string | Delta, source?: Sources) => void;
66
- getHTML: () => string;
67
- setHTML: (html: string, source?: Sources) => void;
68
- getText: (index?: number | undefined, length?: number | undefined) => string;
69
- setText: (text: string, source?: Sources) => void;
70
- reinit: () => void;
71
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("textChange" | "selectionChange" | "editorChange" | "update:content" | "focus" | "blur" | "ready")[], "textChange" | "selectionChange" | "editorChange" | "update:content" | "focus" | "blur" | "ready", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
72
- content: string | Delta;
73
- contentType: "delta" | "html" | "text";
74
- enable: boolean;
75
- readOnly: boolean;
76
- theme: "" | "snow" | "bubble";
77
- } & {
78
- placeholder?: string | undefined;
79
- toolbar?: unknown;
80
- modules?: Module | Module[] | undefined;
81
- options?: QuillOptionsStatic | undefined;
82
- globalOptions?: QuillOptionsStatic | undefined;
83
- }>, {
84
- content: string | Delta;
85
- contentType: "delta" | "html" | "text";
86
- enable: boolean;
87
- readOnly: boolean;
88
- theme: "" | "snow" | "bubble";
134
+ content: string | Delta;
135
+ contentType: "delta" | "html" | "text";
136
+ enable: boolean;
137
+ readOnly: boolean;
138
+ theme: "" | "snow" | "bubble";
89
139
  }>;
90
140
 
91
141
  export { }