pxx-vue-quill 1.0.13 → 1.0.16
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 +25 -8
- package/dist/vue-quill.cjs.prod.js +2 -2
- package/dist/vue-quill.esm-browser.js +25 -8
- package/dist/vue-quill.esm-browser.prod.js +2 -2
- package/dist/vue-quill.esm-bundler.js +25 -8
- package/dist/vue-quill.esm-bundler.prod.js +2 -2
- package/dist/vue-quill.global.js +25 -8
- package/dist/vue-quill.global.prod.js +2 -2
- package/dist/vue-quill.snow.css +2 -5
- package/dist/vue-quill.snow.prod.css +1 -1
- package/package.json +1 -1
package/dist/vue-quill.cjs.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) 2025 Pxx-Team
|
|
9
9
|
* Released under the MIT license
|
|
10
|
-
* Date: 2025-08-
|
|
10
|
+
* Date: 2025-08-25T01:50:19.065Z
|
|
11
11
|
*/
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
@@ -144,11 +144,6 @@ const QuillEditor = vue.defineComponent({
|
|
|
144
144
|
let quill;
|
|
145
145
|
let options;
|
|
146
146
|
const editor = vue.ref();
|
|
147
|
-
const editorWrapStyle = vue.computed(() => {
|
|
148
|
-
return {
|
|
149
|
-
minHeight: `${props.minHeight}px`,
|
|
150
|
-
};
|
|
151
|
-
});
|
|
152
147
|
const editorWrapClass = vue.computed(() => {
|
|
153
148
|
return {
|
|
154
149
|
'quill-editor-container': true,
|
|
@@ -157,6 +152,21 @@ const QuillEditor = vue.defineComponent({
|
|
|
157
152
|
'embedded': props.toolbarMode === 'embedded',
|
|
158
153
|
};
|
|
159
154
|
});
|
|
155
|
+
// 监听 minHeight 变化,同步设置编辑器高度
|
|
156
|
+
const updateEditorHeight = () => {
|
|
157
|
+
if (quill && editor.value) {
|
|
158
|
+
const editorElement = editor.value.querySelector('.ql-editor');
|
|
159
|
+
if (editorElement) {
|
|
160
|
+
editorElement.style.minHeight = `${props.minHeight}px`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
// 监听 minHeight 变化
|
|
165
|
+
vue.watch(() => props.minHeight, () => {
|
|
166
|
+
vue.nextTick(() => {
|
|
167
|
+
updateEditorHeight();
|
|
168
|
+
});
|
|
169
|
+
});
|
|
160
170
|
// Register Module if not already registered
|
|
161
171
|
const registerModule = (moduleName, module) => {
|
|
162
172
|
// For Quill 1.x, we can't check if module is already registered
|
|
@@ -208,6 +218,8 @@ const QuillEditor = vue.defineComponent({
|
|
|
208
218
|
.getModule('toolbar')) === null || _b === void 0 ? void 0 : _b.container.addEventListener('mousedown', (e) => {
|
|
209
219
|
e.preventDefault();
|
|
210
220
|
});
|
|
221
|
+
// 设置初始编辑器高度
|
|
222
|
+
updateEditorHeight();
|
|
211
223
|
// Emit ready event
|
|
212
224
|
ctx.emit('ready', quill);
|
|
213
225
|
};
|
|
@@ -294,8 +306,14 @@ const QuillEditor = vue.defineComponent({
|
|
|
294
306
|
const isEditorFocus = vue.ref();
|
|
295
307
|
const handleSelectionChange = (range, oldRange, source) => {
|
|
296
308
|
var _a;
|
|
309
|
+
console.log("----------------------------------");
|
|
310
|
+
console.log(range);
|
|
311
|
+
console.log(oldRange);
|
|
312
|
+
console.log(source);
|
|
297
313
|
// Set isEditorFocus if quill.hasFocus()
|
|
298
314
|
isEditorFocus.value = !!(quill === null || quill === void 0 ? void 0 : quill.hasFocus());
|
|
315
|
+
console.log(isEditorFocus.value);
|
|
316
|
+
console.log("----------------------------------");
|
|
299
317
|
// 动态显示/隐藏toolbar
|
|
300
318
|
const toolbar = (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
|
|
301
319
|
if (toolbar) {
|
|
@@ -430,14 +448,13 @@ const QuillEditor = vue.defineComponent({
|
|
|
430
448
|
getText,
|
|
431
449
|
setText,
|
|
432
450
|
reinit,
|
|
433
|
-
editorWrapStyle,
|
|
434
451
|
editorWrapClass,
|
|
435
452
|
};
|
|
436
453
|
},
|
|
437
454
|
render() {
|
|
438
455
|
var _a, _b;
|
|
439
456
|
return [
|
|
440
|
-
vue.h('div', { class: this.editorWrapClass
|
|
457
|
+
vue.h('div', { class: this.editorWrapClass }, [
|
|
441
458
|
(_b = (_a = this.$slots).toolbar) === null || _b === void 0 ? void 0 : _b.call(_a),
|
|
442
459
|
vue.h('div', { ref: 'editor', ...this.$attrs }),
|
|
443
460
|
]),
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) 2025 Pxx-Team
|
|
9
9
|
* Released under the MIT license
|
|
10
|
-
* Date: 2025-08-
|
|
10
|
+
* Date: 2025-08-25T01:50:19.065Z
|
|
11
11
|
*/
|
|
12
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("quill"),t=require("quill-delta"),o=require("vue"),l=require("quill-blot-formatter");function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=n(e),i=n(t),a=n(l);const d={full:[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]}],["image"]]},s=o.defineComponent({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,default:"请输入内容"},minHeight:{type:Number,required:!1,default:20},needBorder:{type:Boolean,default:!1},toolbarMode:{type:String,default:"embedded",validator:e=>["fixed-top","embedded"].includes(e)},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(d).indexOf(e)))},modules:{type:Object,required:!1,default:()=>({name:"blotFormatter",module:a})},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready","ocr","math"],setup:(e,t)=>{let l,n;o.onMounted((()=>{p()})),o.onBeforeUnmount((()=>{l=null}));const a=o.ref(),s=o.computed((()=>({minHeight:`${e.minHeight}px`}))),u=o.computed((()=>({"quill-editor-container":!0,"need-border":e.needBorder,"fixed-top":"fixed-top"===e.toolbarMode,embedded:"embedded"===e.toolbarMode}))),c=(e,t)=>{r.register(e,t)},p=()=>{var o,i;if(!a.value)return;l=new r(a.value,n);const d=null===(o=null==l?void 0:l.getModule("toolbar"))||void 0===o?void 0:o.container;d&&(d.style.display="none");const s=r.import("ui/icons");if(s.ocr='<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"><g><g style="opacity:0;"><rect x="0" y="0" width="18" height="18" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M3.0000245140625,2.6000244140625L5.5000243140625,2.6000244140625C5.8313951140625,2.6000244140625,6.1000242140625,2.3313953240625,6.1000242140625,2.0000244340625C6.1000242140625,1.6686535440624999,5.8313951140625,1.4000244140625,5.5000243140625,1.4000244140625L3.0000245140625,1.4000244140625Q2.3372827740625,1.4000244140625,1.8686535940625,1.8686535940625Q1.4000244140625,2.3372827740625,1.4000244140625,3.0000245140625L1.4000244140625,5.5000243140625C1.4000244140625,5.8313951140625,1.6686535440624999,6.1000242140625,2.0000244340625,6.1000242140625C2.3313953240625,6.1000242140625,2.6000244140625,5.8313951140625,2.6000244140625,5.5000243140625L2.6000244140625,3.0000245140625Q2.6000244140625,2.6000244140625,3.0000245140625,2.6000244140625ZM12.5000244140625,1.4000244140625L15.0000244140625,1.4000244140625Q15.6627664140625,1.4000244140625,16.1313954140625,1.8686538940625Q16.6000244140625,2.3372834940625,16.6000244140625,3.0000245140625L16.6000244140625,5.5000243140625C16.6000244140625,5.6591539140625,16.5368104140625,5.8117661140625,16.424288414062502,5.9242883140625C16.3117674140625,6.0368099140625,16.1591544140625,6.1000242140625,16.0000244140625,6.1000242140625C15.6686534140625,6.1000242140625,15.4000244140625,5.8313951140625,15.4000244140625,5.5000243140625L15.4000234140625,3.0000245140625Q15.4000234140625,2.6000244140625,15.0000244140625,2.6000244140625L12.5000244140625,2.6000244140625C12.1686534140625,2.6000244140625,11.9000244140625,2.3313953240625,11.9000244140625,2.0000244340625C11.9000244140625,1.6686535440624999,12.1686534140625,1.4000244140625,12.5000244140625,1.4000244140625ZM8.6239776140625,6.4719930140625C8.5439777140625,6.1512432140625,8.3999777140625,5.7421179140625,8.2479777140625,5.4212432140625L9.4959774140625,5.052368214062501C9.6959782140625,5.4293680140625,9.9199772140625,5.9346180140625,9.9999771140625,6.2714929140625L9.3519778140625,6.4719930140625L12.7119784140625,6.4719930140625L12.7119784140625,7.6079931140625L11.5039774140625,7.6079931140625C11.1279774140625,8.6968679140625,10.6159782140625,9.6014929140625,9.9599781140625,10.3461180140625C10.7599773140625,10.9224930140625,11.7279774140625,11.3468685140625,12.8879774140625,11.6029934140625C12.6239774140625,11.8592434140625,12.2799774140625,12.3716184140625,12.1039784140625,12.6918684140625C10.8719778140625,12.3716184140625,9.8719778140625,11.8752434140625,9.0479779140625,11.2107429140625C8.175977714062501,11.8992434140625,7.1199779140625,12.4036184140625,5.8559775140625,12.7558684140625C5.7279777140625,12.4757434140625,5.3759775140625,11.9312434140625,5.1519775140625,11.6591184140625C6.3759775140625,11.3868685140625,7.3839779140625,10.9706182140625,8.1839781140625,10.3781185140625C7.5199776140625,9.6094932140625,7.0079775140625,8.6888685140625,6.5919776140625,7.6079931140625L5.3279776140625,7.6079931140625L5.3279776140625,6.4719930140625L8.6239776140625,6.4719930140625ZM7.7999778140625,7.6079931140625C8.1119776140625,8.344617814062499,8.5359778140625,9.0011186140625,9.0719776140625,9.5694933140625C9.5439777140625,9.0251179140625,9.9199772140625,8.3766184140625,10.1919784140625,7.6079931140625L7.7999778140625,7.6079931140625ZM2.6000244140625,12.5000244140625L2.6000244140625,15.0000244140625Q2.6000244140625,15.4000234140625,3.0000245140625,15.4000234140625L5.5000243140625,15.4000234140625C5.8313951140625,15.4000244140625,6.1000242140625,15.6686534140625,6.1000242140625,16.0000244140625C6.1000242140625,16.3313964140625,5.8313951140625,16.6000254140625,5.5000243140625,16.6000254140625L5.4989548140625,16.6000244140625L3.0000245140625,16.6000244140625Q2.3372834940625,16.6000244140625,1.8686538940625,16.1313954140625Q1.4000244140625,15.6627664140625,1.4000244140625,15.0000244140625L1.4000244140625,12.5000244140625C1.4000244140625,12.1686534140625,1.6686535440624999,11.9000244140625,2.0000244340625,11.9000244140625C2.3313953240625,11.9000244140625,2.6000244140625,12.1686534140625,2.6000244140625,12.5000244140625ZM16.6000244140625,12.5010944140625L16.6000244140625,15.0000244140625Q16.6000244140625,15.6627654140625,16.1313954140625,16.1313954140625Q15.6627654140625,16.6000244140625,15.0000244140625,16.6000244140625L12.5000244140625,16.6000244140625C12.3408944140625,16.6000244140625,12.1882824140625,16.5368104140625,12.0757594140625,16.424288414062502C11.9632384140625,16.3117664140625,11.9000244140625,16.1591544140625,11.9000244140625,16.0000244140625C11.9000244140625,15.6686534140625,12.1686534140625,15.4000244140625,12.5000244140625,15.4000244140625L15.0000244140625,15.4000234140625Q15.4000234140625,15.4000234140625,15.4000234140625,15.0000244140625L15.4000234140625,12.5000244140625C15.4000244140625,12.1686534140625,15.6686534140625,11.9000244140625,16.0000244140625,11.9000244140625C16.3313964140625,11.9000244140625,16.6000254140625,12.1686534140625,16.6000254140625,12.5000244140625L16.6000244140625,12.5010944140625Z" fill-rule="evenodd" fill="#333333" fill-opacity="1"/></g></g></svg>',s.math='<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=m(),e.modules)if(Array.isArray(e.modules))for(const t of e.modules)c(`modules/${t.name}`,t.module);else c(`modules/${e.modules.name}`,e.modules.module);l=new r(a.value,n),C(e.content),l.on("text-change",Q),l.on("selection-change",b),l.on("editor-change",y),"bubble"!==e.theme&&a.value.classList.remove("ql-bubble"),"snow"!==e.theme&&a.value.classList.remove("ql-snow"),null===(i=l.getModule("toolbar"))||void 0===i||i.container.addEventListener("mousedown",(e=>{e.preventDefault()})),t.emit("ready",l)},m=()=>{const o={};if(""!==e.theme&&(o.theme=e.theme),e.readOnly&&(o.readOnly=e.readOnly),e.placeholder&&(o.placeholder=e.placeholder),e.toolbar&&""!==e.toolbar&&(o.modules={toolbar:{container:[...d.full,["ocr"],[{math:!0}]],handlers:{ocr:function(){console.log("ocr"),t.emit("ocr")},math:function(){t.emit("math")}}}}),e.modules){const t=(()=>{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})();o.modules=Object.assign({},o.modules,t)}return Object.assign({},e.globalOptions,e.options,o)},h=e=>"object"==typeof e&&e?e.slice():e;let g;const v=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},Q=(o,l,n)=>{g=h(L()),v(e.content)||t.emit("update:content",g),t.emit("textChange",{delta:o,oldContents:l,source:n})},f=o.ref(),b=(e,o,n)=>{var r;f.value=!!(null==l?void 0:l.hasFocus());const i=null===(r=null==l?void 0:l.getModule("toolbar"))||void 0===r?void 0:r.container;i&&(i.style.display=f.value?"flex":"none"),t.emit("selectionChange",{range:e,oldRange:o,source:n})};o.watch(f,(e=>{t.emit(e?"focus":"blur",a)}));const y=(...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]})},L=(t,o)=>"html"===e.contentType?M():"text"===e.contentType?x(t,o):null==l?void 0:l.getContents(t,o),C=(t,o="api")=>{const n=t||("delta"===e.contentType?new i:"");"html"===e.contentType?T(n):"text"===e.contentType?w(n,o):null==l||l.setContents(n,o),g=h(n)},x=(e,t)=>{var o;return null!==(o=null==l?void 0:l.getText(e,t))&&void 0!==o?o:""},w=(e,t="api")=>{null==l||l.setText(e,t)},M=()=>{var e;return null!==(e=null==l?void 0:l.root.innerHTML)&&void 0!==e?e:""},T=e=>{l&&(l.root.innerHTML=e)};return o.watch((()=>e.content),(e=>{if(!l||!e||v(e))return;const t=l.getSelection();t&&o.nextTick((()=>null==l?void 0:l.setSelection(t))),C(e)}),{deep:!0}),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:L,setContents:C,getHTML:M,setHTML:T,pasteHTML:(e,t="api")=>{const o=null==l?void 0:l.clipboard.convert(e);o&&(null==l||l.setContents(o,t))},focus:()=>{null==l||l.focus()},getText:x,setText:w,reinit:()=>{o.nextTick((()=>{var e;!t.slots.toolbar&&l&&(null===(e=l.getModule("toolbar"))||void 0===e||e.container.remove()),p()}))},editorWrapStyle:s,editorWrapClass:u}},render(){var e,t;return[o.h("div",{class:this.editorWrapClass,style:this.editorWrapStyle},[null===(t=(e=this.$slots).toolbar)||void 0===t?void 0:t.call(e),o.h("div",{ref:"editor",...this.$attrs})])]}});exports.Quill=r,exports.Delta=i,exports.QuillEditor=s;
|
|
12
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("quill"),t=require("quill-delta"),o=require("vue"),l=require("quill-blot-formatter");function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var r=n(e),i=n(t),a=n(l);const d={full:[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],[{color:[]},{background:[]}],["image"]]},s=o.defineComponent({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,default:"请输入内容"},minHeight:{type:Number,required:!1,default:20},needBorder:{type:Boolean,default:!1},toolbarMode:{type:String,default:"embedded",validator:e=>["fixed-top","embedded"].includes(e)},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(d).indexOf(e)))},modules:{type:Object,required:!1,default:()=>({name:"blotFormatter",module:a})},options:{type:Object,required:!1},globalOptions:{type:Object,required:!1}},emits:["textChange","selectionChange","editorChange","update:content","focus","blur","ready","ocr","math"],setup:(e,t)=>{let l,n;o.onMounted((()=>{g()})),o.onBeforeUnmount((()=>{l=null}));const a=o.ref(),s=o.computed((()=>({"quill-editor-container":!0,"need-border":e.needBorder,"fixed-top":"fixed-top"===e.toolbarMode,embedded:"embedded"===e.toolbarMode}))),u=()=>{if(l&&a.value){const t=a.value.querySelector(".ql-editor");t&&(t.style.minHeight=`${e.minHeight}px`)}};o.watch((()=>e.minHeight),(()=>{o.nextTick((()=>{u()}))}));const c=(e,t)=>{r.register(e,t)},g=()=>{var o,i;if(!a.value)return;l=new r(a.value,n);const d=null===(o=null==l?void 0:l.getModule("toolbar"))||void 0===o?void 0:o.container;d&&(d.style.display="none");const s=r.import("ui/icons");if(s.ocr='<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"><g><g style="opacity:0;"><rect x="0" y="0" width="18" height="18" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M3.0000245140625,2.6000244140625L5.5000243140625,2.6000244140625C5.8313951140625,2.6000244140625,6.1000242140625,2.3313953240625,6.1000242140625,2.0000244340625C6.1000242140625,1.6686535440624999,5.8313951140625,1.4000244140625,5.5000243140625,1.4000244140625L3.0000245140625,1.4000244140625Q2.3372827740625,1.4000244140625,1.8686535940625,1.8686535940625Q1.4000244140625,2.3372827740625,1.4000244140625,3.0000245140625L1.4000244140625,5.5000243140625C1.4000244140625,5.8313951140625,1.6686535440624999,6.1000242140625,2.0000244340625,6.1000242140625C2.3313953240625,6.1000242140625,2.6000244140625,5.8313951140625,2.6000244140625,5.5000243140625L2.6000244140625,3.0000245140625Q2.6000244140625,2.6000244140625,3.0000245140625,2.6000244140625ZM12.5000244140625,1.4000244140625L15.0000244140625,1.4000244140625Q15.6627664140625,1.4000244140625,16.1313954140625,1.8686538940625Q16.6000244140625,2.3372834940625,16.6000244140625,3.0000245140625L16.6000244140625,5.5000243140625C16.6000244140625,5.6591539140625,16.5368104140625,5.8117661140625,16.424288414062502,5.9242883140625C16.3117674140625,6.0368099140625,16.1591544140625,6.1000242140625,16.0000244140625,6.1000242140625C15.6686534140625,6.1000242140625,15.4000244140625,5.8313951140625,15.4000244140625,5.5000243140625L15.4000234140625,3.0000245140625Q15.4000234140625,2.6000244140625,15.0000244140625,2.6000244140625L12.5000244140625,2.6000244140625C12.1686534140625,2.6000244140625,11.9000244140625,2.3313953240625,11.9000244140625,2.0000244340625C11.9000244140625,1.6686535440624999,12.1686534140625,1.4000244140625,12.5000244140625,1.4000244140625ZM8.6239776140625,6.4719930140625C8.5439777140625,6.1512432140625,8.3999777140625,5.7421179140625,8.2479777140625,5.4212432140625L9.4959774140625,5.052368214062501C9.6959782140625,5.4293680140625,9.9199772140625,5.9346180140625,9.9999771140625,6.2714929140625L9.3519778140625,6.4719930140625L12.7119784140625,6.4719930140625L12.7119784140625,7.6079931140625L11.5039774140625,7.6079931140625C11.1279774140625,8.6968679140625,10.6159782140625,9.6014929140625,9.9599781140625,10.3461180140625C10.7599773140625,10.9224930140625,11.7279774140625,11.3468685140625,12.8879774140625,11.6029934140625C12.6239774140625,11.8592434140625,12.2799774140625,12.3716184140625,12.1039784140625,12.6918684140625C10.8719778140625,12.3716184140625,9.8719778140625,11.8752434140625,9.0479779140625,11.2107429140625C8.175977714062501,11.8992434140625,7.1199779140625,12.4036184140625,5.8559775140625,12.7558684140625C5.7279777140625,12.4757434140625,5.3759775140625,11.9312434140625,5.1519775140625,11.6591184140625C6.3759775140625,11.3868685140625,7.3839779140625,10.9706182140625,8.1839781140625,10.3781185140625C7.5199776140625,9.6094932140625,7.0079775140625,8.6888685140625,6.5919776140625,7.6079931140625L5.3279776140625,7.6079931140625L5.3279776140625,6.4719930140625L8.6239776140625,6.4719930140625ZM7.7999778140625,7.6079931140625C8.1119776140625,8.344617814062499,8.5359778140625,9.0011186140625,9.0719776140625,9.5694933140625C9.5439777140625,9.0251179140625,9.9199772140625,8.3766184140625,10.1919784140625,7.6079931140625L7.7999778140625,7.6079931140625ZM2.6000244140625,12.5000244140625L2.6000244140625,15.0000244140625Q2.6000244140625,15.4000234140625,3.0000245140625,15.4000234140625L5.5000243140625,15.4000234140625C5.8313951140625,15.4000244140625,6.1000242140625,15.6686534140625,6.1000242140625,16.0000244140625C6.1000242140625,16.3313964140625,5.8313951140625,16.6000254140625,5.5000243140625,16.6000254140625L5.4989548140625,16.6000244140625L3.0000245140625,16.6000244140625Q2.3372834940625,16.6000244140625,1.8686538940625,16.1313954140625Q1.4000244140625,15.6627664140625,1.4000244140625,15.0000244140625L1.4000244140625,12.5000244140625C1.4000244140625,12.1686534140625,1.6686535440624999,11.9000244140625,2.0000244340625,11.9000244140625C2.3313953240625,11.9000244140625,2.6000244140625,12.1686534140625,2.6000244140625,12.5000244140625ZM16.6000244140625,12.5010944140625L16.6000244140625,15.0000244140625Q16.6000244140625,15.6627654140625,16.1313954140625,16.1313954140625Q15.6627654140625,16.6000244140625,15.0000244140625,16.6000244140625L12.5000244140625,16.6000244140625C12.3408944140625,16.6000244140625,12.1882824140625,16.5368104140625,12.0757594140625,16.424288414062502C11.9632384140625,16.3117664140625,11.9000244140625,16.1591544140625,11.9000244140625,16.0000244140625C11.9000244140625,15.6686534140625,12.1686534140625,15.4000244140625,12.5000244140625,15.4000244140625L15.0000244140625,15.4000234140625Q15.4000234140625,15.4000234140625,15.4000234140625,15.0000244140625L15.4000234140625,12.5000244140625C15.4000244140625,12.1686534140625,15.6686534140625,11.9000244140625,16.0000244140625,11.9000244140625C16.3313964140625,11.9000244140625,16.6000254140625,12.1686534140625,16.6000254140625,12.5000244140625L16.6000244140625,12.5010944140625Z" fill-rule="evenodd" fill="#333333" fill-opacity="1"/></g></g></svg>',s.math='<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=m(),e.modules)if(Array.isArray(e.modules))for(const t of e.modules)c(`modules/${t.name}`,t.module);else c(`modules/${e.modules.name}`,e.modules.module);l=new r(a.value,n),C(e.content),l.on("text-change",Q),l.on("selection-change",b),l.on("editor-change",y),"bubble"!==e.theme&&a.value.classList.remove("ql-bubble"),"snow"!==e.theme&&a.value.classList.remove("ql-snow"),null===(i=l.getModule("toolbar"))||void 0===i||i.container.addEventListener("mousedown",(e=>{e.preventDefault()})),u(),t.emit("ready",l)},m=()=>{const o={};if(""!==e.theme&&(o.theme=e.theme),e.readOnly&&(o.readOnly=e.readOnly),e.placeholder&&(o.placeholder=e.placeholder),e.toolbar&&""!==e.toolbar&&(o.modules={toolbar:{container:[...d.full,["ocr"],[{math:!0}]],handlers:{ocr:function(){console.log("ocr"),t.emit("ocr")},math:function(){t.emit("math")}}}}),e.modules){const t=(()=>{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})();o.modules=Object.assign({},o.modules,t)}return Object.assign({},e.globalOptions,e.options,o)},p=e=>"object"==typeof e&&e?e.slice():e;let h;const v=e=>{if(typeof h==typeof e){if(e===h)return!0;if("object"==typeof e&&e&&"object"==typeof h&&h)return t=h.diff(e),!Object.values(t.ops).some((e=>!e.retain||1!==Object.keys(e).length))}var t;return!1},Q=(o,l,n)=>{h=p(L()),v(e.content)||t.emit("update:content",h),t.emit("textChange",{delta:o,oldContents:l,source:n})},f=o.ref(),b=(e,o,n)=>{var r;console.log("----------------------------------"),console.log(e),console.log(o),console.log(n),f.value=!!(null==l?void 0:l.hasFocus()),console.log(f.value),console.log("----------------------------------");const i=null===(r=null==l?void 0:l.getModule("toolbar"))||void 0===r?void 0:r.container;i&&(i.style.display=f.value?"flex":"none"),t.emit("selectionChange",{range:e,oldRange:o,source:n})};o.watch(f,(e=>{t.emit(e?"focus":"blur",a)}));const y=(...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]})},L=(t,o)=>"html"===e.contentType?M():"text"===e.contentType?x(t,o):null==l?void 0:l.getContents(t,o),C=(t,o="api")=>{const n=t||("delta"===e.contentType?new i:"");"html"===e.contentType?q(n):"text"===e.contentType?w(n,o):null==l||l.setContents(n,o),h=p(n)},x=(e,t)=>{var o;return null!==(o=null==l?void 0:l.getText(e,t))&&void 0!==o?o:""},w=(e,t="api")=>{null==l||l.setText(e,t)},M=()=>{var e;return null!==(e=null==l?void 0:l.root.innerHTML)&&void 0!==e?e:""},q=e=>{l&&(l.root.innerHTML=e)};return o.watch((()=>e.content),(e=>{if(!l||!e||v(e))return;const t=l.getSelection();t&&o.nextTick((()=>null==l?void 0:l.setSelection(t))),C(e)}),{deep:!0}),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:L,setContents:C,getHTML:M,setHTML:q,pasteHTML:(e,t="api")=>{const o=null==l?void 0:l.clipboard.convert(e);o&&(null==l||l.setContents(o,t))},focus:()=>{null==l||l.focus()},getText:x,setText:w,reinit:()=>{o.nextTick((()=>{var e;!t.slots.toolbar&&l&&(null===(e=l.getModule("toolbar"))||void 0===e||e.container.remove()),g()}))},editorWrapClass:s}},render(){var e,t;return[o.h("div",{class:this.editorWrapClass},[null===(t=(e=this.$slots).toolbar)||void 0===t?void 0:t.call(e),o.h("div",{ref:"editor",...this.$attrs})])]}});exports.Quill=r,exports.Delta=i,exports.QuillEditor=s;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Copyright (c) 2025 Pxx-Team
|
|
9
9
|
* Released under the MIT license
|
|
10
|
-
* Date: 2025-08-
|
|
10
|
+
* Date: 2025-08-25T01:50:19.065Z
|
|
11
11
|
*/
|
|
12
12
|
import { defineComponent, onMounted, onBeforeUnmount, ref, computed, watch, nextTick, h } from 'vue';
|
|
13
13
|
|
|
@@ -20063,11 +20063,6 @@ const QuillEditor = defineComponent({
|
|
|
20063
20063
|
let quill;
|
|
20064
20064
|
let options;
|
|
20065
20065
|
const editor = ref();
|
|
20066
|
-
const editorWrapStyle = computed(() => {
|
|
20067
|
-
return {
|
|
20068
|
-
minHeight: `${props.minHeight}px`,
|
|
20069
|
-
};
|
|
20070
|
-
});
|
|
20071
20066
|
const editorWrapClass = computed(() => {
|
|
20072
20067
|
return {
|
|
20073
20068
|
'quill-editor-container': true,
|
|
@@ -20076,6 +20071,21 @@ const QuillEditor = defineComponent({
|
|
|
20076
20071
|
'embedded': props.toolbarMode === 'embedded',
|
|
20077
20072
|
};
|
|
20078
20073
|
});
|
|
20074
|
+
// 监听 minHeight 变化,同步设置编辑器高度
|
|
20075
|
+
const updateEditorHeight = () => {
|
|
20076
|
+
if (quill && editor.value) {
|
|
20077
|
+
const editorElement = editor.value.querySelector('.ql-editor');
|
|
20078
|
+
if (editorElement) {
|
|
20079
|
+
editorElement.style.minHeight = `${props.minHeight}px`;
|
|
20080
|
+
}
|
|
20081
|
+
}
|
|
20082
|
+
};
|
|
20083
|
+
// 监听 minHeight 变化
|
|
20084
|
+
watch(() => props.minHeight, () => {
|
|
20085
|
+
nextTick(() => {
|
|
20086
|
+
updateEditorHeight();
|
|
20087
|
+
});
|
|
20088
|
+
});
|
|
20079
20089
|
// Register Module if not already registered
|
|
20080
20090
|
const registerModule = (moduleName, module) => {
|
|
20081
20091
|
// For Quill 1.x, we can't check if module is already registered
|
|
@@ -20127,6 +20137,8 @@ const QuillEditor = defineComponent({
|
|
|
20127
20137
|
.getModule('toolbar')) === null || _b === void 0 ? void 0 : _b.container.addEventListener('mousedown', (e) => {
|
|
20128
20138
|
e.preventDefault();
|
|
20129
20139
|
});
|
|
20140
|
+
// 设置初始编辑器高度
|
|
20141
|
+
updateEditorHeight();
|
|
20130
20142
|
// Emit ready event
|
|
20131
20143
|
ctx.emit('ready', quill);
|
|
20132
20144
|
};
|
|
@@ -20213,8 +20225,14 @@ const QuillEditor = defineComponent({
|
|
|
20213
20225
|
const isEditorFocus = ref();
|
|
20214
20226
|
const handleSelectionChange = (range, oldRange, source) => {
|
|
20215
20227
|
var _a;
|
|
20228
|
+
console.log("----------------------------------");
|
|
20229
|
+
console.log(range);
|
|
20230
|
+
console.log(oldRange);
|
|
20231
|
+
console.log(source);
|
|
20216
20232
|
// Set isEditorFocus if quill.hasFocus()
|
|
20217
20233
|
isEditorFocus.value = !!(quill === null || quill === void 0 ? void 0 : quill.hasFocus());
|
|
20234
|
+
console.log(isEditorFocus.value);
|
|
20235
|
+
console.log("----------------------------------");
|
|
20218
20236
|
// 动态显示/隐藏toolbar
|
|
20219
20237
|
const toolbar = (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
|
|
20220
20238
|
if (toolbar) {
|
|
@@ -20349,14 +20367,13 @@ const QuillEditor = defineComponent({
|
|
|
20349
20367
|
getText,
|
|
20350
20368
|
setText,
|
|
20351
20369
|
reinit,
|
|
20352
|
-
editorWrapStyle,
|
|
20353
20370
|
editorWrapClass,
|
|
20354
20371
|
};
|
|
20355
20372
|
},
|
|
20356
20373
|
render() {
|
|
20357
20374
|
var _a, _b;
|
|
20358
20375
|
return [
|
|
20359
|
-
h('div', { class: this.editorWrapClass
|
|
20376
|
+
h('div', { class: this.editorWrapClass }, [
|
|
20360
20377
|
(_b = (_a = this.$slots).toolbar) === null || _b === void 0 ? void 0 : _b.call(_a),
|
|
20361
20378
|
h('div', { ref: 'editor', ...this.$attrs }),
|
|
20362
20379
|
]),
|