@zipify/wysiwyg 4.2.2 → 4.4.0-0
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 +1 -0
- package/config/build/cli.config.js +9 -6
- package/config/build/node.config.js +50 -0
- package/dist/cli.js +61 -24
- package/dist/node.js +40 -0
- package/dist/types/Wysiwyg.vue.d.ts +2 -2
- package/dist/types/composables/useEditor.d.ts +3 -4
- package/dist/types/entryLib.d.ts +1 -1
- package/dist/types/entryNode.d.ts +2 -0
- package/dist/types/node/NodeDomParser.d.ts +5 -0
- package/dist/types/node/index.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -2
- package/dist/types/utils/isWysiwygContent.d.ts +0 -5
- package/dist/wysiwyg.mjs +209 -367
- package/lib/cli/commands/ToJsonCommand.js +2 -2
- package/lib/composables/__tests__/__snapshots__/useEditor.test.js.snap +0 -1
- package/lib/composables/useEditor.ts +7 -14
- package/lib/entryLib.ts +1 -1
- package/lib/entryNode.ts +2 -0
- package/lib/node/NodeDomParser.ts +16 -0
- package/lib/node/index.ts +1 -0
- package/lib/utils/index.ts +1 -2
- package/lib/utils/isWysiwygContent.ts +1 -14
- package/package.json +20 -12
- package/lib/cli/NodeDomParser.js +0 -16
package/dist/wysiwyg.mjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
import { defineComponent, ref, onMounted, onBeforeUnmount, h, getCurrentInstance, watchEffect, nextTick, unref, Teleport, reactive, markRaw, customRef, openBlock, createElementBlock, renderSlot, computed, normalizeClass, toRef, watch, Fragment as Fragment$1, renderList, normalizeStyle, inject, onUnmounted, provide, createElementVNode, createVNode, toDisplayString, createCommentVNode, shallowRef, getCurrentScope, onScopeDispose, shallowReadonly, useCssVars, createBlock, Transition, withCtx, withDirectives, pushScopeId, popScopeId, createTextVNode, normalizeProps, guardReactiveProps, withModifiers, resolveComponent, resolveDynamicComponent, KeepAlive, mergeModels, useModel } from "vue";
|
|
8
5
|
import { ColorModel, ColorPicker } from "@zipify/colorpicker";
|
|
9
6
|
import SimpleBar from "simplebar";
|
|
@@ -14,8 +11,7 @@ OrderedMap.prototype = {
|
|
|
14
11
|
constructor: OrderedMap,
|
|
15
12
|
find: function(key) {
|
|
16
13
|
for (var i = 0; i < this.content.length; i += 2)
|
|
17
|
-
if (this.content[i] === key)
|
|
18
|
-
return i;
|
|
14
|
+
if (this.content[i] === key) return i;
|
|
19
15
|
return -1;
|
|
20
16
|
},
|
|
21
17
|
// :: (string) → ?any
|
|
@@ -36,8 +32,7 @@ OrderedMap.prototype = {
|
|
|
36
32
|
content.push(newKey || key, value);
|
|
37
33
|
} else {
|
|
38
34
|
content[found2 + 1] = value;
|
|
39
|
-
if (newKey)
|
|
40
|
-
content[found2] = newKey;
|
|
35
|
+
if (newKey) content[found2] = newKey;
|
|
41
36
|
}
|
|
42
37
|
return new OrderedMap(content);
|
|
43
38
|
},
|
|
@@ -45,8 +40,7 @@ OrderedMap.prototype = {
|
|
|
45
40
|
// Return a map with the given key removed, if it existed.
|
|
46
41
|
remove: function(key) {
|
|
47
42
|
var found2 = this.find(key);
|
|
48
|
-
if (found2 == -1)
|
|
49
|
-
return this;
|
|
43
|
+
if (found2 == -1) return this;
|
|
50
44
|
var content = this.content.slice();
|
|
51
45
|
content.splice(found2, 2);
|
|
52
46
|
return new OrderedMap(content);
|
|
@@ -84,8 +78,7 @@ OrderedMap.prototype = {
|
|
|
84
78
|
// appear in `map` before the keys in `map`.
|
|
85
79
|
prepend: function(map2) {
|
|
86
80
|
map2 = OrderedMap.from(map2);
|
|
87
|
-
if (!map2.size)
|
|
88
|
-
return this;
|
|
81
|
+
if (!map2.size) return this;
|
|
89
82
|
return new OrderedMap(map2.content.concat(this.subtract(map2).content));
|
|
90
83
|
},
|
|
91
84
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
@@ -93,8 +86,7 @@ OrderedMap.prototype = {
|
|
|
93
86
|
// appear in `map` after the keys in `map`.
|
|
94
87
|
append: function(map2) {
|
|
95
88
|
map2 = OrderedMap.from(map2);
|
|
96
|
-
if (!map2.size)
|
|
97
|
-
return this;
|
|
89
|
+
if (!map2.size) return this;
|
|
98
90
|
return new OrderedMap(this.subtract(map2).content.concat(map2.content));
|
|
99
91
|
},
|
|
100
92
|
// :: (union<Object, OrderedMap>) → OrderedMap
|
|
@@ -114,12 +106,9 @@ OrderedMap.prototype = {
|
|
|
114
106
|
}
|
|
115
107
|
};
|
|
116
108
|
OrderedMap.from = function(value) {
|
|
117
|
-
if (value instanceof OrderedMap)
|
|
118
|
-
return value;
|
|
109
|
+
if (value instanceof OrderedMap) return value;
|
|
119
110
|
var content = [];
|
|
120
|
-
if (value)
|
|
121
|
-
for (var prop in value)
|
|
122
|
-
content.push(prop, value[prop]);
|
|
111
|
+
if (value) for (var prop in value) content.push(prop, value[prop]);
|
|
123
112
|
return new OrderedMap(content);
|
|
124
113
|
};
|
|
125
114
|
function findDiffStart(a, b, pos) {
|
|
@@ -728,8 +717,6 @@ function removeRange(content, from2, to) {
|
|
|
728
717
|
function insertInto(content, dist, insert, parent) {
|
|
729
718
|
let { index, offset: offset2 } = content.findIndex(dist), child = content.maybeChild(index);
|
|
730
719
|
if (offset2 == dist || child.isText) {
|
|
731
|
-
if (parent && !parent.canReplace(index, index, insert))
|
|
732
|
-
return null;
|
|
733
720
|
return content.cut(0, dist).append(insert).append(content.cut(dist));
|
|
734
721
|
}
|
|
735
722
|
let inner = insertInto(child.content, dist - offset2 - 1, insert);
|
|
@@ -2748,28 +2735,27 @@ class ParseContext {
|
|
|
2748
2735
|
// had a rule with `ignore` set.
|
|
2749
2736
|
readStyles(styles) {
|
|
2750
2737
|
let add = Mark$1.none, remove = Mark$1.none;
|
|
2751
|
-
style:
|
|
2752
|
-
for (let
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
add = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add);
|
|
2766
|
-
}
|
|
2767
|
-
if (rule.consuming === false)
|
|
2768
|
-
after = rule;
|
|
2769
|
-
else
|
|
2770
|
-
break;
|
|
2738
|
+
style: for (let i = 0; i < styles.length; i += 2) {
|
|
2739
|
+
for (let after = void 0; ; ) {
|
|
2740
|
+
let rule = this.parser.matchStyle(styles[i], styles[i + 1], this, after);
|
|
2741
|
+
if (!rule)
|
|
2742
|
+
continue style;
|
|
2743
|
+
if (rule.ignore)
|
|
2744
|
+
return null;
|
|
2745
|
+
if (rule.clearMark) {
|
|
2746
|
+
this.top.pendingMarks.forEach((m) => {
|
|
2747
|
+
if (rule.clearMark(m))
|
|
2748
|
+
remove = m.addToSet(remove);
|
|
2749
|
+
});
|
|
2750
|
+
} else {
|
|
2751
|
+
add = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add);
|
|
2771
2752
|
}
|
|
2753
|
+
if (rule.consuming === false)
|
|
2754
|
+
after = rule;
|
|
2755
|
+
else
|
|
2756
|
+
break;
|
|
2772
2757
|
}
|
|
2758
|
+
}
|
|
2773
2759
|
return [add, remove];
|
|
2774
2760
|
}
|
|
2775
2761
|
// Look up a handler for the given node. If none are found, return
|
|
@@ -4426,21 +4412,20 @@ class Fitter {
|
|
|
4426
4412
|
return after;
|
|
4427
4413
|
}
|
|
4428
4414
|
findCloseLevel($to) {
|
|
4429
|
-
scan:
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
continue scan;
|
|
4441
|
-
}
|
|
4442
|
-
return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };
|
|
4415
|
+
scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {
|
|
4416
|
+
let { match, type } = this.frontier[i];
|
|
4417
|
+
let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
|
|
4418
|
+
let fit = contentAfterFits($to, i, type, match, dropInner);
|
|
4419
|
+
if (!fit)
|
|
4420
|
+
continue;
|
|
4421
|
+
for (let d = i - 1; d >= 0; d--) {
|
|
4422
|
+
let { match: match2, type: type2 } = this.frontier[d];
|
|
4423
|
+
let matches2 = contentAfterFits($to, d, type2, match2, true);
|
|
4424
|
+
if (!matches2 || matches2.childCount)
|
|
4425
|
+
continue scan;
|
|
4443
4426
|
}
|
|
4427
|
+
return { depth: i, fit, move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to };
|
|
4428
|
+
}
|
|
4444
4429
|
}
|
|
4445
4430
|
close($to) {
|
|
4446
4431
|
let close2 = this.findCloseLevel($to);
|
|
@@ -6963,12 +6948,9 @@ class NodeViewDesc extends ViewDesc {
|
|
|
6963
6948
|
}, (child, outerDeco, innerDeco, i) => {
|
|
6964
6949
|
updater.syncToMarks(child.marks, inline, view);
|
|
6965
6950
|
let compIndex;
|
|
6966
|
-
if (updater.findNodeMatch(child, outerDeco, innerDeco, i))
|
|
6967
|
-
|
|
6968
|
-
else if (
|
|
6969
|
-
;
|
|
6970
|
-
else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i))
|
|
6971
|
-
;
|
|
6951
|
+
if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;
|
|
6952
|
+
else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ;
|
|
6953
|
+
else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i)) ;
|
|
6972
6954
|
else {
|
|
6973
6955
|
updater.addNode(child, outerDeco, innerDeco, view, off);
|
|
6974
6956
|
}
|
|
@@ -7494,36 +7476,35 @@ class ViewTreeUpdater {
|
|
|
7494
7476
|
function preMatch(frag, parentDesc) {
|
|
7495
7477
|
let curDesc = parentDesc, descI = curDesc.children.length;
|
|
7496
7478
|
let fI = frag.childCount, matched = /* @__PURE__ */ new Map(), matches2 = [];
|
|
7497
|
-
outer:
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
descI = next.children.length;
|
|
7506
|
-
} else {
|
|
7507
|
-
desc = next;
|
|
7508
|
-
descI--;
|
|
7509
|
-
break;
|
|
7510
|
-
}
|
|
7511
|
-
} else if (curDesc == parentDesc) {
|
|
7512
|
-
break outer;
|
|
7479
|
+
outer: while (fI > 0) {
|
|
7480
|
+
let desc;
|
|
7481
|
+
for (; ; ) {
|
|
7482
|
+
if (descI) {
|
|
7483
|
+
let next = curDesc.children[descI - 1];
|
|
7484
|
+
if (next instanceof MarkViewDesc) {
|
|
7485
|
+
curDesc = next;
|
|
7486
|
+
descI = next.children.length;
|
|
7513
7487
|
} else {
|
|
7514
|
-
|
|
7515
|
-
|
|
7488
|
+
desc = next;
|
|
7489
|
+
descI--;
|
|
7490
|
+
break;
|
|
7516
7491
|
}
|
|
7492
|
+
} else if (curDesc == parentDesc) {
|
|
7493
|
+
break outer;
|
|
7494
|
+
} else {
|
|
7495
|
+
descI = curDesc.parent.children.indexOf(curDesc);
|
|
7496
|
+
curDesc = curDesc.parent;
|
|
7517
7497
|
}
|
|
7518
|
-
let node = desc.node;
|
|
7519
|
-
if (!node)
|
|
7520
|
-
continue;
|
|
7521
|
-
if (node != frag.child(fI - 1))
|
|
7522
|
-
break;
|
|
7523
|
-
--fI;
|
|
7524
|
-
matched.set(desc, fI);
|
|
7525
|
-
matches2.push(desc);
|
|
7526
7498
|
}
|
|
7499
|
+
let node = desc.node;
|
|
7500
|
+
if (!node)
|
|
7501
|
+
continue;
|
|
7502
|
+
if (node != frag.child(fI - 1))
|
|
7503
|
+
break;
|
|
7504
|
+
--fI;
|
|
7505
|
+
matched.set(desc, fI);
|
|
7506
|
+
matches2.push(desc);
|
|
7507
|
+
}
|
|
7527
7508
|
return { index: fI, matched, matches: matches2.reverse() };
|
|
7528
7509
|
}
|
|
7529
7510
|
function compareSide(a, b) {
|
|
@@ -8458,8 +8439,7 @@ function updateSelection(view, selection, origin) {
|
|
|
8458
8439
|
if (!view.focused)
|
|
8459
8440
|
view.focus();
|
|
8460
8441
|
let tr2 = view.state.tr.setSelection(selection);
|
|
8461
|
-
|
|
8462
|
-
tr2.setMeta("pointer", true);
|
|
8442
|
+
tr2.setMeta("pointer", true);
|
|
8463
8443
|
view.dispatch(tr2);
|
|
8464
8444
|
}
|
|
8465
8445
|
function selectClickedLeaf(view, inside) {
|
|
@@ -8467,7 +8447,7 @@ function selectClickedLeaf(view, inside) {
|
|
|
8467
8447
|
return false;
|
|
8468
8448
|
let $pos = view.state.doc.resolve(inside), node = $pos.nodeAfter;
|
|
8469
8449
|
if (node && node.isAtom && NodeSelection.isSelectable(node)) {
|
|
8470
|
-
updateSelection(view, new NodeSelection($pos)
|
|
8450
|
+
updateSelection(view, new NodeSelection($pos));
|
|
8471
8451
|
return true;
|
|
8472
8452
|
}
|
|
8473
8453
|
return false;
|
|
@@ -8490,7 +8470,7 @@ function selectClickedNode(view, inside) {
|
|
|
8490
8470
|
}
|
|
8491
8471
|
}
|
|
8492
8472
|
if (selectAt != null) {
|
|
8493
|
-
updateSelection(view, NodeSelection.create(view.state.doc, selectAt)
|
|
8473
|
+
updateSelection(view, NodeSelection.create(view.state.doc, selectAt));
|
|
8494
8474
|
return true;
|
|
8495
8475
|
} else {
|
|
8496
8476
|
return false;
|
|
@@ -8511,7 +8491,7 @@ function defaultTripleClick(view, inside, event) {
|
|
|
8511
8491
|
let doc2 = view.state.doc;
|
|
8512
8492
|
if (inside == -1) {
|
|
8513
8493
|
if (doc2.inlineContent) {
|
|
8514
|
-
updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size)
|
|
8494
|
+
updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size));
|
|
8515
8495
|
return true;
|
|
8516
8496
|
}
|
|
8517
8497
|
return false;
|
|
@@ -8521,9 +8501,9 @@ function defaultTripleClick(view, inside, event) {
|
|
|
8521
8501
|
let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
|
|
8522
8502
|
let nodePos = $pos.before(i);
|
|
8523
8503
|
if (node.inlineContent)
|
|
8524
|
-
updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size)
|
|
8504
|
+
updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node.content.size));
|
|
8525
8505
|
else if (NodeSelection.isSelectable(node))
|
|
8526
|
-
updateSelection(view, NodeSelection.create(doc2, nodePos)
|
|
8506
|
+
updateSelection(view, NodeSelection.create(doc2, nodePos));
|
|
8527
8507
|
else
|
|
8528
8508
|
continue;
|
|
8529
8509
|
return true;
|
|
@@ -8640,7 +8620,7 @@ class MouseDown {
|
|
|
8640
8620
|
// thus doesn't get a reaction from ProseMirror. This
|
|
8641
8621
|
// works around that.
|
|
8642
8622
|
chrome$1 && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {
|
|
8643
|
-
updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos))
|
|
8623
|
+
updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)));
|
|
8644
8624
|
event.preventDefault();
|
|
8645
8625
|
} else {
|
|
8646
8626
|
setSelectionOrigin(this.view, "pointer");
|
|
@@ -8842,8 +8822,7 @@ handlers.dragstart = (view, _event) => {
|
|
|
8842
8822
|
return;
|
|
8843
8823
|
let sel = view.state.selection;
|
|
8844
8824
|
let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));
|
|
8845
|
-
if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to))
|
|
8846
|
-
;
|
|
8825
|
+
if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ;
|
|
8847
8826
|
else if (mouseDown && mouseDown.mightDrag) {
|
|
8848
8827
|
view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos)));
|
|
8849
8828
|
} else if (event.target && event.target.nodeType == 1) {
|
|
@@ -10268,8 +10247,7 @@ class EditorView {
|
|
|
10268
10247
|
*/
|
|
10269
10248
|
scrollToSelection() {
|
|
10270
10249
|
let startDOM = this.domSelectionRange().focusNode;
|
|
10271
|
-
if (this.someProp("handleScrollToSelection", (f) => f(this)))
|
|
10272
|
-
;
|
|
10250
|
+
if (this.someProp("handleScrollToSelection", (f) => f(this))) ;
|
|
10273
10251
|
else if (this.state.selection instanceof NodeSelection) {
|
|
10274
10252
|
let target = this.docView.domAfterPos(this.state.selection.from);
|
|
10275
10253
|
if (target.nodeType == 1)
|
|
@@ -10656,32 +10634,22 @@ var chrome = typeof navigator != "undefined" && /Chrome\/(\d+)/.exec(navigator.u
|
|
|
10656
10634
|
var mac$1 = typeof navigator != "undefined" && /Mac/.test(navigator.platform);
|
|
10657
10635
|
var ie = typeof navigator != "undefined" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
|
|
10658
10636
|
var brokenModifierNames = mac$1 || chrome && +chrome[1] < 57;
|
|
10659
|
-
for (var i = 0; i < 10; i++)
|
|
10660
|
-
|
|
10661
|
-
for (var i = 1; i <= 24; i++)
|
|
10662
|
-
base[i + 111] = "F" + i;
|
|
10637
|
+
for (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);
|
|
10638
|
+
for (var i = 1; i <= 24; i++) base[i + 111] = "F" + i;
|
|
10663
10639
|
for (var i = 65; i <= 90; i++) {
|
|
10664
10640
|
base[i] = String.fromCharCode(i + 32);
|
|
10665
10641
|
shift$2[i] = String.fromCharCode(i);
|
|
10666
10642
|
}
|
|
10667
|
-
for (var code in base)
|
|
10668
|
-
if (!shift$2.hasOwnProperty(code))
|
|
10669
|
-
shift$2[code] = base[code];
|
|
10643
|
+
for (var code in base) if (!shift$2.hasOwnProperty(code)) shift$2[code] = base[code];
|
|
10670
10644
|
function keyName(event) {
|
|
10671
10645
|
var ignoreKey = brokenModifierNames && (event.ctrlKey || event.altKey || event.metaKey) || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == "Unidentified";
|
|
10672
10646
|
var name = !ignoreKey && event.key || (event.shiftKey ? shift$2 : base)[event.keyCode] || event.key || "Unidentified";
|
|
10673
|
-
if (name == "Esc")
|
|
10674
|
-
|
|
10675
|
-
if (name == "
|
|
10676
|
-
|
|
10677
|
-
if (name == "
|
|
10678
|
-
|
|
10679
|
-
if (name == "Up")
|
|
10680
|
-
name = "ArrowUp";
|
|
10681
|
-
if (name == "Right")
|
|
10682
|
-
name = "ArrowRight";
|
|
10683
|
-
if (name == "Down")
|
|
10684
|
-
name = "ArrowDown";
|
|
10647
|
+
if (name == "Esc") name = "Escape";
|
|
10648
|
+
if (name == "Del") name = "Delete";
|
|
10649
|
+
if (name == "Left") name = "ArrowLeft";
|
|
10650
|
+
if (name == "Up") name = "ArrowUp";
|
|
10651
|
+
if (name == "Right") name = "ArrowRight";
|
|
10652
|
+
if (name == "Down") name = "ArrowDown";
|
|
10685
10653
|
return name;
|
|
10686
10654
|
}
|
|
10687
10655
|
const mac = typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false;
|
|
@@ -14102,7 +14070,7 @@ img.ProseMirror-separator {
|
|
|
14102
14070
|
opacity: 0
|
|
14103
14071
|
}`;
|
|
14104
14072
|
function createStyleTag(style2, nonce, suffix) {
|
|
14105
|
-
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${
|
|
14073
|
+
const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${""}]`);
|
|
14106
14074
|
if (tiptapStyleTag !== null) {
|
|
14107
14075
|
return tiptapStyleTag;
|
|
14108
14076
|
}
|
|
@@ -14110,7 +14078,7 @@ function createStyleTag(style2, nonce, suffix) {
|
|
|
14110
14078
|
if (nonce) {
|
|
14111
14079
|
styleNode.setAttribute("nonce", nonce);
|
|
14112
14080
|
}
|
|
14113
|
-
styleNode.setAttribute(`data-tiptap-style${
|
|
14081
|
+
styleNode.setAttribute(`data-tiptap-style${""}`, "");
|
|
14114
14082
|
styleNode.innerHTML = style2;
|
|
14115
14083
|
document.getElementsByTagName("head")[0].appendChild(styleNode);
|
|
14116
14084
|
return styleNode;
|
|
@@ -15551,8 +15519,7 @@ function flip$2(_ref) {
|
|
|
15551
15519
|
};
|
|
15552
15520
|
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
15553
15521
|
var _ret = _loop(_i);
|
|
15554
|
-
if (_ret === "break")
|
|
15555
|
-
break;
|
|
15522
|
+
if (_ret === "break") break;
|
|
15556
15523
|
}
|
|
15557
15524
|
}
|
|
15558
15525
|
if (state.placement !== firstFittingPlacement) {
|
|
@@ -18105,10 +18072,8 @@ RopeSequence.prototype.appendInner = function appendInner(other) {
|
|
|
18105
18072
|
return new Append(this, other);
|
|
18106
18073
|
};
|
|
18107
18074
|
RopeSequence.prototype.slice = function slice(from2, to) {
|
|
18108
|
-
if (from2 === void 0)
|
|
18109
|
-
|
|
18110
|
-
if (to === void 0)
|
|
18111
|
-
to = this.length;
|
|
18075
|
+
if (from2 === void 0) from2 = 0;
|
|
18076
|
+
if (to === void 0) to = this.length;
|
|
18112
18077
|
if (from2 >= to) {
|
|
18113
18078
|
return RopeSequence.empty;
|
|
18114
18079
|
}
|
|
@@ -18121,10 +18086,8 @@ RopeSequence.prototype.get = function get(i) {
|
|
|
18121
18086
|
return this.getInner(i);
|
|
18122
18087
|
};
|
|
18123
18088
|
RopeSequence.prototype.forEach = function forEach2(f, from2, to) {
|
|
18124
|
-
if (from2 === void 0)
|
|
18125
|
-
|
|
18126
|
-
if (to === void 0)
|
|
18127
|
-
to = this.length;
|
|
18089
|
+
if (from2 === void 0) from2 = 0;
|
|
18090
|
+
if (to === void 0) to = this.length;
|
|
18128
18091
|
if (from2 <= to) {
|
|
18129
18092
|
this.forEachInner(f, from2, to, 0);
|
|
18130
18093
|
} else {
|
|
@@ -18132,10 +18095,8 @@ RopeSequence.prototype.forEach = function forEach2(f, from2, to) {
|
|
|
18132
18095
|
}
|
|
18133
18096
|
};
|
|
18134
18097
|
RopeSequence.prototype.map = function map(f, from2, to) {
|
|
18135
|
-
if (from2 === void 0)
|
|
18136
|
-
|
|
18137
|
-
if (to === void 0)
|
|
18138
|
-
to = this.length;
|
|
18098
|
+
if (from2 === void 0) from2 = 0;
|
|
18099
|
+
if (to === void 0) to = this.length;
|
|
18139
18100
|
var result = [];
|
|
18140
18101
|
this.forEach(function(elt, i) {
|
|
18141
18102
|
return result.push(f(elt, i));
|
|
@@ -18153,8 +18114,7 @@ var Leaf = /* @__PURE__ */ function(RopeSequence3) {
|
|
|
18153
18114
|
RopeSequence3.call(this);
|
|
18154
18115
|
this.values = values;
|
|
18155
18116
|
}
|
|
18156
|
-
if (RopeSequence3)
|
|
18157
|
-
Leaf2.__proto__ = RopeSequence3;
|
|
18117
|
+
if (RopeSequence3) Leaf2.__proto__ = RopeSequence3;
|
|
18158
18118
|
Leaf2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype);
|
|
18159
18119
|
Leaf2.prototype.constructor = Leaf2;
|
|
18160
18120
|
var prototypeAccessors = { length: { configurable: true }, depth: { configurable: true } };
|
|
@@ -18212,8 +18172,7 @@ var Append = /* @__PURE__ */ function(RopeSequence3) {
|
|
|
18212
18172
|
this.length = left2.length + right2.length;
|
|
18213
18173
|
this.depth = Math.max(left2.depth, right2.depth) + 1;
|
|
18214
18174
|
}
|
|
18215
|
-
if (RopeSequence3)
|
|
18216
|
-
Append2.__proto__ = RopeSequence3;
|
|
18175
|
+
if (RopeSequence3) Append2.__proto__ = RopeSequence3;
|
|
18217
18176
|
Append2.prototype = Object.create(RopeSequence3 && RopeSequence3.prototype);
|
|
18218
18177
|
Append2.prototype.constructor = Append2;
|
|
18219
18178
|
Append2.prototype.flatten = function flatten() {
|
|
@@ -18722,8 +18681,7 @@ class PastePlugin extends ProseMirrorPlugin {
|
|
|
18722
18681
|
let from2 = selection.from;
|
|
18723
18682
|
let to = selection.to;
|
|
18724
18683
|
doc2.nodesBetween(from2, to, (node, position, parent) => {
|
|
18725
|
-
if (parent.type.name !== NodeTypes.DOCUMENT)
|
|
18726
|
-
return;
|
|
18684
|
+
if (parent.type.name !== NodeTypes.DOCUMENT) return;
|
|
18727
18685
|
from2 = Math.min(from2, position + 1);
|
|
18728
18686
|
to = Math.max(to, position + node.nodeSize - 1);
|
|
18729
18687
|
});
|
|
@@ -18739,10 +18697,8 @@ class PlaceholderPlugin extends ProseMirrorPlugin {
|
|
|
18739
18697
|
}
|
|
18740
18698
|
_buildDecorations({ doc: doc2 }) {
|
|
18741
18699
|
const decorations = [];
|
|
18742
|
-
if (!this.editor.isEditable)
|
|
18743
|
-
|
|
18744
|
-
if (doc2.childCount > 1)
|
|
18745
|
-
return;
|
|
18700
|
+
if (!this.editor.isEditable) return null;
|
|
18701
|
+
if (doc2.childCount > 1) return;
|
|
18746
18702
|
doc2.descendants((node, pos) => {
|
|
18747
18703
|
if (!node.childCount) {
|
|
18748
18704
|
const decoration = Decoration.node(pos, pos + node.nodeSize, {
|
|
@@ -19901,12 +19857,10 @@ class PasteLinkPlugin extends ProseMirrorPlugin {
|
|
|
19901
19857
|
return { handlePaste: this._handlePaste };
|
|
19902
19858
|
}
|
|
19903
19859
|
_handlePaste(view, event, slice2) {
|
|
19904
|
-
if (view.state.selection.empty)
|
|
19905
|
-
return false;
|
|
19860
|
+
if (view.state.selection.empty) return false;
|
|
19906
19861
|
const textContent = slice2.content.textBetween(0, slice2.content.size).trim();
|
|
19907
19862
|
const isLink = test(textContent);
|
|
19908
|
-
if (!textContent || !isLink)
|
|
19909
|
-
return false;
|
|
19863
|
+
if (!textContent || !isLink) return false;
|
|
19910
19864
|
const attrs = this._createLinkAttrs(textContent, slice2.content);
|
|
19911
19865
|
this.editor.commands.applyLink(attrs);
|
|
19912
19866
|
return true;
|
|
@@ -19925,8 +19879,7 @@ function createCommand(exec) {
|
|
|
19925
19879
|
}
|
|
19926
19880
|
function renderInlineSetting(setting) {
|
|
19927
19881
|
const style2 = Object.entries(setting).reduce((css, [name, value]) => {
|
|
19928
|
-
if (!value)
|
|
19929
|
-
return css;
|
|
19882
|
+
if (!value) return css;
|
|
19930
19883
|
const property = name.replace(/_/g, "-");
|
|
19931
19884
|
return `${css}--zw-${property}:${value};`;
|
|
19932
19885
|
}, "");
|
|
@@ -19950,8 +19903,7 @@ function convertColor(raw) {
|
|
|
19950
19903
|
return model.alpha === 1 ? model.toHexString() : model.toRgbaString();
|
|
19951
19904
|
}
|
|
19952
19905
|
function convertFontSize(value, wrapperEl) {
|
|
19953
|
-
if (!value.includes("em"))
|
|
19954
|
-
return parseInt(value);
|
|
19906
|
+
if (!value.includes("em")) return parseInt(value);
|
|
19955
19907
|
const containerValue = ContextWindow.getComputedStyle(wrapperEl).fontSize;
|
|
19956
19908
|
const size = parseFloat(value) * parseFloat(containerValue);
|
|
19957
19909
|
return Math.round(size);
|
|
@@ -19962,8 +19914,7 @@ function getFontSize(sourceEl, wrapperEl) {
|
|
|
19962
19914
|
return fontSize || ContextWindow.getComputedStyle(wrapperEl).fontSize;
|
|
19963
19915
|
}
|
|
19964
19916
|
function convertLineHeight(value, sourceEl, wrapperEl) {
|
|
19965
|
-
if (!value.includes("px"))
|
|
19966
|
-
return value;
|
|
19917
|
+
if (!value.includes("px")) return value;
|
|
19967
19918
|
const rawFontSize = getFontSize(sourceEl, wrapperEl);
|
|
19968
19919
|
const fontSize = convertFontSize(rawFontSize, wrapperEl);
|
|
19969
19920
|
return fontSize ? (parseInt(value) / fontSize).toFixed(2) : null;
|
|
@@ -20004,13 +19955,7 @@ function importIcon(name) {
|
|
|
20004
19955
|
return modules[`../assets/icons/${name}.svg`] || "";
|
|
20005
19956
|
}
|
|
20006
19957
|
function isWysiwygContent(content) {
|
|
20007
|
-
return typeof content === "object" && content.
|
|
20008
|
-
}
|
|
20009
|
-
function unmarkWysiwygContent({ __wswg__, ...content }) {
|
|
20010
|
-
return content;
|
|
20011
|
-
}
|
|
20012
|
-
function markWysiwygContent(content) {
|
|
20013
|
-
return { ...content, __wswg__: true };
|
|
19958
|
+
return typeof content === "object" && content.type === "doc";
|
|
20014
19959
|
}
|
|
20015
19960
|
const resolveTextPosition = ($from, $to, node, position) => ({
|
|
20016
19961
|
from: Math.max(position, $from.pos),
|
|
@@ -20029,11 +19974,9 @@ const DEFAULT_COMPARATOR = (parentMark, mark) => parentMark.eq(mark);
|
|
|
20029
19974
|
function isMarkAppliedToParent(doc2, position, checkingMark, comparator = DEFAULT_COMPARATOR) {
|
|
20030
19975
|
const steps = doc2.resolve(position).path.reverse();
|
|
20031
19976
|
for (const step of steps) {
|
|
20032
|
-
if (typeof step === "number")
|
|
20033
|
-
continue;
|
|
19977
|
+
if (typeof step === "number") continue;
|
|
20034
19978
|
for (const mark of step.marks) {
|
|
20035
|
-
if (comparator(mark, checkingMark))
|
|
20036
|
-
return true;
|
|
19979
|
+
if (comparator(mark, checkingMark)) return true;
|
|
20037
19980
|
}
|
|
20038
19981
|
}
|
|
20039
19982
|
return false;
|
|
@@ -21034,8 +20977,7 @@ const NodeProcessor = Extension.create({
|
|
|
21034
20977
|
const { doc: doc2, tr: tr2 } = state;
|
|
21035
20978
|
const { from: from2, to } = tr2.selection;
|
|
21036
20979
|
doc2.nodesBetween(from2, to, (node, position) => {
|
|
21037
|
-
if (!NodeTypes.blocks.includes(node.type.name))
|
|
21038
|
-
return;
|
|
20980
|
+
if (!NodeTypes.blocks.includes(node.type.name)) return;
|
|
21039
20981
|
tr2.setNodeAttribute(position, name, { ...defaults2, ...current, ...attrs });
|
|
21040
20982
|
});
|
|
21041
20983
|
}),
|
|
@@ -21061,8 +21003,7 @@ const NodeProcessor = Extension.create({
|
|
|
21061
21003
|
if (!markGroup.includes(MarkGroups.SETTINGS)) {
|
|
21062
21004
|
return commands2.setMark(name, value);
|
|
21063
21005
|
}
|
|
21064
|
-
if ($from.pos === $to.pos)
|
|
21065
|
-
return;
|
|
21006
|
+
if ($from.pos === $to.pos) return;
|
|
21066
21007
|
const onAppliedToParent = (context) => {
|
|
21067
21008
|
if (!customizer.onAppliedToParent || customizer.onAppliedToParent(context) === false) {
|
|
21068
21009
|
const { tr: tr3, node, position, mark } = context;
|
|
@@ -21070,8 +21011,7 @@ const NodeProcessor = Extension.create({
|
|
|
21070
21011
|
}
|
|
21071
21012
|
};
|
|
21072
21013
|
doc2.nodesBetween($from.pos, $to.pos, (node, position) => {
|
|
21073
|
-
if (node.type.name === NodeTypes.LIST)
|
|
21074
|
-
return;
|
|
21014
|
+
if (node.type.name === NodeTypes.LIST) return;
|
|
21075
21015
|
const initialMark = findMarkByType(node.marks, name);
|
|
21076
21016
|
const applyingMark = markType.create({ ...(initialMark == null ? void 0 : initialMark.attrs) || {}, ...value });
|
|
21077
21017
|
const textPosition = resolveTextPosition($from, $to, node, position);
|
|
@@ -21096,8 +21036,7 @@ const NodeProcessor = Extension.create({
|
|
|
21096
21036
|
const marks = [];
|
|
21097
21037
|
doc2.nodesBetween(from2, to, (node) => {
|
|
21098
21038
|
for (const mark of node.marks) {
|
|
21099
|
-
if (mark.type.name === name)
|
|
21100
|
-
marks.unshift(mark.attrs);
|
|
21039
|
+
if (mark.type.name === name) marks.unshift(mark.attrs);
|
|
21101
21040
|
}
|
|
21102
21041
|
});
|
|
21103
21042
|
return marks;
|
|
@@ -21124,8 +21063,7 @@ const NodeProcessor = Extension.create({
|
|
|
21124
21063
|
return computed(() => {
|
|
21125
21064
|
for (const attrs of unref(selectionRef)) {
|
|
21126
21065
|
const value = attrs[unref(deviceRef)];
|
|
21127
|
-
if (value)
|
|
21128
|
-
return value;
|
|
21066
|
+
if (value) return value;
|
|
21129
21067
|
}
|
|
21130
21068
|
return unref(defaultRef);
|
|
21131
21069
|
});
|
|
@@ -21165,11 +21103,9 @@ const TextProcessor = Extension.create({
|
|
|
21165
21103
|
}),
|
|
21166
21104
|
transformText: createCommand(({ state }, transform) => {
|
|
21167
21105
|
const { $from, $to } = state.tr.selection;
|
|
21168
|
-
if ($from.pos === $to.pos)
|
|
21169
|
-
return;
|
|
21106
|
+
if ($from.pos === $to.pos) return;
|
|
21170
21107
|
state.doc.nodesBetween($from.pos, $to.pos, (node, position) => {
|
|
21171
|
-
if (!node.isText)
|
|
21172
|
-
return;
|
|
21108
|
+
if (!node.isText) return;
|
|
21173
21109
|
const textPosition = resolveTextPosition($from, $to, node, position);
|
|
21174
21110
|
const substringFrom = Math.max(0, $from.pos - position);
|
|
21175
21111
|
const substringTo = Math.max(0, $to.pos - position);
|
|
@@ -21258,8 +21194,7 @@ const Document = Document$1.extend({
|
|
|
21258
21194
|
}),
|
|
21259
21195
|
onCreate() {
|
|
21260
21196
|
this.editor.view.dom.addEventListener("click", (event) => {
|
|
21261
|
-
if (event.target.closest("a"))
|
|
21262
|
-
event.preventDefault();
|
|
21197
|
+
if (event.target.closest("a")) event.preventDefault();
|
|
21263
21198
|
});
|
|
21264
21199
|
},
|
|
21265
21200
|
addCommands() {
|
|
@@ -21472,23 +21407,19 @@ const StylePreset = Extension.create({
|
|
|
21472
21407
|
default: { id: unref(this.options.defaultId) },
|
|
21473
21408
|
parseHTML: (element) => {
|
|
21474
21409
|
const presets = unref(this.options.presets);
|
|
21475
|
-
if (element.parentElement.tagName === "LI")
|
|
21476
|
-
return null;
|
|
21410
|
+
if (element.parentElement.tagName === "LI") return null;
|
|
21477
21411
|
for (const { id, node, fallbackClass } of presets) {
|
|
21478
21412
|
if (fallbackClass && element.classList.contains(fallbackClass)) {
|
|
21479
21413
|
return { id };
|
|
21480
21414
|
}
|
|
21481
21415
|
const presetSelector = unref(this.options.styleRenderer).makePresetCssClass({ id });
|
|
21482
|
-
if (element.matches(presetSelector))
|
|
21483
|
-
|
|
21484
|
-
if (element.tagName === `H${node == null ? void 0 : node.level}`)
|
|
21485
|
-
return { id };
|
|
21416
|
+
if (element.matches(presetSelector)) return { id };
|
|
21417
|
+
if (element.tagName === `H${node == null ? void 0 : node.level}`) return { id };
|
|
21486
21418
|
}
|
|
21487
21419
|
return element.tagName === "P" ? { id: unref(this.options.defaultId) } : null;
|
|
21488
21420
|
},
|
|
21489
21421
|
renderHTML: (attrs) => {
|
|
21490
|
-
if (!attrs.preset)
|
|
21491
|
-
return null;
|
|
21422
|
+
if (!attrs.preset) return null;
|
|
21492
21423
|
return { class: unref(this.options.styleRenderer).makePresetHtmlClass(attrs.preset) };
|
|
21493
21424
|
}
|
|
21494
21425
|
}
|
|
@@ -21521,8 +21452,7 @@ const StylePreset = Extension.create({
|
|
|
21521
21452
|
const linkPresetRef = commands2.getLinkPreset();
|
|
21522
21453
|
return computed(() => {
|
|
21523
21454
|
const preset = findPresetById(unref(presetsRef), unref(selectionRef).id);
|
|
21524
|
-
if (!unref(isLinkRef))
|
|
21525
|
-
return preset;
|
|
21455
|
+
if (!unref(isLinkRef)) return preset;
|
|
21526
21456
|
const linkPreset = unref(linkPresetRef);
|
|
21527
21457
|
return {
|
|
21528
21458
|
id: preset.id,
|
|
@@ -21584,8 +21514,7 @@ const StylePreset = Extension.create({
|
|
|
21584
21514
|
doc2.nodesBetween(from2, to, (node) => {
|
|
21585
21515
|
for (const [name, value] of Object.entries(node.attrs)) {
|
|
21586
21516
|
const isSetting = TextSettings.presetAttributes.includes(name);
|
|
21587
|
-
if (isSetting && value)
|
|
21588
|
-
attributes.add(name);
|
|
21517
|
+
if (isSetting && value) attributes.add(name);
|
|
21589
21518
|
}
|
|
21590
21519
|
for (const { type } of node.marks) {
|
|
21591
21520
|
if (TextSettings.marks.includes(type.name)) {
|
|
@@ -21654,8 +21583,7 @@ const FontWeight = Mark2.create({
|
|
|
21654
21583
|
}),
|
|
21655
21584
|
parseHTML() {
|
|
21656
21585
|
const getAttrs = (value) => {
|
|
21657
|
-
if (value === "bold")
|
|
21658
|
-
return { value: "700" };
|
|
21586
|
+
if (value === "bold") return { value: "700" };
|
|
21659
21587
|
return Number(value) ? { value } : false;
|
|
21660
21588
|
};
|
|
21661
21589
|
return [
|
|
@@ -21709,15 +21637,13 @@ const FontSize = Mark2.create({
|
|
|
21709
21637
|
const device = unref(commands2.getDevice());
|
|
21710
21638
|
commands2.applyMark(this.name, { [device]: value }, {
|
|
21711
21639
|
isAppliedToParent: (parentMark, mark) => {
|
|
21712
|
-
if (parentMark.type.name !== mark.type.name)
|
|
21713
|
-
return false;
|
|
21640
|
+
if (parentMark.type.name !== mark.type.name) return false;
|
|
21714
21641
|
return parentMark.attrs[device] === mark.attrs[device];
|
|
21715
21642
|
},
|
|
21716
21643
|
onAppliedToParent: ({ tr: tr2, node, position, mark }) => {
|
|
21717
21644
|
const attrs = { ...mark.attrs, [device]: null };
|
|
21718
21645
|
const canRemove = !Object.values(attrs).some((value2) => !!value2);
|
|
21719
|
-
if (canRemove)
|
|
21720
|
-
return false;
|
|
21646
|
+
if (canRemove) return false;
|
|
21721
21647
|
const updated = mark.type.create(attrs);
|
|
21722
21648
|
if (node.isText) {
|
|
21723
21649
|
tr2.addMark(position, position + node.nodeSize, updated);
|
|
@@ -21745,8 +21671,7 @@ const FontSize = Mark2.create({
|
|
|
21745
21671
|
}),
|
|
21746
21672
|
parseHTML() {
|
|
21747
21673
|
const parseSize = (value) => {
|
|
21748
|
-
if (!value)
|
|
21749
|
-
return null;
|
|
21674
|
+
if (!value) return null;
|
|
21750
21675
|
const wrapperEl = unref(this.options.wrapperRef);
|
|
21751
21676
|
const converted = convertFontSize(value, wrapperEl);
|
|
21752
21677
|
return String(converted);
|
|
@@ -21888,8 +21813,7 @@ const FontStyle = Mark2.create({
|
|
|
21888
21813
|
}),
|
|
21889
21814
|
toggleItalic: createCommand(({ commands: commands2 }) => {
|
|
21890
21815
|
const isItalicAvailable = unref(commands2.isItalicAvailable());
|
|
21891
|
-
if (!isItalicAvailable)
|
|
21892
|
-
return;
|
|
21816
|
+
if (!isItalicAvailable) return;
|
|
21893
21817
|
unref(commands2.isItalic()) ? commands2.removeItalic() : commands2.applyItalic();
|
|
21894
21818
|
}),
|
|
21895
21819
|
applyItalic: createCommand(({ commands: commands2 }) => {
|
|
@@ -22033,12 +21957,9 @@ const TextDecoration = Mark2.create({
|
|
|
22033
21957
|
},
|
|
22034
21958
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
22035
21959
|
const decorations = [];
|
|
22036
|
-
if (attrs.underline)
|
|
22037
|
-
|
|
22038
|
-
if (
|
|
22039
|
-
decorations.push("line-through");
|
|
22040
|
-
if (!decorations.length)
|
|
22041
|
-
decorations.push("none");
|
|
21960
|
+
if (attrs.underline) decorations.push("underline");
|
|
21961
|
+
if (attrs.strike_through) decorations.push("line-through");
|
|
21962
|
+
if (!decorations.length) decorations.push("none");
|
|
22042
21963
|
return renderMark({ text_decoration: decorations.join(" ") });
|
|
22043
21964
|
}
|
|
22044
21965
|
});
|
|
@@ -22089,13 +22010,11 @@ const Alignment = Extension.create({
|
|
|
22089
22010
|
const mobile = style2.getPropertyValue("--zw-alignment-mobile") || null;
|
|
22090
22011
|
const tablet = style2.getPropertyValue("--zw-alignment-tablet") || null;
|
|
22091
22012
|
const desktop = style2.getPropertyValue("--zw-alignment-desktop") || null;
|
|
22092
|
-
if (!mobile && !tablet && !desktop)
|
|
22093
|
-
return null;
|
|
22013
|
+
if (!mobile && !tablet && !desktop) return null;
|
|
22094
22014
|
return { desktop, tablet, mobile };
|
|
22095
22015
|
},
|
|
22096
22016
|
renderHTML(attrs) {
|
|
22097
|
-
if (!attrs.alignment)
|
|
22098
|
-
return null;
|
|
22017
|
+
if (!attrs.alignment) return null;
|
|
22099
22018
|
return renderInlineSetting({
|
|
22100
22019
|
alignment_mobile: attrs.alignment.mobile,
|
|
22101
22020
|
alignment_tablet: attrs.alignment.tablet,
|
|
@@ -22158,15 +22077,13 @@ const LineHeight = Extension.create({
|
|
|
22158
22077
|
return { mobile, tablet, desktop };
|
|
22159
22078
|
}
|
|
22160
22079
|
const value = element.style.lineHeight;
|
|
22161
|
-
if (!value)
|
|
22162
|
-
return null;
|
|
22080
|
+
if (!value) return null;
|
|
22163
22081
|
const wrapperEl = unref(this.options.wrapperRef);
|
|
22164
22082
|
const converted = convertLineHeight(value, element, wrapperEl);
|
|
22165
22083
|
return converted ? { desktop: converted, tablet: converted, mobile: null } : null;
|
|
22166
22084
|
},
|
|
22167
22085
|
renderHTML(attrs) {
|
|
22168
|
-
if (!attrs.line_height)
|
|
22169
|
-
return null;
|
|
22086
|
+
if (!attrs.line_height) return null;
|
|
22170
22087
|
return renderInlineSetting({
|
|
22171
22088
|
line_height_mobile: attrs.line_height.mobile,
|
|
22172
22089
|
line_height_tablet: attrs.line_height.tablet,
|
|
@@ -22239,8 +22156,7 @@ const ListItem = ListItem$1.extend({
|
|
|
22239
22156
|
listItemNewline: createCommand(({ commands: commands2, tr: tr2 }) => {
|
|
22240
22157
|
const initialNode = tr2.doc.nodeAt(getItemPosition(tr2));
|
|
22241
22158
|
const isEmptyParagraph = !tr2.selection.$cursor.node().textContent;
|
|
22242
|
-
if (isEmptyParagraph)
|
|
22243
|
-
return false;
|
|
22159
|
+
if (isEmptyParagraph) return false;
|
|
22244
22160
|
commands2.splitListItem(this.name);
|
|
22245
22161
|
const position = getItemPosition(tr2);
|
|
22246
22162
|
for (const mark of initialNode.marks) {
|
|
@@ -22261,8 +22177,7 @@ const ListItem = ListItem$1.extend({
|
|
|
22261
22177
|
var _a2;
|
|
22262
22178
|
return ((_a2 = node.type) == null ? void 0 : _a2.name) === NodeTypes.LIST;
|
|
22263
22179
|
});
|
|
22264
|
-
if (isListSelected)
|
|
22265
|
-
return commands2.listItemNewline();
|
|
22180
|
+
if (isListSelected) return commands2.listItemNewline();
|
|
22266
22181
|
}
|
|
22267
22182
|
})
|
|
22268
22183
|
});
|
|
@@ -22292,10 +22207,8 @@ const List = Node$1.create({
|
|
|
22292
22207
|
const getBulletType = (element) => {
|
|
22293
22208
|
for (const type of ListTypes.values) {
|
|
22294
22209
|
const bulletClass = `.${unref(this.options.baseClass)}${type}`;
|
|
22295
|
-
if (element.matches(bulletClass))
|
|
22296
|
-
|
|
22297
|
-
if (HTML_TYPES[element.type.toLowerCase()] === type)
|
|
22298
|
-
return type;
|
|
22210
|
+
if (element.matches(bulletClass)) return type;
|
|
22211
|
+
if (HTML_TYPES[element.type.toLowerCase()] === type) return type;
|
|
22299
22212
|
}
|
|
22300
22213
|
};
|
|
22301
22214
|
return [
|
|
@@ -22340,25 +22253,18 @@ const List = Node$1.create({
|
|
|
22340
22253
|
const from2 = selection.$from.start();
|
|
22341
22254
|
const to = selection.$to.end();
|
|
22342
22255
|
function canBubbleMark(node, childMark) {
|
|
22343
|
-
if (TextSettings.inlineMarks.includes(childMark.type))
|
|
22344
|
-
|
|
22345
|
-
if (childMark.type.isInSet(node.marks))
|
|
22346
|
-
return false;
|
|
22256
|
+
if (TextSettings.inlineMarks.includes(childMark.type)) return false;
|
|
22257
|
+
if (childMark.type.isInSet(node.marks)) return false;
|
|
22347
22258
|
for (const child of node.content.content) {
|
|
22348
|
-
if (!child.childCount)
|
|
22349
|
-
|
|
22350
|
-
if (!child.marks)
|
|
22351
|
-
return false;
|
|
22352
|
-
if (!childMark.isInSet(child.marks))
|
|
22353
|
-
return false;
|
|
22259
|
+
if (!child.childCount) continue;
|
|
22260
|
+
if (!child.marks) return false;
|
|
22261
|
+
if (!childMark.isInSet(child.marks)) return false;
|
|
22354
22262
|
}
|
|
22355
22263
|
return true;
|
|
22356
22264
|
}
|
|
22357
22265
|
doc2.nodesBetween(from2, to, (node, position) => {
|
|
22358
|
-
if (node.type.name === NodeTypes.LIST)
|
|
22359
|
-
|
|
22360
|
-
if (node.type.name !== NodeTypes.LIST_ITEM)
|
|
22361
|
-
return false;
|
|
22266
|
+
if (node.type.name === NodeTypes.LIST) return;
|
|
22267
|
+
if (node.type.name !== NodeTypes.LIST_ITEM) return false;
|
|
22362
22268
|
const bubbled = [];
|
|
22363
22269
|
node.forEach((child) => {
|
|
22364
22270
|
for (const childMark of child.marks) {
|
|
@@ -22381,10 +22287,8 @@ const List = Node$1.create({
|
|
|
22381
22287
|
const from2 = selection.$from.start();
|
|
22382
22288
|
const to = selection.$to.end();
|
|
22383
22289
|
doc2.nodesBetween(from2, to, (node, position, parent) => {
|
|
22384
|
-
if ([NodeTypes.LIST, NodeTypes.LIST_ITEM].includes(node.type.name))
|
|
22385
|
-
|
|
22386
|
-
if (parent.type.name !== NodeTypes.LIST_ITEM)
|
|
22387
|
-
return false;
|
|
22290
|
+
if ([NodeTypes.LIST, NodeTypes.LIST_ITEM].includes(node.type.name)) return;
|
|
22291
|
+
if (parent.type.name !== NodeTypes.LIST_ITEM) return false;
|
|
22388
22292
|
const addingMarks = parent.marks.filter(function(mark) {
|
|
22389
22293
|
return !mark.type.isInSet(node.marks);
|
|
22390
22294
|
});
|
|
@@ -22677,8 +22581,7 @@ const Link = Link$1.extend({
|
|
|
22677
22581
|
default: null,
|
|
22678
22582
|
parseHTML: (element) => {
|
|
22679
22583
|
const href = element.getAttribute("href");
|
|
22680
|
-
if (!href.startsWith("#"))
|
|
22681
|
-
return href;
|
|
22584
|
+
if (!href.startsWith("#")) return href;
|
|
22682
22585
|
return parseFloat(element.getAttribute("href").replace("#", ""));
|
|
22683
22586
|
}
|
|
22684
22587
|
},
|
|
@@ -22690,8 +22593,7 @@ const Link = Link$1.extend({
|
|
|
22690
22593
|
default: LinkDestinations.URL,
|
|
22691
22594
|
parseHTML: (element) => {
|
|
22692
22595
|
const href = element.getAttribute("href");
|
|
22693
|
-
if (!href.startsWith("#"))
|
|
22694
|
-
return LinkDestinations.URL;
|
|
22596
|
+
if (!href.startsWith("#")) return LinkDestinations.URL;
|
|
22695
22597
|
const id = href.replace("#", "");
|
|
22696
22598
|
const blocks = unref(this.options.pageBlocks);
|
|
22697
22599
|
const block = blocks.find((block2) => block2.id === parseInt(id));
|
|
@@ -22782,16 +22684,13 @@ const Margin = Extension.create({
|
|
|
22782
22684
|
parseHTML(el) {
|
|
22783
22685
|
const { margin, marginTop, marginRight, marginBottom, marginLeft } = el.style;
|
|
22784
22686
|
const isPreset = [margin, marginTop, marginRight, marginBottom, marginLeft].some((v) => !!v);
|
|
22785
|
-
if (!isPreset)
|
|
22786
|
-
|
|
22787
|
-
if (margin)
|
|
22788
|
-
return { value: margin };
|
|
22687
|
+
if (!isPreset) return null;
|
|
22688
|
+
if (margin) return { value: margin };
|
|
22789
22689
|
const value = [marginTop || 0, marginRight || 0, marginBottom || 0, marginLeft || 0].join(" ");
|
|
22790
22690
|
return { value };
|
|
22791
22691
|
},
|
|
22792
22692
|
renderHTML(attrs) {
|
|
22793
|
-
if (!attrs.margin)
|
|
22794
|
-
return null;
|
|
22693
|
+
if (!attrs.margin) return null;
|
|
22795
22694
|
return renderInlineSetting({ margin: attrs.margin.value });
|
|
22796
22695
|
}
|
|
22797
22696
|
}
|
|
@@ -22941,8 +22840,7 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
22941
22840
|
}
|
|
22942
22841
|
}
|
|
22943
22842
|
_removeEmptyNodes(node) {
|
|
22944
|
-
if (!node.innerHTML.trim())
|
|
22945
|
-
node.remove();
|
|
22843
|
+
if (!node.innerHTML.trim()) node.remove();
|
|
22946
22844
|
}
|
|
22947
22845
|
_normalizeListItems(itemEl) {
|
|
22948
22846
|
const fragment = this.dom.createDocumentFragment();
|
|
@@ -23011,10 +22909,8 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23011
22909
|
}
|
|
23012
22910
|
}
|
|
23013
22911
|
_normalizeBreakLines({ parentElement }) {
|
|
23014
|
-
if (!this._isBlockNode(parentElement))
|
|
23015
|
-
|
|
23016
|
-
if (!parentElement.textContent)
|
|
23017
|
-
return;
|
|
22912
|
+
if (!this._isBlockNode(parentElement)) return;
|
|
22913
|
+
if (!parentElement.textContent) return;
|
|
23018
22914
|
const fragment = this.dom.createDocumentFragment();
|
|
23019
22915
|
const children = Array.from(parentElement.childNodes);
|
|
23020
22916
|
const parentTemplate = parentElement.cloneNode(true);
|
|
@@ -23045,10 +22941,8 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23045
22941
|
const blockDecoration = this._parseTextDecoration(blockEl);
|
|
23046
22942
|
blockEl.style.removeProperty("text-decoration-line");
|
|
23047
22943
|
blockEl.style.removeProperty("text-decoration");
|
|
23048
|
-
if (!blockEl.style.cssText)
|
|
23049
|
-
|
|
23050
|
-
if (blockDecoration.none)
|
|
23051
|
-
return;
|
|
22944
|
+
if (!blockEl.style.cssText) blockEl.removeAttribute("style");
|
|
22945
|
+
if (blockDecoration.none) return;
|
|
23052
22946
|
for (const childNode of blockEl.childNodes) {
|
|
23053
22947
|
const textEl = this._wrapTextNode(blockEl, childNode);
|
|
23054
22948
|
const textDecoration = this._parseTextDecoration(textEl);
|
|
@@ -23079,8 +22973,7 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23079
22973
|
_moveBackgroundColorToChildren(blockEl) {
|
|
23080
22974
|
const blockColor = blockEl.style.backgroundColor;
|
|
23081
22975
|
blockEl.style.removeProperty("background-color");
|
|
23082
|
-
if (!blockEl.style.cssText)
|
|
23083
|
-
blockEl.removeAttribute("style");
|
|
22976
|
+
if (!blockEl.style.cssText) blockEl.removeAttribute("style");
|
|
23084
22977
|
for (const childNode of blockEl.childNodes) {
|
|
23085
22978
|
const textEl = this._wrapTextNode(blockEl, childNode);
|
|
23086
22979
|
const color = textEl.style.backgroundColor || blockColor;
|
|
@@ -23088,8 +22981,7 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23088
22981
|
}
|
|
23089
22982
|
}
|
|
23090
22983
|
_wrapTextNode(parent, node) {
|
|
23091
|
-
if (node.nodeType !== this._Node.TEXT_NODE)
|
|
23092
|
-
return node;
|
|
22984
|
+
if (node.nodeType !== this._Node.TEXT_NODE) return node;
|
|
23093
22985
|
const span = this.dom.createElement("span");
|
|
23094
22986
|
span.append(node.cloneNode());
|
|
23095
22987
|
parent.replaceChild(span, node);
|
|
@@ -23373,15 +23265,11 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
23373
23265
|
}
|
|
23374
23266
|
}
|
|
23375
23267
|
_bubbleMarks(node) {
|
|
23376
|
-
if (!node.content)
|
|
23377
|
-
|
|
23378
|
-
if (node.type === NodeTypes.LIST)
|
|
23379
|
-
return;
|
|
23268
|
+
if (!node.content) return;
|
|
23269
|
+
if (node.type === NodeTypes.LIST) return;
|
|
23380
23270
|
for (const child of node.content) {
|
|
23381
|
-
if (this._isLink(child))
|
|
23382
|
-
|
|
23383
|
-
if (!child.marks)
|
|
23384
|
-
continue;
|
|
23271
|
+
if (this._isLink(child)) continue;
|
|
23272
|
+
if (!child.marks) continue;
|
|
23385
23273
|
for (const childMark of child.marks.slice()) {
|
|
23386
23274
|
if (this._includesMark(node, childMark)) {
|
|
23387
23275
|
this._removeMark(child, childMark);
|
|
@@ -23395,17 +23283,12 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
23395
23283
|
}
|
|
23396
23284
|
}
|
|
23397
23285
|
_canBubbleMark(node, childMark) {
|
|
23398
|
-
if (TextSettings.inlineMarks.includes(childMark.type))
|
|
23399
|
-
|
|
23400
|
-
if (this._includesMarkType(node, childMark.type))
|
|
23401
|
-
return false;
|
|
23286
|
+
if (TextSettings.inlineMarks.includes(childMark.type)) return false;
|
|
23287
|
+
if (this._includesMarkType(node, childMark.type)) return false;
|
|
23402
23288
|
for (const child of node.content) {
|
|
23403
|
-
if (!child.content && node.type === NodeTypes.LIST_ITEM)
|
|
23404
|
-
|
|
23405
|
-
if (!child
|
|
23406
|
-
return false;
|
|
23407
|
-
if (!this._includesMark(child, childMark))
|
|
23408
|
-
return false;
|
|
23289
|
+
if (!child.content && node.type === NodeTypes.LIST_ITEM) continue;
|
|
23290
|
+
if (!child.marks) return false;
|
|
23291
|
+
if (!this._includesMark(child, childMark)) return false;
|
|
23409
23292
|
}
|
|
23410
23293
|
return true;
|
|
23411
23294
|
}
|
|
@@ -23421,13 +23304,10 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
23421
23304
|
return node.type === NodeTypes.TEXT && this._includesMarkType(node, TextSettings.LINK);
|
|
23422
23305
|
}
|
|
23423
23306
|
_removeMark(node, mark) {
|
|
23424
|
-
if (!node.marks)
|
|
23425
|
-
return;
|
|
23307
|
+
if (!node.marks) return;
|
|
23426
23308
|
const index = this._findMarkIndexByType(node, mark.type);
|
|
23427
|
-
if (index >= 0)
|
|
23428
|
-
|
|
23429
|
-
if (!node.marks.length)
|
|
23430
|
-
delete node.marks;
|
|
23309
|
+
if (index >= 0) node.marks.splice(index, 1);
|
|
23310
|
+
if (!node.marks.length) delete node.marks;
|
|
23431
23311
|
}
|
|
23432
23312
|
_addMark(node, mark) {
|
|
23433
23313
|
this._removeMark(node, mark);
|
|
@@ -23699,8 +23579,7 @@ class StylePresetRenderer {
|
|
|
23699
23579
|
}
|
|
23700
23580
|
inject(hostEl, presets) {
|
|
23701
23581
|
let styleEl = hostEl.querySelector("[data-zw-styles]");
|
|
23702
|
-
if (styleEl)
|
|
23703
|
-
return;
|
|
23582
|
+
if (styleEl) return;
|
|
23704
23583
|
styleEl = ContextWindow.document.createElement("style");
|
|
23705
23584
|
styleEl.dataset.zwStyles = "";
|
|
23706
23585
|
styleEl.innerHTML = this.render(presets);
|
|
@@ -23750,17 +23629,14 @@ const _NodeSelector = class _NodeSelector {
|
|
|
23750
23629
|
query(containerNode, selector) {
|
|
23751
23630
|
let found2 = null;
|
|
23752
23631
|
containerNode.descendants((node) => {
|
|
23753
|
-
if (found2)
|
|
23754
|
-
return false;
|
|
23632
|
+
if (found2) return false;
|
|
23755
23633
|
if (this.matchNode(node, selector)) {
|
|
23756
23634
|
found2 = node;
|
|
23757
23635
|
return false;
|
|
23758
23636
|
}
|
|
23759
23637
|
});
|
|
23760
|
-
if (!found2)
|
|
23761
|
-
|
|
23762
|
-
if (!selector.getMark)
|
|
23763
|
-
return found2;
|
|
23638
|
+
if (!found2) return null;
|
|
23639
|
+
if (!selector.getMark) return found2;
|
|
23764
23640
|
return this.getMark(found2, selector.getMark);
|
|
23765
23641
|
}
|
|
23766
23642
|
matchNode(node, selector) {
|
|
@@ -23808,8 +23684,7 @@ const outClick = {
|
|
|
23808
23684
|
updated(el, { value }) {
|
|
23809
23685
|
const data = dataStorage.get(el);
|
|
23810
23686
|
const isEnabled = !value.isDisabled;
|
|
23811
|
-
if (isEnabled === data.isEnabled)
|
|
23812
|
-
return;
|
|
23687
|
+
if (isEnabled === data.isEnabled) return;
|
|
23813
23688
|
toggleListener(isEnabled, data.callback);
|
|
23814
23689
|
dataStorage.set(el, { callback: data.callback, isEnabled });
|
|
23815
23690
|
},
|
|
@@ -23820,14 +23695,10 @@ const outClick = {
|
|
|
23820
23695
|
function tooltip(el, { value, modifiers: modifiers2 }) {
|
|
23821
23696
|
const options = typeof value === "string" ? { text: value } : value;
|
|
23822
23697
|
const { text, hotkey } = options;
|
|
23823
|
-
if (text)
|
|
23824
|
-
|
|
23825
|
-
if (
|
|
23826
|
-
|
|
23827
|
-
if (modifiers2.xs)
|
|
23828
|
-
el.dataset.tooltipSize = "xs";
|
|
23829
|
-
if (modifiers2.lg)
|
|
23830
|
-
el.dataset.tooltipSize = "lg";
|
|
23698
|
+
if (text) el.dataset.tooltip = text;
|
|
23699
|
+
if (text && hotkey) el.dataset.tooltipHotkey = hotkey;
|
|
23700
|
+
if (modifiers2.xs) el.dataset.tooltipSize = "xs";
|
|
23701
|
+
if (modifiers2.lg) el.dataset.tooltipSize = "lg";
|
|
23831
23702
|
}
|
|
23832
23703
|
const _hoisted_1$n = ["disabled"];
|
|
23833
23704
|
const _sfc_main$I = {
|
|
@@ -23928,13 +23799,11 @@ const _sfc_main$G = {
|
|
|
23928
23799
|
const props = __props;
|
|
23929
23800
|
const source = computed(() => importIcon(props.name));
|
|
23930
23801
|
const iconSize = computed(() => {
|
|
23931
|
-
if (isNaN(Number(props.size)))
|
|
23932
|
-
return props.size;
|
|
23802
|
+
if (isNaN(Number(props.size))) return props.size;
|
|
23933
23803
|
return `${props.size}px`;
|
|
23934
23804
|
});
|
|
23935
23805
|
const iconStyles = computed(() => {
|
|
23936
|
-
if (!props.size)
|
|
23937
|
-
return null;
|
|
23806
|
+
if (!props.size) return null;
|
|
23938
23807
|
return {
|
|
23939
23808
|
"--zw-icon-width": iconSize.value,
|
|
23940
23809
|
"--zw-icon-height": iconSize.value
|
|
@@ -23987,10 +23856,8 @@ function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
|
|
|
23987
23856
|
}
|
|
23988
23857
|
const temp = useTempValue({ valueRef, format });
|
|
23989
23858
|
function validateNumber(number) {
|
|
23990
|
-
if (min2 !== null && number < min2)
|
|
23991
|
-
|
|
23992
|
-
if (max2 !== null && number > max2)
|
|
23993
|
-
return max2;
|
|
23859
|
+
if (min2 !== null && number < min2) return min2;
|
|
23860
|
+
if (max2 !== null && number > max2) return max2;
|
|
23994
23861
|
return number;
|
|
23995
23862
|
}
|
|
23996
23863
|
function change(value) {
|
|
@@ -24026,8 +23893,7 @@ function useModalToggler({ onBeforeOpened, onClosed } = {}) {
|
|
|
24026
23893
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
24027
23894
|
const isOpened = ref(false);
|
|
24028
23895
|
async function open() {
|
|
24029
|
-
if (isOpened.value)
|
|
24030
|
-
return;
|
|
23896
|
+
if (isOpened.value) return;
|
|
24031
23897
|
onBeforeOpened == null ? void 0 : onBeforeOpened();
|
|
24032
23898
|
editor.commands.storeSelection();
|
|
24033
23899
|
isOpened.value = true;
|
|
@@ -24049,8 +23915,7 @@ function useActivatedListener({ targetRef, isActiveRef, event, onEvent, options
|
|
|
24049
23915
|
(_a = targetRef.value) == null ? void 0 : _a.removeEventListener(event, onEvent, options);
|
|
24050
23916
|
}
|
|
24051
23917
|
function updateListener() {
|
|
24052
|
-
if (!targetRef.value)
|
|
24053
|
-
return;
|
|
23918
|
+
if (!targetRef.value) return;
|
|
24054
23919
|
isActiveRef.value ? addListener() : removeListener();
|
|
24055
23920
|
}
|
|
24056
23921
|
watch(isActiveRef, updateListener);
|
|
@@ -24068,8 +23933,7 @@ function useDeselectionLock({ hostRef, isActiveRef }) {
|
|
|
24068
23933
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
24069
23934
|
const targetRef = useElementRef(hostRef);
|
|
24070
23935
|
function onEvent(event) {
|
|
24071
|
-
if (INTERACTIVE_TAGS.includes(event.target.tagName))
|
|
24072
|
-
return;
|
|
23936
|
+
if (INTERACTIVE_TAGS.includes(event.target.tagName)) return;
|
|
24073
23937
|
if (editor.isFocused) {
|
|
24074
23938
|
event.stopPropagation();
|
|
24075
23939
|
event.preventDefault();
|
|
@@ -24087,8 +23951,7 @@ const SCROLL_VIEW = Symbol("scrollView");
|
|
|
24087
23951
|
function useScrollView() {
|
|
24088
23952
|
const scrollerRef = inject(SCROLL_VIEW);
|
|
24089
23953
|
function scrollToElement(element, { offset: offset2 } = {}) {
|
|
24090
|
-
if (!scrollerRef.value)
|
|
24091
|
-
return;
|
|
23954
|
+
if (!scrollerRef.value) return;
|
|
24092
23955
|
const rootRect = scrollerRef.value.getBoundingClientRect();
|
|
24093
23956
|
const elementRect = element.getBoundingClientRect();
|
|
24094
23957
|
const position = elementRect.top - rootRect.top;
|
|
@@ -24381,8 +24244,7 @@ function getSideList(side, isStart, rtl) {
|
|
|
24381
24244
|
switch (side) {
|
|
24382
24245
|
case "top":
|
|
24383
24246
|
case "bottom":
|
|
24384
|
-
if (rtl)
|
|
24385
|
-
return isStart ? rl : lr;
|
|
24247
|
+
if (rtl) return isStart ? rl : lr;
|
|
24386
24248
|
return isStart ? lr : rl;
|
|
24387
24249
|
case "left":
|
|
24388
24250
|
case "right":
|
|
@@ -24977,8 +24839,7 @@ function getContainingBlock(element) {
|
|
|
24977
24839
|
return null;
|
|
24978
24840
|
}
|
|
24979
24841
|
function isWebKit() {
|
|
24980
|
-
if (typeof CSS === "undefined" || !CSS.supports)
|
|
24981
|
-
return false;
|
|
24842
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
24982
24843
|
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
24983
24844
|
}
|
|
24984
24845
|
function isLastTraversableNode(node) {
|
|
@@ -25762,10 +25623,8 @@ const _sfc_main$B = {
|
|
|
25762
25623
|
const floatingRef = ref(null);
|
|
25763
25624
|
const referenceRef = toRef(props, "referenceRef");
|
|
25764
25625
|
const flipMiddleware = computed(() => {
|
|
25765
|
-
if (!props.placementFlip)
|
|
25766
|
-
|
|
25767
|
-
if (typeof props.placementFlip === "boolean")
|
|
25768
|
-
return flip();
|
|
25626
|
+
if (!props.placementFlip) return null;
|
|
25627
|
+
if (typeof props.placementFlip === "boolean") return flip();
|
|
25769
25628
|
return flip({ fallbackPlacements: props.placementFlip });
|
|
25770
25629
|
});
|
|
25771
25630
|
const middlewares = computed(() => [
|
|
@@ -25867,8 +25726,7 @@ const _sfc_main$A = {
|
|
|
25867
25726
|
});
|
|
25868
25727
|
if (props.focusFirstControl) {
|
|
25869
25728
|
watch(toRef(toggler, "isOpened"), async (_, wasOpened) => {
|
|
25870
|
-
if (wasOpened)
|
|
25871
|
-
return;
|
|
25729
|
+
if (wasOpened) return;
|
|
25872
25730
|
await nextTick();
|
|
25873
25731
|
const focusableEl = hostEl.value.querySelector(':where(a, button, input):not(:disabled, [data-initial-focus="false"])');
|
|
25874
25732
|
(focusableEl || hostEl.value).focus();
|
|
@@ -26012,10 +25870,8 @@ const InjectionTokens = Object.freeze({
|
|
|
26012
25870
|
function useActiveOptionManager({ optionsRef, inputRef, stateless, onChange }) {
|
|
26013
25871
|
const activeOption = ref(null);
|
|
26014
25872
|
function activateOption(option, { emitEvent } = {}) {
|
|
26015
|
-
if (!stateless)
|
|
26016
|
-
|
|
26017
|
-
if (emitEvent !== false)
|
|
26018
|
-
onChange(option);
|
|
25873
|
+
if (!stateless) activeOption.value = option;
|
|
25874
|
+
if (emitEvent !== false) onChange(option);
|
|
26019
25875
|
}
|
|
26020
25876
|
function activateById(id, params) {
|
|
26021
25877
|
const option = optionsRef.value.flatMap((option2) => option2.options || option2).find((option2) => option2.id === id);
|
|
@@ -26327,8 +26183,7 @@ function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened
|
|
|
26327
26183
|
isOpened.value ? close2() : open();
|
|
26328
26184
|
}
|
|
26329
26185
|
function triggerChange(color) {
|
|
26330
|
-
if (isOpened.value)
|
|
26331
|
-
onChange(color);
|
|
26186
|
+
if (isOpened.value) onChange(color);
|
|
26332
26187
|
}
|
|
26333
26188
|
function cancel() {
|
|
26334
26189
|
var _a;
|
|
@@ -26351,8 +26206,7 @@ function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened
|
|
|
26351
26206
|
}
|
|
26352
26207
|
function usePickerHotkeys({ isOpenedRef, onCancel, onApply }) {
|
|
26353
26208
|
function useHotkey(event, handler) {
|
|
26354
|
-
if (event.target.closest("input"))
|
|
26355
|
-
return;
|
|
26209
|
+
if (event.target.closest("input")) return;
|
|
26356
26210
|
event.stopImmediatePropagation();
|
|
26357
26211
|
event.preventDefault();
|
|
26358
26212
|
handler();
|
|
@@ -27222,10 +27076,8 @@ function useLink() {
|
|
|
27222
27076
|
if (currentDestination.value.id === LinkDestinations.URL) {
|
|
27223
27077
|
const url = destinationHrefs.value.url;
|
|
27224
27078
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(url) || RegExps.MAILTO_PROTOCOL.test(url);
|
|
27225
|
-
if (isTelOrMail)
|
|
27226
|
-
|
|
27227
|
-
if (url.startsWith("/"))
|
|
27228
|
-
return url;
|
|
27079
|
+
if (isTelOrMail) return url;
|
|
27080
|
+
if (url.startsWith("/")) return url;
|
|
27229
27081
|
const hasProtocol = RegExps.HTTPS_PROTOCOL.test(url);
|
|
27230
27082
|
return hasProtocol ? url : `https://${url}`;
|
|
27231
27083
|
}
|
|
@@ -27376,8 +27228,7 @@ const _sfc_main$9 = {
|
|
|
27376
27228
|
const changeDestination = (value) => {
|
|
27377
27229
|
emit("reset-errors");
|
|
27378
27230
|
link.value.currentDestination.value.id = value;
|
|
27379
|
-
if (!isURLDestination.value)
|
|
27380
|
-
link.value.target = LinkTargets.SELF;
|
|
27231
|
+
if (!isURLDestination.value) link.value.target = LinkTargets.SELF;
|
|
27381
27232
|
link.value.destinationHrefs.value.url = "";
|
|
27382
27233
|
};
|
|
27383
27234
|
const updateLink = (value) => {
|
|
@@ -27436,14 +27287,11 @@ const _sfc_main$8 = {
|
|
|
27436
27287
|
return link.linkData.value.text ? false : "Can't be empty";
|
|
27437
27288
|
};
|
|
27438
27289
|
const isValidUrl = () => {
|
|
27439
|
-
if (link.currentDestination.value.id !== LinkDestinations.URL)
|
|
27440
|
-
return false;
|
|
27290
|
+
if (link.currentDestination.value.id !== LinkDestinations.URL) return false;
|
|
27441
27291
|
const href = link.destinationHrefs.value.url;
|
|
27442
27292
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(href) || RegExps.MAILTO_PROTOCOL.test(href);
|
|
27443
|
-
if (isTelOrMail)
|
|
27444
|
-
|
|
27445
|
-
if (href.startsWith("/"))
|
|
27446
|
-
return false;
|
|
27293
|
+
if (isTelOrMail) return false;
|
|
27294
|
+
if (href.startsWith("/")) return false;
|
|
27447
27295
|
const isUrl = RegExps.URL.test(href);
|
|
27448
27296
|
return isUrl ? false : "Please enter a valid URL";
|
|
27449
27297
|
};
|
|
@@ -27473,8 +27321,7 @@ const _sfc_main$8 = {
|
|
|
27473
27321
|
const applyLink = () => {
|
|
27474
27322
|
urlValidator.validate();
|
|
27475
27323
|
nameValidator.validate();
|
|
27476
|
-
if (urlValidator.error.value || nameValidator.error.value)
|
|
27477
|
-
return;
|
|
27324
|
+
if (urlValidator.error.value || nameValidator.error.value) return;
|
|
27478
27325
|
link.apply();
|
|
27479
27326
|
toggler.close();
|
|
27480
27327
|
link.resetDestinations();
|
|
@@ -27959,8 +27806,7 @@ const _sfc_main$1 = {
|
|
|
27959
27806
|
}));
|
|
27960
27807
|
const props = __props;
|
|
27961
27808
|
const layoutComponent = computed(() => {
|
|
27962
|
-
if (props.popupMode)
|
|
27963
|
-
return _sfc_main$3;
|
|
27809
|
+
if (props.popupMode) return _sfc_main$3;
|
|
27964
27810
|
return props.device === Devices.MOBILE ? _sfc_main$4 : _sfc_main$5;
|
|
27965
27811
|
});
|
|
27966
27812
|
return (_ctx, _cache) => {
|
|
@@ -27990,11 +27836,9 @@ const _sfc_main$1 = {
|
|
|
27990
27836
|
};
|
|
27991
27837
|
const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e9105a30"]]);
|
|
27992
27838
|
function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
|
|
27993
|
-
|
|
27994
|
-
const getContent = () => markWysiwygContent(editor.getJSON());
|
|
27995
|
-
editor = reactive(new Editor2({
|
|
27839
|
+
const editor = reactive(new Editor2({
|
|
27996
27840
|
content: ContentNormalizer.normalize(content.value),
|
|
27997
|
-
onUpdate: () => onChange(
|
|
27841
|
+
onUpdate: () => onChange(editor.getJSON()),
|
|
27998
27842
|
extensions: extensions2,
|
|
27999
27843
|
injectCSS: false,
|
|
28000
27844
|
editable: !unref(isReadonlyRef),
|
|
@@ -28006,13 +27850,13 @@ function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }
|
|
|
28006
27850
|
}));
|
|
28007
27851
|
onUnmounted(() => editor.destroy());
|
|
28008
27852
|
watch(content, (value) => {
|
|
28009
|
-
if (JSON.stringify(
|
|
27853
|
+
if (JSON.stringify(editor.getJSON()) !== JSON.stringify(value)) {
|
|
28010
27854
|
const content2 = ContentNormalizer.normalize(value);
|
|
28011
27855
|
editor.commands.setContent(content2, false);
|
|
28012
27856
|
}
|
|
28013
27857
|
});
|
|
28014
27858
|
watch(isReadonlyRef, (isReadonly) => editor.setEditable(!isReadonly, false));
|
|
28015
|
-
return { editor, getContent };
|
|
27859
|
+
return { editor, getContent: () => editor.getJSON() };
|
|
28016
27860
|
}
|
|
28017
27861
|
class Font {
|
|
28018
27862
|
constructor({ name, category, styles }) {
|
|
@@ -28225,8 +28069,6 @@ export {
|
|
|
28225
28069
|
TextSettings,
|
|
28226
28070
|
_sfc_main as Wysiwyg,
|
|
28227
28071
|
isWysiwygContent,
|
|
28228
|
-
markWysiwygContent,
|
|
28229
|
-
unmarkWysiwygContent,
|
|
28230
28072
|
useElementRef,
|
|
28231
28073
|
useModalToggler
|
|
28232
28074
|
};
|