@zipify/wysiwyg 4.11.0 → 4.11.2
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/.release-it.json +2 -1
- package/dist/cli.js +28 -28
- package/dist/node.js +26 -26
- package/dist/types/Wysiwyg.vue.d.ts +7 -8
- package/dist/types/components/base/Button.vue.d.ts +5 -10
- package/dist/types/components/base/ButtonToggle.vue.d.ts +9 -14
- package/dist/types/components/base/Checkbox.vue.d.ts +1 -1
- package/dist/types/components/base/FieldLabel.vue.d.ts +5 -10
- package/dist/types/components/base/Icon.vue.d.ts +1 -1
- package/dist/types/components/base/Modal.vue.d.ts +5 -14
- package/dist/types/components/base/ModalFloating.vue.d.ts +5 -14
- package/dist/types/components/base/NumberField.vue.d.ts +1 -1
- package/dist/types/components/base/Range.vue.d.ts +1 -1
- package/dist/types/components/base/ScrollView.vue.d.ts +5 -14
- package/dist/types/components/base/TextField.vue.d.ts +1 -1
- package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +10 -517
- package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +6 -15
- package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +7 -12
- package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +1 -1
- package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +7 -12
- package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +6 -12
- package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +5 -14
- package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +5 -14
- package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +1 -3
- package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +1 -3
- package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +11 -9
- package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +2 -4
- package/dist/types/enums/Alignment.d.ts +7 -0
- package/dist/types/enums/CaseStyle.d.ts +5 -0
- package/dist/types/enums/Device.d.ts +7 -0
- package/dist/types/enums/LinkDestination.d.ts +4 -0
- package/dist/types/enums/LinkTarget.d.ts +4 -0
- package/dist/types/enums/ListType.d.ts +10 -0
- package/dist/types/enums/MarkGroup.d.ts +4 -0
- package/dist/types/enums/NodeType.d.ts +9 -0
- package/dist/types/enums/TextSetting.d.ts +19 -0
- package/dist/types/enums/index.d.ts +9 -9
- package/dist/types/extensions/Alignment.d.ts +2 -1
- package/dist/types/extensions/CaseStyle.d.ts +2 -1
- package/dist/types/models/Font.d.ts +1 -0
- package/dist/wysiwyg.css +27 -27
- package/dist/wysiwyg.mjs +135 -165
- package/example/fonts.js +111 -111
- package/lib/Wysiwyg.vue +3 -3
- package/lib/__tests__/utils/buildTestExtensions.js +6 -6
- package/lib/components/toolbar/Toolbar.vue +2 -2
- package/lib/components/toolbar/__tests__/Toolbar.test.js +5 -5
- package/lib/components/toolbar/controls/AlignmentControl.vue +7 -7
- package/lib/components/toolbar/controls/CaseStyleControl.vue +5 -5
- package/lib/components/toolbar/controls/FontColorControl.vue +2 -2
- package/lib/components/toolbar/controls/FontFamilyControl.vue +2 -2
- package/lib/components/toolbar/controls/FontSizeControl.vue +2 -2
- package/lib/components/toolbar/controls/FontWeightControl.vue +2 -2
- package/lib/components/toolbar/controls/ItalicControl.vue +2 -2
- package/lib/components/toolbar/controls/LineHeightControl.vue +2 -2
- package/lib/components/toolbar/controls/ListControl.vue +5 -5
- package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +13 -13
- package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +4 -4
- package/lib/components/toolbar/controls/__tests__/ListControl.test.js +10 -10
- package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +6 -6
- package/lib/components/toolbar/controls/link/LinkControl.vue +5 -5
- package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +20 -20
- package/lib/components/toolbar/controls/link/composables/useLink.js +10 -10
- package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +10 -7
- package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
- package/lib/enums/{Alignments.ts → Alignment.ts} +0 -8
- package/lib/enums/{CaseStyles.ts → CaseStyle.ts} +0 -6
- package/lib/enums/{Devices.ts → Device.ts} +0 -8
- package/lib/enums/LinkDestination.ts +4 -0
- package/lib/enums/LinkTarget.ts +4 -0
- package/lib/enums/{ListTypes.ts → ListType.ts} +0 -9
- package/lib/enums/MarkGroup.ts +4 -0
- package/lib/enums/{NodeTypes.ts → NodeType.ts} +0 -8
- package/lib/enums/{TextSettings.ts → TextSetting.ts} +0 -11
- package/lib/enums/index.ts +9 -9
- package/lib/extensions/Alignment.js +13 -11
- package/lib/extensions/BackgroundColor.js +2 -2
- package/lib/extensions/CaseStyle.js +8 -6
- package/lib/extensions/FontColor.js +4 -4
- package/lib/extensions/FontFamily.js +8 -6
- package/lib/extensions/FontSize.js +3 -3
- package/lib/extensions/FontStyle.js +3 -3
- package/lib/extensions/FontWeight.js +3 -3
- package/lib/extensions/LineHeight.js +4 -4
- package/lib/extensions/Link.js +11 -11
- package/lib/extensions/Margin.js +4 -4
- package/lib/extensions/StylePreset.js +18 -12
- package/lib/extensions/Superscript.js +2 -2
- package/lib/extensions/TextDecoration.js +2 -2
- package/lib/extensions/__tests__/Alignment.test.js +21 -21
- package/lib/extensions/__tests__/BackgroundColor.test.js +4 -4
- package/lib/extensions/__tests__/CaseStyle.test.js +6 -6
- package/lib/extensions/__tests__/FontColor.test.js +4 -4
- package/lib/extensions/__tests__/FontFamily.test.js +10 -10
- package/lib/extensions/__tests__/FontSize.test.js +9 -9
- package/lib/extensions/__tests__/FontStyle.test.js +6 -6
- package/lib/extensions/__tests__/FontWeight.test.js +11 -11
- package/lib/extensions/__tests__/LineHeight.test.js +2 -2
- package/lib/extensions/__tests__/Link.test.js +13 -13
- package/lib/extensions/__tests__/StylePreset.test.js +29 -29
- package/lib/extensions/__tests__/Superscript.test.js +5 -5
- package/lib/extensions/__tests__/TextDecoration.test.js +14 -14
- package/lib/extensions/core/Document.js +3 -3
- package/lib/extensions/core/Heading.js +2 -2
- package/lib/extensions/core/NodeProcessor.js +8 -8
- package/lib/extensions/core/Paragraph.js +2 -2
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +68 -68
- package/lib/extensions/core/__tests__/TextProcessor.test.js +13 -13
- package/lib/extensions/list/ListItem.js +5 -5
- package/lib/extensions/list/__tests__/List.test.js +11 -11
- package/lib/extensions/proseMirror/PasteLinkPlugin.js +4 -4
- package/lib/extensions/proseMirror/PastePlugin.js +2 -2
- package/lib/models/Font.ts +4 -0
- package/lib/services/ContentSerializer.js +3 -3
- package/lib/services/StylePresetRenderer.js +4 -4
- package/lib/services/__tests__/NodeFactory.test.js +11 -11
- package/lib/services/__tests__/NodeSelector.test.js +18 -18
- package/lib/services/normalizer/JsonNormalizer.js +5 -5
- package/lib/services/normalizer/__tests__/JsonNormalizer.test.js +15 -15
- package/lib/utils/__tests__/convertAlignment.test.js +3 -3
- package/lib/utils/convertAlignment.js +4 -4
- package/package.json +17 -17
- package/lib/enums/LinkDestinations.ts +0 -9
- package/lib/enums/LinkTargets.ts +0 -9
- package/lib/enums/MarkGroups.ts +0 -9
package/dist/wysiwyg.mjs
CHANGED
|
@@ -19265,24 +19265,19 @@ const DeviceList = [
|
|
|
19265
19265
|
"desktop"
|
|
19266
19266
|
/* DESKTOP */
|
|
19267
19267
|
];
|
|
19268
|
-
|
|
19269
|
-
...Device,
|
|
19270
|
-
values: DeviceList
|
|
19271
|
-
};
|
|
19272
|
-
var CaseStyle$1 = /* @__PURE__ */ ((CaseStyle2) => {
|
|
19268
|
+
var CaseStyle = /* @__PURE__ */ ((CaseStyle2) => {
|
|
19273
19269
|
CaseStyle2["UPPERCASE"] = "uppercase";
|
|
19274
19270
|
CaseStyle2["LOWERCASE"] = "lowercase";
|
|
19275
19271
|
CaseStyle2["CAPITALIZE"] = "capitalize";
|
|
19276
19272
|
return CaseStyle2;
|
|
19277
|
-
})(CaseStyle
|
|
19278
|
-
|
|
19279
|
-
var Alignment$1 = /* @__PURE__ */ ((Alignment2) => {
|
|
19273
|
+
})(CaseStyle || {});
|
|
19274
|
+
var Alignment = /* @__PURE__ */ ((Alignment2) => {
|
|
19280
19275
|
Alignment2["LEFT"] = "left";
|
|
19281
19276
|
Alignment2["CENTER"] = "center";
|
|
19282
19277
|
Alignment2["RIGHT"] = "right";
|
|
19283
19278
|
Alignment2["JUSTIFY"] = "justify";
|
|
19284
19279
|
return Alignment2;
|
|
19285
|
-
})(Alignment
|
|
19280
|
+
})(Alignment || {});
|
|
19286
19281
|
const AlignmentList = [
|
|
19287
19282
|
"left",
|
|
19288
19283
|
"center",
|
|
@@ -19290,10 +19285,6 @@ const AlignmentList = [
|
|
|
19290
19285
|
"justify"
|
|
19291
19286
|
/* JUSTIFY */
|
|
19292
19287
|
];
|
|
19293
|
-
const Alignments = {
|
|
19294
|
-
...Alignment$1,
|
|
19295
|
-
values: AlignmentList
|
|
19296
|
-
};
|
|
19297
19288
|
var NodeType3 = /* @__PURE__ */ ((NodeType22) => {
|
|
19298
19289
|
NodeType22["DOCUMENT"] = "doc";
|
|
19299
19290
|
NodeType22["PARAGRAPH"] = "paragraph";
|
|
@@ -19309,10 +19300,6 @@ const NodeBlockTypeList = [
|
|
|
19309
19300
|
"heading"
|
|
19310
19301
|
/* HEADING */
|
|
19311
19302
|
];
|
|
19312
|
-
const NodeTypes = Object.freeze({
|
|
19313
|
-
...NodeType3,
|
|
19314
|
-
blocks: NodeBlockTypeList
|
|
19315
|
-
});
|
|
19316
19303
|
var ListType = /* @__PURE__ */ ((ListType2) => {
|
|
19317
19304
|
ListType2["DISC"] = "disc";
|
|
19318
19305
|
ListType2["CIRCLE"] = "circle";
|
|
@@ -19337,11 +19324,6 @@ const ListOrderedTypeList = [
|
|
|
19337
19324
|
"latin"
|
|
19338
19325
|
/* LATIN */
|
|
19339
19326
|
];
|
|
19340
|
-
const ListTypes = {
|
|
19341
|
-
...ListType,
|
|
19342
|
-
values: ListTypeList,
|
|
19343
|
-
ordered: ListOrderedTypeList
|
|
19344
|
-
};
|
|
19345
19327
|
var TextSetting = /* @__PURE__ */ ((TextSetting2) => {
|
|
19346
19328
|
TextSetting2["ALIGNMENT"] = "alignment";
|
|
19347
19329
|
TextSetting2["BACKGROUND_COLOR"] = "background_color";
|
|
@@ -19386,31 +19368,21 @@ const TextBlockMarkList = [
|
|
|
19386
19368
|
"superscript"
|
|
19387
19369
|
/* SUPERSCRIPT */
|
|
19388
19370
|
];
|
|
19389
|
-
const TextSettings = {
|
|
19390
|
-
...TextSetting,
|
|
19391
|
-
attributes: TextAttributeSettingList,
|
|
19392
|
-
presetAttributes: TextPresetAttributeSettingList,
|
|
19393
|
-
inlineMarks: TextInlineMarkList,
|
|
19394
|
-
marks: TextBlockMarkList
|
|
19395
|
-
};
|
|
19396
19371
|
var MarkGroup = /* @__PURE__ */ ((MarkGroup2) => {
|
|
19397
19372
|
MarkGroup2["SETTINGS"] = "settings";
|
|
19398
19373
|
MarkGroup2["ALL"] = "_";
|
|
19399
19374
|
return MarkGroup2;
|
|
19400
19375
|
})(MarkGroup || {});
|
|
19401
|
-
const MarkGroups = MarkGroup;
|
|
19402
19376
|
var LinkTarget = /* @__PURE__ */ ((LinkTarget2) => {
|
|
19403
19377
|
LinkTarget2["BLANK"] = "_blank";
|
|
19404
19378
|
LinkTarget2["SELF"] = "_self";
|
|
19405
19379
|
return LinkTarget2;
|
|
19406
19380
|
})(LinkTarget || {});
|
|
19407
|
-
const LinkTargets = LinkTarget;
|
|
19408
19381
|
var LinkDestination = /* @__PURE__ */ ((LinkDestination2) => {
|
|
19409
19382
|
LinkDestination2["URL"] = "url";
|
|
19410
19383
|
LinkDestination2["BLOCK"] = "block";
|
|
19411
19384
|
return LinkDestination2;
|
|
19412
19385
|
})(LinkDestination || {});
|
|
19413
|
-
const LinkDestinations = LinkDestination;
|
|
19414
19386
|
const _export_sfc = (sfc, props) => {
|
|
19415
19387
|
const target = sfc.__vccOpts || sfc;
|
|
19416
19388
|
for (const [key, val] of props) {
|
|
@@ -20118,7 +20090,7 @@ class PastePlugin extends ProseMirrorPlugin {
|
|
|
20118
20090
|
let from2 = selection.from;
|
|
20119
20091
|
let to = selection.to;
|
|
20120
20092
|
doc2.nodesBetween(from2, to, (node, position, parent) => {
|
|
20121
|
-
if (parent.type.name !==
|
|
20093
|
+
if (parent.type.name !== NodeType3.DOCUMENT) return;
|
|
20122
20094
|
from2 = Math.min(from2, position + 1);
|
|
20123
20095
|
to = Math.max(to, position + node.nodeSize - 1);
|
|
20124
20096
|
});
|
|
@@ -21320,9 +21292,9 @@ class PasteLinkPlugin extends ProseMirrorPlugin {
|
|
|
21320
21292
|
}
|
|
21321
21293
|
_createLinkAttrs(text, nodes) {
|
|
21322
21294
|
const pastingLink = NodeSelector.query(nodes, {
|
|
21323
|
-
typeName:
|
|
21324
|
-
mark: { typeName:
|
|
21325
|
-
getMark: { typeName:
|
|
21295
|
+
typeName: NodeType3.TEXT,
|
|
21296
|
+
mark: { typeName: TextSetting.LINK },
|
|
21297
|
+
getMark: { typeName: TextSetting.LINK }
|
|
21326
21298
|
});
|
|
21327
21299
|
return (pastingLink == null ? void 0 : pastingLink.attrs) || { href: text };
|
|
21328
21300
|
}
|
|
@@ -21372,12 +21344,12 @@ function convertLineHeight(value, sourceEl, wrapperEl) {
|
|
|
21372
21344
|
return fontSize ? (parseInt(value) / fontSize).toFixed(2) : null;
|
|
21373
21345
|
}
|
|
21374
21346
|
const MAPPING = {
|
|
21375
|
-
start:
|
|
21376
|
-
end:
|
|
21347
|
+
start: Alignment.LEFT,
|
|
21348
|
+
end: Alignment.RIGHT
|
|
21377
21349
|
};
|
|
21378
21350
|
function convertAlignment(alignment) {
|
|
21379
21351
|
const mapped = MAPPING[alignment] || alignment;
|
|
21380
|
-
return
|
|
21352
|
+
return AlignmentList.includes(mapped) ? mapped : null;
|
|
21381
21353
|
}
|
|
21382
21354
|
const __vite_glob_0_0 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" fill-rule="evenodd" d="M23 7H5v2h18V7Zm-3 4H8v2h12v-2Zm3 4H5v2h18v-2ZM8 19h12v2H8v-2Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
21383
21355
|
const __vite_glob_0_1 = '<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 28 28">\n <path fill="var(--zw-icon-foreground)" fill-rule="evenodd" d="M23 7H5v2h18V7Zm0 4H5v2h18v-2Zm0 4H5v2h18v-2ZM5 19h18v2H5v-2Z" clip-rule="evenodd"/>\n</svg>\n';
|
|
@@ -23183,30 +23155,30 @@ const NodeProcessor = Extension.create({
|
|
|
23183
23155
|
const { doc: doc2, tr: tr2 } = state;
|
|
23184
23156
|
const { from: from2, to } = tr2.selection;
|
|
23185
23157
|
doc2.nodesBetween(from2, to, (node, position) => {
|
|
23186
|
-
if (!
|
|
23158
|
+
if (!NodeBlockTypeList.includes(node.type.name)) return;
|
|
23187
23159
|
tr2.setNodeAttribute(position, name, { ...defaults2, ...current, ...attrs });
|
|
23188
23160
|
});
|
|
23189
23161
|
}),
|
|
23190
23162
|
getBlockAttributes: createCommand(({ editor }, name, defaults2) => computed(() => {
|
|
23191
23163
|
var _a;
|
|
23192
23164
|
let attrs = Object.assign({}, defaults2 || {});
|
|
23193
|
-
for (const type of
|
|
23165
|
+
for (const type of NodeBlockTypeList) {
|
|
23194
23166
|
Object.assign(attrs, ((_a = editor.getAttributes(type)) == null ? void 0 : _a[name]) || {});
|
|
23195
23167
|
}
|
|
23196
23168
|
return Object.keys(attrs).length ? attrs : null;
|
|
23197
23169
|
})),
|
|
23198
23170
|
removeBlockAttributes: createCommand(({ commands: commands2 }, names) => {
|
|
23199
|
-
for (const type of
|
|
23171
|
+
for (const type of NodeBlockTypeList) {
|
|
23200
23172
|
commands2.resetAttributes(type, names);
|
|
23201
23173
|
}
|
|
23202
23174
|
}),
|
|
23203
23175
|
applyMark: createCommand(({ state, commands: commands2 }, name, value, customizer = {}) => {
|
|
23204
23176
|
const { tr: tr2, doc: doc2, schema } = state;
|
|
23205
23177
|
const { $from, $to } = tr2.selection;
|
|
23206
|
-
const linkMarkType = getMarkType(
|
|
23178
|
+
const linkMarkType = getMarkType(TextSetting.LINK, schema);
|
|
23207
23179
|
const markType = getMarkType(name, schema);
|
|
23208
23180
|
const markGroup = markType.spec.group || "";
|
|
23209
|
-
if (!markGroup.includes(
|
|
23181
|
+
if (!markGroup.includes(MarkGroup.SETTINGS)) {
|
|
23210
23182
|
return commands2.setMark(name, value);
|
|
23211
23183
|
}
|
|
23212
23184
|
if ($from.pos === $to.pos) return;
|
|
@@ -23217,7 +23189,7 @@ const NodeProcessor = Extension.create({
|
|
|
23217
23189
|
}
|
|
23218
23190
|
};
|
|
23219
23191
|
doc2.nodesBetween($from.pos, $to.pos, (node, position) => {
|
|
23220
|
-
if (node.type.name ===
|
|
23192
|
+
if (node.type.name === NodeType3.LIST) return;
|
|
23221
23193
|
const initialMark = findMarkByType(node.marks, name);
|
|
23222
23194
|
const applyingMark = markType.create({ ...(initialMark == null ? void 0 : initialMark.attrs) || {}, ...value });
|
|
23223
23195
|
const textPosition = resolveTextPosition($from, $to, node, position);
|
|
@@ -23391,7 +23363,7 @@ class SetDocAttr extends Step {
|
|
|
23391
23363
|
}
|
|
23392
23364
|
Step.jsonID("setDocAttr", SetDocAttr);
|
|
23393
23365
|
const Document = Document$1.extend({
|
|
23394
|
-
marks:
|
|
23366
|
+
marks: MarkGroup.SETTINGS,
|
|
23395
23367
|
addAttributes: () => ({
|
|
23396
23368
|
meta: { default: {} }
|
|
23397
23369
|
}),
|
|
@@ -23440,7 +23412,7 @@ const Paragraph$1 = Node$1.create({
|
|
|
23440
23412
|
}
|
|
23441
23413
|
});
|
|
23442
23414
|
const Paragraph = Paragraph$1.extend({
|
|
23443
|
-
marks:
|
|
23415
|
+
marks: MarkGroup.ALL,
|
|
23444
23416
|
addOptions: () => ({
|
|
23445
23417
|
HTMLAttributes: { class: "zw-style" }
|
|
23446
23418
|
})
|
|
@@ -23512,7 +23484,7 @@ const Heading$1 = Node$1.create({
|
|
|
23512
23484
|
}
|
|
23513
23485
|
});
|
|
23514
23486
|
const Heading = Heading$1.extend({
|
|
23515
|
-
marks:
|
|
23487
|
+
marks: MarkGroup.ALL,
|
|
23516
23488
|
addOptions: () => ({
|
|
23517
23489
|
levels: [1, 2, 3, 4],
|
|
23518
23490
|
HTMLAttributes: { class: "zw-style" }
|
|
@@ -23539,8 +23511,8 @@ const buildCoreExtensions = () => [
|
|
|
23539
23511
|
ProseMirrorPlugins
|
|
23540
23512
|
];
|
|
23541
23513
|
const FontFamily = Mark2.create({
|
|
23542
|
-
name:
|
|
23543
|
-
group:
|
|
23514
|
+
name: TextSetting.FONT_FAMILY,
|
|
23515
|
+
group: MarkGroup.SETTINGS,
|
|
23544
23516
|
addOptions: () => ({
|
|
23545
23517
|
fonts: []
|
|
23546
23518
|
}),
|
|
@@ -23557,8 +23529,10 @@ const FontFamily = Mark2.create({
|
|
|
23557
23529
|
fontWeight = font.findClosestWeight(fontWeight);
|
|
23558
23530
|
commands2.applyFontWeight(fontWeight);
|
|
23559
23531
|
}
|
|
23560
|
-
const isItalicCustomized = commands2.isSettingCustomized(
|
|
23561
|
-
if (
|
|
23532
|
+
const isItalicCustomized = commands2.isSettingCustomized(TextSetting.FONT_STYLE).value;
|
|
23533
|
+
if (font.isItalicOnly) {
|
|
23534
|
+
commands2.applyItalic();
|
|
23535
|
+
} else if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
|
|
23562
23536
|
commands2.removeItalic();
|
|
23563
23537
|
}
|
|
23564
23538
|
}),
|
|
@@ -23599,11 +23573,11 @@ const FontFamily = Mark2.create({
|
|
|
23599
23573
|
}
|
|
23600
23574
|
});
|
|
23601
23575
|
const StylePreset = Extension.create({
|
|
23602
|
-
name:
|
|
23576
|
+
name: TextSetting.STYLE_PRESET,
|
|
23603
23577
|
addGlobalAttributes() {
|
|
23604
23578
|
return [
|
|
23605
23579
|
{
|
|
23606
|
-
types: [
|
|
23580
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
23607
23581
|
attributes: {
|
|
23608
23582
|
preset: {
|
|
23609
23583
|
isRequired: false,
|
|
@@ -23670,14 +23644,14 @@ const StylePreset = Extension.create({
|
|
|
23670
23644
|
var _a;
|
|
23671
23645
|
const presets = unref(commands2.getPresetList());
|
|
23672
23646
|
const preset = findPresetById(presets, presetId);
|
|
23673
|
-
const nodeType = ((_a = preset.node) == null ? void 0 : _a.type) ??
|
|
23647
|
+
const nodeType = ((_a = preset.node) == null ? void 0 : _a.type) ?? NodeType3.PARAGRAPH;
|
|
23674
23648
|
const attrs = {
|
|
23675
23649
|
preset: { id: presetId }
|
|
23676
23650
|
};
|
|
23677
23651
|
if (preset.node) {
|
|
23678
23652
|
attrs.level = preset.node.level;
|
|
23679
23653
|
}
|
|
23680
|
-
for (const textAttribute of
|
|
23654
|
+
for (const textAttribute of TextAttributeSettingList) {
|
|
23681
23655
|
attrs[textAttribute] = unref(commands2.getBlockAttributes(textAttribute));
|
|
23682
23656
|
}
|
|
23683
23657
|
chain().removeList().setNode(nodeType, attrs).run();
|
|
@@ -23686,7 +23660,7 @@ const StylePreset = Extension.create({
|
|
|
23686
23660
|
commands2.applyPreset(unref(this.options.defaultId));
|
|
23687
23661
|
}),
|
|
23688
23662
|
removePreset: createCommand(({ commands: commands2 }) => {
|
|
23689
|
-
commands2.setNode(
|
|
23663
|
+
commands2.setNode(NodeType3.PARAGRAPH, { preset: null });
|
|
23690
23664
|
}),
|
|
23691
23665
|
getPresetCustomization: createCommand(({ editor, commands: commands2 }) => {
|
|
23692
23666
|
const state = toRef(editor, "state");
|
|
@@ -23698,7 +23672,7 @@ const StylePreset = Extension.create({
|
|
|
23698
23672
|
}),
|
|
23699
23673
|
isSettingCustomized: createCommand(({ commands: commands2 }, name) => {
|
|
23700
23674
|
const customization = commands2.getPresetCustomization();
|
|
23701
|
-
const group =
|
|
23675
|
+
const group = TextPresetAttributeSettingList.includes(name) ? "attributes" : "marks";
|
|
23702
23676
|
return computed(() => {
|
|
23703
23677
|
var _a;
|
|
23704
23678
|
return ((_a = unref(customization)[group]) == null ? void 0 : _a.includes(name)) ?? false;
|
|
@@ -23716,11 +23690,11 @@ const StylePreset = Extension.create({
|
|
|
23716
23690
|
const attributes = /* @__PURE__ */ new Set();
|
|
23717
23691
|
doc2.nodesBetween(from2, to, (node) => {
|
|
23718
23692
|
for (const [name, value] of Object.entries(node.attrs)) {
|
|
23719
|
-
const isSetting =
|
|
23693
|
+
const isSetting = TextPresetAttributeSettingList.includes(name);
|
|
23720
23694
|
if (isSetting && value) attributes.add(name);
|
|
23721
23695
|
}
|
|
23722
23696
|
for (const { type } of node.marks) {
|
|
23723
|
-
if (
|
|
23697
|
+
if (TextBlockMarkList.includes(type.name)) {
|
|
23724
23698
|
marks.add(type.name);
|
|
23725
23699
|
}
|
|
23726
23700
|
}
|
|
@@ -23731,7 +23705,7 @@ const StylePreset = Extension.create({
|
|
|
23731
23705
|
};
|
|
23732
23706
|
}),
|
|
23733
23707
|
removePresetCustomization: createCommand(({ chain }) => {
|
|
23734
|
-
chain().storeSelection().expandSelectionToBlock().removeMarks(
|
|
23708
|
+
chain().storeSelection().expandSelectionToBlock().removeMarks(TextBlockMarkList).resetAttributes(NodeType3.PARAGRAPH, TextPresetAttributeSettingList).resetAttributes(NodeType3.HEADING, TextPresetAttributeSettingList).restoreSelection().run();
|
|
23735
23709
|
}),
|
|
23736
23710
|
removeFormat: createCommand(({ chain }) => {
|
|
23737
23711
|
chain().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run();
|
|
@@ -23743,8 +23717,8 @@ const StylePreset = Extension.create({
|
|
|
23743
23717
|
}
|
|
23744
23718
|
});
|
|
23745
23719
|
const FontWeight = Mark2.create({
|
|
23746
|
-
name:
|
|
23747
|
-
group:
|
|
23720
|
+
name: TextSetting.FONT_WEIGHT,
|
|
23721
|
+
group: MarkGroup.SETTINGS,
|
|
23748
23722
|
addAttributes: () => ({
|
|
23749
23723
|
value: { required: true }
|
|
23750
23724
|
}),
|
|
@@ -23813,8 +23787,8 @@ const FontWeight = Mark2.create({
|
|
|
23813
23787
|
}
|
|
23814
23788
|
});
|
|
23815
23789
|
const FontSize = Mark2.create({
|
|
23816
|
-
name:
|
|
23817
|
-
group:
|
|
23790
|
+
name: TextSetting.FONT_SIZE,
|
|
23791
|
+
group: MarkGroup.SETTINGS,
|
|
23818
23792
|
addOptions: () => ({
|
|
23819
23793
|
minSize: 1,
|
|
23820
23794
|
maxSize: 100
|
|
@@ -23907,8 +23881,8 @@ const FontSize = Mark2.create({
|
|
|
23907
23881
|
}
|
|
23908
23882
|
});
|
|
23909
23883
|
const FontColor = Mark2.create({
|
|
23910
|
-
name:
|
|
23911
|
-
group:
|
|
23884
|
+
name: TextSetting.FONT_COLOR,
|
|
23885
|
+
group: MarkGroup.SETTINGS,
|
|
23912
23886
|
addAttributes: () => ({
|
|
23913
23887
|
value: { required: true }
|
|
23914
23888
|
}),
|
|
@@ -23944,7 +23918,7 @@ const FontColor = Mark2.create({
|
|
|
23944
23918
|
}
|
|
23945
23919
|
});
|
|
23946
23920
|
const BackgroundColor = Mark2.create({
|
|
23947
|
-
name:
|
|
23921
|
+
name: TextSetting.BACKGROUND_COLOR,
|
|
23948
23922
|
addAttributes: () => ({
|
|
23949
23923
|
value: { required: true }
|
|
23950
23924
|
}),
|
|
@@ -23984,8 +23958,8 @@ const DeviceManager = Extension.create({
|
|
|
23984
23958
|
}
|
|
23985
23959
|
});
|
|
23986
23960
|
const FontStyle = Mark2.create({
|
|
23987
|
-
name:
|
|
23988
|
-
group:
|
|
23961
|
+
name: TextSetting.FONT_STYLE,
|
|
23962
|
+
group: MarkGroup.SETTINGS,
|
|
23989
23963
|
addAttributes: () => ({
|
|
23990
23964
|
italic: { required: true }
|
|
23991
23965
|
}),
|
|
@@ -24054,7 +24028,7 @@ const FontStyle = Mark2.create({
|
|
|
24054
24028
|
}
|
|
24055
24029
|
});
|
|
24056
24030
|
const TextDecoration = Mark2.create({
|
|
24057
|
-
name:
|
|
24031
|
+
name: TextSetting.TEXT_DECORATION,
|
|
24058
24032
|
priority: 1e3,
|
|
24059
24033
|
addAttributes: () => ({
|
|
24060
24034
|
underline: { default: false },
|
|
@@ -24166,17 +24140,17 @@ const TextDecoration = Mark2.create({
|
|
|
24166
24140
|
return renderMark({ text_decoration: decorations.join(" ") });
|
|
24167
24141
|
}
|
|
24168
24142
|
});
|
|
24169
|
-
const
|
|
24143
|
+
const CaseStyleExtension = Extension.create({
|
|
24170
24144
|
name: "case_style",
|
|
24171
24145
|
addCommands() {
|
|
24172
24146
|
return {
|
|
24173
24147
|
applyCaseStyle: createCommand(({ commands: commands2 }, value) => {
|
|
24174
24148
|
switch (value) {
|
|
24175
|
-
case
|
|
24149
|
+
case CaseStyle.CAPITALIZE:
|
|
24176
24150
|
return commands2.applyCapitalize();
|
|
24177
|
-
case
|
|
24151
|
+
case CaseStyle.LOWERCASE:
|
|
24178
24152
|
return commands2.applyLowerCase();
|
|
24179
|
-
case
|
|
24153
|
+
case CaseStyle.UPPERCASE:
|
|
24180
24154
|
return commands2.applyUpperCase();
|
|
24181
24155
|
}
|
|
24182
24156
|
}),
|
|
@@ -24197,13 +24171,13 @@ const DEFAULTS$1 = {
|
|
|
24197
24171
|
tablet: null,
|
|
24198
24172
|
desktop: null
|
|
24199
24173
|
};
|
|
24200
|
-
const
|
|
24201
|
-
name:
|
|
24174
|
+
const AlignmentExtension = Extension.create({
|
|
24175
|
+
name: TextSetting.ALIGNMENT,
|
|
24202
24176
|
addGlobalAttributes: () => [
|
|
24203
24177
|
{
|
|
24204
|
-
types: [
|
|
24178
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
24205
24179
|
attributes: {
|
|
24206
|
-
[
|
|
24180
|
+
[TextSetting.ALIGNMENT]: {
|
|
24207
24181
|
isRequired: false,
|
|
24208
24182
|
parseHTML({ style: style2 }) {
|
|
24209
24183
|
const textAlign = convertAlignment(style2.textAlign);
|
|
@@ -24247,15 +24221,15 @@ const Alignment = Extension.create({
|
|
|
24247
24221
|
getDefaultAlignment: createCommand(({ commands: commands2 }) => {
|
|
24248
24222
|
const device = commands2.getDevice();
|
|
24249
24223
|
const preset = commands2.getPreset();
|
|
24250
|
-
return computed(() => unref(preset)[unref(device)].alignment ??
|
|
24224
|
+
return computed(() => unref(preset)[unref(device)].alignment ?? Alignment.LEFT);
|
|
24251
24225
|
})
|
|
24252
24226
|
};
|
|
24253
24227
|
},
|
|
24254
24228
|
addKeyboardShortcuts: () => ({
|
|
24255
|
-
"Mod-Shift-l": createKeyboardShortcut("applyAlignment",
|
|
24256
|
-
"Mod-Shift-e": createKeyboardShortcut("applyAlignment",
|
|
24257
|
-
"Mod-Shift-r": createKeyboardShortcut("applyAlignment",
|
|
24258
|
-
"Mod-Shift-j": createKeyboardShortcut("applyAlignment",
|
|
24229
|
+
"Mod-Shift-l": createKeyboardShortcut("applyAlignment", Alignment.LEFT),
|
|
24230
|
+
"Mod-Shift-e": createKeyboardShortcut("applyAlignment", Alignment.CENTER),
|
|
24231
|
+
"Mod-Shift-r": createKeyboardShortcut("applyAlignment", Alignment.RIGHT),
|
|
24232
|
+
"Mod-Shift-j": createKeyboardShortcut("applyAlignment", Alignment.JUSTIFY)
|
|
24259
24233
|
})
|
|
24260
24234
|
});
|
|
24261
24235
|
const DEFAULTS = {
|
|
@@ -24264,13 +24238,13 @@ const DEFAULTS = {
|
|
|
24264
24238
|
desktop: null
|
|
24265
24239
|
};
|
|
24266
24240
|
const LineHeight = Extension.create({
|
|
24267
|
-
name:
|
|
24241
|
+
name: TextSetting.LINE_HEIGHT,
|
|
24268
24242
|
addGlobalAttributes() {
|
|
24269
24243
|
return [
|
|
24270
24244
|
{
|
|
24271
|
-
types: [
|
|
24245
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
24272
24246
|
attributes: {
|
|
24273
|
-
[
|
|
24247
|
+
[TextSetting.LINE_HEIGHT]: {
|
|
24274
24248
|
isRequired: false,
|
|
24275
24249
|
parseHTML: (element) => {
|
|
24276
24250
|
if (element.matches('[style*="--zw-line-height"]')) {
|
|
@@ -24351,8 +24325,8 @@ const ListItem$1 = Node$1.create({
|
|
|
24351
24325
|
}
|
|
24352
24326
|
});
|
|
24353
24327
|
const ListItem = ListItem$1.extend({
|
|
24354
|
-
name:
|
|
24355
|
-
marks:
|
|
24328
|
+
name: NodeType3.LIST_ITEM,
|
|
24329
|
+
marks: MarkGroup.SETTINGS,
|
|
24356
24330
|
addCommands() {
|
|
24357
24331
|
const getItemPosition = ({ selection }) => selection.$cursor.before(selection.$cursor.depth - 1);
|
|
24358
24332
|
return {
|
|
@@ -24378,7 +24352,7 @@ const ListItem = ListItem$1.extend({
|
|
|
24378
24352
|
const { state, commands: commands2 } = context.editor;
|
|
24379
24353
|
const isListSelected = (_a = state.selection.$cursor) == null ? void 0 : _a.path.some((node) => {
|
|
24380
24354
|
var _a2;
|
|
24381
|
-
return ((_a2 = node.type) == null ? void 0 : _a2.name) ===
|
|
24355
|
+
return ((_a2 = node.type) == null ? void 0 : _a2.name) === NodeType3.LIST;
|
|
24382
24356
|
});
|
|
24383
24357
|
if (isListSelected) return commands2.listItemNewline();
|
|
24384
24358
|
}
|
|
@@ -24862,7 +24836,7 @@ const Link$1 = Mark2.create({
|
|
|
24862
24836
|
}
|
|
24863
24837
|
});
|
|
24864
24838
|
const Link = Link$1.extend({
|
|
24865
|
-
name:
|
|
24839
|
+
name: TextSetting.LINK,
|
|
24866
24840
|
addOptions() {
|
|
24867
24841
|
var _a;
|
|
24868
24842
|
return {
|
|
@@ -24882,18 +24856,18 @@ const Link = Link$1.extend({
|
|
|
24882
24856
|
}
|
|
24883
24857
|
},
|
|
24884
24858
|
target: {
|
|
24885
|
-
default:
|
|
24886
|
-
parseHTML: (element) => element.getAttribute("target") ||
|
|
24859
|
+
default: LinkTarget.SELF,
|
|
24860
|
+
parseHTML: (element) => element.getAttribute("target") || LinkTarget.SELF
|
|
24887
24861
|
},
|
|
24888
24862
|
destination: {
|
|
24889
|
-
default:
|
|
24863
|
+
default: LinkDestination.URL,
|
|
24890
24864
|
parseHTML: (element) => {
|
|
24891
24865
|
const href = element.getAttribute("href");
|
|
24892
|
-
if (!href.startsWith("#")) return
|
|
24866
|
+
if (!href.startsWith("#")) return LinkDestination.URL;
|
|
24893
24867
|
const id = href.replace("#", "");
|
|
24894
24868
|
const blocks = unref(this.options.pageBlocks);
|
|
24895
24869
|
const block = blocks.find((block2) => block2.id === parseInt(id));
|
|
24896
|
-
return block ?
|
|
24870
|
+
return block ? LinkDestination.BLOCK : LinkDestination.URL;
|
|
24897
24871
|
}
|
|
24898
24872
|
}
|
|
24899
24873
|
};
|
|
@@ -24906,7 +24880,7 @@ const Link = Link$1.extend({
|
|
|
24906
24880
|
commands2.setMeta("preventAutolink", true);
|
|
24907
24881
|
if (!commands2.getSelectedText()) {
|
|
24908
24882
|
return commands2.insertContent(NodeFactory.text(attributes.text, [
|
|
24909
|
-
NodeFactory.mark(
|
|
24883
|
+
NodeFactory.mark(TextSetting.LINK, attributes)
|
|
24910
24884
|
]));
|
|
24911
24885
|
}
|
|
24912
24886
|
return chain().applyMark(this.name, attributes).expandSelectionToLink().command(({ tr: tr2 }) => {
|
|
@@ -24930,14 +24904,14 @@ const Link = Link$1.extend({
|
|
|
24930
24904
|
];
|
|
24931
24905
|
},
|
|
24932
24906
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
24933
|
-
const href = attrs.destination ===
|
|
24907
|
+
const href = attrs.destination === LinkDestination.BLOCK ? `#${attrs.href}` : attrs.href;
|
|
24934
24908
|
const presetClass = unref(this.options.basePresetClass) + unref(this.options.preset).id;
|
|
24935
24909
|
const linkAttrs = { href, target: attrs.target, class: `${presetClass} zw-style` };
|
|
24936
24910
|
return ["a", linkAttrs, 0];
|
|
24937
24911
|
}
|
|
24938
24912
|
});
|
|
24939
24913
|
const Superscript = Mark2.create({
|
|
24940
|
-
name:
|
|
24914
|
+
name: TextSetting.SUPERSCRIPT,
|
|
24941
24915
|
addCommands() {
|
|
24942
24916
|
return {
|
|
24943
24917
|
applySuperscript: createCommand(({ commands: commands2 }) => {
|
|
@@ -24970,12 +24944,12 @@ const Superscript = Mark2.create({
|
|
|
24970
24944
|
}
|
|
24971
24945
|
});
|
|
24972
24946
|
const Margin = Extension.create({
|
|
24973
|
-
name:
|
|
24947
|
+
name: TextSetting.MARGIN,
|
|
24974
24948
|
addGlobalAttributes: () => [
|
|
24975
24949
|
{
|
|
24976
|
-
types: [
|
|
24950
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
24977
24951
|
attributes: {
|
|
24978
|
-
[
|
|
24952
|
+
[TextSetting.MARGIN]: {
|
|
24979
24953
|
isRequired: false,
|
|
24980
24954
|
parseHTML(el) {
|
|
24981
24955
|
const { margin, marginTop, marginRight, marginBottom, marginLeft } = el.style;
|
|
@@ -25034,9 +25008,9 @@ function buildExtensions(options) {
|
|
|
25034
25008
|
BackgroundColor,
|
|
25035
25009
|
FontStyle,
|
|
25036
25010
|
TextDecoration,
|
|
25037
|
-
|
|
25011
|
+
CaseStyleExtension,
|
|
25038
25012
|
Superscript,
|
|
25039
|
-
|
|
25013
|
+
AlignmentExtension,
|
|
25040
25014
|
LineHeight.configure({
|
|
25041
25015
|
wrapperRef: options.wrapperRef
|
|
25042
25016
|
}),
|
|
@@ -25655,7 +25629,7 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
25655
25629
|
}
|
|
25656
25630
|
_bubbleMarks(node) {
|
|
25657
25631
|
if (!node.content) return;
|
|
25658
|
-
if (node.type ===
|
|
25632
|
+
if (node.type === NodeType3.LIST) return;
|
|
25659
25633
|
for (const child of node.content) {
|
|
25660
25634
|
if (this._isLink(child)) continue;
|
|
25661
25635
|
if (!child.marks) continue;
|
|
@@ -25672,10 +25646,10 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
25672
25646
|
}
|
|
25673
25647
|
}
|
|
25674
25648
|
_canBubbleMark(node, childMark) {
|
|
25675
|
-
if (
|
|
25649
|
+
if (TextInlineMarkList.includes(childMark.type)) return false;
|
|
25676
25650
|
if (this._includesMarkType(node, childMark.type)) return false;
|
|
25677
25651
|
for (const child of node.content) {
|
|
25678
|
-
if (!child.content && node.type ===
|
|
25652
|
+
if (!child.content && node.type === NodeType3.LIST_ITEM) continue;
|
|
25679
25653
|
if (!child.marks) return false;
|
|
25680
25654
|
if (!this._includesMark(child, childMark)) return false;
|
|
25681
25655
|
}
|
|
@@ -25690,7 +25664,7 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
25690
25664
|
return ((_a = node.marks) == null ? void 0 : _a.some((mark) => mark.type === type)) ?? false;
|
|
25691
25665
|
}
|
|
25692
25666
|
_isLink(node) {
|
|
25693
|
-
return node.type ===
|
|
25667
|
+
return node.type === NodeType3.TEXT && this._includesMarkType(node, TextSetting.LINK);
|
|
25694
25668
|
}
|
|
25695
25669
|
_removeMark(node, mark) {
|
|
25696
25670
|
if (!node.marks) return;
|
|
@@ -25763,7 +25737,7 @@ class ContentSerializer {
|
|
|
25763
25737
|
makePresetVariable: () => "",
|
|
25764
25738
|
basePresetClass: config.basePresetClass,
|
|
25765
25739
|
baseListClass: config.baseListClass,
|
|
25766
|
-
deviceRef: ref(
|
|
25740
|
+
deviceRef: ref(Device.DESKTOP),
|
|
25767
25741
|
pageBlocksRef: ref([]),
|
|
25768
25742
|
wrapperRef: ContextWindow.document.createElement("p")
|
|
25769
25743
|
});
|
|
@@ -25940,12 +25914,12 @@ class StylePresetRenderer {
|
|
|
25940
25914
|
const isLink = preset.id === this._linkPresetId;
|
|
25941
25915
|
const className = this.makePresetCssClass(preset);
|
|
25942
25916
|
css += ` ${className} {`;
|
|
25943
|
-
for (const device of
|
|
25917
|
+
for (const device of DeviceList) {
|
|
25944
25918
|
for (const setting of Object.keys(preset[device])) {
|
|
25945
25919
|
const variable = this._makeVariable({ device, preset, property: setting });
|
|
25946
25920
|
const internalVariable = this._makeInternalVariableName(setting, device);
|
|
25947
25921
|
css += `${internalVariable}: var(${variable}, inherit);`;
|
|
25948
|
-
if (isLink && !
|
|
25922
|
+
if (isLink && !TextAttributeSettingList.includes(setting)) {
|
|
25949
25923
|
const overrideVariable = internalVariable.replace("preset-", "");
|
|
25950
25924
|
css += `${overrideVariable}: var(${internalVariable});`;
|
|
25951
25925
|
}
|
|
@@ -25957,7 +25931,7 @@ class StylePresetRenderer {
|
|
|
25957
25931
|
}
|
|
25958
25932
|
_makeInternalVariableName(setting, device) {
|
|
25959
25933
|
const property = setting === "color" ? "font-color" : setting.replace(/_/i, "-");
|
|
25960
|
-
const prefix = device ===
|
|
25934
|
+
const prefix = device === Device.COMMON ? "" : `-${device}`;
|
|
25961
25935
|
return `--zw-preset-${property}${prefix}`;
|
|
25962
25936
|
}
|
|
25963
25937
|
makePresetHtmlClass(preset) {
|
|
@@ -28696,7 +28670,7 @@ const _sfc_main$q = {
|
|
|
28696
28670
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
28697
28671
|
const defaultFontFamily = editor.commands.getDefaultFontFamily();
|
|
28698
28672
|
const recentFontNames = useRecentFonts({ limit: 5 });
|
|
28699
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28673
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_FAMILY);
|
|
28700
28674
|
const recentFontsCategory = computed(() => ({
|
|
28701
28675
|
id: "Recently Used",
|
|
28702
28676
|
options: recentFontNames.fonts.value.map((name) => ({
|
|
@@ -28758,7 +28732,7 @@ const _sfc_main$q = {
|
|
|
28758
28732
|
};
|
|
28759
28733
|
}
|
|
28760
28734
|
};
|
|
28761
|
-
const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-
|
|
28735
|
+
const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e3657967"]]);
|
|
28762
28736
|
const _hoisted_1$a = {
|
|
28763
28737
|
key: 0,
|
|
28764
28738
|
class: "zw-dropdown__default-option"
|
|
@@ -28776,7 +28750,7 @@ const _sfc_main$p = {
|
|
|
28776
28750
|
}));
|
|
28777
28751
|
});
|
|
28778
28752
|
const currentValue = editor.commands.getFontWeight();
|
|
28779
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28753
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_WEIGHT);
|
|
28780
28754
|
const apply2 = (value) => editor.chain().focus().applyFontWeight(value).run();
|
|
28781
28755
|
return (_ctx, _cache) => {
|
|
28782
28756
|
return withDirectives((openBlock(), createBlock(unref(Dropdown), {
|
|
@@ -28807,7 +28781,7 @@ const _sfc_main$p = {
|
|
|
28807
28781
|
};
|
|
28808
28782
|
}
|
|
28809
28783
|
};
|
|
28810
|
-
const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-
|
|
28784
|
+
const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-6c8237c7"]]);
|
|
28811
28785
|
const _hoisted_1$9 = {
|
|
28812
28786
|
key: 0,
|
|
28813
28787
|
class: "zw-dropdown__default-option"
|
|
@@ -28826,7 +28800,7 @@ const _sfc_main$o = {
|
|
|
28826
28800
|
}));
|
|
28827
28801
|
});
|
|
28828
28802
|
const currentValue = editor.commands.getFontSize();
|
|
28829
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28803
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_SIZE);
|
|
28830
28804
|
const apply2 = (value) => editor.chain().focus().applyFontSize(value).run();
|
|
28831
28805
|
return (_ctx, _cache) => {
|
|
28832
28806
|
return withDirectives((openBlock(), createBlock(unref(Dropdown), {
|
|
@@ -28857,7 +28831,7 @@ const _sfc_main$o = {
|
|
|
28857
28831
|
};
|
|
28858
28832
|
}
|
|
28859
28833
|
};
|
|
28860
|
-
const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-
|
|
28834
|
+
const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-779fe48e"]]);
|
|
28861
28835
|
const _hoisted_1$8 = {
|
|
28862
28836
|
key: 0,
|
|
28863
28837
|
class: "zw-button__customized-indicator",
|
|
@@ -28868,7 +28842,7 @@ const _sfc_main$n = {
|
|
|
28868
28842
|
setup(__props) {
|
|
28869
28843
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
28870
28844
|
const currentValue = editor.commands.getFontColor();
|
|
28871
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28845
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_COLOR);
|
|
28872
28846
|
const apply2 = (color) => editor.chain().applyFontColor(color).run();
|
|
28873
28847
|
return (_ctx, _cache) => {
|
|
28874
28848
|
return openBlock(), createBlock(unref(_sfc_main$r), {
|
|
@@ -28954,7 +28928,7 @@ const _sfc_main$l = {
|
|
|
28954
28928
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
28955
28929
|
const currentValue = editor.commands.isItalic();
|
|
28956
28930
|
const isAvailable = editor.commands.isItalicAvailable();
|
|
28957
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28931
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_STYLE);
|
|
28958
28932
|
const apply2 = () => editor.chain().focus().toggleItalic().run();
|
|
28959
28933
|
return (_ctx, _cache) => {
|
|
28960
28934
|
return withDirectives((openBlock(), createBlock(unref(Button), {
|
|
@@ -29087,9 +29061,9 @@ const _sfc_main$h = {
|
|
|
29087
29061
|
__name: "CaseStyleControl",
|
|
29088
29062
|
setup(__props) {
|
|
29089
29063
|
const styles = [
|
|
29090
|
-
{ id:
|
|
29091
|
-
{ id:
|
|
29092
|
-
{ id:
|
|
29064
|
+
{ id: CaseStyle.UPPERCASE, title: "UPPERCASE" },
|
|
29065
|
+
{ id: CaseStyle.LOWERCASE, title: "lowercase" },
|
|
29066
|
+
{ id: CaseStyle.CAPITALIZE, title: "Capitalize" }
|
|
29093
29067
|
];
|
|
29094
29068
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29095
29069
|
const apply2 = (value) => editor.chain().focus().applyCaseStyle(value).run();
|
|
@@ -29129,25 +29103,25 @@ const _sfc_main$g = {
|
|
|
29129
29103
|
const emit = __emit;
|
|
29130
29104
|
const alignments = [
|
|
29131
29105
|
{
|
|
29132
|
-
id:
|
|
29106
|
+
id: Alignment.LEFT,
|
|
29133
29107
|
tooltip: { text: "Align Left", hotkey: "Mod Shift L" }
|
|
29134
29108
|
},
|
|
29135
29109
|
{
|
|
29136
|
-
id:
|
|
29110
|
+
id: Alignment.CENTER,
|
|
29137
29111
|
tooltip: { text: "Align Center", hotkey: "Mod Shift E" }
|
|
29138
29112
|
},
|
|
29139
29113
|
{
|
|
29140
|
-
id:
|
|
29114
|
+
id: Alignment.RIGHT,
|
|
29141
29115
|
tooltip: { text: "Align Right", hotkey: "Mod Shift R" }
|
|
29142
29116
|
},
|
|
29143
29117
|
{
|
|
29144
|
-
id:
|
|
29118
|
+
id: Alignment.JUSTIFY,
|
|
29145
29119
|
tooltip: { text: "Justify", hotkey: "Mod Shift J" }
|
|
29146
29120
|
}
|
|
29147
29121
|
];
|
|
29148
29122
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29149
29123
|
const currentValue = editor.commands.getAlignment();
|
|
29150
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
29124
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.ALIGNMENT);
|
|
29151
29125
|
function toggle(value) {
|
|
29152
29126
|
editor.chain().focus().applyAlignment(value).run();
|
|
29153
29127
|
emit("applied");
|
|
@@ -29210,7 +29184,7 @@ const _sfc_main$f = {
|
|
|
29210
29184
|
const wrapperRef = ref(null);
|
|
29211
29185
|
const toggler = useModalToggler();
|
|
29212
29186
|
const currentValue = editor.commands.getLineHeight();
|
|
29213
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
29187
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.LINE_HEIGHT);
|
|
29214
29188
|
const apply2 = (value) => editor.commands.applyLineHeight(String(value));
|
|
29215
29189
|
return (_ctx, _cache) => {
|
|
29216
29190
|
return openBlock(), createElementBlock("div", {
|
|
@@ -29285,26 +29259,26 @@ const _sfc_main$f = {
|
|
|
29285
29259
|
};
|
|
29286
29260
|
}
|
|
29287
29261
|
};
|
|
29288
|
-
const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-
|
|
29262
|
+
const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-643242a1"]]);
|
|
29289
29263
|
const _hoisted_1$4 = { class: "zpa-list-control" };
|
|
29290
29264
|
const _sfc_main$e = {
|
|
29291
29265
|
__name: "ListControl",
|
|
29292
29266
|
setup(__props) {
|
|
29293
|
-
const listTypes =
|
|
29267
|
+
const listTypes = ListTypeList.map((type) => ({
|
|
29294
29268
|
id: type,
|
|
29295
29269
|
icon: `list-${type}`
|
|
29296
29270
|
}));
|
|
29297
29271
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29298
29272
|
const selectionValue = editor.commands.getListType();
|
|
29299
29273
|
const currentValue = computed(() => unref(selectionValue) || "none");
|
|
29300
|
-
const recentListType = ref(
|
|
29274
|
+
const recentListType = ref(ListType.DISC);
|
|
29301
29275
|
const isCurrentListSelected = computed(() => unref(selectionValue) === recentListType.value);
|
|
29302
29276
|
const currentIcon = computed(() => `list-${recentListType.value}`);
|
|
29303
29277
|
const apply2 = (type) => {
|
|
29304
29278
|
recentListType.value = type;
|
|
29305
29279
|
editor.chain().focus().applyList(type).run();
|
|
29306
29280
|
};
|
|
29307
|
-
const toggle = () => apply2(recentListType.value ||
|
|
29281
|
+
const toggle = () => apply2(recentListType.value || ListType.DISC);
|
|
29308
29282
|
return (_ctx, _cache) => {
|
|
29309
29283
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
29310
29284
|
withDirectives((openBlock(), createBlock(unref(Button), {
|
|
@@ -29370,7 +29344,7 @@ const _sfc_main$e = {
|
|
|
29370
29344
|
};
|
|
29371
29345
|
}
|
|
29372
29346
|
};
|
|
29373
|
-
const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
29347
|
+
const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-55962f5e"]]);
|
|
29374
29348
|
const _sfc_main$d = {
|
|
29375
29349
|
__name: "RemoveFormatControl",
|
|
29376
29350
|
setup(__props) {
|
|
@@ -29439,18 +29413,18 @@ const LinkControlHeader = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId"
|
|
|
29439
29413
|
function useLink() {
|
|
29440
29414
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29441
29415
|
const pageBlocks = inject(InjectionTokens$1.PAGE_BLOCKS);
|
|
29442
|
-
const linkData = ref({ text: "", target:
|
|
29416
|
+
const linkData = ref({ text: "", target: LinkTarget.SELF, destination: LinkDestination.URL });
|
|
29443
29417
|
const destinationHrefs = ref({ block: pageBlocks.value[0].id, url: "" });
|
|
29444
|
-
const currentDestination = ref({ id:
|
|
29418
|
+
const currentDestination = ref({ id: LinkDestination.URL });
|
|
29445
29419
|
function updateTarget(isChecked) {
|
|
29446
|
-
linkData.value.target = isChecked ?
|
|
29420
|
+
linkData.value.target = isChecked ? LinkTarget.BLANK : LinkTarget.SELF;
|
|
29447
29421
|
}
|
|
29448
29422
|
function prepareInitialFields() {
|
|
29449
29423
|
editor.commands.expandSelectionToLink();
|
|
29450
29424
|
linkData.value.text = editor.commands.getSelectedText();
|
|
29451
|
-
const { destination, href, target } = editor.getAttributes(
|
|
29452
|
-
currentDestination.value.id = destination ||
|
|
29453
|
-
linkData.value.target = target ||
|
|
29425
|
+
const { destination, href, target } = editor.getAttributes(TextSetting.LINK);
|
|
29426
|
+
currentDestination.value.id = destination || LinkDestination.URL;
|
|
29427
|
+
linkData.value.target = target || LinkTarget.SELF;
|
|
29454
29428
|
destinationHrefs.value[currentDestination.value.id] = href || "";
|
|
29455
29429
|
}
|
|
29456
29430
|
function resetDestinations() {
|
|
@@ -29458,7 +29432,7 @@ function useLink() {
|
|
|
29458
29432
|
destinationHrefs.value.url = "";
|
|
29459
29433
|
}
|
|
29460
29434
|
function getFormattedHref() {
|
|
29461
|
-
if (currentDestination.value.id ===
|
|
29435
|
+
if (currentDestination.value.id === LinkDestination.URL) {
|
|
29462
29436
|
const url = destinationHrefs.value.url;
|
|
29463
29437
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(url) || RegExps.MAILTO_PROTOCOL.test(url);
|
|
29464
29438
|
if (isTelOrMail) return url;
|
|
@@ -29604,16 +29578,18 @@ const _sfc_main$9 = {
|
|
|
29604
29578
|
const props = __props;
|
|
29605
29579
|
const emit = __emit;
|
|
29606
29580
|
const destinationTypes = [
|
|
29607
|
-
{ id:
|
|
29608
|
-
{ id:
|
|
29581
|
+
{ id: LinkDestination.URL, title: "URL" },
|
|
29582
|
+
{ id: LinkDestination.BLOCK, title: "Page Section" }
|
|
29609
29583
|
];
|
|
29610
29584
|
const link = toRef(props, "link");
|
|
29611
|
-
const isURLDestination = computed(() => link.value.currentDestination.value.id ===
|
|
29612
|
-
const isTargetBlank = computed(() => link.value.linkData.value.target ===
|
|
29585
|
+
const isURLDestination = computed(() => link.value.currentDestination.value.id === LinkDestination.URL);
|
|
29586
|
+
const isTargetBlank = computed(() => link.value.linkData.value.target === LinkTarget.BLANK);
|
|
29613
29587
|
const changeDestination = (value) => {
|
|
29614
29588
|
emit("reset-errors");
|
|
29615
29589
|
link.value.currentDestination.value.id = value;
|
|
29616
|
-
if (!isURLDestination.value)
|
|
29590
|
+
if (!isURLDestination.value) {
|
|
29591
|
+
link.value.target = LinkTarget.SELF;
|
|
29592
|
+
}
|
|
29617
29593
|
link.value.destinationHrefs.value.url = "";
|
|
29618
29594
|
};
|
|
29619
29595
|
const updateLink = (value) => {
|
|
@@ -29624,7 +29600,7 @@ const _sfc_main$9 = {
|
|
|
29624
29600
|
return openBlock(), createElementBlock("div", null, [
|
|
29625
29601
|
createVNode(unref(FieldLabel), { class: "zw-margin-bottom--xxs" }, {
|
|
29626
29602
|
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
29627
|
-
createTextVNode("
|
|
29603
|
+
createTextVNode(" Click Action ")
|
|
29628
29604
|
])),
|
|
29629
29605
|
_: 1
|
|
29630
29606
|
}),
|
|
@@ -29672,7 +29648,7 @@ const _sfc_main$8 = {
|
|
|
29672
29648
|
return link.linkData.value.text ? false : "Can't be empty";
|
|
29673
29649
|
};
|
|
29674
29650
|
const isValidUrl = () => {
|
|
29675
|
-
if (link.currentDestination.value.id !==
|
|
29651
|
+
if (link.currentDestination.value.id !== LinkDestination.URL) return false;
|
|
29676
29652
|
const href = link.destinationHrefs.value.url;
|
|
29677
29653
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(href) || RegExps.MAILTO_PROTOCOL.test(href);
|
|
29678
29654
|
if (isTelOrMail) return false;
|
|
@@ -29692,7 +29668,7 @@ const _sfc_main$8 = {
|
|
|
29692
29668
|
};
|
|
29693
29669
|
const toggler = useModalToggler({
|
|
29694
29670
|
onBeforeOpened: () => {
|
|
29695
|
-
editor.commands.extendMarkRange(
|
|
29671
|
+
editor.commands.extendMarkRange(TextSetting.LINK);
|
|
29696
29672
|
resetErrors();
|
|
29697
29673
|
link.prepareInitialFields();
|
|
29698
29674
|
}
|
|
@@ -29794,7 +29770,7 @@ const _sfc_main$8 = {
|
|
|
29794
29770
|
};
|
|
29795
29771
|
}
|
|
29796
29772
|
};
|
|
29797
|
-
const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
29773
|
+
const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-ebae331e"]]);
|
|
29798
29774
|
const _sfc_main$7 = {
|
|
29799
29775
|
name: "StylePresetOption",
|
|
29800
29776
|
components: {
|
|
@@ -30185,12 +30161,12 @@ const _sfc_main$1 = {
|
|
|
30185
30161
|
},
|
|
30186
30162
|
setup(__props) {
|
|
30187
30163
|
useCssVars((_ctx) => ({
|
|
30188
|
-
"
|
|
30164
|
+
"35f1c9c0": __props.offsets[1]
|
|
30189
30165
|
}));
|
|
30190
30166
|
const props = __props;
|
|
30191
30167
|
const layoutComponent = computed(() => {
|
|
30192
30168
|
if (props.popupMode) return _sfc_main$3;
|
|
30193
|
-
return props.device ===
|
|
30169
|
+
return props.device === Device.MOBILE ? _sfc_main$4 : _sfc_main$5;
|
|
30194
30170
|
});
|
|
30195
30171
|
return (_ctx, _cache) => {
|
|
30196
30172
|
return openBlock(), createBlock(KeepAlive, null, [
|
|
@@ -30217,7 +30193,7 @@ const _sfc_main$1 = {
|
|
|
30217
30193
|
};
|
|
30218
30194
|
}
|
|
30219
30195
|
};
|
|
30220
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
30196
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-da0b6f48"]]);
|
|
30221
30197
|
function useEditor({ content, onChange, extensions, isReadonlyRef }) {
|
|
30222
30198
|
const editor = reactive(new Editor2({
|
|
30223
30199
|
content: ContentNormalizer.normalize(content.value),
|
|
@@ -30256,6 +30232,9 @@ class Font {
|
|
|
30256
30232
|
const weights = this.styles.map((style2) => style2.replace("i", ""));
|
|
30257
30233
|
return Array.from(new Set(weights));
|
|
30258
30234
|
}
|
|
30235
|
+
get isItalicOnly() {
|
|
30236
|
+
return this.styles.every((style2) => style2.endsWith("i"));
|
|
30237
|
+
}
|
|
30259
30238
|
isWeightSupported(weight) {
|
|
30260
30239
|
return this.weights.includes(weight);
|
|
30261
30240
|
}
|
|
@@ -30315,7 +30294,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30315
30294
|
device: {
|
|
30316
30295
|
type: String,
|
|
30317
30296
|
required: false,
|
|
30318
|
-
default:
|
|
30297
|
+
default: Device.DESKTOP
|
|
30319
30298
|
},
|
|
30320
30299
|
favoriteColors: {
|
|
30321
30300
|
type: Array,
|
|
@@ -30437,18 +30416,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30437
30416
|
}
|
|
30438
30417
|
});
|
|
30439
30418
|
export {
|
|
30440
|
-
Alignment
|
|
30419
|
+
Alignment,
|
|
30441
30420
|
AlignmentList,
|
|
30442
|
-
Alignments,
|
|
30443
30421
|
Button,
|
|
30444
30422
|
ButtonToggle,
|
|
30445
|
-
CaseStyle
|
|
30446
|
-
CaseStyles,
|
|
30423
|
+
CaseStyle,
|
|
30447
30424
|
Checkbox,
|
|
30448
30425
|
_sfc_main$r as ColorPicker,
|
|
30449
30426
|
Device,
|
|
30450
30427
|
DeviceList,
|
|
30451
|
-
Devices,
|
|
30452
30428
|
Dropdown,
|
|
30453
30429
|
DropdownOption,
|
|
30454
30430
|
FieldLabel,
|
|
@@ -30456,20 +30432,15 @@ export {
|
|
|
30456
30432
|
Icon,
|
|
30457
30433
|
InjectionTokens$1 as InjectionTokens,
|
|
30458
30434
|
LinkDestination,
|
|
30459
|
-
LinkDestinations,
|
|
30460
30435
|
LinkTarget,
|
|
30461
|
-
LinkTargets,
|
|
30462
30436
|
ListOrderedTypeList,
|
|
30463
30437
|
ListType,
|
|
30464
30438
|
ListTypeList,
|
|
30465
|
-
ListTypes,
|
|
30466
30439
|
MarkGroup,
|
|
30467
|
-
MarkGroups,
|
|
30468
30440
|
Modal,
|
|
30469
30441
|
NodeBlockTypeList,
|
|
30470
30442
|
NodeFactory,
|
|
30471
30443
|
NodeType3 as NodeType,
|
|
30472
|
-
NodeTypes,
|
|
30473
30444
|
NumberField,
|
|
30474
30445
|
Range,
|
|
30475
30446
|
ScrollView,
|
|
@@ -30479,7 +30450,6 @@ export {
|
|
|
30479
30450
|
TextInlineMarkList,
|
|
30480
30451
|
TextPresetAttributeSettingList,
|
|
30481
30452
|
TextSetting,
|
|
30482
|
-
TextSettings,
|
|
30483
30453
|
_sfc_main as Wysiwyg,
|
|
30484
30454
|
isWysiwygContent,
|
|
30485
30455
|
useElementRef,
|