pxx-vue-quill 1.0.94 → 1.0.96
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.umd.js +103 -19
- package/dist/vue-quill.umd.prod.js +2 -2
- package/package.json +1 -1
- package/dist/vue-quill.core.css +0 -391
- package/dist/vue-quill.core.prod.css +0 -1
- package/dist/vue-quill.extend.css +0 -225
- package/dist/vue-quill.extend.prod.css +0 -1
- package/dist/vue-quill.snow.css +0 -1142
- package/dist/vue-quill.snow.prod.css +0 -1
package/dist/vue-quill.umd.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-09-
|
|
10
|
+
* Date: 2025-09-09T02:28:36.927Z
|
|
11
11
|
*/
|
|
12
12
|
(function (global, factory) {
|
|
13
13
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
|
|
@@ -18468,6 +18468,14 @@
|
|
|
18468
18468
|
type: Boolean,
|
|
18469
18469
|
default: false,
|
|
18470
18470
|
},
|
|
18471
|
+
canUndo: {
|
|
18472
|
+
type: Boolean,
|
|
18473
|
+
default: false,
|
|
18474
|
+
},
|
|
18475
|
+
canRedo: {
|
|
18476
|
+
type: Boolean,
|
|
18477
|
+
default: false,
|
|
18478
|
+
},
|
|
18471
18479
|
},
|
|
18472
18480
|
emits: ['toolClick'],
|
|
18473
18481
|
setup(props, { emit }) {
|
|
@@ -18548,14 +18556,16 @@
|
|
|
18548
18556
|
]),
|
|
18549
18557
|
vue.h('span', { class: 'ql-formats' }, [
|
|
18550
18558
|
vue.h('button', {
|
|
18551
|
-
class: 'ql-undo',
|
|
18559
|
+
class: ['ql-undo', { 'ql-disabled': !props.canUndo }],
|
|
18552
18560
|
type: 'button',
|
|
18553
|
-
|
|
18561
|
+
disabled: !props.canUndo,
|
|
18562
|
+
onClick: () => props.canUndo && emit('toolClick', 'undo')
|
|
18554
18563
|
}, ''),
|
|
18555
18564
|
vue.h('button', {
|
|
18556
|
-
class: 'ql-redo',
|
|
18565
|
+
class: ['ql-redo', { 'ql-disabled': !props.canRedo }],
|
|
18557
18566
|
type: 'button',
|
|
18558
|
-
|
|
18567
|
+
disabled: !props.canRedo,
|
|
18568
|
+
onClick: () => props.canRedo && emit('toolClick', 'redo')
|
|
18559
18569
|
}, '')
|
|
18560
18570
|
]),
|
|
18561
18571
|
vue.h('span', { class: 'ql-formats' }, [
|
|
@@ -20087,7 +20097,8 @@
|
|
|
20087
20097
|
|
|
20088
20098
|
var BlotFormatter = /*@__PURE__*/getDefaultExportFromCjs(dist);
|
|
20089
20099
|
|
|
20090
|
-
|
|
20100
|
+
let isBlotFormatterRegistered = false;
|
|
20101
|
+
function useBlotFormatter(editor, enableImageResize = true) {
|
|
20091
20102
|
const quillRef = vue.ref(null);
|
|
20092
20103
|
const removeQuillBlotFormatter = () => {
|
|
20093
20104
|
var _a;
|
|
@@ -20185,10 +20196,13 @@
|
|
|
20185
20196
|
}
|
|
20186
20197
|
};
|
|
20187
20198
|
const registerBlotFormatter = () => {
|
|
20188
|
-
|
|
20199
|
+
if (!enableImageResize) {
|
|
20200
|
+
return;
|
|
20201
|
+
}
|
|
20189
20202
|
try {
|
|
20190
|
-
if (!
|
|
20203
|
+
if (!isBlotFormatterRegistered) {
|
|
20191
20204
|
Quill.register('modules/blotFormatter', BlotFormatter);
|
|
20205
|
+
isBlotFormatterRegistered = true;
|
|
20192
20206
|
}
|
|
20193
20207
|
}
|
|
20194
20208
|
catch (error) {
|
|
@@ -20196,7 +20210,12 @@
|
|
|
20196
20210
|
}
|
|
20197
20211
|
};
|
|
20198
20212
|
const getBlotFormatterConfig = () => {
|
|
20199
|
-
|
|
20213
|
+
if (!enableImageResize) {
|
|
20214
|
+
return {};
|
|
20215
|
+
}
|
|
20216
|
+
return {
|
|
20217
|
+
blotFormatter: {}
|
|
20218
|
+
};
|
|
20200
20219
|
};
|
|
20201
20220
|
vue.onMounted(() => {
|
|
20202
20221
|
window.addEventListener('click', handleGlobalClick, true);
|
|
@@ -20275,6 +20294,10 @@
|
|
|
20275
20294
|
type: Boolean,
|
|
20276
20295
|
default: false,
|
|
20277
20296
|
},
|
|
20297
|
+
enableImageResize: {
|
|
20298
|
+
type: Boolean,
|
|
20299
|
+
default: true,
|
|
20300
|
+
},
|
|
20278
20301
|
toolbarStyle: {
|
|
20279
20302
|
type: Object,
|
|
20280
20303
|
required: false,
|
|
@@ -20310,7 +20333,9 @@
|
|
|
20310
20333
|
setup: (props, ctx) => {
|
|
20311
20334
|
const editor = vue.ref();
|
|
20312
20335
|
const showMoreToolbar = vue.ref(false);
|
|
20313
|
-
const
|
|
20336
|
+
const canUndo = vue.ref(false);
|
|
20337
|
+
const canRedo = vue.ref(false);
|
|
20338
|
+
const { setQuill, removeQuillBlotFormatter, configureBlotFormatter, applyImageStyle, registerBlotFormatter, getBlotFormatterConfig } = useBlotFormatter(editor, props.enableImageResize);
|
|
20314
20339
|
vue.onMounted(() => {
|
|
20315
20340
|
initialize();
|
|
20316
20341
|
});
|
|
@@ -20366,11 +20391,51 @@
|
|
|
20366
20391
|
console.warn('设置图标时出错:', error);
|
|
20367
20392
|
}
|
|
20368
20393
|
};
|
|
20394
|
+
const updateHistoryState = () => {
|
|
20395
|
+
if (quill) {
|
|
20396
|
+
const history = quill.getModule('history');
|
|
20397
|
+
if (history) {
|
|
20398
|
+
canUndo.value = history.stack.undo.length > 0;
|
|
20399
|
+
canRedo.value = history.stack.redo.length > 0;
|
|
20400
|
+
updateToolbarButtonStyles();
|
|
20401
|
+
}
|
|
20402
|
+
}
|
|
20403
|
+
};
|
|
20404
|
+
const updateToolbarButtonStyles = () => {
|
|
20405
|
+
var _a;
|
|
20406
|
+
if (!quill)
|
|
20407
|
+
return;
|
|
20408
|
+
const toolbar = (_a = quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
|
|
20409
|
+
if (toolbar) {
|
|
20410
|
+
const undoBtn = toolbar.querySelector('.ql-undo');
|
|
20411
|
+
const redoBtn = toolbar.querySelector('.ql-redo');
|
|
20412
|
+
if (undoBtn) {
|
|
20413
|
+
if (canUndo.value) {
|
|
20414
|
+
undoBtn.classList.remove('ql-disabled');
|
|
20415
|
+
}
|
|
20416
|
+
else {
|
|
20417
|
+
undoBtn.classList.add('ql-disabled');
|
|
20418
|
+
}
|
|
20419
|
+
undoBtn.disabled = !canUndo.value;
|
|
20420
|
+
}
|
|
20421
|
+
if (redoBtn) {
|
|
20422
|
+
if (canRedo.value) {
|
|
20423
|
+
redoBtn.classList.remove('ql-disabled');
|
|
20424
|
+
}
|
|
20425
|
+
else {
|
|
20426
|
+
redoBtn.classList.add('ql-disabled');
|
|
20427
|
+
}
|
|
20428
|
+
redoBtn.disabled = !canRedo.value;
|
|
20429
|
+
}
|
|
20430
|
+
}
|
|
20431
|
+
};
|
|
20369
20432
|
const initialize = () => {
|
|
20370
20433
|
var _a, _b;
|
|
20371
20434
|
if (!editor.value)
|
|
20372
20435
|
return;
|
|
20373
|
-
|
|
20436
|
+
if (props.enableImageResize) {
|
|
20437
|
+
registerBlotFormatter();
|
|
20438
|
+
}
|
|
20374
20439
|
options = composeOptions();
|
|
20375
20440
|
setIcons();
|
|
20376
20441
|
quill = new Quill(editor.value, options);
|
|
@@ -20383,6 +20448,9 @@
|
|
|
20383
20448
|
quill.on('text-change', handleTextChange);
|
|
20384
20449
|
quill.on('selection-change', handleSelectionChange);
|
|
20385
20450
|
quill.on('editor-change', handleEditorChange);
|
|
20451
|
+
quill.on('text-change', updateHistoryState);
|
|
20452
|
+
quill.on('selection-change', updateHistoryState);
|
|
20453
|
+
updateHistoryState();
|
|
20386
20454
|
const toolbarDom = (_b = quill.getModule('toolbar')) === null || _b === void 0 ? void 0 : _b.container;
|
|
20387
20455
|
toolbarDom.addEventListener('mousedown', (e) => {
|
|
20388
20456
|
e.preventDefault();
|
|
@@ -20397,7 +20465,9 @@
|
|
|
20397
20465
|
applyToolbarStyle();
|
|
20398
20466
|
}
|
|
20399
20467
|
applyEditorStyle();
|
|
20400
|
-
|
|
20468
|
+
if (props.enableImageResize) {
|
|
20469
|
+
configureBlotFormatter();
|
|
20470
|
+
}
|
|
20401
20471
|
ctx.emit('ready', quill);
|
|
20402
20472
|
};
|
|
20403
20473
|
const composeOptions = () => {
|
|
@@ -20421,11 +20491,15 @@
|
|
|
20421
20491
|
handlers: {
|
|
20422
20492
|
redo: function () {
|
|
20423
20493
|
var _a;
|
|
20424
|
-
(
|
|
20494
|
+
if (canRedo.value) {
|
|
20495
|
+
(_a = quill === null || quill === void 0 ? void 0 : quill.getModule('history')) === null || _a === void 0 ? void 0 : _a.redo();
|
|
20496
|
+
}
|
|
20425
20497
|
},
|
|
20426
20498
|
undo: function () {
|
|
20427
20499
|
var _a;
|
|
20428
|
-
(
|
|
20500
|
+
if (canUndo.value) {
|
|
20501
|
+
(_a = quill === null || quill === void 0 ? void 0 : quill.getModule('history')) === null || _a === void 0 ? void 0 : _a.undo();
|
|
20502
|
+
}
|
|
20429
20503
|
},
|
|
20430
20504
|
ocr: function () {
|
|
20431
20505
|
ctx.emit('ocr');
|
|
@@ -20440,9 +20514,11 @@
|
|
|
20440
20514
|
},
|
|
20441
20515
|
};
|
|
20442
20516
|
}
|
|
20443
|
-
|
|
20444
|
-
|
|
20445
|
-
|
|
20517
|
+
if (props.enableImageResize) {
|
|
20518
|
+
const blotFormatterConfig = getBlotFormatterConfig();
|
|
20519
|
+
if (Object.keys(blotFormatterConfig).length > 0) {
|
|
20520
|
+
clientOptions.modules = Object.assign({}, clientOptions.modules, blotFormatterConfig);
|
|
20521
|
+
}
|
|
20446
20522
|
}
|
|
20447
20523
|
return Object.assign({}, props.globalOptions, props.options, clientOptions);
|
|
20448
20524
|
};
|
|
@@ -20617,10 +20693,14 @@
|
|
|
20617
20693
|
if (!quill)
|
|
20618
20694
|
return;
|
|
20619
20695
|
if (tool === 'undo') {
|
|
20620
|
-
(
|
|
20696
|
+
if (canUndo.value) {
|
|
20697
|
+
(_a = quill.getModule('history')) === null || _a === void 0 ? void 0 : _a.undo();
|
|
20698
|
+
}
|
|
20621
20699
|
}
|
|
20622
20700
|
else if (tool === 'redo') {
|
|
20623
|
-
(
|
|
20701
|
+
if (canRedo.value) {
|
|
20702
|
+
(_b = quill.getModule('history')) === null || _b === void 0 ? void 0 : _b.redo();
|
|
20703
|
+
}
|
|
20624
20704
|
}
|
|
20625
20705
|
else if (tool === 'ocr') {
|
|
20626
20706
|
ctx.emit('ocr');
|
|
@@ -20649,6 +20729,8 @@
|
|
|
20649
20729
|
editor,
|
|
20650
20730
|
editorWrapClass,
|
|
20651
20731
|
showMoreToolbar,
|
|
20732
|
+
canUndo,
|
|
20733
|
+
canRedo,
|
|
20652
20734
|
getEditor,
|
|
20653
20735
|
getToolbar,
|
|
20654
20736
|
getQuill,
|
|
@@ -20672,6 +20754,8 @@
|
|
|
20672
20754
|
needCollapse: this.needCollapse,
|
|
20673
20755
|
toolbarStyle: this.$props.toolbarStyle,
|
|
20674
20756
|
showMoreToolbar: this.showMoreToolbar,
|
|
20757
|
+
canUndo: this.canUndo,
|
|
20758
|
+
canRedo: this.canRedo,
|
|
20675
20759
|
onToolClick: (tool) => {
|
|
20676
20760
|
this.moreToolbarToolClick(tool);
|
|
20677
20761
|
}
|