@zipify/wysiwyg 4.3.0 → 4.4.0-dev.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 +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/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/wysiwyg.mjs +204 -352
- package/lib/cli/commands/ToJsonCommand.js +2 -2
- package/lib/entryNode.ts +2 -0
- package/lib/node/NodeDomParser.ts +16 -0
- package/lib/node/index.ts +1 -0
- package/package.json +11 -10
- 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;
|
|
@@ -20023,11 +19974,9 @@ const DEFAULT_COMPARATOR = (parentMark, mark) => parentMark.eq(mark);
|
|
|
20023
19974
|
function isMarkAppliedToParent(doc2, position, checkingMark, comparator = DEFAULT_COMPARATOR) {
|
|
20024
19975
|
const steps = doc2.resolve(position).path.reverse();
|
|
20025
19976
|
for (const step of steps) {
|
|
20026
|
-
if (typeof step === "number")
|
|
20027
|
-
continue;
|
|
19977
|
+
if (typeof step === "number") continue;
|
|
20028
19978
|
for (const mark of step.marks) {
|
|
20029
|
-
if (comparator(mark, checkingMark))
|
|
20030
|
-
return true;
|
|
19979
|
+
if (comparator(mark, checkingMark)) return true;
|
|
20031
19980
|
}
|
|
20032
19981
|
}
|
|
20033
19982
|
return false;
|
|
@@ -21028,8 +20977,7 @@ const NodeProcessor = Extension.create({
|
|
|
21028
20977
|
const { doc: doc2, tr: tr2 } = state;
|
|
21029
20978
|
const { from: from2, to } = tr2.selection;
|
|
21030
20979
|
doc2.nodesBetween(from2, to, (node, position) => {
|
|
21031
|
-
if (!NodeTypes.blocks.includes(node.type.name))
|
|
21032
|
-
return;
|
|
20980
|
+
if (!NodeTypes.blocks.includes(node.type.name)) return;
|
|
21033
20981
|
tr2.setNodeAttribute(position, name, { ...defaults2, ...current, ...attrs });
|
|
21034
20982
|
});
|
|
21035
20983
|
}),
|
|
@@ -21055,8 +21003,7 @@ const NodeProcessor = Extension.create({
|
|
|
21055
21003
|
if (!markGroup.includes(MarkGroups.SETTINGS)) {
|
|
21056
21004
|
return commands2.setMark(name, value);
|
|
21057
21005
|
}
|
|
21058
|
-
if ($from.pos === $to.pos)
|
|
21059
|
-
return;
|
|
21006
|
+
if ($from.pos === $to.pos) return;
|
|
21060
21007
|
const onAppliedToParent = (context) => {
|
|
21061
21008
|
if (!customizer.onAppliedToParent || customizer.onAppliedToParent(context) === false) {
|
|
21062
21009
|
const { tr: tr3, node, position, mark } = context;
|
|
@@ -21064,8 +21011,7 @@ const NodeProcessor = Extension.create({
|
|
|
21064
21011
|
}
|
|
21065
21012
|
};
|
|
21066
21013
|
doc2.nodesBetween($from.pos, $to.pos, (node, position) => {
|
|
21067
|
-
if (node.type.name === NodeTypes.LIST)
|
|
21068
|
-
return;
|
|
21014
|
+
if (node.type.name === NodeTypes.LIST) return;
|
|
21069
21015
|
const initialMark = findMarkByType(node.marks, name);
|
|
21070
21016
|
const applyingMark = markType.create({ ...(initialMark == null ? void 0 : initialMark.attrs) || {}, ...value });
|
|
21071
21017
|
const textPosition = resolveTextPosition($from, $to, node, position);
|
|
@@ -21090,8 +21036,7 @@ const NodeProcessor = Extension.create({
|
|
|
21090
21036
|
const marks = [];
|
|
21091
21037
|
doc2.nodesBetween(from2, to, (node) => {
|
|
21092
21038
|
for (const mark of node.marks) {
|
|
21093
|
-
if (mark.type.name === name)
|
|
21094
|
-
marks.unshift(mark.attrs);
|
|
21039
|
+
if (mark.type.name === name) marks.unshift(mark.attrs);
|
|
21095
21040
|
}
|
|
21096
21041
|
});
|
|
21097
21042
|
return marks;
|
|
@@ -21118,8 +21063,7 @@ const NodeProcessor = Extension.create({
|
|
|
21118
21063
|
return computed(() => {
|
|
21119
21064
|
for (const attrs of unref(selectionRef)) {
|
|
21120
21065
|
const value = attrs[unref(deviceRef)];
|
|
21121
|
-
if (value)
|
|
21122
|
-
return value;
|
|
21066
|
+
if (value) return value;
|
|
21123
21067
|
}
|
|
21124
21068
|
return unref(defaultRef);
|
|
21125
21069
|
});
|
|
@@ -21159,11 +21103,9 @@ const TextProcessor = Extension.create({
|
|
|
21159
21103
|
}),
|
|
21160
21104
|
transformText: createCommand(({ state }, transform) => {
|
|
21161
21105
|
const { $from, $to } = state.tr.selection;
|
|
21162
|
-
if ($from.pos === $to.pos)
|
|
21163
|
-
return;
|
|
21106
|
+
if ($from.pos === $to.pos) return;
|
|
21164
21107
|
state.doc.nodesBetween($from.pos, $to.pos, (node, position) => {
|
|
21165
|
-
if (!node.isText)
|
|
21166
|
-
return;
|
|
21108
|
+
if (!node.isText) return;
|
|
21167
21109
|
const textPosition = resolveTextPosition($from, $to, node, position);
|
|
21168
21110
|
const substringFrom = Math.max(0, $from.pos - position);
|
|
21169
21111
|
const substringTo = Math.max(0, $to.pos - position);
|
|
@@ -21252,8 +21194,7 @@ const Document = Document$1.extend({
|
|
|
21252
21194
|
}),
|
|
21253
21195
|
onCreate() {
|
|
21254
21196
|
this.editor.view.dom.addEventListener("click", (event) => {
|
|
21255
|
-
if (event.target.closest("a"))
|
|
21256
|
-
event.preventDefault();
|
|
21197
|
+
if (event.target.closest("a")) event.preventDefault();
|
|
21257
21198
|
});
|
|
21258
21199
|
},
|
|
21259
21200
|
addCommands() {
|
|
@@ -21466,23 +21407,19 @@ const StylePreset = Extension.create({
|
|
|
21466
21407
|
default: { id: unref(this.options.defaultId) },
|
|
21467
21408
|
parseHTML: (element) => {
|
|
21468
21409
|
const presets = unref(this.options.presets);
|
|
21469
|
-
if (element.parentElement.tagName === "LI")
|
|
21470
|
-
return null;
|
|
21410
|
+
if (element.parentElement.tagName === "LI") return null;
|
|
21471
21411
|
for (const { id, node, fallbackClass } of presets) {
|
|
21472
21412
|
if (fallbackClass && element.classList.contains(fallbackClass)) {
|
|
21473
21413
|
return { id };
|
|
21474
21414
|
}
|
|
21475
21415
|
const presetSelector = unref(this.options.styleRenderer).makePresetCssClass({ id });
|
|
21476
|
-
if (element.matches(presetSelector))
|
|
21477
|
-
|
|
21478
|
-
if (element.tagName === `H${node == null ? void 0 : node.level}`)
|
|
21479
|
-
return { id };
|
|
21416
|
+
if (element.matches(presetSelector)) return { id };
|
|
21417
|
+
if (element.tagName === `H${node == null ? void 0 : node.level}`) return { id };
|
|
21480
21418
|
}
|
|
21481
21419
|
return element.tagName === "P" ? { id: unref(this.options.defaultId) } : null;
|
|
21482
21420
|
},
|
|
21483
21421
|
renderHTML: (attrs) => {
|
|
21484
|
-
if (!attrs.preset)
|
|
21485
|
-
return null;
|
|
21422
|
+
if (!attrs.preset) return null;
|
|
21486
21423
|
return { class: unref(this.options.styleRenderer).makePresetHtmlClass(attrs.preset) };
|
|
21487
21424
|
}
|
|
21488
21425
|
}
|
|
@@ -21515,8 +21452,7 @@ const StylePreset = Extension.create({
|
|
|
21515
21452
|
const linkPresetRef = commands2.getLinkPreset();
|
|
21516
21453
|
return computed(() => {
|
|
21517
21454
|
const preset = findPresetById(unref(presetsRef), unref(selectionRef).id);
|
|
21518
|
-
if (!unref(isLinkRef))
|
|
21519
|
-
return preset;
|
|
21455
|
+
if (!unref(isLinkRef)) return preset;
|
|
21520
21456
|
const linkPreset = unref(linkPresetRef);
|
|
21521
21457
|
return {
|
|
21522
21458
|
id: preset.id,
|
|
@@ -21578,8 +21514,7 @@ const StylePreset = Extension.create({
|
|
|
21578
21514
|
doc2.nodesBetween(from2, to, (node) => {
|
|
21579
21515
|
for (const [name, value] of Object.entries(node.attrs)) {
|
|
21580
21516
|
const isSetting = TextSettings.presetAttributes.includes(name);
|
|
21581
|
-
if (isSetting && value)
|
|
21582
|
-
attributes.add(name);
|
|
21517
|
+
if (isSetting && value) attributes.add(name);
|
|
21583
21518
|
}
|
|
21584
21519
|
for (const { type } of node.marks) {
|
|
21585
21520
|
if (TextSettings.marks.includes(type.name)) {
|
|
@@ -21648,8 +21583,7 @@ const FontWeight = Mark2.create({
|
|
|
21648
21583
|
}),
|
|
21649
21584
|
parseHTML() {
|
|
21650
21585
|
const getAttrs = (value) => {
|
|
21651
|
-
if (value === "bold")
|
|
21652
|
-
return { value: "700" };
|
|
21586
|
+
if (value === "bold") return { value: "700" };
|
|
21653
21587
|
return Number(value) ? { value } : false;
|
|
21654
21588
|
};
|
|
21655
21589
|
return [
|
|
@@ -21703,15 +21637,13 @@ const FontSize = Mark2.create({
|
|
|
21703
21637
|
const device = unref(commands2.getDevice());
|
|
21704
21638
|
commands2.applyMark(this.name, { [device]: value }, {
|
|
21705
21639
|
isAppliedToParent: (parentMark, mark) => {
|
|
21706
|
-
if (parentMark.type.name !== mark.type.name)
|
|
21707
|
-
return false;
|
|
21640
|
+
if (parentMark.type.name !== mark.type.name) return false;
|
|
21708
21641
|
return parentMark.attrs[device] === mark.attrs[device];
|
|
21709
21642
|
},
|
|
21710
21643
|
onAppliedToParent: ({ tr: tr2, node, position, mark }) => {
|
|
21711
21644
|
const attrs = { ...mark.attrs, [device]: null };
|
|
21712
21645
|
const canRemove = !Object.values(attrs).some((value2) => !!value2);
|
|
21713
|
-
if (canRemove)
|
|
21714
|
-
return false;
|
|
21646
|
+
if (canRemove) return false;
|
|
21715
21647
|
const updated = mark.type.create(attrs);
|
|
21716
21648
|
if (node.isText) {
|
|
21717
21649
|
tr2.addMark(position, position + node.nodeSize, updated);
|
|
@@ -21739,8 +21671,7 @@ const FontSize = Mark2.create({
|
|
|
21739
21671
|
}),
|
|
21740
21672
|
parseHTML() {
|
|
21741
21673
|
const parseSize = (value) => {
|
|
21742
|
-
if (!value)
|
|
21743
|
-
return null;
|
|
21674
|
+
if (!value) return null;
|
|
21744
21675
|
const wrapperEl = unref(this.options.wrapperRef);
|
|
21745
21676
|
const converted = convertFontSize(value, wrapperEl);
|
|
21746
21677
|
return String(converted);
|
|
@@ -21882,8 +21813,7 @@ const FontStyle = Mark2.create({
|
|
|
21882
21813
|
}),
|
|
21883
21814
|
toggleItalic: createCommand(({ commands: commands2 }) => {
|
|
21884
21815
|
const isItalicAvailable = unref(commands2.isItalicAvailable());
|
|
21885
|
-
if (!isItalicAvailable)
|
|
21886
|
-
return;
|
|
21816
|
+
if (!isItalicAvailable) return;
|
|
21887
21817
|
unref(commands2.isItalic()) ? commands2.removeItalic() : commands2.applyItalic();
|
|
21888
21818
|
}),
|
|
21889
21819
|
applyItalic: createCommand(({ commands: commands2 }) => {
|
|
@@ -22027,12 +21957,9 @@ const TextDecoration = Mark2.create({
|
|
|
22027
21957
|
},
|
|
22028
21958
|
renderHTML({ HTMLAttributes: attrs }) {
|
|
22029
21959
|
const decorations = [];
|
|
22030
|
-
if (attrs.underline)
|
|
22031
|
-
|
|
22032
|
-
if (
|
|
22033
|
-
decorations.push("line-through");
|
|
22034
|
-
if (!decorations.length)
|
|
22035
|
-
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");
|
|
22036
21963
|
return renderMark({ text_decoration: decorations.join(" ") });
|
|
22037
21964
|
}
|
|
22038
21965
|
});
|
|
@@ -22083,13 +22010,11 @@ const Alignment = Extension.create({
|
|
|
22083
22010
|
const mobile = style2.getPropertyValue("--zw-alignment-mobile") || null;
|
|
22084
22011
|
const tablet = style2.getPropertyValue("--zw-alignment-tablet") || null;
|
|
22085
22012
|
const desktop = style2.getPropertyValue("--zw-alignment-desktop") || null;
|
|
22086
|
-
if (!mobile && !tablet && !desktop)
|
|
22087
|
-
return null;
|
|
22013
|
+
if (!mobile && !tablet && !desktop) return null;
|
|
22088
22014
|
return { desktop, tablet, mobile };
|
|
22089
22015
|
},
|
|
22090
22016
|
renderHTML(attrs) {
|
|
22091
|
-
if (!attrs.alignment)
|
|
22092
|
-
return null;
|
|
22017
|
+
if (!attrs.alignment) return null;
|
|
22093
22018
|
return renderInlineSetting({
|
|
22094
22019
|
alignment_mobile: attrs.alignment.mobile,
|
|
22095
22020
|
alignment_tablet: attrs.alignment.tablet,
|
|
@@ -22152,15 +22077,13 @@ const LineHeight = Extension.create({
|
|
|
22152
22077
|
return { mobile, tablet, desktop };
|
|
22153
22078
|
}
|
|
22154
22079
|
const value = element.style.lineHeight;
|
|
22155
|
-
if (!value)
|
|
22156
|
-
return null;
|
|
22080
|
+
if (!value) return null;
|
|
22157
22081
|
const wrapperEl = unref(this.options.wrapperRef);
|
|
22158
22082
|
const converted = convertLineHeight(value, element, wrapperEl);
|
|
22159
22083
|
return converted ? { desktop: converted, tablet: converted, mobile: null } : null;
|
|
22160
22084
|
},
|
|
22161
22085
|
renderHTML(attrs) {
|
|
22162
|
-
if (!attrs.line_height)
|
|
22163
|
-
return null;
|
|
22086
|
+
if (!attrs.line_height) return null;
|
|
22164
22087
|
return renderInlineSetting({
|
|
22165
22088
|
line_height_mobile: attrs.line_height.mobile,
|
|
22166
22089
|
line_height_tablet: attrs.line_height.tablet,
|
|
@@ -22233,8 +22156,7 @@ const ListItem = ListItem$1.extend({
|
|
|
22233
22156
|
listItemNewline: createCommand(({ commands: commands2, tr: tr2 }) => {
|
|
22234
22157
|
const initialNode = tr2.doc.nodeAt(getItemPosition(tr2));
|
|
22235
22158
|
const isEmptyParagraph = !tr2.selection.$cursor.node().textContent;
|
|
22236
|
-
if (isEmptyParagraph)
|
|
22237
|
-
return false;
|
|
22159
|
+
if (isEmptyParagraph) return false;
|
|
22238
22160
|
commands2.splitListItem(this.name);
|
|
22239
22161
|
const position = getItemPosition(tr2);
|
|
22240
22162
|
for (const mark of initialNode.marks) {
|
|
@@ -22255,8 +22177,7 @@ const ListItem = ListItem$1.extend({
|
|
|
22255
22177
|
var _a2;
|
|
22256
22178
|
return ((_a2 = node.type) == null ? void 0 : _a2.name) === NodeTypes.LIST;
|
|
22257
22179
|
});
|
|
22258
|
-
if (isListSelected)
|
|
22259
|
-
return commands2.listItemNewline();
|
|
22180
|
+
if (isListSelected) return commands2.listItemNewline();
|
|
22260
22181
|
}
|
|
22261
22182
|
})
|
|
22262
22183
|
});
|
|
@@ -22286,10 +22207,8 @@ const List = Node$1.create({
|
|
|
22286
22207
|
const getBulletType = (element) => {
|
|
22287
22208
|
for (const type of ListTypes.values) {
|
|
22288
22209
|
const bulletClass = `.${unref(this.options.baseClass)}${type}`;
|
|
22289
|
-
if (element.matches(bulletClass))
|
|
22290
|
-
|
|
22291
|
-
if (HTML_TYPES[element.type.toLowerCase()] === type)
|
|
22292
|
-
return type;
|
|
22210
|
+
if (element.matches(bulletClass)) return type;
|
|
22211
|
+
if (HTML_TYPES[element.type.toLowerCase()] === type) return type;
|
|
22293
22212
|
}
|
|
22294
22213
|
};
|
|
22295
22214
|
return [
|
|
@@ -22334,25 +22253,18 @@ const List = Node$1.create({
|
|
|
22334
22253
|
const from2 = selection.$from.start();
|
|
22335
22254
|
const to = selection.$to.end();
|
|
22336
22255
|
function canBubbleMark(node, childMark) {
|
|
22337
|
-
if (TextSettings.inlineMarks.includes(childMark.type))
|
|
22338
|
-
|
|
22339
|
-
if (childMark.type.isInSet(node.marks))
|
|
22340
|
-
return false;
|
|
22256
|
+
if (TextSettings.inlineMarks.includes(childMark.type)) return false;
|
|
22257
|
+
if (childMark.type.isInSet(node.marks)) return false;
|
|
22341
22258
|
for (const child of node.content.content) {
|
|
22342
|
-
if (!child.childCount)
|
|
22343
|
-
|
|
22344
|
-
if (!child.marks)
|
|
22345
|
-
return false;
|
|
22346
|
-
if (!childMark.isInSet(child.marks))
|
|
22347
|
-
return false;
|
|
22259
|
+
if (!child.childCount) continue;
|
|
22260
|
+
if (!child.marks) return false;
|
|
22261
|
+
if (!childMark.isInSet(child.marks)) return false;
|
|
22348
22262
|
}
|
|
22349
22263
|
return true;
|
|
22350
22264
|
}
|
|
22351
22265
|
doc2.nodesBetween(from2, to, (node, position) => {
|
|
22352
|
-
if (node.type.name === NodeTypes.LIST)
|
|
22353
|
-
|
|
22354
|
-
if (node.type.name !== NodeTypes.LIST_ITEM)
|
|
22355
|
-
return false;
|
|
22266
|
+
if (node.type.name === NodeTypes.LIST) return;
|
|
22267
|
+
if (node.type.name !== NodeTypes.LIST_ITEM) return false;
|
|
22356
22268
|
const bubbled = [];
|
|
22357
22269
|
node.forEach((child) => {
|
|
22358
22270
|
for (const childMark of child.marks) {
|
|
@@ -22375,10 +22287,8 @@ const List = Node$1.create({
|
|
|
22375
22287
|
const from2 = selection.$from.start();
|
|
22376
22288
|
const to = selection.$to.end();
|
|
22377
22289
|
doc2.nodesBetween(from2, to, (node, position, parent) => {
|
|
22378
|
-
if ([NodeTypes.LIST, NodeTypes.LIST_ITEM].includes(node.type.name))
|
|
22379
|
-
|
|
22380
|
-
if (parent.type.name !== NodeTypes.LIST_ITEM)
|
|
22381
|
-
return false;
|
|
22290
|
+
if ([NodeTypes.LIST, NodeTypes.LIST_ITEM].includes(node.type.name)) return;
|
|
22291
|
+
if (parent.type.name !== NodeTypes.LIST_ITEM) return false;
|
|
22382
22292
|
const addingMarks = parent.marks.filter(function(mark) {
|
|
22383
22293
|
return !mark.type.isInSet(node.marks);
|
|
22384
22294
|
});
|
|
@@ -22671,8 +22581,7 @@ const Link = Link$1.extend({
|
|
|
22671
22581
|
default: null,
|
|
22672
22582
|
parseHTML: (element) => {
|
|
22673
22583
|
const href = element.getAttribute("href");
|
|
22674
|
-
if (!href.startsWith("#"))
|
|
22675
|
-
return href;
|
|
22584
|
+
if (!href.startsWith("#")) return href;
|
|
22676
22585
|
return parseFloat(element.getAttribute("href").replace("#", ""));
|
|
22677
22586
|
}
|
|
22678
22587
|
},
|
|
@@ -22684,8 +22593,7 @@ const Link = Link$1.extend({
|
|
|
22684
22593
|
default: LinkDestinations.URL,
|
|
22685
22594
|
parseHTML: (element) => {
|
|
22686
22595
|
const href = element.getAttribute("href");
|
|
22687
|
-
if (!href.startsWith("#"))
|
|
22688
|
-
return LinkDestinations.URL;
|
|
22596
|
+
if (!href.startsWith("#")) return LinkDestinations.URL;
|
|
22689
22597
|
const id = href.replace("#", "");
|
|
22690
22598
|
const blocks = unref(this.options.pageBlocks);
|
|
22691
22599
|
const block = blocks.find((block2) => block2.id === parseInt(id));
|
|
@@ -22776,16 +22684,13 @@ const Margin = Extension.create({
|
|
|
22776
22684
|
parseHTML(el) {
|
|
22777
22685
|
const { margin, marginTop, marginRight, marginBottom, marginLeft } = el.style;
|
|
22778
22686
|
const isPreset = [margin, marginTop, marginRight, marginBottom, marginLeft].some((v) => !!v);
|
|
22779
|
-
if (!isPreset)
|
|
22780
|
-
|
|
22781
|
-
if (margin)
|
|
22782
|
-
return { value: margin };
|
|
22687
|
+
if (!isPreset) return null;
|
|
22688
|
+
if (margin) return { value: margin };
|
|
22783
22689
|
const value = [marginTop || 0, marginRight || 0, marginBottom || 0, marginLeft || 0].join(" ");
|
|
22784
22690
|
return { value };
|
|
22785
22691
|
},
|
|
22786
22692
|
renderHTML(attrs) {
|
|
22787
|
-
if (!attrs.margin)
|
|
22788
|
-
return null;
|
|
22693
|
+
if (!attrs.margin) return null;
|
|
22789
22694
|
return renderInlineSetting({ margin: attrs.margin.value });
|
|
22790
22695
|
}
|
|
22791
22696
|
}
|
|
@@ -22935,8 +22840,7 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
22935
22840
|
}
|
|
22936
22841
|
}
|
|
22937
22842
|
_removeEmptyNodes(node) {
|
|
22938
|
-
if (!node.innerHTML.trim())
|
|
22939
|
-
node.remove();
|
|
22843
|
+
if (!node.innerHTML.trim()) node.remove();
|
|
22940
22844
|
}
|
|
22941
22845
|
_normalizeListItems(itemEl) {
|
|
22942
22846
|
const fragment = this.dom.createDocumentFragment();
|
|
@@ -23005,10 +22909,8 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23005
22909
|
}
|
|
23006
22910
|
}
|
|
23007
22911
|
_normalizeBreakLines({ parentElement }) {
|
|
23008
|
-
if (!this._isBlockNode(parentElement))
|
|
23009
|
-
|
|
23010
|
-
if (!parentElement.textContent)
|
|
23011
|
-
return;
|
|
22912
|
+
if (!this._isBlockNode(parentElement)) return;
|
|
22913
|
+
if (!parentElement.textContent) return;
|
|
23012
22914
|
const fragment = this.dom.createDocumentFragment();
|
|
23013
22915
|
const children = Array.from(parentElement.childNodes);
|
|
23014
22916
|
const parentTemplate = parentElement.cloneNode(true);
|
|
@@ -23039,10 +22941,8 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23039
22941
|
const blockDecoration = this._parseTextDecoration(blockEl);
|
|
23040
22942
|
blockEl.style.removeProperty("text-decoration-line");
|
|
23041
22943
|
blockEl.style.removeProperty("text-decoration");
|
|
23042
|
-
if (!blockEl.style.cssText)
|
|
23043
|
-
|
|
23044
|
-
if (blockDecoration.none)
|
|
23045
|
-
return;
|
|
22944
|
+
if (!blockEl.style.cssText) blockEl.removeAttribute("style");
|
|
22945
|
+
if (blockDecoration.none) return;
|
|
23046
22946
|
for (const childNode of blockEl.childNodes) {
|
|
23047
22947
|
const textEl = this._wrapTextNode(blockEl, childNode);
|
|
23048
22948
|
const textDecoration = this._parseTextDecoration(textEl);
|
|
@@ -23073,8 +22973,7 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23073
22973
|
_moveBackgroundColorToChildren(blockEl) {
|
|
23074
22974
|
const blockColor = blockEl.style.backgroundColor;
|
|
23075
22975
|
blockEl.style.removeProperty("background-color");
|
|
23076
|
-
if (!blockEl.style.cssText)
|
|
23077
|
-
blockEl.removeAttribute("style");
|
|
22976
|
+
if (!blockEl.style.cssText) blockEl.removeAttribute("style");
|
|
23078
22977
|
for (const childNode of blockEl.childNodes) {
|
|
23079
22978
|
const textEl = this._wrapTextNode(blockEl, childNode);
|
|
23080
22979
|
const color = textEl.style.backgroundColor || blockColor;
|
|
@@ -23082,8 +22981,7 @@ const _HtmlNormalizer = class _HtmlNormalizer extends BaseNormalizer {
|
|
|
23082
22981
|
}
|
|
23083
22982
|
}
|
|
23084
22983
|
_wrapTextNode(parent, node) {
|
|
23085
|
-
if (node.nodeType !== this._Node.TEXT_NODE)
|
|
23086
|
-
return node;
|
|
22984
|
+
if (node.nodeType !== this._Node.TEXT_NODE) return node;
|
|
23087
22985
|
const span = this.dom.createElement("span");
|
|
23088
22986
|
span.append(node.cloneNode());
|
|
23089
22987
|
parent.replaceChild(span, node);
|
|
@@ -23367,15 +23265,11 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
23367
23265
|
}
|
|
23368
23266
|
}
|
|
23369
23267
|
_bubbleMarks(node) {
|
|
23370
|
-
if (!node.content)
|
|
23371
|
-
|
|
23372
|
-
if (node.type === NodeTypes.LIST)
|
|
23373
|
-
return;
|
|
23268
|
+
if (!node.content) return;
|
|
23269
|
+
if (node.type === NodeTypes.LIST) return;
|
|
23374
23270
|
for (const child of node.content) {
|
|
23375
|
-
if (this._isLink(child))
|
|
23376
|
-
|
|
23377
|
-
if (!child.marks)
|
|
23378
|
-
continue;
|
|
23271
|
+
if (this._isLink(child)) continue;
|
|
23272
|
+
if (!child.marks) continue;
|
|
23379
23273
|
for (const childMark of child.marks.slice()) {
|
|
23380
23274
|
if (this._includesMark(node, childMark)) {
|
|
23381
23275
|
this._removeMark(child, childMark);
|
|
@@ -23389,17 +23283,12 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
23389
23283
|
}
|
|
23390
23284
|
}
|
|
23391
23285
|
_canBubbleMark(node, childMark) {
|
|
23392
|
-
if (TextSettings.inlineMarks.includes(childMark.type))
|
|
23393
|
-
|
|
23394
|
-
if (this._includesMarkType(node, childMark.type))
|
|
23395
|
-
return false;
|
|
23286
|
+
if (TextSettings.inlineMarks.includes(childMark.type)) return false;
|
|
23287
|
+
if (this._includesMarkType(node, childMark.type)) return false;
|
|
23396
23288
|
for (const child of node.content) {
|
|
23397
|
-
if (!child.content && node.type === NodeTypes.LIST_ITEM)
|
|
23398
|
-
|
|
23399
|
-
if (!child
|
|
23400
|
-
return false;
|
|
23401
|
-
if (!this._includesMark(child, childMark))
|
|
23402
|
-
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;
|
|
23403
23292
|
}
|
|
23404
23293
|
return true;
|
|
23405
23294
|
}
|
|
@@ -23415,13 +23304,10 @@ class JsonNormalizer extends BaseNormalizer {
|
|
|
23415
23304
|
return node.type === NodeTypes.TEXT && this._includesMarkType(node, TextSettings.LINK);
|
|
23416
23305
|
}
|
|
23417
23306
|
_removeMark(node, mark) {
|
|
23418
|
-
if (!node.marks)
|
|
23419
|
-
return;
|
|
23307
|
+
if (!node.marks) return;
|
|
23420
23308
|
const index = this._findMarkIndexByType(node, mark.type);
|
|
23421
|
-
if (index >= 0)
|
|
23422
|
-
|
|
23423
|
-
if (!node.marks.length)
|
|
23424
|
-
delete node.marks;
|
|
23309
|
+
if (index >= 0) node.marks.splice(index, 1);
|
|
23310
|
+
if (!node.marks.length) delete node.marks;
|
|
23425
23311
|
}
|
|
23426
23312
|
_addMark(node, mark) {
|
|
23427
23313
|
this._removeMark(node, mark);
|
|
@@ -23693,8 +23579,7 @@ class StylePresetRenderer {
|
|
|
23693
23579
|
}
|
|
23694
23580
|
inject(hostEl, presets) {
|
|
23695
23581
|
let styleEl = hostEl.querySelector("[data-zw-styles]");
|
|
23696
|
-
if (styleEl)
|
|
23697
|
-
return;
|
|
23582
|
+
if (styleEl) return;
|
|
23698
23583
|
styleEl = ContextWindow.document.createElement("style");
|
|
23699
23584
|
styleEl.dataset.zwStyles = "";
|
|
23700
23585
|
styleEl.innerHTML = this.render(presets);
|
|
@@ -23744,17 +23629,14 @@ const _NodeSelector = class _NodeSelector {
|
|
|
23744
23629
|
query(containerNode, selector) {
|
|
23745
23630
|
let found2 = null;
|
|
23746
23631
|
containerNode.descendants((node) => {
|
|
23747
|
-
if (found2)
|
|
23748
|
-
return false;
|
|
23632
|
+
if (found2) return false;
|
|
23749
23633
|
if (this.matchNode(node, selector)) {
|
|
23750
23634
|
found2 = node;
|
|
23751
23635
|
return false;
|
|
23752
23636
|
}
|
|
23753
23637
|
});
|
|
23754
|
-
if (!found2)
|
|
23755
|
-
|
|
23756
|
-
if (!selector.getMark)
|
|
23757
|
-
return found2;
|
|
23638
|
+
if (!found2) return null;
|
|
23639
|
+
if (!selector.getMark) return found2;
|
|
23758
23640
|
return this.getMark(found2, selector.getMark);
|
|
23759
23641
|
}
|
|
23760
23642
|
matchNode(node, selector) {
|
|
@@ -23802,8 +23684,7 @@ const outClick = {
|
|
|
23802
23684
|
updated(el, { value }) {
|
|
23803
23685
|
const data = dataStorage.get(el);
|
|
23804
23686
|
const isEnabled = !value.isDisabled;
|
|
23805
|
-
if (isEnabled === data.isEnabled)
|
|
23806
|
-
return;
|
|
23687
|
+
if (isEnabled === data.isEnabled) return;
|
|
23807
23688
|
toggleListener(isEnabled, data.callback);
|
|
23808
23689
|
dataStorage.set(el, { callback: data.callback, isEnabled });
|
|
23809
23690
|
},
|
|
@@ -23814,14 +23695,10 @@ const outClick = {
|
|
|
23814
23695
|
function tooltip(el, { value, modifiers: modifiers2 }) {
|
|
23815
23696
|
const options = typeof value === "string" ? { text: value } : value;
|
|
23816
23697
|
const { text, hotkey } = options;
|
|
23817
|
-
if (text)
|
|
23818
|
-
|
|
23819
|
-
if (
|
|
23820
|
-
|
|
23821
|
-
if (modifiers2.xs)
|
|
23822
|
-
el.dataset.tooltipSize = "xs";
|
|
23823
|
-
if (modifiers2.lg)
|
|
23824
|
-
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";
|
|
23825
23702
|
}
|
|
23826
23703
|
const _hoisted_1$n = ["disabled"];
|
|
23827
23704
|
const _sfc_main$I = {
|
|
@@ -23922,13 +23799,11 @@ const _sfc_main$G = {
|
|
|
23922
23799
|
const props = __props;
|
|
23923
23800
|
const source = computed(() => importIcon(props.name));
|
|
23924
23801
|
const iconSize = computed(() => {
|
|
23925
|
-
if (isNaN(Number(props.size)))
|
|
23926
|
-
return props.size;
|
|
23802
|
+
if (isNaN(Number(props.size))) return props.size;
|
|
23927
23803
|
return `${props.size}px`;
|
|
23928
23804
|
});
|
|
23929
23805
|
const iconStyles = computed(() => {
|
|
23930
|
-
if (!props.size)
|
|
23931
|
-
return null;
|
|
23806
|
+
if (!props.size) return null;
|
|
23932
23807
|
return {
|
|
23933
23808
|
"--zw-icon-width": iconSize.value,
|
|
23934
23809
|
"--zw-icon-height": iconSize.value
|
|
@@ -23981,10 +23856,8 @@ function useNumberValue({ valueRef, digits, min: min2, max: max2, onChange }) {
|
|
|
23981
23856
|
}
|
|
23982
23857
|
const temp = useTempValue({ valueRef, format });
|
|
23983
23858
|
function validateNumber(number) {
|
|
23984
|
-
if (min2 !== null && number < min2)
|
|
23985
|
-
|
|
23986
|
-
if (max2 !== null && number > max2)
|
|
23987
|
-
return max2;
|
|
23859
|
+
if (min2 !== null && number < min2) return min2;
|
|
23860
|
+
if (max2 !== null && number > max2) return max2;
|
|
23988
23861
|
return number;
|
|
23989
23862
|
}
|
|
23990
23863
|
function change(value) {
|
|
@@ -24020,8 +23893,7 @@ function useModalToggler({ onBeforeOpened, onClosed } = {}) {
|
|
|
24020
23893
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
24021
23894
|
const isOpened = ref(false);
|
|
24022
23895
|
async function open() {
|
|
24023
|
-
if (isOpened.value)
|
|
24024
|
-
return;
|
|
23896
|
+
if (isOpened.value) return;
|
|
24025
23897
|
onBeforeOpened == null ? void 0 : onBeforeOpened();
|
|
24026
23898
|
editor.commands.storeSelection();
|
|
24027
23899
|
isOpened.value = true;
|
|
@@ -24043,8 +23915,7 @@ function useActivatedListener({ targetRef, isActiveRef, event, onEvent, options
|
|
|
24043
23915
|
(_a = targetRef.value) == null ? void 0 : _a.removeEventListener(event, onEvent, options);
|
|
24044
23916
|
}
|
|
24045
23917
|
function updateListener() {
|
|
24046
|
-
if (!targetRef.value)
|
|
24047
|
-
return;
|
|
23918
|
+
if (!targetRef.value) return;
|
|
24048
23919
|
isActiveRef.value ? addListener() : removeListener();
|
|
24049
23920
|
}
|
|
24050
23921
|
watch(isActiveRef, updateListener);
|
|
@@ -24062,8 +23933,7 @@ function useDeselectionLock({ hostRef, isActiveRef }) {
|
|
|
24062
23933
|
const editor = inject(InjectionTokens$1.EDITOR);
|
|
24063
23934
|
const targetRef = useElementRef(hostRef);
|
|
24064
23935
|
function onEvent(event) {
|
|
24065
|
-
if (INTERACTIVE_TAGS.includes(event.target.tagName))
|
|
24066
|
-
return;
|
|
23936
|
+
if (INTERACTIVE_TAGS.includes(event.target.tagName)) return;
|
|
24067
23937
|
if (editor.isFocused) {
|
|
24068
23938
|
event.stopPropagation();
|
|
24069
23939
|
event.preventDefault();
|
|
@@ -24081,8 +23951,7 @@ const SCROLL_VIEW = Symbol("scrollView");
|
|
|
24081
23951
|
function useScrollView() {
|
|
24082
23952
|
const scrollerRef = inject(SCROLL_VIEW);
|
|
24083
23953
|
function scrollToElement(element, { offset: offset2 } = {}) {
|
|
24084
|
-
if (!scrollerRef.value)
|
|
24085
|
-
return;
|
|
23954
|
+
if (!scrollerRef.value) return;
|
|
24086
23955
|
const rootRect = scrollerRef.value.getBoundingClientRect();
|
|
24087
23956
|
const elementRect = element.getBoundingClientRect();
|
|
24088
23957
|
const position = elementRect.top - rootRect.top;
|
|
@@ -24375,8 +24244,7 @@ function getSideList(side, isStart, rtl) {
|
|
|
24375
24244
|
switch (side) {
|
|
24376
24245
|
case "top":
|
|
24377
24246
|
case "bottom":
|
|
24378
|
-
if (rtl)
|
|
24379
|
-
return isStart ? rl : lr;
|
|
24247
|
+
if (rtl) return isStart ? rl : lr;
|
|
24380
24248
|
return isStart ? lr : rl;
|
|
24381
24249
|
case "left":
|
|
24382
24250
|
case "right":
|
|
@@ -24971,8 +24839,7 @@ function getContainingBlock(element) {
|
|
|
24971
24839
|
return null;
|
|
24972
24840
|
}
|
|
24973
24841
|
function isWebKit() {
|
|
24974
|
-
if (typeof CSS === "undefined" || !CSS.supports)
|
|
24975
|
-
return false;
|
|
24842
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
24976
24843
|
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
24977
24844
|
}
|
|
24978
24845
|
function isLastTraversableNode(node) {
|
|
@@ -25756,10 +25623,8 @@ const _sfc_main$B = {
|
|
|
25756
25623
|
const floatingRef = ref(null);
|
|
25757
25624
|
const referenceRef = toRef(props, "referenceRef");
|
|
25758
25625
|
const flipMiddleware = computed(() => {
|
|
25759
|
-
if (!props.placementFlip)
|
|
25760
|
-
|
|
25761
|
-
if (typeof props.placementFlip === "boolean")
|
|
25762
|
-
return flip();
|
|
25626
|
+
if (!props.placementFlip) return null;
|
|
25627
|
+
if (typeof props.placementFlip === "boolean") return flip();
|
|
25763
25628
|
return flip({ fallbackPlacements: props.placementFlip });
|
|
25764
25629
|
});
|
|
25765
25630
|
const middlewares = computed(() => [
|
|
@@ -25861,8 +25726,7 @@ const _sfc_main$A = {
|
|
|
25861
25726
|
});
|
|
25862
25727
|
if (props.focusFirstControl) {
|
|
25863
25728
|
watch(toRef(toggler, "isOpened"), async (_, wasOpened) => {
|
|
25864
|
-
if (wasOpened)
|
|
25865
|
-
return;
|
|
25729
|
+
if (wasOpened) return;
|
|
25866
25730
|
await nextTick();
|
|
25867
25731
|
const focusableEl = hostEl.value.querySelector(':where(a, button, input):not(:disabled, [data-initial-focus="false"])');
|
|
25868
25732
|
(focusableEl || hostEl.value).focus();
|
|
@@ -26006,10 +25870,8 @@ const InjectionTokens = Object.freeze({
|
|
|
26006
25870
|
function useActiveOptionManager({ optionsRef, inputRef, stateless, onChange }) {
|
|
26007
25871
|
const activeOption = ref(null);
|
|
26008
25872
|
function activateOption(option, { emitEvent } = {}) {
|
|
26009
|
-
if (!stateless)
|
|
26010
|
-
|
|
26011
|
-
if (emitEvent !== false)
|
|
26012
|
-
onChange(option);
|
|
25873
|
+
if (!stateless) activeOption.value = option;
|
|
25874
|
+
if (emitEvent !== false) onChange(option);
|
|
26013
25875
|
}
|
|
26014
25876
|
function activateById(id, params) {
|
|
26015
25877
|
const option = optionsRef.value.flatMap((option2) => option2.options || option2).find((option2) => option2.id === id);
|
|
@@ -26321,8 +26183,7 @@ function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened
|
|
|
26321
26183
|
isOpened.value ? close2() : open();
|
|
26322
26184
|
}
|
|
26323
26185
|
function triggerChange(color) {
|
|
26324
|
-
if (isOpened.value)
|
|
26325
|
-
onChange(color);
|
|
26186
|
+
if (isOpened.value) onChange(color);
|
|
26326
26187
|
}
|
|
26327
26188
|
function cancel() {
|
|
26328
26189
|
var _a;
|
|
@@ -26345,8 +26206,7 @@ function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened
|
|
|
26345
26206
|
}
|
|
26346
26207
|
function usePickerHotkeys({ isOpenedRef, onCancel, onApply }) {
|
|
26347
26208
|
function useHotkey(event, handler) {
|
|
26348
|
-
if (event.target.closest("input"))
|
|
26349
|
-
return;
|
|
26209
|
+
if (event.target.closest("input")) return;
|
|
26350
26210
|
event.stopImmediatePropagation();
|
|
26351
26211
|
event.preventDefault();
|
|
26352
26212
|
handler();
|
|
@@ -27216,10 +27076,8 @@ function useLink() {
|
|
|
27216
27076
|
if (currentDestination.value.id === LinkDestinations.URL) {
|
|
27217
27077
|
const url = destinationHrefs.value.url;
|
|
27218
27078
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(url) || RegExps.MAILTO_PROTOCOL.test(url);
|
|
27219
|
-
if (isTelOrMail)
|
|
27220
|
-
|
|
27221
|
-
if (url.startsWith("/"))
|
|
27222
|
-
return url;
|
|
27079
|
+
if (isTelOrMail) return url;
|
|
27080
|
+
if (url.startsWith("/")) return url;
|
|
27223
27081
|
const hasProtocol = RegExps.HTTPS_PROTOCOL.test(url);
|
|
27224
27082
|
return hasProtocol ? url : `https://${url}`;
|
|
27225
27083
|
}
|
|
@@ -27370,8 +27228,7 @@ const _sfc_main$9 = {
|
|
|
27370
27228
|
const changeDestination = (value) => {
|
|
27371
27229
|
emit("reset-errors");
|
|
27372
27230
|
link.value.currentDestination.value.id = value;
|
|
27373
|
-
if (!isURLDestination.value)
|
|
27374
|
-
link.value.target = LinkTargets.SELF;
|
|
27231
|
+
if (!isURLDestination.value) link.value.target = LinkTargets.SELF;
|
|
27375
27232
|
link.value.destinationHrefs.value.url = "";
|
|
27376
27233
|
};
|
|
27377
27234
|
const updateLink = (value) => {
|
|
@@ -27430,14 +27287,11 @@ const _sfc_main$8 = {
|
|
|
27430
27287
|
return link.linkData.value.text ? false : "Can't be empty";
|
|
27431
27288
|
};
|
|
27432
27289
|
const isValidUrl = () => {
|
|
27433
|
-
if (link.currentDestination.value.id !== LinkDestinations.URL)
|
|
27434
|
-
return false;
|
|
27290
|
+
if (link.currentDestination.value.id !== LinkDestinations.URL) return false;
|
|
27435
27291
|
const href = link.destinationHrefs.value.url;
|
|
27436
27292
|
const isTelOrMail = RegExps.TEL_PROTOCOL.test(href) || RegExps.MAILTO_PROTOCOL.test(href);
|
|
27437
|
-
if (isTelOrMail)
|
|
27438
|
-
|
|
27439
|
-
if (href.startsWith("/"))
|
|
27440
|
-
return false;
|
|
27293
|
+
if (isTelOrMail) return false;
|
|
27294
|
+
if (href.startsWith("/")) return false;
|
|
27441
27295
|
const isUrl = RegExps.URL.test(href);
|
|
27442
27296
|
return isUrl ? false : "Please enter a valid URL";
|
|
27443
27297
|
};
|
|
@@ -27467,8 +27321,7 @@ const _sfc_main$8 = {
|
|
|
27467
27321
|
const applyLink = () => {
|
|
27468
27322
|
urlValidator.validate();
|
|
27469
27323
|
nameValidator.validate();
|
|
27470
|
-
if (urlValidator.error.value || nameValidator.error.value)
|
|
27471
|
-
return;
|
|
27324
|
+
if (urlValidator.error.value || nameValidator.error.value) return;
|
|
27472
27325
|
link.apply();
|
|
27473
27326
|
toggler.close();
|
|
27474
27327
|
link.resetDestinations();
|
|
@@ -27953,8 +27806,7 @@ const _sfc_main$1 = {
|
|
|
27953
27806
|
}));
|
|
27954
27807
|
const props = __props;
|
|
27955
27808
|
const layoutComponent = computed(() => {
|
|
27956
|
-
if (props.popupMode)
|
|
27957
|
-
return _sfc_main$3;
|
|
27809
|
+
if (props.popupMode) return _sfc_main$3;
|
|
27958
27810
|
return props.device === Devices.MOBILE ? _sfc_main$4 : _sfc_main$5;
|
|
27959
27811
|
});
|
|
27960
27812
|
return (_ctx, _cache) => {
|