@deot/vc 1.0.54 → 1.0.56
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/index.d.ts +40 -4
- package/dist/index.iife.js +68 -49
- package/dist/index.umd.cjs +68 -49
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -4110,10 +4110,18 @@ export declare const Components: {
|
|
|
4110
4110
|
crossOrigin: {
|
|
4111
4111
|
type: StringConstructor;
|
|
4112
4112
|
default: string;
|
|
4113
|
-
validator: (v:
|
|
4113
|
+
validator: (v: string) => boolean;
|
|
4114
4114
|
};
|
|
4115
4115
|
source: FunctionConstructor;
|
|
4116
4116
|
download: FunctionConstructor;
|
|
4117
|
+
lazy: {
|
|
4118
|
+
type: BooleanConstructor;
|
|
4119
|
+
default: boolean;
|
|
4120
|
+
};
|
|
4121
|
+
showLoading: {
|
|
4122
|
+
type: BooleanConstructor;
|
|
4123
|
+
default: boolean;
|
|
4124
|
+
};
|
|
4117
4125
|
options: {
|
|
4118
4126
|
type: ObjectConstructor;
|
|
4119
4127
|
default: () => {};
|
|
@@ -4126,10 +4134,18 @@ export declare const Components: {
|
|
|
4126
4134
|
crossOrigin: {
|
|
4127
4135
|
type: StringConstructor;
|
|
4128
4136
|
default: string;
|
|
4129
|
-
validator: (v:
|
|
4137
|
+
validator: (v: string) => boolean;
|
|
4130
4138
|
};
|
|
4131
4139
|
source: FunctionConstructor;
|
|
4132
4140
|
download: FunctionConstructor;
|
|
4141
|
+
lazy: {
|
|
4142
|
+
type: BooleanConstructor;
|
|
4143
|
+
default: boolean;
|
|
4144
|
+
};
|
|
4145
|
+
showLoading: {
|
|
4146
|
+
type: BooleanConstructor;
|
|
4147
|
+
default: boolean;
|
|
4148
|
+
};
|
|
4133
4149
|
options: {
|
|
4134
4150
|
type: ObjectConstructor;
|
|
4135
4151
|
default: () => {};
|
|
@@ -4139,7 +4155,9 @@ export declare const Components: {
|
|
|
4139
4155
|
}>, {
|
|
4140
4156
|
tag: string;
|
|
4141
4157
|
options: Record<string, any>;
|
|
4158
|
+
showLoading: boolean;
|
|
4142
4159
|
crossOrigin: string;
|
|
4160
|
+
lazy: boolean;
|
|
4143
4161
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
4144
4162
|
MSnapshot: DefineComponent<ExtractPropTypes< {
|
|
4145
4163
|
tag: {
|
|
@@ -4149,10 +4167,18 @@ export declare const Components: {
|
|
|
4149
4167
|
crossOrigin: {
|
|
4150
4168
|
type: StringConstructor;
|
|
4151
4169
|
default: string;
|
|
4152
|
-
validator: (v:
|
|
4170
|
+
validator: (v: string) => boolean;
|
|
4153
4171
|
};
|
|
4154
4172
|
source: FunctionConstructor;
|
|
4155
4173
|
download: FunctionConstructor;
|
|
4174
|
+
lazy: {
|
|
4175
|
+
type: BooleanConstructor;
|
|
4176
|
+
default: boolean;
|
|
4177
|
+
};
|
|
4178
|
+
showLoading: {
|
|
4179
|
+
type: BooleanConstructor;
|
|
4180
|
+
default: boolean;
|
|
4181
|
+
};
|
|
4156
4182
|
options: {
|
|
4157
4183
|
type: ObjectConstructor;
|
|
4158
4184
|
default: () => {};
|
|
@@ -4165,10 +4191,18 @@ export declare const Components: {
|
|
|
4165
4191
|
crossOrigin: {
|
|
4166
4192
|
type: StringConstructor;
|
|
4167
4193
|
default: string;
|
|
4168
|
-
validator: (v:
|
|
4194
|
+
validator: (v: string) => boolean;
|
|
4169
4195
|
};
|
|
4170
4196
|
source: FunctionConstructor;
|
|
4171
4197
|
download: FunctionConstructor;
|
|
4198
|
+
lazy: {
|
|
4199
|
+
type: BooleanConstructor;
|
|
4200
|
+
default: boolean;
|
|
4201
|
+
};
|
|
4202
|
+
showLoading: {
|
|
4203
|
+
type: BooleanConstructor;
|
|
4204
|
+
default: boolean;
|
|
4205
|
+
};
|
|
4172
4206
|
options: {
|
|
4173
4207
|
type: ObjectConstructor;
|
|
4174
4208
|
default: () => {};
|
|
@@ -4178,7 +4212,9 @@ export declare const Components: {
|
|
|
4178
4212
|
}>, {
|
|
4179
4213
|
tag: string;
|
|
4180
4214
|
options: Record<string, any>;
|
|
4215
|
+
showLoading: boolean;
|
|
4181
4216
|
crossOrigin: string;
|
|
4217
|
+
lazy: boolean;
|
|
4182
4218
|
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
|
|
4183
4219
|
Icon: DefineComponent<ExtractPropTypes< {
|
|
4184
4220
|
type: StringConstructor;
|
package/dist/index.iife.js
CHANGED
|
@@ -9104,6 +9104,7 @@ var Vc = (function (exports, vue) {
|
|
|
9104
9104
|
line: nil
|
|
9105
9105
|
},
|
|
9106
9106
|
Snapshot: {
|
|
9107
|
+
options: nil,
|
|
9107
9108
|
source: nil,
|
|
9108
9109
|
download: nil
|
|
9109
9110
|
}
|
|
@@ -18573,23 +18574,16 @@ var Vc = (function (exports, vue) {
|
|
|
18573
18574
|
.ql-snow .ql-font-size.ql-picker .ql-picker-label[data-value="${fontSize}"]:before {
|
|
18574
18575
|
content: "${fontSize}"
|
|
18575
18576
|
}`;
|
|
18576
|
-
pre += `.ql-editor .ql-font-size-${fontSize} {
|
|
18577
|
-
font-size: ${fontSize};
|
|
18578
|
-
}`;
|
|
18579
18577
|
return pre;
|
|
18580
18578
|
}, "");
|
|
18581
18579
|
return style(code, { id });
|
|
18582
18580
|
};
|
|
18583
18581
|
const insertLineHeightStyle = (value, id) => {
|
|
18584
18582
|
const code = value.reduce((pre, lineHeight) => {
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
.ql-snow .ql-line-height.ql-picker .ql-picker-label[data-value="${classLineHeightValue}"]:before {
|
|
18583
|
+
pre += `.ql-snow .ql-line-height.ql-picker .ql-picker-item[data-value="${lineHeight}"]:before,
|
|
18584
|
+
.ql-snow .ql-line-height.ql-picker .ql-picker-label[data-value="${lineHeight}"]:before {
|
|
18588
18585
|
content: "${+lineHeight}"
|
|
18589
18586
|
}`;
|
|
18590
|
-
pre += `.ql-editor .ql-line-height-${classLineHeightValue} {
|
|
18591
|
-
line-height: ${+lineHeight};
|
|
18592
|
-
}`;
|
|
18593
18587
|
return pre;
|
|
18594
18588
|
}, "");
|
|
18595
18589
|
return style(code, { id });
|
|
@@ -18600,9 +18594,6 @@ var Vc = (function (exports, vue) {
|
|
|
18600
18594
|
.ql-snow .ql-letter-spacing.ql-picker .ql-picker-label[data-value="${letterSpacing}"]:before {
|
|
18601
18595
|
content: "${letterSpacing}"
|
|
18602
18596
|
}`;
|
|
18603
|
-
pre += `.ql-editor .ql-letter-spacing-${letterSpacing} {
|
|
18604
|
-
letter-spacing: ${letterSpacing};
|
|
18605
|
-
}`;
|
|
18606
18597
|
return pre;
|
|
18607
18598
|
}, "");
|
|
18608
18599
|
return style(code, { id });
|
|
@@ -18786,9 +18777,8 @@ var Vc = (function (exports, vue) {
|
|
|
18786
18777
|
"selected": true
|
|
18787
18778
|
}, null);
|
|
18788
18779
|
}
|
|
18789
|
-
const v = key === "line-height" ? +it * 10 : it;
|
|
18790
18780
|
return vue.createVNode("option", {
|
|
18791
|
-
"value": `${
|
|
18781
|
+
"value": `${it}`
|
|
18792
18782
|
}, null);
|
|
18793
18783
|
})]);
|
|
18794
18784
|
}
|
|
@@ -18801,16 +18791,18 @@ var Vc = (function (exports, vue) {
|
|
|
18801
18791
|
if (Array.isArray(item)) {
|
|
18802
18792
|
return insertStyle(item);
|
|
18803
18793
|
}
|
|
18794
|
+
let key = item;
|
|
18795
|
+
let value = [];
|
|
18804
18796
|
if (typeof item === "object") {
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18797
|
+
[key, value] = Object.entries(item)[0];
|
|
18798
|
+
}
|
|
18799
|
+
value = value.length && value || toolbarDefaultsMap[key];
|
|
18800
|
+
if (key === "font-size" && Array.isArray(value)) {
|
|
18801
|
+
insertFontSizeStyle(value, styleId);
|
|
18802
|
+
} else if (key === "line-height") {
|
|
18803
|
+
insertLineHeightStyle(value, lineHeightStyleId);
|
|
18804
|
+
} else if (key === "letter-spacing") {
|
|
18805
|
+
insertLetterSpacingStyle(value, letterSpacingStyleId);
|
|
18814
18806
|
}
|
|
18815
18807
|
});
|
|
18816
18808
|
};
|
|
@@ -18888,20 +18880,19 @@ var Vc = (function (exports, vue) {
|
|
|
18888
18880
|
};
|
|
18889
18881
|
const registerLineHeight = (quillInstance) => {
|
|
18890
18882
|
const lineHeight = toolbarDefaultsMap["line-height"];
|
|
18891
|
-
const whitelist = lineHeight.map((i) => String(+i * 10));
|
|
18892
18883
|
const Parchment = quillInstance.import("parchment");
|
|
18893
|
-
const lineHeightStyle = new Parchment.
|
|
18884
|
+
const lineHeightStyle = new Parchment.StyleAttributor(
|
|
18885
|
+
"line-height",
|
|
18894
18886
|
"line-height",
|
|
18895
|
-
|
|
18896
|
-
{ scope: Parchment.Scope.INLINE, whitelist }
|
|
18887
|
+
{ scope: Parchment.Scope.INLINE, whitelist: lineHeight }
|
|
18897
18888
|
);
|
|
18898
18889
|
quillInstance.register({ "formats/line-height": lineHeightStyle }, true);
|
|
18899
18890
|
};
|
|
18900
18891
|
const registerLetterSpacing = (quillInstance) => {
|
|
18901
18892
|
const Parchment = quillInstance.import("parchment");
|
|
18902
|
-
const letterSpacingStyle = new Parchment.
|
|
18893
|
+
const letterSpacingStyle = new Parchment.StyleAttributor(
|
|
18894
|
+
"letter-spacing",
|
|
18903
18895
|
"letter-spacing",
|
|
18904
|
-
"ql-letter-spacing",
|
|
18905
18896
|
{
|
|
18906
18897
|
scope: Parchment.Scope.INLINE,
|
|
18907
18898
|
whitelist: toolbarDefaultsMap["letter-spacing"]
|
|
@@ -19570,18 +19561,12 @@ var Vc = (function (exports, vue) {
|
|
|
19570
19561
|
const registerFontSize = (editor) => {
|
|
19571
19562
|
const Parchment = editor.import("parchment");
|
|
19572
19563
|
const fontSize = toolbarDefaultsMap["font-size"];
|
|
19573
|
-
const SizeClass = new Parchment.ClassAttributor("font-size", "ql-font-size", {
|
|
19574
|
-
scope: Parchment.Scope.INLINE,
|
|
19575
|
-
whitelist: fontSize
|
|
19576
|
-
});
|
|
19577
19564
|
const SizeStyle = new Parchment.StyleAttributor("font-size", "font-size", {
|
|
19578
19565
|
scope: Parchment.Scope.INLINE,
|
|
19579
19566
|
whitelist: fontSize
|
|
19580
19567
|
});
|
|
19581
19568
|
editor.register({
|
|
19582
|
-
"formats/font-size":
|
|
19583
|
-
"attributors/class/font-size": SizeClass,
|
|
19584
|
-
"attributors/style/font-size": SizeStyle
|
|
19569
|
+
"formats/font-size": SizeStyle
|
|
19585
19570
|
}, true);
|
|
19586
19571
|
};
|
|
19587
19572
|
const registerExtends = (e) => {
|
|
@@ -19634,6 +19619,7 @@ var Vc = (function (exports, vue) {
|
|
|
19634
19619
|
const Editor$1 = /* @__PURE__ */ vue.defineComponent({
|
|
19635
19620
|
name: COMPONENT_NAME$14,
|
|
19636
19621
|
props: props$M,
|
|
19622
|
+
defaults: defaults$3,
|
|
19637
19623
|
emits: ["ready", "blur", "focus", "input", "update:modelValue", "change"],
|
|
19638
19624
|
setup(props2, {
|
|
19639
19625
|
slots,
|
|
@@ -20557,6 +20543,14 @@ var Vc = (function (exports, vue) {
|
|
|
20557
20543
|
},
|
|
20558
20544
|
source: Function,
|
|
20559
20545
|
download: Function,
|
|
20546
|
+
lazy: {
|
|
20547
|
+
type: Boolean,
|
|
20548
|
+
default: true
|
|
20549
|
+
},
|
|
20550
|
+
showLoading: {
|
|
20551
|
+
type: Boolean,
|
|
20552
|
+
default: true
|
|
20553
|
+
},
|
|
20560
20554
|
// 传递给snap-dom的配置项
|
|
20561
20555
|
options: {
|
|
20562
20556
|
type: Object,
|
|
@@ -20576,34 +20570,59 @@ var Vc = (function (exports, vue) {
|
|
|
20576
20570
|
let snapDOM;
|
|
20577
20571
|
const instance = vue.getCurrentInstance();
|
|
20578
20572
|
const current = vue.ref();
|
|
20579
|
-
const
|
|
20573
|
+
const snapshot = vue.ref();
|
|
20580
20574
|
const refresh = async () => {
|
|
20581
20575
|
await vue.nextTick();
|
|
20582
|
-
|
|
20583
|
-
|
|
20576
|
+
snapshot.value = await snapDOM(current.value, {
|
|
20577
|
+
fast: false,
|
|
20578
|
+
// dom太大时会卡死一会儿
|
|
20579
|
+
...VcInstance.options.Snapshot?.options,
|
|
20580
|
+
...props2.options
|
|
20581
|
+
});
|
|
20582
|
+
return snapshot.value;
|
|
20583
|
+
};
|
|
20584
|
+
const onLoad = () => {
|
|
20585
|
+
return props2.showLoading && Message.loading("正在生成...");
|
|
20586
|
+
};
|
|
20587
|
+
const onLoaded = (ctx) => {
|
|
20588
|
+
ctx?.destroy?.();
|
|
20584
20589
|
};
|
|
20585
20590
|
const toDataURL = async () => {
|
|
20591
|
+
const loadContext = onLoad();
|
|
20592
|
+
try {
|
|
20593
|
+
await refresh();
|
|
20594
|
+
return snapshot.value.toRaw();
|
|
20595
|
+
} finally {
|
|
20596
|
+
onLoaded(loadContext);
|
|
20597
|
+
}
|
|
20598
|
+
};
|
|
20599
|
+
const downloadByDefault = async (options) => {
|
|
20586
20600
|
await refresh();
|
|
20587
|
-
return
|
|
20601
|
+
return snapshot.value.download(options);
|
|
20588
20602
|
};
|
|
20589
20603
|
const download = async (options) => {
|
|
20590
|
-
|
|
20591
|
-
const
|
|
20592
|
-
const skip =
|
|
20604
|
+
const loadContext = onLoad();
|
|
20605
|
+
const downloadByUser = props2.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
20606
|
+
const skip = downloadByUser(instance, options);
|
|
20607
|
+
const done = async (v) => {
|
|
20608
|
+
try {
|
|
20609
|
+
v || await downloadByDefault(options);
|
|
20610
|
+
} finally {
|
|
20611
|
+
onLoaded(loadContext);
|
|
20612
|
+
}
|
|
20613
|
+
};
|
|
20593
20614
|
if (skip && skip.then) {
|
|
20594
20615
|
let skip$ = false;
|
|
20595
20616
|
skip.then((v) => {
|
|
20596
20617
|
skip$ = typeof v === "undefined" ? true : !!v;
|
|
20597
20618
|
return v;
|
|
20598
|
-
}).finally(() =>
|
|
20599
|
-
skip$ || snapdom.value.download(options);
|
|
20600
|
-
});
|
|
20619
|
+
}).finally(() => done(skip$));
|
|
20601
20620
|
return;
|
|
20602
20621
|
}
|
|
20603
|
-
skip
|
|
20622
|
+
done(skip);
|
|
20604
20623
|
};
|
|
20605
20624
|
expose({
|
|
20606
|
-
|
|
20625
|
+
snapshot,
|
|
20607
20626
|
refresh,
|
|
20608
20627
|
toDataURL,
|
|
20609
20628
|
download
|
|
@@ -20612,7 +20631,7 @@ var Vc = (function (exports, vue) {
|
|
|
20612
20631
|
try {
|
|
20613
20632
|
snapDOM = window.snapdom || await Promise.resolve().then(() => snapdom$1);
|
|
20614
20633
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
20615
|
-
await refresh();
|
|
20634
|
+
!props2.lazy && await refresh();
|
|
20616
20635
|
emit("ready", {
|
|
20617
20636
|
instance,
|
|
20618
20637
|
dependencies: {
|
package/dist/index.umd.cjs
CHANGED
|
@@ -9107,6 +9107,7 @@
|
|
|
9107
9107
|
line: nil
|
|
9108
9108
|
},
|
|
9109
9109
|
Snapshot: {
|
|
9110
|
+
options: nil,
|
|
9110
9111
|
source: nil,
|
|
9111
9112
|
download: nil
|
|
9112
9113
|
}
|
|
@@ -18576,23 +18577,16 @@
|
|
|
18576
18577
|
.ql-snow .ql-font-size.ql-picker .ql-picker-label[data-value="${fontSize}"]:before {
|
|
18577
18578
|
content: "${fontSize}"
|
|
18578
18579
|
}`;
|
|
18579
|
-
pre += `.ql-editor .ql-font-size-${fontSize} {
|
|
18580
|
-
font-size: ${fontSize};
|
|
18581
|
-
}`;
|
|
18582
18580
|
return pre;
|
|
18583
18581
|
}, "");
|
|
18584
18582
|
return style(code, { id });
|
|
18585
18583
|
};
|
|
18586
18584
|
const insertLineHeightStyle = (value, id) => {
|
|
18587
18585
|
const code = value.reduce((pre, lineHeight) => {
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
.ql-snow .ql-line-height.ql-picker .ql-picker-label[data-value="${classLineHeightValue}"]:before {
|
|
18586
|
+
pre += `.ql-snow .ql-line-height.ql-picker .ql-picker-item[data-value="${lineHeight}"]:before,
|
|
18587
|
+
.ql-snow .ql-line-height.ql-picker .ql-picker-label[data-value="${lineHeight}"]:before {
|
|
18591
18588
|
content: "${+lineHeight}"
|
|
18592
18589
|
}`;
|
|
18593
|
-
pre += `.ql-editor .ql-line-height-${classLineHeightValue} {
|
|
18594
|
-
line-height: ${+lineHeight};
|
|
18595
|
-
}`;
|
|
18596
18590
|
return pre;
|
|
18597
18591
|
}, "");
|
|
18598
18592
|
return style(code, { id });
|
|
@@ -18603,9 +18597,6 @@
|
|
|
18603
18597
|
.ql-snow .ql-letter-spacing.ql-picker .ql-picker-label[data-value="${letterSpacing}"]:before {
|
|
18604
18598
|
content: "${letterSpacing}"
|
|
18605
18599
|
}`;
|
|
18606
|
-
pre += `.ql-editor .ql-letter-spacing-${letterSpacing} {
|
|
18607
|
-
letter-spacing: ${letterSpacing};
|
|
18608
|
-
}`;
|
|
18609
18600
|
return pre;
|
|
18610
18601
|
}, "");
|
|
18611
18602
|
return style(code, { id });
|
|
@@ -18789,9 +18780,8 @@
|
|
|
18789
18780
|
"selected": true
|
|
18790
18781
|
}, null);
|
|
18791
18782
|
}
|
|
18792
|
-
const v = key === "line-height" ? +it * 10 : it;
|
|
18793
18783
|
return vue.createVNode("option", {
|
|
18794
|
-
"value": `${
|
|
18784
|
+
"value": `${it}`
|
|
18795
18785
|
}, null);
|
|
18796
18786
|
})]);
|
|
18797
18787
|
}
|
|
@@ -18804,16 +18794,18 @@
|
|
|
18804
18794
|
if (Array.isArray(item)) {
|
|
18805
18795
|
return insertStyle(item);
|
|
18806
18796
|
}
|
|
18797
|
+
let key = item;
|
|
18798
|
+
let value = [];
|
|
18807
18799
|
if (typeof item === "object") {
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
|
|
18816
|
-
|
|
18800
|
+
[key, value] = Object.entries(item)[0];
|
|
18801
|
+
}
|
|
18802
|
+
value = value.length && value || toolbarDefaultsMap[key];
|
|
18803
|
+
if (key === "font-size" && Array.isArray(value)) {
|
|
18804
|
+
insertFontSizeStyle(value, styleId);
|
|
18805
|
+
} else if (key === "line-height") {
|
|
18806
|
+
insertLineHeightStyle(value, lineHeightStyleId);
|
|
18807
|
+
} else if (key === "letter-spacing") {
|
|
18808
|
+
insertLetterSpacingStyle(value, letterSpacingStyleId);
|
|
18817
18809
|
}
|
|
18818
18810
|
});
|
|
18819
18811
|
};
|
|
@@ -18891,20 +18883,19 @@
|
|
|
18891
18883
|
};
|
|
18892
18884
|
const registerLineHeight = (quillInstance) => {
|
|
18893
18885
|
const lineHeight = toolbarDefaultsMap["line-height"];
|
|
18894
|
-
const whitelist = lineHeight.map((i) => String(+i * 10));
|
|
18895
18886
|
const Parchment = quillInstance.import("parchment");
|
|
18896
|
-
const lineHeightStyle = new Parchment.
|
|
18887
|
+
const lineHeightStyle = new Parchment.StyleAttributor(
|
|
18888
|
+
"line-height",
|
|
18897
18889
|
"line-height",
|
|
18898
|
-
|
|
18899
|
-
{ scope: Parchment.Scope.INLINE, whitelist }
|
|
18890
|
+
{ scope: Parchment.Scope.INLINE, whitelist: lineHeight }
|
|
18900
18891
|
);
|
|
18901
18892
|
quillInstance.register({ "formats/line-height": lineHeightStyle }, true);
|
|
18902
18893
|
};
|
|
18903
18894
|
const registerLetterSpacing = (quillInstance) => {
|
|
18904
18895
|
const Parchment = quillInstance.import("parchment");
|
|
18905
|
-
const letterSpacingStyle = new Parchment.
|
|
18896
|
+
const letterSpacingStyle = new Parchment.StyleAttributor(
|
|
18897
|
+
"letter-spacing",
|
|
18906
18898
|
"letter-spacing",
|
|
18907
|
-
"ql-letter-spacing",
|
|
18908
18899
|
{
|
|
18909
18900
|
scope: Parchment.Scope.INLINE,
|
|
18910
18901
|
whitelist: toolbarDefaultsMap["letter-spacing"]
|
|
@@ -19573,18 +19564,12 @@
|
|
|
19573
19564
|
const registerFontSize = (editor) => {
|
|
19574
19565
|
const Parchment = editor.import("parchment");
|
|
19575
19566
|
const fontSize = toolbarDefaultsMap["font-size"];
|
|
19576
|
-
const SizeClass = new Parchment.ClassAttributor("font-size", "ql-font-size", {
|
|
19577
|
-
scope: Parchment.Scope.INLINE,
|
|
19578
|
-
whitelist: fontSize
|
|
19579
|
-
});
|
|
19580
19567
|
const SizeStyle = new Parchment.StyleAttributor("font-size", "font-size", {
|
|
19581
19568
|
scope: Parchment.Scope.INLINE,
|
|
19582
19569
|
whitelist: fontSize
|
|
19583
19570
|
});
|
|
19584
19571
|
editor.register({
|
|
19585
|
-
"formats/font-size":
|
|
19586
|
-
"attributors/class/font-size": SizeClass,
|
|
19587
|
-
"attributors/style/font-size": SizeStyle
|
|
19572
|
+
"formats/font-size": SizeStyle
|
|
19588
19573
|
}, true);
|
|
19589
19574
|
};
|
|
19590
19575
|
const registerExtends = (e) => {
|
|
@@ -19637,6 +19622,7 @@
|
|
|
19637
19622
|
const Editor$1 = /* @__PURE__ */ vue.defineComponent({
|
|
19638
19623
|
name: COMPONENT_NAME$14,
|
|
19639
19624
|
props: props$M,
|
|
19625
|
+
defaults: defaults$3,
|
|
19640
19626
|
emits: ["ready", "blur", "focus", "input", "update:modelValue", "change"],
|
|
19641
19627
|
setup(props2, {
|
|
19642
19628
|
slots,
|
|
@@ -20560,6 +20546,14 @@
|
|
|
20560
20546
|
},
|
|
20561
20547
|
source: Function,
|
|
20562
20548
|
download: Function,
|
|
20549
|
+
lazy: {
|
|
20550
|
+
type: Boolean,
|
|
20551
|
+
default: true
|
|
20552
|
+
},
|
|
20553
|
+
showLoading: {
|
|
20554
|
+
type: Boolean,
|
|
20555
|
+
default: true
|
|
20556
|
+
},
|
|
20563
20557
|
// 传递给snap-dom的配置项
|
|
20564
20558
|
options: {
|
|
20565
20559
|
type: Object,
|
|
@@ -20579,34 +20573,59 @@
|
|
|
20579
20573
|
let snapDOM;
|
|
20580
20574
|
const instance = vue.getCurrentInstance();
|
|
20581
20575
|
const current = vue.ref();
|
|
20582
|
-
const
|
|
20576
|
+
const snapshot = vue.ref();
|
|
20583
20577
|
const refresh = async () => {
|
|
20584
20578
|
await vue.nextTick();
|
|
20585
|
-
|
|
20586
|
-
|
|
20579
|
+
snapshot.value = await snapDOM(current.value, {
|
|
20580
|
+
fast: false,
|
|
20581
|
+
// dom太大时会卡死一会儿
|
|
20582
|
+
...VcInstance.options.Snapshot?.options,
|
|
20583
|
+
...props2.options
|
|
20584
|
+
});
|
|
20585
|
+
return snapshot.value;
|
|
20586
|
+
};
|
|
20587
|
+
const onLoad = () => {
|
|
20588
|
+
return props2.showLoading && Message.loading("正在生成...");
|
|
20589
|
+
};
|
|
20590
|
+
const onLoaded = (ctx) => {
|
|
20591
|
+
ctx?.destroy?.();
|
|
20587
20592
|
};
|
|
20588
20593
|
const toDataURL = async () => {
|
|
20594
|
+
const loadContext = onLoad();
|
|
20595
|
+
try {
|
|
20596
|
+
await refresh();
|
|
20597
|
+
return snapshot.value.toRaw();
|
|
20598
|
+
} finally {
|
|
20599
|
+
onLoaded(loadContext);
|
|
20600
|
+
}
|
|
20601
|
+
};
|
|
20602
|
+
const downloadByDefault = async (options) => {
|
|
20589
20603
|
await refresh();
|
|
20590
|
-
return
|
|
20604
|
+
return snapshot.value.download(options);
|
|
20591
20605
|
};
|
|
20592
20606
|
const download = async (options) => {
|
|
20593
|
-
|
|
20594
|
-
const
|
|
20595
|
-
const skip =
|
|
20607
|
+
const loadContext = onLoad();
|
|
20608
|
+
const downloadByUser = props2.download || VcInstance.options.Snapshot?.download || (() => false);
|
|
20609
|
+
const skip = downloadByUser(instance, options);
|
|
20610
|
+
const done = async (v) => {
|
|
20611
|
+
try {
|
|
20612
|
+
v || await downloadByDefault(options);
|
|
20613
|
+
} finally {
|
|
20614
|
+
onLoaded(loadContext);
|
|
20615
|
+
}
|
|
20616
|
+
};
|
|
20596
20617
|
if (skip && skip.then) {
|
|
20597
20618
|
let skip$ = false;
|
|
20598
20619
|
skip.then((v) => {
|
|
20599
20620
|
skip$ = typeof v === "undefined" ? true : !!v;
|
|
20600
20621
|
return v;
|
|
20601
|
-
}).finally(() =>
|
|
20602
|
-
skip$ || snapdom.value.download(options);
|
|
20603
|
-
});
|
|
20622
|
+
}).finally(() => done(skip$));
|
|
20604
20623
|
return;
|
|
20605
20624
|
}
|
|
20606
|
-
skip
|
|
20625
|
+
done(skip);
|
|
20607
20626
|
};
|
|
20608
20627
|
expose({
|
|
20609
|
-
|
|
20628
|
+
snapshot,
|
|
20610
20629
|
refresh,
|
|
20611
20630
|
toDataURL,
|
|
20612
20631
|
download
|
|
@@ -20615,7 +20634,7 @@
|
|
|
20615
20634
|
try {
|
|
20616
20635
|
snapDOM = window.snapdom || await Promise.resolve().then(() => snapdom$1);
|
|
20617
20636
|
snapDOM = snapDOM.snapdom || snapDOM;
|
|
20618
|
-
await refresh();
|
|
20637
|
+
!props2.lazy && await refresh();
|
|
20619
20638
|
emit("ready", {
|
|
20620
20639
|
instance,
|
|
20621
20640
|
dependencies: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/vc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.56",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"access": "public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@deot/vc-components": "^1.0.
|
|
23
|
-
"@deot/vc-hooks": "^1.0.
|
|
24
|
-
"@deot/vc-shared": "^1.0.
|
|
22
|
+
"@deot/vc-components": "^1.0.56",
|
|
23
|
+
"@deot/vc-hooks": "^1.0.56",
|
|
24
|
+
"@deot/vc-shared": "^1.0.56"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"vue": "*"
|