@zipify/wysiwyg 4.11.0-4 → 4.11.1
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/wysiwyg.css +27 -27
- package/dist/wysiwyg.mjs +129 -164
- 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 +5 -5
- 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/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,7 +23529,7 @@ const FontFamily = Mark2.create({
|
|
|
23557
23529
|
fontWeight = font.findClosestWeight(fontWeight);
|
|
23558
23530
|
commands2.applyFontWeight(fontWeight);
|
|
23559
23531
|
}
|
|
23560
|
-
const isItalicCustomized = commands2.isSettingCustomized(
|
|
23532
|
+
const isItalicCustomized = commands2.isSettingCustomized(TextSetting.FONT_STYLE).value;
|
|
23561
23533
|
if (!font.isItalicSupported(fontWeight) && isItalicCustomized) {
|
|
23562
23534
|
commands2.removeItalic();
|
|
23563
23535
|
}
|
|
@@ -23599,11 +23571,11 @@ const FontFamily = Mark2.create({
|
|
|
23599
23571
|
}
|
|
23600
23572
|
});
|
|
23601
23573
|
const StylePreset = Extension.create({
|
|
23602
|
-
name:
|
|
23574
|
+
name: TextSetting.STYLE_PRESET,
|
|
23603
23575
|
addGlobalAttributes() {
|
|
23604
23576
|
return [
|
|
23605
23577
|
{
|
|
23606
|
-
types: [
|
|
23578
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
23607
23579
|
attributes: {
|
|
23608
23580
|
preset: {
|
|
23609
23581
|
isRequired: false,
|
|
@@ -23670,14 +23642,14 @@ const StylePreset = Extension.create({
|
|
|
23670
23642
|
var _a;
|
|
23671
23643
|
const presets = unref(commands2.getPresetList());
|
|
23672
23644
|
const preset = findPresetById(presets, presetId);
|
|
23673
|
-
const nodeType = ((_a = preset.node) == null ? void 0 : _a.type) ??
|
|
23645
|
+
const nodeType = ((_a = preset.node) == null ? void 0 : _a.type) ?? NodeType3.PARAGRAPH;
|
|
23674
23646
|
const attrs = {
|
|
23675
23647
|
preset: { id: presetId }
|
|
23676
23648
|
};
|
|
23677
23649
|
if (preset.node) {
|
|
23678
23650
|
attrs.level = preset.node.level;
|
|
23679
23651
|
}
|
|
23680
|
-
for (const textAttribute of
|
|
23652
|
+
for (const textAttribute of TextAttributeSettingList) {
|
|
23681
23653
|
attrs[textAttribute] = unref(commands2.getBlockAttributes(textAttribute));
|
|
23682
23654
|
}
|
|
23683
23655
|
chain().removeList().setNode(nodeType, attrs).run();
|
|
@@ -23686,7 +23658,7 @@ const StylePreset = Extension.create({
|
|
|
23686
23658
|
commands2.applyPreset(unref(this.options.defaultId));
|
|
23687
23659
|
}),
|
|
23688
23660
|
removePreset: createCommand(({ commands: commands2 }) => {
|
|
23689
|
-
commands2.setNode(
|
|
23661
|
+
commands2.setNode(NodeType3.PARAGRAPH, { preset: null });
|
|
23690
23662
|
}),
|
|
23691
23663
|
getPresetCustomization: createCommand(({ editor, commands: commands2 }) => {
|
|
23692
23664
|
const state = toRef(editor, "state");
|
|
@@ -23698,7 +23670,7 @@ const StylePreset = Extension.create({
|
|
|
23698
23670
|
}),
|
|
23699
23671
|
isSettingCustomized: createCommand(({ commands: commands2 }, name) => {
|
|
23700
23672
|
const customization = commands2.getPresetCustomization();
|
|
23701
|
-
const group =
|
|
23673
|
+
const group = TextPresetAttributeSettingList.includes(name) ? "attributes" : "marks";
|
|
23702
23674
|
return computed(() => {
|
|
23703
23675
|
var _a;
|
|
23704
23676
|
return ((_a = unref(customization)[group]) == null ? void 0 : _a.includes(name)) ?? false;
|
|
@@ -23716,11 +23688,11 @@ const StylePreset = Extension.create({
|
|
|
23716
23688
|
const attributes = /* @__PURE__ */ new Set();
|
|
23717
23689
|
doc2.nodesBetween(from2, to, (node) => {
|
|
23718
23690
|
for (const [name, value] of Object.entries(node.attrs)) {
|
|
23719
|
-
const isSetting =
|
|
23691
|
+
const isSetting = TextPresetAttributeSettingList.includes(name);
|
|
23720
23692
|
if (isSetting && value) attributes.add(name);
|
|
23721
23693
|
}
|
|
23722
23694
|
for (const { type } of node.marks) {
|
|
23723
|
-
if (
|
|
23695
|
+
if (TextBlockMarkList.includes(type.name)) {
|
|
23724
23696
|
marks.add(type.name);
|
|
23725
23697
|
}
|
|
23726
23698
|
}
|
|
@@ -23731,7 +23703,7 @@ const StylePreset = Extension.create({
|
|
|
23731
23703
|
};
|
|
23732
23704
|
}),
|
|
23733
23705
|
removePresetCustomization: createCommand(({ chain }) => {
|
|
23734
|
-
chain().storeSelection().expandSelectionToBlock().removeMarks(
|
|
23706
|
+
chain().storeSelection().expandSelectionToBlock().removeMarks(TextBlockMarkList).resetAttributes(NodeType3.PARAGRAPH, TextPresetAttributeSettingList).resetAttributes(NodeType3.HEADING, TextPresetAttributeSettingList).restoreSelection().run();
|
|
23735
23707
|
}),
|
|
23736
23708
|
removeFormat: createCommand(({ chain }) => {
|
|
23737
23709
|
chain().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run();
|
|
@@ -23743,8 +23715,8 @@ const StylePreset = Extension.create({
|
|
|
23743
23715
|
}
|
|
23744
23716
|
});
|
|
23745
23717
|
const FontWeight = Mark2.create({
|
|
23746
|
-
name:
|
|
23747
|
-
group:
|
|
23718
|
+
name: TextSetting.FONT_WEIGHT,
|
|
23719
|
+
group: MarkGroup.SETTINGS,
|
|
23748
23720
|
addAttributes: () => ({
|
|
23749
23721
|
value: { required: true }
|
|
23750
23722
|
}),
|
|
@@ -23813,8 +23785,8 @@ const FontWeight = Mark2.create({
|
|
|
23813
23785
|
}
|
|
23814
23786
|
});
|
|
23815
23787
|
const FontSize = Mark2.create({
|
|
23816
|
-
name:
|
|
23817
|
-
group:
|
|
23788
|
+
name: TextSetting.FONT_SIZE,
|
|
23789
|
+
group: MarkGroup.SETTINGS,
|
|
23818
23790
|
addOptions: () => ({
|
|
23819
23791
|
minSize: 1,
|
|
23820
23792
|
maxSize: 100
|
|
@@ -23907,8 +23879,8 @@ const FontSize = Mark2.create({
|
|
|
23907
23879
|
}
|
|
23908
23880
|
});
|
|
23909
23881
|
const FontColor = Mark2.create({
|
|
23910
|
-
name:
|
|
23911
|
-
group:
|
|
23882
|
+
name: TextSetting.FONT_COLOR,
|
|
23883
|
+
group: MarkGroup.SETTINGS,
|
|
23912
23884
|
addAttributes: () => ({
|
|
23913
23885
|
value: { required: true }
|
|
23914
23886
|
}),
|
|
@@ -23944,7 +23916,7 @@ const FontColor = Mark2.create({
|
|
|
23944
23916
|
}
|
|
23945
23917
|
});
|
|
23946
23918
|
const BackgroundColor = Mark2.create({
|
|
23947
|
-
name:
|
|
23919
|
+
name: TextSetting.BACKGROUND_COLOR,
|
|
23948
23920
|
addAttributes: () => ({
|
|
23949
23921
|
value: { required: true }
|
|
23950
23922
|
}),
|
|
@@ -23984,8 +23956,8 @@ const DeviceManager = Extension.create({
|
|
|
23984
23956
|
}
|
|
23985
23957
|
});
|
|
23986
23958
|
const FontStyle = Mark2.create({
|
|
23987
|
-
name:
|
|
23988
|
-
group:
|
|
23959
|
+
name: TextSetting.FONT_STYLE,
|
|
23960
|
+
group: MarkGroup.SETTINGS,
|
|
23989
23961
|
addAttributes: () => ({
|
|
23990
23962
|
italic: { required: true }
|
|
23991
23963
|
}),
|
|
@@ -24054,7 +24026,7 @@ const FontStyle = Mark2.create({
|
|
|
24054
24026
|
}
|
|
24055
24027
|
});
|
|
24056
24028
|
const TextDecoration = Mark2.create({
|
|
24057
|
-
name:
|
|
24029
|
+
name: TextSetting.TEXT_DECORATION,
|
|
24058
24030
|
priority: 1e3,
|
|
24059
24031
|
addAttributes: () => ({
|
|
24060
24032
|
underline: { default: false },
|
|
@@ -24166,17 +24138,17 @@ const TextDecoration = Mark2.create({
|
|
|
24166
24138
|
return renderMark({ text_decoration: decorations.join(" ") });
|
|
24167
24139
|
}
|
|
24168
24140
|
});
|
|
24169
|
-
const
|
|
24141
|
+
const CaseStyleExtension = Extension.create({
|
|
24170
24142
|
name: "case_style",
|
|
24171
24143
|
addCommands() {
|
|
24172
24144
|
return {
|
|
24173
24145
|
applyCaseStyle: createCommand(({ commands: commands2 }, value) => {
|
|
24174
24146
|
switch (value) {
|
|
24175
|
-
case
|
|
24147
|
+
case CaseStyle.CAPITALIZE:
|
|
24176
24148
|
return commands2.applyCapitalize();
|
|
24177
|
-
case
|
|
24149
|
+
case CaseStyle.LOWERCASE:
|
|
24178
24150
|
return commands2.applyLowerCase();
|
|
24179
|
-
case
|
|
24151
|
+
case CaseStyle.UPPERCASE:
|
|
24180
24152
|
return commands2.applyUpperCase();
|
|
24181
24153
|
}
|
|
24182
24154
|
}),
|
|
@@ -24197,13 +24169,13 @@ const DEFAULTS$1 = {
|
|
|
24197
24169
|
tablet: null,
|
|
24198
24170
|
desktop: null
|
|
24199
24171
|
};
|
|
24200
|
-
const
|
|
24201
|
-
name:
|
|
24172
|
+
const AlignmentExtension = Extension.create({
|
|
24173
|
+
name: TextSetting.ALIGNMENT,
|
|
24202
24174
|
addGlobalAttributes: () => [
|
|
24203
24175
|
{
|
|
24204
|
-
types: [
|
|
24176
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
24205
24177
|
attributes: {
|
|
24206
|
-
[
|
|
24178
|
+
[TextSetting.ALIGNMENT]: {
|
|
24207
24179
|
isRequired: false,
|
|
24208
24180
|
parseHTML({ style: style2 }) {
|
|
24209
24181
|
const textAlign = convertAlignment(style2.textAlign);
|
|
@@ -24247,15 +24219,15 @@ const Alignment = Extension.create({
|
|
|
24247
24219
|
getDefaultAlignment: createCommand(({ commands: commands2 }) => {
|
|
24248
24220
|
const device = commands2.getDevice();
|
|
24249
24221
|
const preset = commands2.getPreset();
|
|
24250
|
-
return computed(() => unref(preset)[unref(device)].alignment ??
|
|
24222
|
+
return computed(() => unref(preset)[unref(device)].alignment ?? Alignment.LEFT);
|
|
24251
24223
|
})
|
|
24252
24224
|
};
|
|
24253
24225
|
},
|
|
24254
24226
|
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",
|
|
24227
|
+
"Mod-Shift-l": createKeyboardShortcut("applyAlignment", Alignment.LEFT),
|
|
24228
|
+
"Mod-Shift-e": createKeyboardShortcut("applyAlignment", Alignment.CENTER),
|
|
24229
|
+
"Mod-Shift-r": createKeyboardShortcut("applyAlignment", Alignment.RIGHT),
|
|
24230
|
+
"Mod-Shift-j": createKeyboardShortcut("applyAlignment", Alignment.JUSTIFY)
|
|
24259
24231
|
})
|
|
24260
24232
|
});
|
|
24261
24233
|
const DEFAULTS = {
|
|
@@ -24264,13 +24236,13 @@ const DEFAULTS = {
|
|
|
24264
24236
|
desktop: null
|
|
24265
24237
|
};
|
|
24266
24238
|
const LineHeight = Extension.create({
|
|
24267
|
-
name:
|
|
24239
|
+
name: TextSetting.LINE_HEIGHT,
|
|
24268
24240
|
addGlobalAttributes() {
|
|
24269
24241
|
return [
|
|
24270
24242
|
{
|
|
24271
|
-
types: [
|
|
24243
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
24272
24244
|
attributes: {
|
|
24273
|
-
[
|
|
24245
|
+
[TextSetting.LINE_HEIGHT]: {
|
|
24274
24246
|
isRequired: false,
|
|
24275
24247
|
parseHTML: (element) => {
|
|
24276
24248
|
if (element.matches('[style*="--zw-line-height"]')) {
|
|
@@ -24351,8 +24323,8 @@ const ListItem$1 = Node$1.create({
|
|
|
24351
24323
|
}
|
|
24352
24324
|
});
|
|
24353
24325
|
const ListItem = ListItem$1.extend({
|
|
24354
|
-
name:
|
|
24355
|
-
marks:
|
|
24326
|
+
name: NodeType3.LIST_ITEM,
|
|
24327
|
+
marks: MarkGroup.SETTINGS,
|
|
24356
24328
|
addCommands() {
|
|
24357
24329
|
const getItemPosition = ({ selection }) => selection.$cursor.before(selection.$cursor.depth - 1);
|
|
24358
24330
|
return {
|
|
@@ -24378,7 +24350,7 @@ const ListItem = ListItem$1.extend({
|
|
|
24378
24350
|
const { state, commands: commands2 } = context.editor;
|
|
24379
24351
|
const isListSelected = (_a = state.selection.$cursor) == null ? void 0 : _a.path.some((node) => {
|
|
24380
24352
|
var _a2;
|
|
24381
|
-
return ((_a2 = node.type) == null ? void 0 : _a2.name) ===
|
|
24353
|
+
return ((_a2 = node.type) == null ? void 0 : _a2.name) === NodeType3.LIST;
|
|
24382
24354
|
});
|
|
24383
24355
|
if (isListSelected) return commands2.listItemNewline();
|
|
24384
24356
|
}
|
|
@@ -24862,7 +24834,7 @@ const Link$1 = Mark2.create({
|
|
|
24862
24834
|
}
|
|
24863
24835
|
});
|
|
24864
24836
|
const Link = Link$1.extend({
|
|
24865
|
-
name:
|
|
24837
|
+
name: TextSetting.LINK,
|
|
24866
24838
|
addOptions() {
|
|
24867
24839
|
var _a;
|
|
24868
24840
|
return {
|
|
@@ -24882,18 +24854,18 @@ const Link = Link$1.extend({
|
|
|
24882
24854
|
}
|
|
24883
24855
|
},
|
|
24884
24856
|
target: {
|
|
24885
|
-
default:
|
|
24886
|
-
parseHTML: (element) => element.getAttribute("target") ||
|
|
24857
|
+
default: LinkTarget.SELF,
|
|
24858
|
+
parseHTML: (element) => element.getAttribute("target") || LinkTarget.SELF
|
|
24887
24859
|
},
|
|
24888
24860
|
destination: {
|
|
24889
|
-
default:
|
|
24861
|
+
default: LinkDestination.URL,
|
|
24890
24862
|
parseHTML: (element) => {
|
|
24891
24863
|
const href = element.getAttribute("href");
|
|
24892
|
-
if (!href.startsWith("#")) return
|
|
24864
|
+
if (!href.startsWith("#")) return LinkDestination.URL;
|
|
24893
24865
|
const id = href.replace("#", "");
|
|
24894
24866
|
const blocks = unref(this.options.pageBlocks);
|
|
24895
24867
|
const block = blocks.find((block2) => block2.id === parseInt(id));
|
|
24896
|
-
return block ?
|
|
24868
|
+
return block ? LinkDestination.BLOCK : LinkDestination.URL;
|
|
24897
24869
|
}
|
|
24898
24870
|
}
|
|
24899
24871
|
};
|
|
@@ -24906,7 +24878,7 @@ const Link = Link$1.extend({
|
|
|
24906
24878
|
commands2.setMeta("preventAutolink", true);
|
|
24907
24879
|
if (!commands2.getSelectedText()) {
|
|
24908
24880
|
return commands2.insertContent(NodeFactory.text(attributes.text, [
|
|
24909
|
-
NodeFactory.mark(
|
|
24881
|
+
NodeFactory.mark(TextSetting.LINK, attributes)
|
|
24910
24882
|
]));
|
|
24911
24883
|
}
|
|
24912
24884
|
return chain().applyMark(this.name, attributes).expandSelectionToLink().command(({ tr: tr2 }) => {
|
|
@@ -24930,14 +24902,14 @@ const Link = Link$1.extend({
|
|
|
24930
24902
|
];
|
|
24931
24903
|
},
|
|
24932
24904
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
24933
|
-
const href = attrs.destination ===
|
|
24905
|
+
const href = attrs.destination === LinkDestination.BLOCK ? `#${attrs.href}` : attrs.href;
|
|
24934
24906
|
const presetClass = unref(this.options.basePresetClass) + unref(this.options.preset).id;
|
|
24935
24907
|
const linkAttrs = { href, target: attrs.target, class: `${presetClass} zw-style` };
|
|
24936
24908
|
return ["a", linkAttrs, 0];
|
|
24937
24909
|
}
|
|
24938
24910
|
});
|
|
24939
24911
|
const Superscript = Mark2.create({
|
|
24940
|
-
name:
|
|
24912
|
+
name: TextSetting.SUPERSCRIPT,
|
|
24941
24913
|
addCommands() {
|
|
24942
24914
|
return {
|
|
24943
24915
|
applySuperscript: createCommand(({ commands: commands2 }) => {
|
|
@@ -24970,12 +24942,12 @@ const Superscript = Mark2.create({
|
|
|
24970
24942
|
}
|
|
24971
24943
|
});
|
|
24972
24944
|
const Margin = Extension.create({
|
|
24973
|
-
name:
|
|
24945
|
+
name: TextSetting.MARGIN,
|
|
24974
24946
|
addGlobalAttributes: () => [
|
|
24975
24947
|
{
|
|
24976
|
-
types: [
|
|
24948
|
+
types: [NodeType3.PARAGRAPH, NodeType3.HEADING],
|
|
24977
24949
|
attributes: {
|
|
24978
|
-
[
|
|
24950
|
+
[TextSetting.MARGIN]: {
|
|
24979
24951
|
isRequired: false,
|
|
24980
24952
|
parseHTML(el) {
|
|
24981
24953
|
const { margin, marginTop, marginRight, marginBottom, marginLeft } = el.style;
|
|
@@ -25034,9 +25006,9 @@ function buildExtensions(options) {
|
|
|
25034
25006
|
BackgroundColor,
|
|
25035
25007
|
FontStyle,
|
|
25036
25008
|
TextDecoration,
|
|
25037
|
-
|
|
25009
|
+
CaseStyleExtension,
|
|
25038
25010
|
Superscript,
|
|
25039
|
-
|
|
25011
|
+
AlignmentExtension,
|
|
25040
25012
|
LineHeight.configure({
|
|
25041
25013
|
wrapperRef: options.wrapperRef
|
|
25042
25014
|
}),
|
|
@@ -25655,7 +25627,7 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
25655
25627
|
}
|
|
25656
25628
|
_bubbleMarks(node) {
|
|
25657
25629
|
if (!node.content) return;
|
|
25658
|
-
if (node.type ===
|
|
25630
|
+
if (node.type === NodeType3.LIST) return;
|
|
25659
25631
|
for (const child of node.content) {
|
|
25660
25632
|
if (this._isLink(child)) continue;
|
|
25661
25633
|
if (!child.marks) continue;
|
|
@@ -25672,10 +25644,10 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
25672
25644
|
}
|
|
25673
25645
|
}
|
|
25674
25646
|
_canBubbleMark(node, childMark) {
|
|
25675
|
-
if (
|
|
25647
|
+
if (TextInlineMarkList.includes(childMark.type)) return false;
|
|
25676
25648
|
if (this._includesMarkType(node, childMark.type)) return false;
|
|
25677
25649
|
for (const child of node.content) {
|
|
25678
|
-
if (!child.content && node.type ===
|
|
25650
|
+
if (!child.content && node.type === NodeType3.LIST_ITEM) continue;
|
|
25679
25651
|
if (!child.marks) return false;
|
|
25680
25652
|
if (!this._includesMark(child, childMark)) return false;
|
|
25681
25653
|
}
|
|
@@ -25690,7 +25662,7 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
25690
25662
|
return ((_a = node.marks) == null ? void 0 : _a.some((mark) => mark.type === type)) ?? false;
|
|
25691
25663
|
}
|
|
25692
25664
|
_isLink(node) {
|
|
25693
|
-
return node.type ===
|
|
25665
|
+
return node.type === NodeType3.TEXT && this._includesMarkType(node, TextSetting.LINK);
|
|
25694
25666
|
}
|
|
25695
25667
|
_removeMark(node, mark) {
|
|
25696
25668
|
if (!node.marks) return;
|
|
@@ -25763,7 +25735,7 @@ class ContentSerializer {
|
|
|
25763
25735
|
makePresetVariable: () => "",
|
|
25764
25736
|
basePresetClass: config.basePresetClass,
|
|
25765
25737
|
baseListClass: config.baseListClass,
|
|
25766
|
-
deviceRef: ref(
|
|
25738
|
+
deviceRef: ref(Device.DESKTOP),
|
|
25767
25739
|
pageBlocksRef: ref([]),
|
|
25768
25740
|
wrapperRef: ContextWindow.document.createElement("p")
|
|
25769
25741
|
});
|
|
@@ -25940,12 +25912,12 @@ class StylePresetRenderer {
|
|
|
25940
25912
|
const isLink = preset.id === this._linkPresetId;
|
|
25941
25913
|
const className = this.makePresetCssClass(preset);
|
|
25942
25914
|
css += ` ${className} {`;
|
|
25943
|
-
for (const device of
|
|
25915
|
+
for (const device of DeviceList) {
|
|
25944
25916
|
for (const setting of Object.keys(preset[device])) {
|
|
25945
25917
|
const variable = this._makeVariable({ device, preset, property: setting });
|
|
25946
25918
|
const internalVariable = this._makeInternalVariableName(setting, device);
|
|
25947
25919
|
css += `${internalVariable}: var(${variable}, inherit);`;
|
|
25948
|
-
if (isLink && !
|
|
25920
|
+
if (isLink && !TextAttributeSettingList.includes(setting)) {
|
|
25949
25921
|
const overrideVariable = internalVariable.replace("preset-", "");
|
|
25950
25922
|
css += `${overrideVariable}: var(${internalVariable});`;
|
|
25951
25923
|
}
|
|
@@ -25957,7 +25929,7 @@ class StylePresetRenderer {
|
|
|
25957
25929
|
}
|
|
25958
25930
|
_makeInternalVariableName(setting, device) {
|
|
25959
25931
|
const property = setting === "color" ? "font-color" : setting.replace(/_/i, "-");
|
|
25960
|
-
const prefix = device ===
|
|
25932
|
+
const prefix = device === Device.COMMON ? "" : `-${device}`;
|
|
25961
25933
|
return `--zw-preset-${property}${prefix}`;
|
|
25962
25934
|
}
|
|
25963
25935
|
makePresetHtmlClass(preset) {
|
|
@@ -28696,7 +28668,7 @@ const _sfc_main$q = {
|
|
|
28696
28668
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
28697
28669
|
const defaultFontFamily = editor.commands.getDefaultFontFamily();
|
|
28698
28670
|
const recentFontNames = useRecentFonts({ limit: 5 });
|
|
28699
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28671
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_FAMILY);
|
|
28700
28672
|
const recentFontsCategory = computed(() => ({
|
|
28701
28673
|
id: "Recently Used",
|
|
28702
28674
|
options: recentFontNames.fonts.value.map((name) => ({
|
|
@@ -28758,7 +28730,7 @@ const _sfc_main$q = {
|
|
|
28758
28730
|
};
|
|
28759
28731
|
}
|
|
28760
28732
|
};
|
|
28761
|
-
const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-
|
|
28733
|
+
const FontFamilyControl = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__scopeId", "data-v-e3657967"]]);
|
|
28762
28734
|
const _hoisted_1$a = {
|
|
28763
28735
|
key: 0,
|
|
28764
28736
|
class: "zw-dropdown__default-option"
|
|
@@ -28776,7 +28748,7 @@ const _sfc_main$p = {
|
|
|
28776
28748
|
}));
|
|
28777
28749
|
});
|
|
28778
28750
|
const currentValue = editor.commands.getFontWeight();
|
|
28779
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28751
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_WEIGHT);
|
|
28780
28752
|
const apply2 = (value) => editor.chain().focus().applyFontWeight(value).run();
|
|
28781
28753
|
return (_ctx, _cache) => {
|
|
28782
28754
|
return withDirectives((openBlock(), createBlock(unref(Dropdown), {
|
|
@@ -28807,7 +28779,7 @@ const _sfc_main$p = {
|
|
|
28807
28779
|
};
|
|
28808
28780
|
}
|
|
28809
28781
|
};
|
|
28810
|
-
const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-
|
|
28782
|
+
const FontWeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__scopeId", "data-v-6c8237c7"]]);
|
|
28811
28783
|
const _hoisted_1$9 = {
|
|
28812
28784
|
key: 0,
|
|
28813
28785
|
class: "zw-dropdown__default-option"
|
|
@@ -28826,7 +28798,7 @@ const _sfc_main$o = {
|
|
|
28826
28798
|
}));
|
|
28827
28799
|
});
|
|
28828
28800
|
const currentValue = editor.commands.getFontSize();
|
|
28829
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28801
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_SIZE);
|
|
28830
28802
|
const apply2 = (value) => editor.chain().focus().applyFontSize(value).run();
|
|
28831
28803
|
return (_ctx, _cache) => {
|
|
28832
28804
|
return withDirectives((openBlock(), createBlock(unref(Dropdown), {
|
|
@@ -28857,7 +28829,7 @@ const _sfc_main$o = {
|
|
|
28857
28829
|
};
|
|
28858
28830
|
}
|
|
28859
28831
|
};
|
|
28860
|
-
const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-
|
|
28832
|
+
const FontSizeControl = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__scopeId", "data-v-779fe48e"]]);
|
|
28861
28833
|
const _hoisted_1$8 = {
|
|
28862
28834
|
key: 0,
|
|
28863
28835
|
class: "zw-button__customized-indicator",
|
|
@@ -28868,7 +28840,7 @@ const _sfc_main$n = {
|
|
|
28868
28840
|
setup(__props) {
|
|
28869
28841
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
28870
28842
|
const currentValue = editor.commands.getFontColor();
|
|
28871
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28843
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_COLOR);
|
|
28872
28844
|
const apply2 = (color) => editor.chain().applyFontColor(color).run();
|
|
28873
28845
|
return (_ctx, _cache) => {
|
|
28874
28846
|
return openBlock(), createBlock(unref(_sfc_main$r), {
|
|
@@ -28954,7 +28926,7 @@ const _sfc_main$l = {
|
|
|
28954
28926
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
28955
28927
|
const currentValue = editor.commands.isItalic();
|
|
28956
28928
|
const isAvailable = editor.commands.isItalicAvailable();
|
|
28957
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
28929
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.FONT_STYLE);
|
|
28958
28930
|
const apply2 = () => editor.chain().focus().toggleItalic().run();
|
|
28959
28931
|
return (_ctx, _cache) => {
|
|
28960
28932
|
return withDirectives((openBlock(), createBlock(unref(Button), {
|
|
@@ -29087,9 +29059,9 @@ const _sfc_main$h = {
|
|
|
29087
29059
|
__name: "CaseStyleControl",
|
|
29088
29060
|
setup(__props) {
|
|
29089
29061
|
const styles = [
|
|
29090
|
-
{ id:
|
|
29091
|
-
{ id:
|
|
29092
|
-
{ id:
|
|
29062
|
+
{ id: CaseStyle.UPPERCASE, title: "UPPERCASE" },
|
|
29063
|
+
{ id: CaseStyle.LOWERCASE, title: "lowercase" },
|
|
29064
|
+
{ id: CaseStyle.CAPITALIZE, title: "Capitalize" }
|
|
29093
29065
|
];
|
|
29094
29066
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29095
29067
|
const apply2 = (value) => editor.chain().focus().applyCaseStyle(value).run();
|
|
@@ -29129,25 +29101,25 @@ const _sfc_main$g = {
|
|
|
29129
29101
|
const emit = __emit;
|
|
29130
29102
|
const alignments = [
|
|
29131
29103
|
{
|
|
29132
|
-
id:
|
|
29104
|
+
id: Alignment.LEFT,
|
|
29133
29105
|
tooltip: { text: "Align Left", hotkey: "Mod Shift L" }
|
|
29134
29106
|
},
|
|
29135
29107
|
{
|
|
29136
|
-
id:
|
|
29108
|
+
id: Alignment.CENTER,
|
|
29137
29109
|
tooltip: { text: "Align Center", hotkey: "Mod Shift E" }
|
|
29138
29110
|
},
|
|
29139
29111
|
{
|
|
29140
|
-
id:
|
|
29112
|
+
id: Alignment.RIGHT,
|
|
29141
29113
|
tooltip: { text: "Align Right", hotkey: "Mod Shift R" }
|
|
29142
29114
|
},
|
|
29143
29115
|
{
|
|
29144
|
-
id:
|
|
29116
|
+
id: Alignment.JUSTIFY,
|
|
29145
29117
|
tooltip: { text: "Justify", hotkey: "Mod Shift J" }
|
|
29146
29118
|
}
|
|
29147
29119
|
];
|
|
29148
29120
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29149
29121
|
const currentValue = editor.commands.getAlignment();
|
|
29150
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
29122
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.ALIGNMENT);
|
|
29151
29123
|
function toggle(value) {
|
|
29152
29124
|
editor.chain().focus().applyAlignment(value).run();
|
|
29153
29125
|
emit("applied");
|
|
@@ -29210,7 +29182,7 @@ const _sfc_main$f = {
|
|
|
29210
29182
|
const wrapperRef = ref(null);
|
|
29211
29183
|
const toggler = useModalToggler();
|
|
29212
29184
|
const currentValue = editor.commands.getLineHeight();
|
|
29213
|
-
const isCustomized = editor.commands.isSettingCustomized(
|
|
29185
|
+
const isCustomized = editor.commands.isSettingCustomized(TextSetting.LINE_HEIGHT);
|
|
29214
29186
|
const apply2 = (value) => editor.commands.applyLineHeight(String(value));
|
|
29215
29187
|
return (_ctx, _cache) => {
|
|
29216
29188
|
return openBlock(), createElementBlock("div", {
|
|
@@ -29285,26 +29257,26 @@ const _sfc_main$f = {
|
|
|
29285
29257
|
};
|
|
29286
29258
|
}
|
|
29287
29259
|
};
|
|
29288
|
-
const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-
|
|
29260
|
+
const LineHeightControl = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__scopeId", "data-v-643242a1"]]);
|
|
29289
29261
|
const _hoisted_1$4 = { class: "zpa-list-control" };
|
|
29290
29262
|
const _sfc_main$e = {
|
|
29291
29263
|
__name: "ListControl",
|
|
29292
29264
|
setup(__props) {
|
|
29293
|
-
const listTypes =
|
|
29265
|
+
const listTypes = ListTypeList.map((type) => ({
|
|
29294
29266
|
id: type,
|
|
29295
29267
|
icon: `list-${type}`
|
|
29296
29268
|
}));
|
|
29297
29269
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29298
29270
|
const selectionValue = editor.commands.getListType();
|
|
29299
29271
|
const currentValue = computed(() => unref(selectionValue) || "none");
|
|
29300
|
-
const recentListType = ref(
|
|
29272
|
+
const recentListType = ref(ListType.DISC);
|
|
29301
29273
|
const isCurrentListSelected = computed(() => unref(selectionValue) === recentListType.value);
|
|
29302
29274
|
const currentIcon = computed(() => `list-${recentListType.value}`);
|
|
29303
29275
|
const apply2 = (type) => {
|
|
29304
29276
|
recentListType.value = type;
|
|
29305
29277
|
editor.chain().focus().applyList(type).run();
|
|
29306
29278
|
};
|
|
29307
|
-
const toggle = () => apply2(recentListType.value ||
|
|
29279
|
+
const toggle = () => apply2(recentListType.value || ListType.DISC);
|
|
29308
29280
|
return (_ctx, _cache) => {
|
|
29309
29281
|
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
29310
29282
|
withDirectives((openBlock(), createBlock(unref(Button), {
|
|
@@ -29370,7 +29342,7 @@ const _sfc_main$e = {
|
|
|
29370
29342
|
};
|
|
29371
29343
|
}
|
|
29372
29344
|
};
|
|
29373
|
-
const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-
|
|
29345
|
+
const ListControl = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__scopeId", "data-v-55962f5e"]]);
|
|
29374
29346
|
const _sfc_main$d = {
|
|
29375
29347
|
__name: "RemoveFormatControl",
|
|
29376
29348
|
setup(__props) {
|
|
@@ -29439,18 +29411,18 @@ const LinkControlHeader = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId"
|
|
|
29439
29411
|
function useLink() {
|
|
29440
29412
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
29441
29413
|
const pageBlocks = inject(InjectionTokens$1.PAGE_BLOCKS);
|
|
29442
|
-
const linkData = ref({ text: "", target:
|
|
29414
|
+
const linkData = ref({ text: "", target: LinkTarget.SELF, destination: LinkDestination.URL });
|
|
29443
29415
|
const destinationHrefs = ref({ block: pageBlocks.value[0].id, url: "" });
|
|
29444
|
-
const currentDestination = ref({ id:
|
|
29416
|
+
const currentDestination = ref({ id: LinkDestination.URL });
|
|
29445
29417
|
function updateTarget(isChecked) {
|
|
29446
|
-
linkData.value.target = isChecked ?
|
|
29418
|
+
linkData.value.target = isChecked ? LinkTarget.BLANK : LinkTarget.SELF;
|
|
29447
29419
|
}
|
|
29448
29420
|
function prepareInitialFields() {
|
|
29449
29421
|
editor.commands.expandSelectionToLink();
|
|
29450
29422
|
linkData.value.text = editor.commands.getSelectedText();
|
|
29451
|
-
const { destination, href, target } = editor.getAttributes(
|
|
29452
|
-
currentDestination.value.id = destination ||
|
|
29453
|
-
linkData.value.target = target ||
|
|
29423
|
+
const { destination, href, target } = editor.getAttributes(TextSetting.LINK);
|
|
29424
|
+
currentDestination.value.id = destination || LinkDestination.URL;
|
|
29425
|
+
linkData.value.target = target || LinkTarget.SELF;
|
|
29454
29426
|
destinationHrefs.value[currentDestination.value.id] = href || "";
|
|
29455
29427
|
}
|
|
29456
29428
|
function resetDestinations() {
|
|
@@ -29458,7 +29430,7 @@ function useLink() {
|
|
|
29458
29430
|
destinationHrefs.value.url = "";
|
|
29459
29431
|
}
|
|
29460
29432
|
function getFormattedHref() {
|
|
29461
|
-
if (currentDestination.value.id ===
|
|
29433
|
+
if (currentDestination.value.id === LinkDestination.URL) {
|
|
29462
29434
|
const url = destinationHrefs.value.url;
|
|
29463
29435
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(url) || RegExps.MAILTO_PROTOCOL.test(url);
|
|
29464
29436
|
if (isTelOrMail) return url;
|
|
@@ -29604,16 +29576,18 @@ const _sfc_main$9 = {
|
|
|
29604
29576
|
const props = __props;
|
|
29605
29577
|
const emit = __emit;
|
|
29606
29578
|
const destinationTypes = [
|
|
29607
|
-
{ id:
|
|
29608
|
-
{ id:
|
|
29579
|
+
{ id: LinkDestination.URL, title: "URL" },
|
|
29580
|
+
{ id: LinkDestination.BLOCK, title: "Page Section" }
|
|
29609
29581
|
];
|
|
29610
29582
|
const link = toRef(props, "link");
|
|
29611
|
-
const isURLDestination = computed(() => link.value.currentDestination.value.id ===
|
|
29612
|
-
const isTargetBlank = computed(() => link.value.linkData.value.target ===
|
|
29583
|
+
const isURLDestination = computed(() => link.value.currentDestination.value.id === LinkDestination.URL);
|
|
29584
|
+
const isTargetBlank = computed(() => link.value.linkData.value.target === LinkTarget.BLANK);
|
|
29613
29585
|
const changeDestination = (value) => {
|
|
29614
29586
|
emit("reset-errors");
|
|
29615
29587
|
link.value.currentDestination.value.id = value;
|
|
29616
|
-
if (!isURLDestination.value)
|
|
29588
|
+
if (!isURLDestination.value) {
|
|
29589
|
+
link.value.target = LinkTarget.SELF;
|
|
29590
|
+
}
|
|
29617
29591
|
link.value.destinationHrefs.value.url = "";
|
|
29618
29592
|
};
|
|
29619
29593
|
const updateLink = (value) => {
|
|
@@ -29624,7 +29598,7 @@ const _sfc_main$9 = {
|
|
|
29624
29598
|
return openBlock(), createElementBlock("div", null, [
|
|
29625
29599
|
createVNode(unref(FieldLabel), { class: "zw-margin-bottom--xxs" }, {
|
|
29626
29600
|
default: withCtx(() => _cache[0] || (_cache[0] = [
|
|
29627
|
-
createTextVNode("
|
|
29601
|
+
createTextVNode(" Click Action ")
|
|
29628
29602
|
])),
|
|
29629
29603
|
_: 1
|
|
29630
29604
|
}),
|
|
@@ -29672,7 +29646,7 @@ const _sfc_main$8 = {
|
|
|
29672
29646
|
return link.linkData.value.text ? false : "Can't be empty";
|
|
29673
29647
|
};
|
|
29674
29648
|
const isValidUrl = () => {
|
|
29675
|
-
if (link.currentDestination.value.id !==
|
|
29649
|
+
if (link.currentDestination.value.id !== LinkDestination.URL) return false;
|
|
29676
29650
|
const href = link.destinationHrefs.value.url;
|
|
29677
29651
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(href) || RegExps.MAILTO_PROTOCOL.test(href);
|
|
29678
29652
|
if (isTelOrMail) return false;
|
|
@@ -29692,7 +29666,7 @@ const _sfc_main$8 = {
|
|
|
29692
29666
|
};
|
|
29693
29667
|
const toggler = useModalToggler({
|
|
29694
29668
|
onBeforeOpened: () => {
|
|
29695
|
-
editor.commands.extendMarkRange(
|
|
29669
|
+
editor.commands.extendMarkRange(TextSetting.LINK);
|
|
29696
29670
|
resetErrors();
|
|
29697
29671
|
link.prepareInitialFields();
|
|
29698
29672
|
}
|
|
@@ -29794,7 +29768,7 @@ const _sfc_main$8 = {
|
|
|
29794
29768
|
};
|
|
29795
29769
|
}
|
|
29796
29770
|
};
|
|
29797
|
-
const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-
|
|
29771
|
+
const LinkControl = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-ebae331e"]]);
|
|
29798
29772
|
const _sfc_main$7 = {
|
|
29799
29773
|
name: "StylePresetOption",
|
|
29800
29774
|
components: {
|
|
@@ -30185,12 +30159,12 @@ const _sfc_main$1 = {
|
|
|
30185
30159
|
},
|
|
30186
30160
|
setup(__props) {
|
|
30187
30161
|
useCssVars((_ctx) => ({
|
|
30188
|
-
"
|
|
30162
|
+
"35f1c9c0": __props.offsets[1]
|
|
30189
30163
|
}));
|
|
30190
30164
|
const props = __props;
|
|
30191
30165
|
const layoutComponent = computed(() => {
|
|
30192
30166
|
if (props.popupMode) return _sfc_main$3;
|
|
30193
|
-
return props.device ===
|
|
30167
|
+
return props.device === Device.MOBILE ? _sfc_main$4 : _sfc_main$5;
|
|
30194
30168
|
});
|
|
30195
30169
|
return (_ctx, _cache) => {
|
|
30196
30170
|
return openBlock(), createBlock(KeepAlive, null, [
|
|
@@ -30217,7 +30191,7 @@ const _sfc_main$1 = {
|
|
|
30217
30191
|
};
|
|
30218
30192
|
}
|
|
30219
30193
|
};
|
|
30220
|
-
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-
|
|
30194
|
+
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-da0b6f48"]]);
|
|
30221
30195
|
function useEditor({ content, onChange, extensions, isReadonlyRef }) {
|
|
30222
30196
|
const editor = reactive(new Editor2({
|
|
30223
30197
|
content: ContentNormalizer.normalize(content.value),
|
|
@@ -30315,7 +30289,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30315
30289
|
device: {
|
|
30316
30290
|
type: String,
|
|
30317
30291
|
required: false,
|
|
30318
|
-
default:
|
|
30292
|
+
default: Device.DESKTOP
|
|
30319
30293
|
},
|
|
30320
30294
|
favoriteColors: {
|
|
30321
30295
|
type: Array,
|
|
@@ -30437,18 +30411,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30437
30411
|
}
|
|
30438
30412
|
});
|
|
30439
30413
|
export {
|
|
30440
|
-
Alignment
|
|
30414
|
+
Alignment,
|
|
30441
30415
|
AlignmentList,
|
|
30442
|
-
Alignments,
|
|
30443
30416
|
Button,
|
|
30444
30417
|
ButtonToggle,
|
|
30445
|
-
CaseStyle
|
|
30446
|
-
CaseStyles,
|
|
30418
|
+
CaseStyle,
|
|
30447
30419
|
Checkbox,
|
|
30448
30420
|
_sfc_main$r as ColorPicker,
|
|
30449
30421
|
Device,
|
|
30450
30422
|
DeviceList,
|
|
30451
|
-
Devices,
|
|
30452
30423
|
Dropdown,
|
|
30453
30424
|
DropdownOption,
|
|
30454
30425
|
FieldLabel,
|
|
@@ -30456,20 +30427,15 @@ export {
|
|
|
30456
30427
|
Icon,
|
|
30457
30428
|
InjectionTokens$1 as InjectionTokens,
|
|
30458
30429
|
LinkDestination,
|
|
30459
|
-
LinkDestinations,
|
|
30460
30430
|
LinkTarget,
|
|
30461
|
-
LinkTargets,
|
|
30462
30431
|
ListOrderedTypeList,
|
|
30463
30432
|
ListType,
|
|
30464
30433
|
ListTypeList,
|
|
30465
|
-
ListTypes,
|
|
30466
30434
|
MarkGroup,
|
|
30467
|
-
MarkGroups,
|
|
30468
30435
|
Modal,
|
|
30469
30436
|
NodeBlockTypeList,
|
|
30470
30437
|
NodeFactory,
|
|
30471
30438
|
NodeType3 as NodeType,
|
|
30472
|
-
NodeTypes,
|
|
30473
30439
|
NumberField,
|
|
30474
30440
|
Range,
|
|
30475
30441
|
ScrollView,
|
|
@@ -30479,7 +30445,6 @@ export {
|
|
|
30479
30445
|
TextInlineMarkList,
|
|
30480
30446
|
TextPresetAttributeSettingList,
|
|
30481
30447
|
TextSetting,
|
|
30482
|
-
TextSettings,
|
|
30483
30448
|
_sfc_main as Wysiwyg,
|
|
30484
30449
|
isWysiwygContent,
|
|
30485
30450
|
useElementRef,
|