@harbour-enterprises/superdoc 0.14.4 → 0.14.5-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{super-editor.es-COF7S1m0.es.js → super-editor.es-BIYtrkJV.es.js} +431 -316
- package/dist/chunks/{super-editor.es-BOGWXrpc.cjs → super-editor.es-Dxgot_qP.cjs} +431 -316
- package/dist/style.css +169 -169
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-DcG3OPh9.js → converter-DTFcIIv4.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-Cz9xh4dK.js → docx-zipper-BH0873uU.js} +1 -1
- package/dist/super-editor/chunks/{editor-BndKcGqQ.js → editor-CteP9LA6.js} +17 -16
- package/dist/super-editor/chunks/{toolbar-BfGFnFms.js → toolbar-Dt_5DQhL.js} +2 -2
- package/dist/super-editor/components/toolbar/defaultItems.d.ts.map +1 -1
- package/dist/super-editor/components/toolbar/super-toolbar.d.ts.map +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/extensions/link/link.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +169 -169
- package/dist/super-editor/super-editor.es.js +378 -263
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +3 -3
- package/dist/superdoc.umd.js +432 -317
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -15022,7 +15022,7 @@ class Selection {
|
|
|
15022
15022
|
found.
|
|
15023
15023
|
*/
|
|
15024
15024
|
static findFrom($pos, dir, textOnly = false) {
|
|
15025
|
-
let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
|
|
15025
|
+
let inner = $pos.parent.inlineContent ? new TextSelection$1($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
|
|
15026
15026
|
if (inner)
|
|
15027
15027
|
return inner;
|
|
15028
15028
|
for (let depth = $pos.depth - 1; depth >= 0; depth--) {
|
|
@@ -15091,7 +15091,7 @@ class Selection {
|
|
|
15091
15091
|
returns the bookmark for that.
|
|
15092
15092
|
*/
|
|
15093
15093
|
getBookmark() {
|
|
15094
|
-
return TextSelection.between(this.$anchor, this.$head).getBookmark();
|
|
15094
|
+
return TextSelection$1.between(this.$anchor, this.$head).getBookmark();
|
|
15095
15095
|
}
|
|
15096
15096
|
}
|
|
15097
15097
|
Selection.prototype.visible = true;
|
|
@@ -15111,7 +15111,7 @@ function checkTextSelection($pos) {
|
|
|
15111
15111
|
console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
|
|
15112
15112
|
}
|
|
15113
15113
|
}
|
|
15114
|
-
|
|
15114
|
+
let TextSelection$1 = class TextSelection2 extends Selection {
|
|
15115
15115
|
/**
|
|
15116
15116
|
Construct a text selection between the given points.
|
|
15117
15117
|
*/
|
|
@@ -15132,7 +15132,7 @@ class TextSelection extends Selection {
|
|
|
15132
15132
|
if (!$head.parent.inlineContent)
|
|
15133
15133
|
return Selection.near($head);
|
|
15134
15134
|
let $anchor = doc2.resolve(mapping.map(this.anchor));
|
|
15135
|
-
return new
|
|
15135
|
+
return new TextSelection2($anchor.parent.inlineContent ? $anchor : $head, $head);
|
|
15136
15136
|
}
|
|
15137
15137
|
replace(tr, content = Slice.empty) {
|
|
15138
15138
|
super.replace(tr, content);
|
|
@@ -15143,7 +15143,7 @@ class TextSelection extends Selection {
|
|
|
15143
15143
|
}
|
|
15144
15144
|
}
|
|
15145
15145
|
eq(other) {
|
|
15146
|
-
return other instanceof
|
|
15146
|
+
return other instanceof TextSelection2 && other.anchor == this.anchor && other.head == this.head;
|
|
15147
15147
|
}
|
|
15148
15148
|
getBookmark() {
|
|
15149
15149
|
return new TextBookmark(this.anchor, this.head);
|
|
@@ -15157,7 +15157,7 @@ class TextSelection extends Selection {
|
|
|
15157
15157
|
static fromJSON(doc2, json) {
|
|
15158
15158
|
if (typeof json.anchor != "number" || typeof json.head != "number")
|
|
15159
15159
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
15160
|
-
return new
|
|
15160
|
+
return new TextSelection2(doc2.resolve(json.anchor), doc2.resolve(json.head));
|
|
15161
15161
|
}
|
|
15162
15162
|
/**
|
|
15163
15163
|
Create a text selection from non-resolved positions.
|
|
@@ -15194,10 +15194,10 @@ class TextSelection extends Selection {
|
|
|
15194
15194
|
$anchor = $head;
|
|
15195
15195
|
}
|
|
15196
15196
|
}
|
|
15197
|
-
return new
|
|
15197
|
+
return new TextSelection2($anchor, $head);
|
|
15198
15198
|
}
|
|
15199
|
-
}
|
|
15200
|
-
Selection.jsonID("text", TextSelection);
|
|
15199
|
+
};
|
|
15200
|
+
Selection.jsonID("text", TextSelection$1);
|
|
15201
15201
|
class TextBookmark {
|
|
15202
15202
|
constructor(anchor, head) {
|
|
15203
15203
|
this.anchor = anchor;
|
|
@@ -15207,7 +15207,7 @@ class TextBookmark {
|
|
|
15207
15207
|
return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
|
|
15208
15208
|
}
|
|
15209
15209
|
resolve(doc2) {
|
|
15210
|
-
return TextSelection.between(doc2.resolve(this.anchor), doc2.resolve(this.head));
|
|
15210
|
+
return TextSelection$1.between(doc2.resolve(this.anchor), doc2.resolve(this.head));
|
|
15211
15211
|
}
|
|
15212
15212
|
}
|
|
15213
15213
|
class NodeSelection extends Selection {
|
|
@@ -15326,7 +15326,7 @@ const AllBookmark = {
|
|
|
15326
15326
|
};
|
|
15327
15327
|
function findSelectionIn(doc2, node2, pos, index2, dir, text = false) {
|
|
15328
15328
|
if (node2.inlineContent)
|
|
15329
|
-
return TextSelection.create(doc2, pos);
|
|
15329
|
+
return TextSelection$1.create(doc2, pos);
|
|
15330
15330
|
for (let i = index2 - (dir > 0 ? 0 : 1); dir > 0 ? i < node2.childCount : i >= 0; i += dir) {
|
|
15331
15331
|
let child = node2.child(i);
|
|
15332
15332
|
if (!child.isAtom) {
|
|
@@ -24326,7 +24326,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
24326
24326
|
return;
|
|
24327
24327
|
}
|
|
24328
24328
|
}
|
|
24329
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.
|
|
24329
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.5-next.2") {
|
|
24330
24330
|
const customLocation = "docProps/custom.xml";
|
|
24331
24331
|
if (!docx[customLocation]) {
|
|
24332
24332
|
docx[customLocation] = generateCustomXml();
|
|
@@ -24802,7 +24802,7 @@ function storeSuperdocVersion(docx) {
|
|
|
24802
24802
|
function generateCustomXml() {
|
|
24803
24803
|
return DEFAULT_CUSTOM_XML;
|
|
24804
24804
|
}
|
|
24805
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.
|
|
24805
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.5-next.2") {
|
|
24806
24806
|
return {
|
|
24807
24807
|
type: "element",
|
|
24808
24808
|
name: "property",
|
|
@@ -28540,7 +28540,7 @@ const insertTabCharacter = ({ tr, state: state2, dispatch }) => {
|
|
|
28540
28540
|
const { from: from2 } = tr.selection;
|
|
28541
28541
|
const tabText = state2.schema.text(" ");
|
|
28542
28542
|
tr = tr.replaceSelectionWith(tabText);
|
|
28543
|
-
tr = tr.setSelection(TextSelection.create(tr.doc, from2 + 1));
|
|
28543
|
+
tr = tr.setSelection(TextSelection$1.create(tr.doc, from2 + 1));
|
|
28544
28544
|
if (dispatch) dispatch(tr);
|
|
28545
28545
|
return true;
|
|
28546
28546
|
};
|
|
@@ -28777,7 +28777,7 @@ const createParagraphNear$1 = (state2, dispatch) => {
|
|
|
28777
28777
|
if (dispatch) {
|
|
28778
28778
|
let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;
|
|
28779
28779
|
let tr = state2.tr.insert(side, type2.createAndFill());
|
|
28780
|
-
tr.setSelection(TextSelection.create(tr.doc, side + 1));
|
|
28780
|
+
tr.setSelection(TextSelection$1.create(tr.doc, side + 1));
|
|
28781
28781
|
dispatch(tr.scrollIntoView());
|
|
28782
28782
|
}
|
|
28783
28783
|
return true;
|
|
@@ -28831,7 +28831,7 @@ function splitBlockAs(splitNode) {
|
|
|
28831
28831
|
}
|
|
28832
28832
|
}
|
|
28833
28833
|
let tr = state2.tr;
|
|
28834
|
-
if (state2.selection instanceof TextSelection || state2.selection instanceof AllSelection)
|
|
28834
|
+
if (state2.selection instanceof TextSelection$1 || state2.selection instanceof AllSelection)
|
|
28835
28835
|
tr.deleteSelection();
|
|
28836
28836
|
let splitPos = tr.mapping.map($from.pos);
|
|
28837
28837
|
let can = canSplit(tr.doc, splitPos, types2.length, types2);
|
|
@@ -28936,7 +28936,7 @@ function selectTextblockSide(side) {
|
|
|
28936
28936
|
if (!$pos.node(depth).isTextblock)
|
|
28937
28937
|
return false;
|
|
28938
28938
|
if (dispatch)
|
|
28939
|
-
dispatch(state2.tr.setSelection(TextSelection.create(state2.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));
|
|
28939
|
+
dispatch(state2.tr.setSelection(TextSelection$1.create(state2.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));
|
|
28940
28940
|
return true;
|
|
28941
28941
|
};
|
|
28942
28942
|
}
|
|
@@ -29018,7 +29018,7 @@ const splitBlock = ({ keepMarks = true } = {}) => (props) => {
|
|
|
29018
29018
|
if (!$from.parent.isBlock) return false;
|
|
29019
29019
|
if (dispatch) {
|
|
29020
29020
|
const atEnd = $to.parentOffset === $to.parent.content.size;
|
|
29021
|
-
if (selection instanceof TextSelection) tr.deleteSelection();
|
|
29021
|
+
if (selection instanceof TextSelection$1) tr.deleteSelection();
|
|
29022
29022
|
const deflt = $from.depth === 0 ? null : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
29023
29023
|
let types2 = atEnd && deflt ? [{ type: deflt, attrs: newAttrs }] : void 0;
|
|
29024
29024
|
let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types2);
|
|
@@ -29369,7 +29369,7 @@ const handleBackspaceNextToList = () => ({ state: state2, dispatch }) => {
|
|
|
29369
29369
|
tr.delete(oldParaPos, oldParaPos + $from.parent.nodeSize);
|
|
29370
29370
|
const insertPos = paraStartPos + 1 + targetPara.content.size;
|
|
29371
29371
|
tr.insert(insertPos, inlineContent);
|
|
29372
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos), 1));
|
|
29372
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve(insertPos), 1));
|
|
29373
29373
|
dispatch(tr);
|
|
29374
29374
|
return true;
|
|
29375
29375
|
};
|
|
@@ -29413,7 +29413,7 @@ const handleDeleteNextToList = () => ({ state: state2, dispatch }) => {
|
|
|
29413
29413
|
tr.delete(nextListStartPos, nextListStartPos + nextNode.nodeSize);
|
|
29414
29414
|
const insertPos = tr.mapping.map($from.pos);
|
|
29415
29415
|
tr.insert(insertPos, targetInlineContent);
|
|
29416
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos), 1));
|
|
29416
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve(insertPos), 1));
|
|
29417
29417
|
dispatch(tr);
|
|
29418
29418
|
return true;
|
|
29419
29419
|
} else {
|
|
@@ -29436,7 +29436,7 @@ const handleDeleteNextToList = () => ({ state: state2, dispatch }) => {
|
|
|
29436
29436
|
tr.delete(listStartPos, listStartPos + afterNode.nodeSize);
|
|
29437
29437
|
const insertPos = tr.mapping.map($from.pos);
|
|
29438
29438
|
tr.insert(insertPos, targetInlineContent);
|
|
29439
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos), 1));
|
|
29439
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve(insertPos), 1));
|
|
29440
29440
|
dispatch(tr);
|
|
29441
29441
|
return true;
|
|
29442
29442
|
}
|
|
@@ -31379,10 +31379,10 @@ const getParentOrderedList = (state2) => {
|
|
|
31379
31379
|
const setSelectionInsideNewList = (tr, basePos) => {
|
|
31380
31380
|
try {
|
|
31381
31381
|
const $pos = tr.doc.resolve(basePos + 3);
|
|
31382
|
-
tr.setSelection(TextSelection.near($pos));
|
|
31382
|
+
tr.setSelection(TextSelection$1.near($pos));
|
|
31383
31383
|
} catch {
|
|
31384
31384
|
const $fallback = tr.doc.resolve(basePos + 1);
|
|
31385
|
-
tr.setSelection(TextSelection.near($fallback));
|
|
31385
|
+
tr.setSelection(TextSelection$1.near($fallback));
|
|
31386
31386
|
}
|
|
31387
31387
|
};
|
|
31388
31388
|
const replaceListWithNode = ({ tr, from: from2, to, newNode }) => {
|
|
@@ -31399,7 +31399,7 @@ const convertListItemToParagraph = ({ state: state2, tr, currentNode, replaceFro
|
|
|
31399
31399
|
replaceListWithNode({ tr, from: replaceFrom, to: replaceTo, newNode: paragraphNode });
|
|
31400
31400
|
const newPos = replaceFrom + 1;
|
|
31401
31401
|
const $pos = tr.doc.resolve(newPos);
|
|
31402
|
-
tr.setSelection(TextSelection.near($pos));
|
|
31402
|
+
tr.setSelection(TextSelection$1.near($pos));
|
|
31403
31403
|
return true;
|
|
31404
31404
|
};
|
|
31405
31405
|
const insertNewList = (tr, replaceFrom, replaceTo, listNode, marks = []) => {
|
|
@@ -31410,7 +31410,7 @@ const insertNewList = (tr, replaceFrom, replaceTo, listNode, marks = []) => {
|
|
|
31410
31410
|
const paragraphNode = $paragraphStart.parent;
|
|
31411
31411
|
const endPos = $paragraphStart.pos + paragraphNode.content.size;
|
|
31412
31412
|
const $endPos = tr.doc.resolve(endPos);
|
|
31413
|
-
tr.setSelection(TextSelection.near($endPos));
|
|
31413
|
+
tr.setSelection(TextSelection$1.near($endPos));
|
|
31414
31414
|
return true;
|
|
31415
31415
|
};
|
|
31416
31416
|
const getListItemStyleDefinitions = ({ styleId, node: node2, numId, level, editor, tries }) => {
|
|
@@ -31608,7 +31608,7 @@ const splitListItem = () => (props) => {
|
|
|
31608
31608
|
const insertPosition = listStart + firstList.nodeSize;
|
|
31609
31609
|
tr.insert(insertPosition, secondList);
|
|
31610
31610
|
const secondListStart = insertPosition + 2;
|
|
31611
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(secondListStart)));
|
|
31611
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve(secondListStart)));
|
|
31612
31612
|
tr.scrollIntoView();
|
|
31613
31613
|
const marks = state2.storedMarks || $from.marks() || [];
|
|
31614
31614
|
if (marks?.length) {
|
|
@@ -31643,7 +31643,7 @@ const handleSplitInEmptyBlock = (props, currentListItem) => {
|
|
|
31643
31643
|
const insertPos = parentList.pos + parentList.node.nodeSize;
|
|
31644
31644
|
tr.insert(insertPos, newList);
|
|
31645
31645
|
const newPos = insertPos + 2;
|
|
31646
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(newPos)));
|
|
31646
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve(newPos)));
|
|
31647
31647
|
tr.scrollIntoView();
|
|
31648
31648
|
return true;
|
|
31649
31649
|
} catch (error) {
|
|
@@ -31692,7 +31692,7 @@ const handleSplitInEmptyBlock = (props, currentListItem) => {
|
|
|
31692
31692
|
const listEnd = parentList.pos + parentList.node.nodeSize;
|
|
31693
31693
|
tr.replaceWith(listStart, listEnd, newParagraph);
|
|
31694
31694
|
const newPos = listStart + 1;
|
|
31695
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(newPos)));
|
|
31695
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve(newPos)));
|
|
31696
31696
|
tr.scrollIntoView();
|
|
31697
31697
|
return true;
|
|
31698
31698
|
} catch (error) {
|
|
@@ -31727,7 +31727,7 @@ const deleteListItem = () => (props) => {
|
|
|
31727
31727
|
tr.delete(pos, pos + size2);
|
|
31728
31728
|
});
|
|
31729
31729
|
const $new = tr.doc.resolve(from2);
|
|
31730
|
-
tr.setSelection(TextSelection.near($new));
|
|
31730
|
+
tr.setSelection(TextSelection$1.near($new));
|
|
31731
31731
|
return true;
|
|
31732
31732
|
}
|
|
31733
31733
|
return false;
|
|
@@ -31755,7 +31755,7 @@ const deleteListItem = () => (props) => {
|
|
|
31755
31755
|
});
|
|
31756
31756
|
tr.replaceWith(listFrom, listTo, nodes);
|
|
31757
31757
|
const $pos = tr.doc.resolve(listFrom + 1);
|
|
31758
|
-
tr.setSelection(TextSelection.near($pos));
|
|
31758
|
+
tr.setSelection(TextSelection$1.near($pos));
|
|
31759
31759
|
return true;
|
|
31760
31760
|
};
|
|
31761
31761
|
const increaseListIndent = () => ({ editor, tr }) => {
|
|
@@ -33192,7 +33192,7 @@ class NodeViewDesc extends ViewDesc {
|
|
|
33192
33192
|
}
|
|
33193
33193
|
localCompositionInfo(view, pos) {
|
|
33194
33194
|
let { from: from2, to } = view.state.selection;
|
|
33195
|
-
if (!(view.state.selection instanceof TextSelection) || from2 < pos || to > pos + this.node.content.size)
|
|
33195
|
+
if (!(view.state.selection instanceof TextSelection$1) || from2 < pos || to > pos + this.node.content.size)
|
|
33196
33196
|
return null;
|
|
33197
33197
|
let textNode = view.input.compositionNode;
|
|
33198
33198
|
if (!textNode || !this.dom.contains(textNode.parentNode))
|
|
@@ -33958,7 +33958,7 @@ function selectionToDOM(view, force = false) {
|
|
|
33958
33958
|
selectCursorWrapper(view);
|
|
33959
33959
|
} else {
|
|
33960
33960
|
let { anchor, head } = sel, resetEditableFrom, resetEditableTo;
|
|
33961
|
-
if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {
|
|
33961
|
+
if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection$1)) {
|
|
33962
33962
|
if (!sel.$from.parent.inlineContent)
|
|
33963
33963
|
resetEditableFrom = temporarilyEditableNear(view, sel.from);
|
|
33964
33964
|
if (!sel.empty && !sel.$from.parent.inlineContent)
|
|
@@ -34064,7 +34064,7 @@ function clearNodeSelection(view) {
|
|
|
34064
34064
|
}
|
|
34065
34065
|
}
|
|
34066
34066
|
function selectionBetween(view, $anchor, $head, bias) {
|
|
34067
|
-
return view.someProp("createSelectionBetween", (f) => f(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias);
|
|
34067
|
+
return view.someProp("createSelectionBetween", (f) => f(view, $anchor, $head)) || TextSelection$1.between($anchor, $head, bias);
|
|
34068
34068
|
}
|
|
34069
34069
|
function hasFocusAndSelection(view) {
|
|
34070
34070
|
if (view.editable && !view.hasFocus())
|
|
@@ -34098,13 +34098,13 @@ function apply$1(view, sel) {
|
|
|
34098
34098
|
}
|
|
34099
34099
|
function selectHorizontally(view, dir, mods) {
|
|
34100
34100
|
let sel = view.state.selection;
|
|
34101
|
-
if (sel instanceof TextSelection) {
|
|
34101
|
+
if (sel instanceof TextSelection$1) {
|
|
34102
34102
|
if (mods.indexOf("s") > -1) {
|
|
34103
34103
|
let { $head } = sel, node2 = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;
|
|
34104
34104
|
if (!node2 || node2.isText || !node2.isLeaf)
|
|
34105
34105
|
return false;
|
|
34106
34106
|
let $newHead = view.state.doc.resolve($head.pos + node2.nodeSize * (dir < 0 ? -1 : 1));
|
|
34107
|
-
return apply$1(view, new TextSelection(sel.$anchor, $newHead));
|
|
34107
|
+
return apply$1(view, new TextSelection$1(sel.$anchor, $newHead));
|
|
34108
34108
|
} else if (!sel.empty) {
|
|
34109
34109
|
return false;
|
|
34110
34110
|
} else if (view.endOfTextblock(dir > 0 ? "forward" : "backward")) {
|
|
@@ -34122,13 +34122,13 @@ function selectHorizontally(view, dir, mods) {
|
|
|
34122
34122
|
if (NodeSelection.isSelectable(node2)) {
|
|
34123
34123
|
return apply$1(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node2.nodeSize) : $head));
|
|
34124
34124
|
} else if (webkit) {
|
|
34125
|
-
return apply$1(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node2.nodeSize)));
|
|
34125
|
+
return apply$1(view, new TextSelection$1(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node2.nodeSize)));
|
|
34126
34126
|
} else {
|
|
34127
34127
|
return false;
|
|
34128
34128
|
}
|
|
34129
34129
|
}
|
|
34130
34130
|
} else if (sel instanceof NodeSelection && sel.node.isInline) {
|
|
34131
|
-
return apply$1(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));
|
|
34131
|
+
return apply$1(view, new TextSelection$1(dir > 0 ? sel.$to : sel.$from));
|
|
34132
34132
|
} else {
|
|
34133
34133
|
let next = moveSelectionBlock(view.state, dir);
|
|
34134
34134
|
if (next)
|
|
@@ -34321,7 +34321,7 @@ function findDirection(view, pos) {
|
|
|
34321
34321
|
}
|
|
34322
34322
|
function selectVertically(view, dir, mods) {
|
|
34323
34323
|
let sel = view.state.selection;
|
|
34324
|
-
if (sel instanceof TextSelection && !sel.empty || mods.indexOf("s") > -1)
|
|
34324
|
+
if (sel instanceof TextSelection$1 && !sel.empty || mods.indexOf("s") > -1)
|
|
34325
34325
|
return false;
|
|
34326
34326
|
if (mac$2 && mods.indexOf("m") > -1)
|
|
34327
34327
|
return false;
|
|
@@ -34339,7 +34339,7 @@ function selectVertically(view, dir, mods) {
|
|
|
34339
34339
|
return false;
|
|
34340
34340
|
}
|
|
34341
34341
|
function stopNativeHorizontalDelete(view, dir) {
|
|
34342
|
-
if (!(view.state.selection instanceof TextSelection))
|
|
34342
|
+
if (!(view.state.selection instanceof TextSelection$1))
|
|
34343
34343
|
return true;
|
|
34344
34344
|
let { $head, $anchor, empty: empty2 } = view.state.selection;
|
|
34345
34345
|
if (!$head.sameParent($anchor))
|
|
@@ -34769,7 +34769,7 @@ editHandlers.keypress = (view, _event) => {
|
|
|
34769
34769
|
return;
|
|
34770
34770
|
}
|
|
34771
34771
|
let sel = view.state.selection;
|
|
34772
|
-
if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {
|
|
34772
|
+
if (!(sel instanceof TextSelection$1) || !sel.$from.sameParent(sel.$to)) {
|
|
34773
34773
|
let text = String.fromCharCode(event.charCode);
|
|
34774
34774
|
let deflt = () => view.state.tr.insertText(text).scrollIntoView();
|
|
34775
34775
|
if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text, deflt)))
|
|
@@ -34852,7 +34852,7 @@ function defaultTripleClick(view, inside, event) {
|
|
|
34852
34852
|
let doc2 = view.state.doc;
|
|
34853
34853
|
if (inside == -1) {
|
|
34854
34854
|
if (doc2.inlineContent) {
|
|
34855
|
-
updateSelection(view, TextSelection.create(doc2, 0, doc2.content.size));
|
|
34855
|
+
updateSelection(view, TextSelection$1.create(doc2, 0, doc2.content.size));
|
|
34856
34856
|
return true;
|
|
34857
34857
|
}
|
|
34858
34858
|
return false;
|
|
@@ -34862,7 +34862,7 @@ function defaultTripleClick(view, inside, event) {
|
|
|
34862
34862
|
let node2 = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);
|
|
34863
34863
|
let nodePos = $pos.before(i);
|
|
34864
34864
|
if (node2.inlineContent)
|
|
34865
|
-
updateSelection(view, TextSelection.create(doc2, nodePos + 1, nodePos + 1 + node2.content.size));
|
|
34865
|
+
updateSelection(view, TextSelection$1.create(doc2, nodePos + 1, nodePos + 1 + node2.content.size));
|
|
34866
34866
|
else if (NodeSelection.isSelectable(node2))
|
|
34867
34867
|
updateSelection(view, NodeSelection.create(doc2, nodePos));
|
|
34868
34868
|
else
|
|
@@ -35022,7 +35022,7 @@ editHandlers.compositionstart = editHandlers.compositionupdate = (view) => {
|
|
|
35022
35022
|
if (!view.composing) {
|
|
35023
35023
|
view.domObserver.flush();
|
|
35024
35024
|
let { state: state2 } = view, $pos = state2.selection.$to;
|
|
35025
|
-
if (state2.selection instanceof TextSelection && (state2.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false))) {
|
|
35025
|
+
if (state2.selection instanceof TextSelection$1 && (state2.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some((m) => m.type.spec.inclusive === false))) {
|
|
35026
35026
|
view.markCursor = view.state.storedMarks || $pos.marks();
|
|
35027
35027
|
endComposition(view, true);
|
|
35028
35028
|
view.markCursor = null;
|
|
@@ -36380,7 +36380,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
36380
36380
|
return;
|
|
36381
36381
|
}
|
|
36382
36382
|
if (!change) {
|
|
36383
|
-
if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse2.sel && parse2.sel.anchor != parse2.sel.head)) {
|
|
36383
|
+
if (typeOver && sel instanceof TextSelection$1 && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse2.sel && parse2.sel.anchor != parse2.sel.head)) {
|
|
36384
36384
|
change = { start: sel.from, endA: sel.to, endB: sel.to };
|
|
36385
36385
|
} else {
|
|
36386
36386
|
if (parse2.sel) {
|
|
@@ -36395,7 +36395,7 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
36395
36395
|
return;
|
|
36396
36396
|
}
|
|
36397
36397
|
}
|
|
36398
|
-
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {
|
|
36398
|
+
if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection$1) {
|
|
36399
36399
|
if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse2.from) {
|
|
36400
36400
|
change.start = view.state.selection.from;
|
|
36401
36401
|
} else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 && view.state.selection.to <= parse2.to) {
|
|
@@ -37823,7 +37823,7 @@ const restoreRelativeSelection = (tr, relSel, binding) => {
|
|
|
37823
37823
|
binding.mapping
|
|
37824
37824
|
);
|
|
37825
37825
|
if (anchor !== null && head !== null) {
|
|
37826
|
-
const sel = TextSelection.between(tr.doc.resolve(anchor), tr.doc.resolve(head));
|
|
37826
|
+
const sel = TextSelection$1.between(tr.doc.resolve(anchor), tr.doc.resolve(head));
|
|
37827
37827
|
tr.setSelection(sel);
|
|
37828
37828
|
}
|
|
37829
37829
|
}
|
|
@@ -37958,7 +37958,7 @@ class ProsemirrorBinding {
|
|
|
37958
37958
|
if (sel) {
|
|
37959
37959
|
const clampedAnchor = min$2(max$2(sel.anchor, 0), tr.doc.content.size);
|
|
37960
37960
|
const clampedHead = min$2(max$2(sel.head, 0), tr.doc.content.size);
|
|
37961
|
-
tr.setSelection(TextSelection.create(tr.doc, clampedAnchor, clampedHead));
|
|
37961
|
+
tr.setSelection(TextSelection$1.create(tr.doc, clampedAnchor, clampedHead));
|
|
37962
37962
|
}
|
|
37963
37963
|
this.prosemirrorView.dispatch(
|
|
37964
37964
|
tr.setMeta(ySyncPluginKey, { isChangeOrigin: true, binding: this })
|
|
@@ -40919,18 +40919,18 @@ const trackedTransaction = ({ tr, state: state2, user }) => {
|
|
|
40919
40919
|
if (tr.selectionSet) {
|
|
40920
40920
|
const deletionMarkSchema = state2.schema.marks[TrackDeleteMarkName];
|
|
40921
40921
|
const deletionMark = findMark(state2, deletionMarkSchema, false);
|
|
40922
|
-
if (tr.selection instanceof TextSelection && (tr.selection.from < state2.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
|
|
40922
|
+
if (tr.selection instanceof TextSelection$1 && (tr.selection.from < state2.selection.from || tr.getMeta("inputType") === "deleteContentBackward")) {
|
|
40923
40923
|
const caretPos = map22.map(tr.selection.from, -1);
|
|
40924
|
-
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
|
|
40924
|
+
newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
|
|
40925
40925
|
} else if (tr.selection.from > state2.selection.from && deletionMark) {
|
|
40926
40926
|
const caretPos = map22.map(deletionMark.to + 1, 1);
|
|
40927
|
-
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
|
|
40927
|
+
newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
|
|
40928
40928
|
} else {
|
|
40929
40929
|
newTr.setSelection(tr.selection.map(newTr.doc, map22));
|
|
40930
40930
|
}
|
|
40931
40931
|
} else if (state2.selection.from - tr.selection.from > 1 && tr.selection.$head.depth > 1) {
|
|
40932
40932
|
const caretPos = map22.map(tr.selection.from - 2, -1);
|
|
40933
|
-
newTr.setSelection(new TextSelection(newTr.doc.resolve(caretPos)));
|
|
40933
|
+
newTr.setSelection(new TextSelection$1(newTr.doc.resolve(caretPos)));
|
|
40934
40934
|
} else ;
|
|
40935
40935
|
if (tr.storedMarksSet) {
|
|
40936
40936
|
newTr.setStoredMarks(tr.storedMarks);
|
|
@@ -41507,7 +41507,7 @@ const findWordBounds = (doc2, pos) => {
|
|
|
41507
41507
|
const setWordSelection = (view, pos) => {
|
|
41508
41508
|
const { state: state2, dispatch } = view;
|
|
41509
41509
|
const word = findWordBounds(state2.doc, pos);
|
|
41510
|
-
const tr = state2.tr.setSelection(TextSelection.create(state2.doc, word.from, word.to));
|
|
41510
|
+
const tr = state2.tr.setSelection(TextSelection$1.create(state2.doc, word.from, word.to));
|
|
41511
41511
|
dispatch(tr);
|
|
41512
41512
|
};
|
|
41513
41513
|
const setImageNodeSelection = (view, pos) => {
|
|
@@ -42396,7 +42396,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42396
42396
|
* @returns {Object | void} Migration results
|
|
42397
42397
|
*/
|
|
42398
42398
|
processCollaborationMigrations() {
|
|
42399
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.
|
|
42399
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.5-next.2");
|
|
42400
42400
|
if (!this.options.ydoc) return;
|
|
42401
42401
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
42402
42402
|
let docVersion = metaMap.get("version");
|
|
@@ -43594,7 +43594,7 @@ function arrow$3(axis, dir) {
|
|
|
43594
43594
|
return function(state2, dispatch, view) {
|
|
43595
43595
|
let sel = state2.selection;
|
|
43596
43596
|
let $start = dir > 0 ? sel.$to : sel.$from, mustMove = sel.empty;
|
|
43597
|
-
if (sel instanceof TextSelection) {
|
|
43597
|
+
if (sel instanceof TextSelection$1) {
|
|
43598
43598
|
if (!view.endOfTextblock(dirStr) || $start.depth == 0)
|
|
43599
43599
|
return false;
|
|
43600
43600
|
mustMove = false;
|
|
@@ -43631,7 +43631,7 @@ function beforeinput(view, event) {
|
|
|
43631
43631
|
for (let i = insert.length - 1; i >= 0; i--)
|
|
43632
43632
|
frag = Fragment.from(insert[i].createAndFill(null, frag));
|
|
43633
43633
|
let tr = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
|
|
43634
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve($from.pos + 1)));
|
|
43634
|
+
tr.setSelection(TextSelection$1.near(tr.doc.resolve($from.pos + 1)));
|
|
43635
43635
|
view.dispatch(tr);
|
|
43636
43636
|
return false;
|
|
43637
43637
|
}
|
|
@@ -46108,7 +46108,7 @@ var CellSelection = class _CellSelection extends Selection {
|
|
|
46108
46108
|
return _CellSelection.colSelection($anchorCell, $headCell);
|
|
46109
46109
|
else return new _CellSelection($anchorCell, $headCell);
|
|
46110
46110
|
}
|
|
46111
|
-
return TextSelection.between($anchorCell, $headCell);
|
|
46111
|
+
return TextSelection$1.between($anchorCell, $headCell);
|
|
46112
46112
|
}
|
|
46113
46113
|
// Returns a rectangular slice of table rows containing the selected
|
|
46114
46114
|
// cells.
|
|
@@ -46380,10 +46380,10 @@ function normalizeSelection(state2, tr, allowTableNodeSelection) {
|
|
|
46380
46380
|
const lastCell = start2 + map22.map[map22.width * map22.height - 1];
|
|
46381
46381
|
normalize22 = CellSelection.create(doc2, start2 + 1, lastCell);
|
|
46382
46382
|
}
|
|
46383
|
-
} else if (sel instanceof TextSelection && isCellBoundarySelection(sel)) {
|
|
46384
|
-
normalize22 = TextSelection.create(doc2, sel.from);
|
|
46385
|
-
} else if (sel instanceof TextSelection && isTextSelectionAcrossCells(sel)) {
|
|
46386
|
-
normalize22 = TextSelection.create(doc2, sel.$from.start(), sel.$from.end());
|
|
46383
|
+
} else if (sel instanceof TextSelection$1 && isCellBoundarySelection(sel)) {
|
|
46384
|
+
normalize22 = TextSelection$1.create(doc2, sel.from);
|
|
46385
|
+
} else if (sel instanceof TextSelection$1 && isTextSelectionAcrossCells(sel)) {
|
|
46386
|
+
normalize22 = TextSelection$1.create(doc2, sel.$from.start(), sel.$from.end());
|
|
46387
46387
|
}
|
|
46388
46388
|
if (normalize22) (tr || (tr = state2.tr)).setSelection(normalize22);
|
|
46389
46389
|
return tr;
|
|
@@ -46979,7 +46979,7 @@ function goToNextCell(direction) {
|
|
|
46979
46979
|
if (dispatch) {
|
|
46980
46980
|
const $cell = state2.doc.resolve(cell);
|
|
46981
46981
|
dispatch(
|
|
46982
|
-
state2.tr.setSelection(TextSelection.between($cell, moveCellForward($cell))).scrollIntoView()
|
|
46982
|
+
state2.tr.setSelection(TextSelection$1.between($cell, moveCellForward($cell))).scrollIntoView()
|
|
46983
46983
|
);
|
|
46984
46984
|
}
|
|
46985
46985
|
return true;
|
|
@@ -47432,7 +47432,7 @@ function handleMouseDown(view, startEvent) {
|
|
|
47432
47432
|
view.root.addEventListener("mousemove", move2);
|
|
47433
47433
|
}
|
|
47434
47434
|
function atEndOfCell(view, axis, dir) {
|
|
47435
|
-
if (!(view.state.selection instanceof TextSelection)) return null;
|
|
47435
|
+
if (!(view.state.selection instanceof TextSelection$1)) return null;
|
|
47436
47436
|
const { $head } = view.state.selection;
|
|
47437
47437
|
for (let d = $head.depth - 1; d >= 0; d--) {
|
|
47438
47438
|
const parent = $head.node(d), index2 = dir < 0 ? $head.index(d) : $head.indexAfter(d);
|
|
@@ -47999,7 +47999,7 @@ const Table = Node$1.create({
|
|
|
47999
47999
|
const node2 = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
48000
48000
|
if (dispatch) {
|
|
48001
48001
|
const offset2 = tr.selection.from + 1;
|
|
48002
|
-
tr.replaceSelectionWith(node2).scrollIntoView().setSelection(TextSelection.near(tr.doc.resolve(offset2)));
|
|
48002
|
+
tr.replaceSelectionWith(node2).scrollIntoView().setSelection(TextSelection$1.near(tr.doc.resolve(offset2)));
|
|
48003
48003
|
}
|
|
48004
48004
|
return true;
|
|
48005
48005
|
},
|
|
@@ -51325,7 +51325,7 @@ const Link = Mark2.create({
|
|
|
51325
51325
|
return chain().setMark("underline").setMark(this.name, { href }).run();
|
|
51326
51326
|
},
|
|
51327
51327
|
unsetLink: () => ({ chain }) => {
|
|
51328
|
-
return chain().unsetMark("underline").unsetColor().unsetMark(
|
|
51328
|
+
return chain().unsetMark("underline", { extendEmptyMarkRange: true }).unsetColor().unsetMark("link", { extendEmptyMarkRange: true }).run();
|
|
51329
51329
|
},
|
|
51330
51330
|
toggleLink: ({ href }) => ({ commands: commands2 }) => {
|
|
51331
51331
|
if (!href) return commands2.unsetLink();
|
|
@@ -56791,7 +56791,7 @@ const Search = Extension.create({
|
|
|
56791
56791
|
goToSearchResult: (match) => ({ state: state2, dispatch, editor }) => {
|
|
56792
56792
|
const { from: from2, to } = match;
|
|
56793
56793
|
editor.view.focus();
|
|
56794
|
-
const tr = state2.tr.setSelection(TextSelection.create(state2.doc, from2, to)).scrollIntoView();
|
|
56794
|
+
const tr = state2.tr.setSelection(TextSelection$1.create(state2.doc, from2, to)).scrollIntoView();
|
|
56795
56795
|
dispatch(tr);
|
|
56796
56796
|
const { node: node2 } = editor.view.domAtPos(from2);
|
|
56797
56797
|
if (node2?.scrollIntoView) {
|
|
@@ -67612,7 +67612,7 @@ const _sfc_main$f = {
|
|
|
67612
67612
|
const { state: state2 } = props.editor;
|
|
67613
67613
|
const { from: from2, to } = selectionState.value;
|
|
67614
67614
|
const tr = state2.tr.setSelection(
|
|
67615
|
-
TextSelection.create(state2.doc, from2, to)
|
|
67615
|
+
TextSelection$1.create(state2.doc, from2, to)
|
|
67616
67616
|
);
|
|
67617
67617
|
props.editor.view.dispatch(tr);
|
|
67618
67618
|
} else {
|
|
@@ -67844,7 +67844,7 @@ var eventemitter3 = { exports: {} };
|
|
|
67844
67844
|
var evt = prefix2 ? prefix2 + event : event, handlers2 = this._events[evt];
|
|
67845
67845
|
if (!handlers2) return [];
|
|
67846
67846
|
if (handlers2.fn) return [handlers2.fn];
|
|
67847
|
-
for (var i = 0,
|
|
67847
|
+
for (var i = 0, l = handlers2.length, ee = new Array(l); i < l; i++) {
|
|
67848
67848
|
ee[i] = handlers2[i].fn;
|
|
67849
67849
|
}
|
|
67850
67850
|
return ee;
|
|
@@ -68345,11 +68345,238 @@ const _sfc_main$c = {
|
|
|
68345
68345
|
}
|
|
68346
68346
|
};
|
|
68347
68347
|
const LinkedStyle = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__scopeId", "data-v-2cf079a2"]]);
|
|
68348
|
-
const _hoisted_1$9 =
|
|
68349
|
-
|
|
68350
|
-
|
|
68351
|
-
|
|
68348
|
+
const _hoisted_1$9 = {
|
|
68349
|
+
key: 0,
|
|
68350
|
+
class: "link-title"
|
|
68351
|
+
};
|
|
68352
|
+
const _hoisted_2$7 = {
|
|
68353
|
+
key: 1,
|
|
68354
|
+
class: "link-title"
|
|
68355
|
+
};
|
|
68356
|
+
const _hoisted_3$6 = {
|
|
68357
|
+
key: 2,
|
|
68358
|
+
class: "link-title"
|
|
68359
|
+
};
|
|
68360
|
+
const _hoisted_4$2 = { key: 3 };
|
|
68361
|
+
const _hoisted_5$1 = { class: "input-row" };
|
|
68362
|
+
const _hoisted_6 = ["innerHTML"];
|
|
68363
|
+
const _hoisted_7 = ["onKeydown"];
|
|
68364
|
+
const _hoisted_8 = ["innerHTML"];
|
|
68365
|
+
const _hoisted_9 = { class: "input-row link-buttons" };
|
|
68366
|
+
const _hoisted_10 = ["innerHTML"];
|
|
68367
|
+
const _hoisted_11 = {
|
|
68368
|
+
key: 4,
|
|
68369
|
+
class: "input-row go-to-anchor clickable"
|
|
68370
|
+
};
|
|
68352
68371
|
const _sfc_main$b = {
|
|
68372
|
+
__name: "LinkInput",
|
|
68373
|
+
props: {
|
|
68374
|
+
showInput: {
|
|
68375
|
+
type: Boolean,
|
|
68376
|
+
default: true
|
|
68377
|
+
},
|
|
68378
|
+
showLink: {
|
|
68379
|
+
type: Boolean,
|
|
68380
|
+
default: true
|
|
68381
|
+
},
|
|
68382
|
+
goToAnchor: {
|
|
68383
|
+
type: Function,
|
|
68384
|
+
default: () => {
|
|
68385
|
+
}
|
|
68386
|
+
},
|
|
68387
|
+
editor: {
|
|
68388
|
+
type: Object,
|
|
68389
|
+
required: true
|
|
68390
|
+
},
|
|
68391
|
+
closePopover: {
|
|
68392
|
+
type: Function,
|
|
68393
|
+
default: () => {
|
|
68394
|
+
}
|
|
68395
|
+
}
|
|
68396
|
+
},
|
|
68397
|
+
setup(__props) {
|
|
68398
|
+
const props = __props;
|
|
68399
|
+
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
68400
|
+
const urlError = ref$1(false);
|
|
68401
|
+
const getSelectedText = () => {
|
|
68402
|
+
if (!props.editor || !props.editor.state) return "";
|
|
68403
|
+
const { state: state2 } = props.editor;
|
|
68404
|
+
const { from: from2, to } = state2.selection;
|
|
68405
|
+
return state2.doc.textBetween(from2, to, " ");
|
|
68406
|
+
};
|
|
68407
|
+
const getLinkHrefAtSelection = () => {
|
|
68408
|
+
if (!props.editor || !props.editor.state) return "";
|
|
68409
|
+
const { state: state2 } = props.editor;
|
|
68410
|
+
const { schema, selection } = state2;
|
|
68411
|
+
const linkMark = schema.marks.link;
|
|
68412
|
+
if (!linkMark) return "";
|
|
68413
|
+
let href = "";
|
|
68414
|
+
const { $from, empty: empty2 } = selection;
|
|
68415
|
+
if (empty2) {
|
|
68416
|
+
const marks = state2.storedMarks || $from.marks();
|
|
68417
|
+
const link = marks.find((mark) => mark.type === linkMark);
|
|
68418
|
+
if (link) href = link.attrs.href;
|
|
68419
|
+
} else {
|
|
68420
|
+
state2.doc.nodesBetween(selection.from, selection.to, (node2) => {
|
|
68421
|
+
if (node2.marks) {
|
|
68422
|
+
const link = node2.marks.find((mark) => mark.type === linkMark);
|
|
68423
|
+
if (link) href = link.attrs.href;
|
|
68424
|
+
}
|
|
68425
|
+
});
|
|
68426
|
+
}
|
|
68427
|
+
return href || "";
|
|
68428
|
+
};
|
|
68429
|
+
const text = ref$1("");
|
|
68430
|
+
const rawUrl = ref$1("");
|
|
68431
|
+
const isAnchor = ref$1(false);
|
|
68432
|
+
const url = computed(() => {
|
|
68433
|
+
if (!rawUrl.value?.startsWith("http")) return "http://" + rawUrl.value;
|
|
68434
|
+
return rawUrl.value;
|
|
68435
|
+
});
|
|
68436
|
+
const validUrl = computed(() => {
|
|
68437
|
+
const urlSplit = url.value.split(".").filter(Boolean);
|
|
68438
|
+
return url.value.includes(".") && urlSplit.length > 1;
|
|
68439
|
+
});
|
|
68440
|
+
const isEditing = computed(() => !isAnchor.value && !!getLinkHrefAtSelection());
|
|
68441
|
+
const getApplyText = computed(() => showApply.value ? "Apply" : "Remove");
|
|
68442
|
+
const isDisabled2 = computed(() => !validUrl.value);
|
|
68443
|
+
const showApply = computed(() => !showRemove.value);
|
|
68444
|
+
const showRemove = computed(() => rawUrl.value === "" && getLinkHrefAtSelection());
|
|
68445
|
+
const openLink = () => {
|
|
68446
|
+
window.open(url.value, "_blank");
|
|
68447
|
+
};
|
|
68448
|
+
const updateFromEditor = () => {
|
|
68449
|
+
text.value = getSelectedText();
|
|
68450
|
+
rawUrl.value = getLinkHrefAtSelection();
|
|
68451
|
+
};
|
|
68452
|
+
watch(
|
|
68453
|
+
() => props.editor?.state?.selection,
|
|
68454
|
+
() => {
|
|
68455
|
+
updateFromEditor();
|
|
68456
|
+
},
|
|
68457
|
+
{ immediate: true }
|
|
68458
|
+
);
|
|
68459
|
+
const focusInput = () => {
|
|
68460
|
+
const input = document.querySelector(".link-input-ctn input");
|
|
68461
|
+
if (!input) return;
|
|
68462
|
+
input.focus();
|
|
68463
|
+
};
|
|
68464
|
+
onMounted(() => {
|
|
68465
|
+
updateFromEditor();
|
|
68466
|
+
isAnchor.value = rawUrl.value.startsWith("#");
|
|
68467
|
+
if (props.showInput) focusInput();
|
|
68468
|
+
});
|
|
68469
|
+
const handleSubmit = () => {
|
|
68470
|
+
if (rawUrl.value && validUrl.value) {
|
|
68471
|
+
if (props.editor && props.editor.commands) {
|
|
68472
|
+
if (isEditing.value) {
|
|
68473
|
+
const { state: state2, view: view2 } = props.editor;
|
|
68474
|
+
const linkMark = state2.schema.marks.link;
|
|
68475
|
+
let { from: from2, to } = state2.selection;
|
|
68476
|
+
if (state2.selection.empty) {
|
|
68477
|
+
const range2 = getMarkRange(state2.selection.$from, linkMark);
|
|
68478
|
+
if (range2) {
|
|
68479
|
+
from2 = range2.from;
|
|
68480
|
+
to = range2.to;
|
|
68481
|
+
}
|
|
68482
|
+
}
|
|
68483
|
+
const tr2 = state2.tr.removeMark(from2, to, linkMark).addMark(from2, to, linkMark.create({ href: url.value }));
|
|
68484
|
+
view2.dispatch(tr2);
|
|
68485
|
+
} else if (props.editor.commands.toggleLink) {
|
|
68486
|
+
props.editor.commands.toggleLink({ href: url.value, text: text.value });
|
|
68487
|
+
}
|
|
68488
|
+
const { view } = props.editor;
|
|
68489
|
+
let { selection } = view.state;
|
|
68490
|
+
const endPos = selection.$to.pos;
|
|
68491
|
+
const tr = view.state.tr.setSelection(new TextSelection$1(view.state.doc.resolve(endPos)));
|
|
68492
|
+
view.dispatch(tr);
|
|
68493
|
+
setTimeout(() => {
|
|
68494
|
+
view.focus();
|
|
68495
|
+
}, 100);
|
|
68496
|
+
}
|
|
68497
|
+
props.closePopover();
|
|
68498
|
+
return;
|
|
68499
|
+
} else if (!rawUrl.value) {
|
|
68500
|
+
if (props.editor && props.editor.commands && props.editor.commands.unsetLink) {
|
|
68501
|
+
props.editor.commands.unsetLink();
|
|
68502
|
+
}
|
|
68503
|
+
props.closePopover();
|
|
68504
|
+
return;
|
|
68505
|
+
}
|
|
68506
|
+
urlError.value = true;
|
|
68507
|
+
};
|
|
68508
|
+
const handleRemove = () => {
|
|
68509
|
+
if (props.editor && props.editor.commands && props.editor.commands.unsetLink) {
|
|
68510
|
+
props.editor.commands.unsetLink();
|
|
68511
|
+
props.closePopover();
|
|
68512
|
+
}
|
|
68513
|
+
};
|
|
68514
|
+
return (_ctx, _cache) => {
|
|
68515
|
+
return openBlock(), createElementBlock("div", {
|
|
68516
|
+
class: normalizeClass(["link-input-ctn", { "high-contrast": unref(isHighContrastMode2) }])
|
|
68517
|
+
}, [
|
|
68518
|
+
isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_1$9, "Page anchor")) : isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_2$7, "Edit link")) : (openBlock(), createElementBlock("div", _hoisted_3$6, "Add link")),
|
|
68519
|
+
__props.showInput && !isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
|
|
68520
|
+
createBaseVNode("div", _hoisted_5$1, [
|
|
68521
|
+
createBaseVNode("div", {
|
|
68522
|
+
class: "input-icon",
|
|
68523
|
+
innerHTML: unref(toolbarIcons).linkInput
|
|
68524
|
+
}, null, 8, _hoisted_6),
|
|
68525
|
+
withDirectives(createBaseVNode("input", {
|
|
68526
|
+
type: "text",
|
|
68527
|
+
name: "link",
|
|
68528
|
+
placeholder: "Type or paste a link",
|
|
68529
|
+
class: normalizeClass({ error: urlError.value }),
|
|
68530
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => rawUrl.value = $event),
|
|
68531
|
+
onKeydown: [
|
|
68532
|
+
withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]),
|
|
68533
|
+
_cache[1] || (_cache[1] = ($event) => urlError.value = false)
|
|
68534
|
+
]
|
|
68535
|
+
}, null, 42, _hoisted_7), [
|
|
68536
|
+
[vModelText, rawUrl.value]
|
|
68537
|
+
]),
|
|
68538
|
+
createBaseVNode("div", {
|
|
68539
|
+
class: normalizeClass(["open-link-icon", { disabled: !validUrl.value }]),
|
|
68540
|
+
innerHTML: unref(toolbarIcons).openLink,
|
|
68541
|
+
onClick: openLink,
|
|
68542
|
+
"data-item": "btn-link-open"
|
|
68543
|
+
}, null, 10, _hoisted_8)
|
|
68544
|
+
]),
|
|
68545
|
+
createBaseVNode("div", _hoisted_9, [
|
|
68546
|
+
rawUrl.value ? (openBlock(), createElementBlock("button", {
|
|
68547
|
+
key: 0,
|
|
68548
|
+
class: "remove-btn",
|
|
68549
|
+
onClick: handleRemove,
|
|
68550
|
+
"data-item": "btn-link-remove"
|
|
68551
|
+
}, [
|
|
68552
|
+
createBaseVNode("div", {
|
|
68553
|
+
class: "remove-btn__icon",
|
|
68554
|
+
innerHTML: unref(toolbarIcons).removeLink
|
|
68555
|
+
}, null, 8, _hoisted_10),
|
|
68556
|
+
_cache[3] || (_cache[3] = createTextVNode(" Remove "))
|
|
68557
|
+
])) : createCommentVNode("", true),
|
|
68558
|
+
showApply.value ? (openBlock(), createElementBlock("button", {
|
|
68559
|
+
key: 1,
|
|
68560
|
+
class: normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
|
|
68561
|
+
onClick: handleSubmit,
|
|
68562
|
+
"data-item": "btn-link-apply"
|
|
68563
|
+
}, toDisplayString(getApplyText.value), 3)) : createCommentVNode("", true)
|
|
68564
|
+
])
|
|
68565
|
+
])) : isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
68566
|
+
createBaseVNode("a", {
|
|
68567
|
+
onClick: _cache[2] || (_cache[2] = withModifiers((...args) => __props.goToAnchor && __props.goToAnchor(...args), ["stop", "prevent"]))
|
|
68568
|
+
}, "Go to " + toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)
|
|
68569
|
+
])) : createCommentVNode("", true)
|
|
68570
|
+
], 2);
|
|
68571
|
+
};
|
|
68572
|
+
}
|
|
68573
|
+
};
|
|
68574
|
+
const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-0c411ee5"]]);
|
|
68575
|
+
const _hoisted_1$8 = ["aria-label", "onClick", "onKeydown"];
|
|
68576
|
+
const _hoisted_2$6 = ["innerHTML"];
|
|
68577
|
+
const _hoisted_3$5 = ["innerHTML"];
|
|
68578
|
+
const ROW_SIZE$1 = 7;
|
|
68579
|
+
const _sfc_main$a = {
|
|
68353
68580
|
__name: "IconGridRow",
|
|
68354
68581
|
props: {
|
|
68355
68582
|
icons: {
|
|
@@ -68468,26 +68695,26 @@ const _sfc_main$b = {
|
|
|
68468
68695
|
class: "option__icon",
|
|
68469
68696
|
innerHTML: option.icon,
|
|
68470
68697
|
style: normalizeStyle(option.style)
|
|
68471
|
-
}, null, 12, _hoisted_2$
|
|
68698
|
+
}, null, 12, _hoisted_2$6),
|
|
68472
68699
|
isActive2.value(option) ? (openBlock(), createElementBlock("div", {
|
|
68473
68700
|
key: 0,
|
|
68474
68701
|
class: "option__check",
|
|
68475
68702
|
innerHTML: unref(toolbarIcons).colorOptionCheck,
|
|
68476
68703
|
style: normalizeStyle(getCheckStyle(option.value, optionIndex))
|
|
68477
|
-
}, null, 12, _hoisted_3$
|
|
68478
|
-
], 40, _hoisted_1$
|
|
68704
|
+
}, null, 12, _hoisted_3$5)) : createCommentVNode("", true)
|
|
68705
|
+
], 40, _hoisted_1$8);
|
|
68479
68706
|
}), 128))
|
|
68480
68707
|
]);
|
|
68481
68708
|
}), 128);
|
|
68482
68709
|
};
|
|
68483
68710
|
}
|
|
68484
68711
|
};
|
|
68485
|
-
const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
68712
|
+
const IconGridRow = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-e89b7f5f"]]);
|
|
68486
68713
|
const DropIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>\n';
|
|
68487
|
-
const _hoisted_1$
|
|
68488
|
-
const _hoisted_2$
|
|
68489
|
-
const _hoisted_3$
|
|
68490
|
-
const _sfc_main$
|
|
68714
|
+
const _hoisted_1$7 = { class: "options-grid-wrap" };
|
|
68715
|
+
const _hoisted_2$5 = ["innerHTML"];
|
|
68716
|
+
const _hoisted_3$4 = { class: "option-grid-ctn" };
|
|
68717
|
+
const _sfc_main$9 = {
|
|
68491
68718
|
__name: "IconGrid",
|
|
68492
68719
|
props: {
|
|
68493
68720
|
icons: {
|
|
@@ -68514,7 +68741,7 @@ const _sfc_main$a = {
|
|
|
68514
68741
|
emit("select", option);
|
|
68515
68742
|
};
|
|
68516
68743
|
return (_ctx, _cache) => {
|
|
68517
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
68744
|
+
return openBlock(), createElementBlock("div", _hoisted_1$7, [
|
|
68518
68745
|
__props.hasNoneIcon ? (openBlock(), createElementBlock("div", {
|
|
68519
68746
|
key: 0,
|
|
68520
68747
|
class: "none-option",
|
|
@@ -68525,10 +68752,10 @@ const _sfc_main$a = {
|
|
|
68525
68752
|
createBaseVNode("span", {
|
|
68526
68753
|
innerHTML: unref(DropIcon),
|
|
68527
68754
|
class: "none-icon"
|
|
68528
|
-
}, null, 8, _hoisted_2$
|
|
68755
|
+
}, null, 8, _hoisted_2$5),
|
|
68529
68756
|
_cache[1] || (_cache[1] = createTextVNode(" None "))
|
|
68530
68757
|
])) : createCommentVNode("", true),
|
|
68531
|
-
createBaseVNode("div", _hoisted_3$
|
|
68758
|
+
createBaseVNode("div", _hoisted_3$4, [
|
|
68532
68759
|
createVNode(IconGridRow, {
|
|
68533
68760
|
icons: __props.icons,
|
|
68534
68761
|
"active-color": __props.activeColor,
|
|
@@ -68547,7 +68774,7 @@ const _sfc_main$a = {
|
|
|
68547
68774
|
};
|
|
68548
68775
|
}
|
|
68549
68776
|
};
|
|
68550
|
-
const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
68777
|
+
const IconGrid = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a00a9a3e"]]);
|
|
68551
68778
|
const closeDropdown$1 = (dropdown) => {
|
|
68552
68779
|
dropdown.expand.value = false;
|
|
68553
68780
|
};
|
|
@@ -68656,10 +68883,10 @@ const icons = [
|
|
|
68656
68883
|
const getAvailableColorOptions = () => {
|
|
68657
68884
|
return icons.flat().map((item) => item.value);
|
|
68658
68885
|
};
|
|
68659
|
-
const _hoisted_1$
|
|
68660
|
-
const _hoisted_2$
|
|
68886
|
+
const _hoisted_1$6 = ["data-cols", "data-rows", "onKeydown", "onClick"];
|
|
68887
|
+
const _hoisted_2$4 = ["aria-valuetext"];
|
|
68661
68888
|
const ROW_SIZE = 5;
|
|
68662
|
-
const _sfc_main$
|
|
68889
|
+
const _sfc_main$8 = {
|
|
68663
68890
|
__name: "TableGrid",
|
|
68664
68891
|
emits: ["select", "clickoutside"],
|
|
68665
68892
|
setup(__props, { emit: __emit }) {
|
|
@@ -68775,7 +69002,7 @@ const _sfc_main$9 = {
|
|
|
68775
69002
|
ref: tableGridItems,
|
|
68776
69003
|
onKeydown: withModifiers((event) => handleKeyDown2(event, n2, i), ["prevent"]),
|
|
68777
69004
|
onClick: withModifiers(($event) => handleClick2({ cols: n2, rows: i }), ["stop", "prevent"])
|
|
68778
|
-
}, null, 40, _hoisted_1$
|
|
69005
|
+
}, null, 40, _hoisted_1$6);
|
|
68779
69006
|
}), 64))
|
|
68780
69007
|
], 64);
|
|
68781
69008
|
}), 64))
|
|
@@ -68783,17 +69010,39 @@ const _sfc_main$9 = {
|
|
|
68783
69010
|
createBaseVNode("div", {
|
|
68784
69011
|
class: "toolbar-table-grid-value",
|
|
68785
69012
|
"aria-valuetext": `${selectedRows.value} x ${selectedCols.value}`
|
|
68786
|
-
}, toDisplayString(selectedRows.value) + " x " + toDisplayString(selectedCols.value), 9, _hoisted_2$
|
|
69013
|
+
}, toDisplayString(selectedRows.value) + " x " + toDisplayString(selectedCols.value), 9, _hoisted_2$4)
|
|
68787
69014
|
], 2);
|
|
68788
69015
|
};
|
|
68789
69016
|
}
|
|
68790
69017
|
};
|
|
68791
|
-
const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
69018
|
+
const TableGrid = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-3e1154b8"]]);
|
|
69019
|
+
function getScrollableParent(element) {
|
|
69020
|
+
let currentElement2 = element;
|
|
69021
|
+
while (currentElement2) {
|
|
69022
|
+
const overflowY = window.getComputedStyle(currentElement2).overflowY;
|
|
69023
|
+
if (/(auto|scroll)/.test(overflowY) && currentElement2.scrollHeight > currentElement2.clientHeight) {
|
|
69024
|
+
return currentElement2;
|
|
69025
|
+
}
|
|
69026
|
+
currentElement2 = currentElement2.parentElement;
|
|
69027
|
+
}
|
|
69028
|
+
return document.scrollingElement || document.documentElement;
|
|
69029
|
+
}
|
|
69030
|
+
function scrollToElement(targetElement, options2 = { behavior: "smooth", block: "start" }) {
|
|
69031
|
+
if (!targetElement) return;
|
|
69032
|
+
const container = getScrollableParent(targetElement);
|
|
69033
|
+
const containerRect = container.getBoundingClientRect();
|
|
69034
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
69035
|
+
const offsetTop = targetRect.top - containerRect.top + container.scrollTop;
|
|
69036
|
+
container.scrollTo({
|
|
69037
|
+
top: options2.block === "start" ? offsetTop : offsetTop - container.clientHeight + targetElement.offsetHeight,
|
|
69038
|
+
behavior: options2.behavior
|
|
69039
|
+
});
|
|
69040
|
+
}
|
|
68792
69041
|
const checkIconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>\n';
|
|
68793
|
-
const _hoisted_1$
|
|
68794
|
-
const _hoisted_2$
|
|
68795
|
-
const _hoisted_3$
|
|
68796
|
-
const _sfc_main$
|
|
69042
|
+
const _hoisted_1$5 = { class: "search-input-ctn" };
|
|
69043
|
+
const _hoisted_2$3 = { class: "row" };
|
|
69044
|
+
const _hoisted_3$3 = ["onKeydown"];
|
|
69045
|
+
const _sfc_main$7 = {
|
|
68797
69046
|
__name: "SearchInput",
|
|
68798
69047
|
props: {
|
|
68799
69048
|
searchRef: {
|
|
@@ -68808,8 +69057,8 @@ const _sfc_main$8 = {
|
|
|
68808
69057
|
emit("submit", { value: searchValue.value });
|
|
68809
69058
|
};
|
|
68810
69059
|
return (_ctx, _cache) => {
|
|
68811
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
68812
|
-
createBaseVNode("div", _hoisted_2$
|
|
69060
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
69061
|
+
createBaseVNode("div", _hoisted_2$3, [
|
|
68813
69062
|
withDirectives(createBaseVNode("input", {
|
|
68814
69063
|
ref: __props.searchRef,
|
|
68815
69064
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchValue.value = $event),
|
|
@@ -68818,7 +69067,7 @@ const _sfc_main$8 = {
|
|
|
68818
69067
|
name: "search",
|
|
68819
69068
|
placeholder: "Type search string",
|
|
68820
69069
|
onKeydown: withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"])
|
|
68821
|
-
}, null, 40, _hoisted_3$
|
|
69070
|
+
}, null, 40, _hoisted_3$3), [
|
|
68822
69071
|
[vModelText, searchValue.value]
|
|
68823
69072
|
])
|
|
68824
69073
|
]),
|
|
@@ -68832,7 +69081,7 @@ const _sfc_main$8 = {
|
|
|
68832
69081
|
};
|
|
68833
69082
|
}
|
|
68834
69083
|
};
|
|
68835
|
-
const SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$
|
|
69084
|
+
const SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-af870fbd"]]);
|
|
68836
69085
|
const TOOLBAR_FONTS = [
|
|
68837
69086
|
{
|
|
68838
69087
|
label: "Georgia",
|
|
@@ -69114,6 +69363,54 @@ const makeDefaultItems = ({
|
|
|
69114
69363
|
})
|
|
69115
69364
|
]);
|
|
69116
69365
|
};
|
|
69366
|
+
const link = useToolbarItem({
|
|
69367
|
+
type: "dropdown",
|
|
69368
|
+
name: "link",
|
|
69369
|
+
markName: "link",
|
|
69370
|
+
icon: toolbarIcons2.link,
|
|
69371
|
+
tooltip: toolbarTexts2.link,
|
|
69372
|
+
attributes: {
|
|
69373
|
+
ariaLabel: "Link dropdown"
|
|
69374
|
+
},
|
|
69375
|
+
options: [
|
|
69376
|
+
{
|
|
69377
|
+
type: "render",
|
|
69378
|
+
key: "linkDropdown",
|
|
69379
|
+
render: () => renderLinkDropdown(link)
|
|
69380
|
+
}
|
|
69381
|
+
],
|
|
69382
|
+
onActivate: ({ href }) => {
|
|
69383
|
+
if (href) link.attributes.value = { href };
|
|
69384
|
+
else link.attributes.value = {};
|
|
69385
|
+
},
|
|
69386
|
+
onDeactivate: () => {
|
|
69387
|
+
link.attributes.value = {};
|
|
69388
|
+
link.expand.value = false;
|
|
69389
|
+
}
|
|
69390
|
+
});
|
|
69391
|
+
function renderLinkDropdown(link2) {
|
|
69392
|
+
return h("div", {}, [
|
|
69393
|
+
h(LinkInput, {
|
|
69394
|
+
editor: superToolbar.activeEditor,
|
|
69395
|
+
closePopover: () => closeDropdown(link2),
|
|
69396
|
+
goToAnchor: () => {
|
|
69397
|
+
closeDropdown(link2);
|
|
69398
|
+
if (!superToolbar.activeEditor || !link2.attributes.value?.href) return;
|
|
69399
|
+
const anchorName = link2.attributes.value?.href?.slice(1);
|
|
69400
|
+
const container = superToolbar.activeEditor.element;
|
|
69401
|
+
const anchor = container.querySelector(`a[name='${anchorName}']`);
|
|
69402
|
+
if (anchor) scrollToElement(anchor);
|
|
69403
|
+
}
|
|
69404
|
+
})
|
|
69405
|
+
]);
|
|
69406
|
+
}
|
|
69407
|
+
const linkInput = useToolbarItem({
|
|
69408
|
+
type: "options",
|
|
69409
|
+
name: "linkInput",
|
|
69410
|
+
command: "toggleLink"
|
|
69411
|
+
});
|
|
69412
|
+
link.childItem = linkInput;
|
|
69413
|
+
linkInput.parentItem = link;
|
|
69117
69414
|
const image = useToolbarItem({
|
|
69118
69415
|
type: "button",
|
|
69119
69416
|
name: "image",
|
|
@@ -69611,6 +69908,7 @@ const makeDefaultItems = ({
|
|
|
69611
69908
|
colorButton,
|
|
69612
69909
|
highlight,
|
|
69613
69910
|
separator,
|
|
69911
|
+
link,
|
|
69614
69912
|
image,
|
|
69615
69913
|
tableItem,
|
|
69616
69914
|
separator,
|
|
@@ -69947,6 +70245,35 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
69947
70245
|
}
|
|
69948
70246
|
this.updateToolbarState();
|
|
69949
70247
|
},
|
|
70248
|
+
/**
|
|
70249
|
+
* Toggles link formatting and updates cursor position
|
|
70250
|
+
* @param {Object} params - Command parameters
|
|
70251
|
+
* @param {CommandItem} params.item - The command item
|
|
70252
|
+
* @param {*} params.argument - Command arguments
|
|
70253
|
+
* @returns {void}
|
|
70254
|
+
*/
|
|
70255
|
+
toggleLink: ({ item, argument }) => {
|
|
70256
|
+
let command2 = item.command;
|
|
70257
|
+
if (command2 in this.activeEditor.commands) {
|
|
70258
|
+
this.activeEditor.commands[command2](argument);
|
|
70259
|
+
const { view } = this.activeEditor;
|
|
70260
|
+
let { selection } = view.state;
|
|
70261
|
+
if (this.activeEditor.options.isHeaderOrFooter) {
|
|
70262
|
+
selection = this.activeEditor.options.lastSelection;
|
|
70263
|
+
}
|
|
70264
|
+
const endPos = selection.$to.pos;
|
|
70265
|
+
const newSelection = new TextSelection(view.state.doc.resolve(endPos));
|
|
70266
|
+
const tr = view.state.tr.setSelection(newSelection);
|
|
70267
|
+
const state2 = view.state.apply(tr);
|
|
70268
|
+
view.updateState(state2);
|
|
70269
|
+
if (!this.activeEditor.options.isHeaderOrFooter) {
|
|
70270
|
+
setTimeout(() => {
|
|
70271
|
+
view.focus();
|
|
70272
|
+
}, 100);
|
|
70273
|
+
}
|
|
70274
|
+
}
|
|
70275
|
+
this.updateToolbarState();
|
|
70276
|
+
},
|
|
69950
70277
|
/**
|
|
69951
70278
|
* Inserts a table into the document
|
|
69952
70279
|
* @param {Object} params - Command parameters
|
|
@@ -70513,219 +70840,6 @@ async function getEditorContext(editor, event) {
|
|
|
70513
70840
|
clipboardContent
|
|
70514
70841
|
};
|
|
70515
70842
|
}
|
|
70516
|
-
const _hoisted_1$5 = {
|
|
70517
|
-
key: 0,
|
|
70518
|
-
class: "link-title"
|
|
70519
|
-
};
|
|
70520
|
-
const _hoisted_2$3 = {
|
|
70521
|
-
key: 1,
|
|
70522
|
-
class: "link-title"
|
|
70523
|
-
};
|
|
70524
|
-
const _hoisted_3$3 = {
|
|
70525
|
-
key: 2,
|
|
70526
|
-
class: "link-title"
|
|
70527
|
-
};
|
|
70528
|
-
const _hoisted_4$2 = { key: 3 };
|
|
70529
|
-
const _hoisted_5$1 = { class: "input-row" };
|
|
70530
|
-
const _hoisted_6 = ["innerHTML"];
|
|
70531
|
-
const _hoisted_7 = ["onKeydown"];
|
|
70532
|
-
const _hoisted_8 = ["innerHTML"];
|
|
70533
|
-
const _hoisted_9 = { class: "input-row link-buttons" };
|
|
70534
|
-
const _hoisted_10 = ["innerHTML"];
|
|
70535
|
-
const _hoisted_11 = {
|
|
70536
|
-
key: 4,
|
|
70537
|
-
class: "input-row go-to-anchor clickable"
|
|
70538
|
-
};
|
|
70539
|
-
const _sfc_main$7 = {
|
|
70540
|
-
__name: "LinkInput",
|
|
70541
|
-
props: {
|
|
70542
|
-
showInput: {
|
|
70543
|
-
type: Boolean,
|
|
70544
|
-
default: true
|
|
70545
|
-
},
|
|
70546
|
-
showLink: {
|
|
70547
|
-
type: Boolean,
|
|
70548
|
-
default: true
|
|
70549
|
-
},
|
|
70550
|
-
goToAnchor: {
|
|
70551
|
-
type: Function,
|
|
70552
|
-
default: () => {
|
|
70553
|
-
}
|
|
70554
|
-
},
|
|
70555
|
-
editor: {
|
|
70556
|
-
type: Object,
|
|
70557
|
-
required: true
|
|
70558
|
-
},
|
|
70559
|
-
closePopover: {
|
|
70560
|
-
type: Function,
|
|
70561
|
-
default: () => {
|
|
70562
|
-
}
|
|
70563
|
-
}
|
|
70564
|
-
},
|
|
70565
|
-
setup(__props) {
|
|
70566
|
-
const props = __props;
|
|
70567
|
-
const { isHighContrastMode: isHighContrastMode2 } = useHighContrastMode();
|
|
70568
|
-
const urlError = ref$1(false);
|
|
70569
|
-
const getSelectedText = () => {
|
|
70570
|
-
if (!props.editor || !props.editor.state) return "";
|
|
70571
|
-
const { state: state2 } = props.editor;
|
|
70572
|
-
const { from: from2, to } = state2.selection;
|
|
70573
|
-
return state2.doc.textBetween(from2, to, " ");
|
|
70574
|
-
};
|
|
70575
|
-
const getLinkHrefAtSelection = () => {
|
|
70576
|
-
if (!props.editor || !props.editor.state) return "";
|
|
70577
|
-
const { state: state2 } = props.editor;
|
|
70578
|
-
const { schema, selection } = state2;
|
|
70579
|
-
const linkMark = schema.marks.link;
|
|
70580
|
-
if (!linkMark) return "";
|
|
70581
|
-
let href = "";
|
|
70582
|
-
const { $from, empty: empty2 } = selection;
|
|
70583
|
-
if (empty2) {
|
|
70584
|
-
const marks = state2.storedMarks || $from.marks();
|
|
70585
|
-
const link = marks.find((mark) => mark.type === linkMark);
|
|
70586
|
-
if (link) href = link.attrs.href;
|
|
70587
|
-
} else {
|
|
70588
|
-
state2.doc.nodesBetween(selection.from, selection.to, (node2) => {
|
|
70589
|
-
if (node2.marks) {
|
|
70590
|
-
const link = node2.marks.find((mark) => mark.type === linkMark);
|
|
70591
|
-
if (link) href = link.attrs.href;
|
|
70592
|
-
}
|
|
70593
|
-
});
|
|
70594
|
-
}
|
|
70595
|
-
return href || "";
|
|
70596
|
-
};
|
|
70597
|
-
const text = ref$1("");
|
|
70598
|
-
const rawUrl = ref$1("");
|
|
70599
|
-
const isAnchor = ref$1(false);
|
|
70600
|
-
const url = computed(() => {
|
|
70601
|
-
if (!rawUrl.value?.startsWith("http")) return "http://" + rawUrl.value;
|
|
70602
|
-
return rawUrl.value;
|
|
70603
|
-
});
|
|
70604
|
-
const validUrl = computed(() => {
|
|
70605
|
-
const urlSplit = url.value.split(".").filter(Boolean);
|
|
70606
|
-
return url.value.includes(".") && urlSplit.length > 1;
|
|
70607
|
-
});
|
|
70608
|
-
const isEditing = computed(() => !isAnchor.value && !!getLinkHrefAtSelection());
|
|
70609
|
-
const getApplyText = computed(() => showApply.value ? "Apply" : "Remove");
|
|
70610
|
-
const isDisabled2 = computed(() => !validUrl.value);
|
|
70611
|
-
const showApply = computed(() => !showRemove.value);
|
|
70612
|
-
const showRemove = computed(() => rawUrl.value === "" && getLinkHrefAtSelection());
|
|
70613
|
-
const openLink = () => {
|
|
70614
|
-
window.open(url.value, "_blank");
|
|
70615
|
-
};
|
|
70616
|
-
const updateFromEditor = () => {
|
|
70617
|
-
text.value = getSelectedText();
|
|
70618
|
-
rawUrl.value = getLinkHrefAtSelection();
|
|
70619
|
-
};
|
|
70620
|
-
watch(
|
|
70621
|
-
() => props.editor?.state?.selection,
|
|
70622
|
-
() => {
|
|
70623
|
-
updateFromEditor();
|
|
70624
|
-
},
|
|
70625
|
-
{ immediate: true }
|
|
70626
|
-
);
|
|
70627
|
-
const focusInput = () => {
|
|
70628
|
-
const input = document.querySelector(".link-input-ctn input");
|
|
70629
|
-
if (!input) return;
|
|
70630
|
-
input.focus();
|
|
70631
|
-
};
|
|
70632
|
-
onMounted(() => {
|
|
70633
|
-
updateFromEditor();
|
|
70634
|
-
isAnchor.value = rawUrl.value.startsWith("#");
|
|
70635
|
-
if (props.showInput) focusInput();
|
|
70636
|
-
});
|
|
70637
|
-
const handleSubmit = () => {
|
|
70638
|
-
if (rawUrl.value && validUrl.value) {
|
|
70639
|
-
if (props.editor && props.editor.commands && props.editor.commands.toggleLink) {
|
|
70640
|
-
props.editor.commands.toggleLink({ href: url.value, text: text.value });
|
|
70641
|
-
const { view } = props.editor;
|
|
70642
|
-
let { selection } = view.state;
|
|
70643
|
-
const endPos = selection.$to.pos;
|
|
70644
|
-
const tr = view.state.tr.setSelection(new TextSelection(view.state.doc.resolve(endPos)));
|
|
70645
|
-
const state2 = view.state.apply(tr);
|
|
70646
|
-
view.updateState(state2);
|
|
70647
|
-
setTimeout(() => {
|
|
70648
|
-
view.focus();
|
|
70649
|
-
}, 100);
|
|
70650
|
-
}
|
|
70651
|
-
props.closePopover();
|
|
70652
|
-
return;
|
|
70653
|
-
} else if (!rawUrl.value) {
|
|
70654
|
-
if (props.editor && props.editor.commands && props.editor.commands.unsetLink) {
|
|
70655
|
-
props.editor.commands.unsetLink();
|
|
70656
|
-
}
|
|
70657
|
-
props.closePopover();
|
|
70658
|
-
return;
|
|
70659
|
-
}
|
|
70660
|
-
urlError.value = true;
|
|
70661
|
-
};
|
|
70662
|
-
const handleRemove = () => {
|
|
70663
|
-
if (props.editor && props.editor.commands && props.editor.commands.unsetLink) {
|
|
70664
|
-
props.editor.commands.unsetLink();
|
|
70665
|
-
props.closePopover();
|
|
70666
|
-
}
|
|
70667
|
-
};
|
|
70668
|
-
return (_ctx, _cache) => {
|
|
70669
|
-
return openBlock(), createElementBlock("div", {
|
|
70670
|
-
class: normalizeClass(["link-input-ctn", { "high-contrast": unref(isHighContrastMode2) }])
|
|
70671
|
-
}, [
|
|
70672
|
-
isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_1$5, "Page anchor")) : isEditing.value ? (openBlock(), createElementBlock("div", _hoisted_2$3, "Edit link")) : (openBlock(), createElementBlock("div", _hoisted_3$3, "Add link")),
|
|
70673
|
-
__props.showInput && !isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_4$2, [
|
|
70674
|
-
createBaseVNode("div", _hoisted_5$1, [
|
|
70675
|
-
createBaseVNode("div", {
|
|
70676
|
-
class: "input-icon",
|
|
70677
|
-
innerHTML: unref(toolbarIcons).linkInput
|
|
70678
|
-
}, null, 8, _hoisted_6),
|
|
70679
|
-
withDirectives(createBaseVNode("input", {
|
|
70680
|
-
type: "text",
|
|
70681
|
-
name: "link",
|
|
70682
|
-
placeholder: "Type or paste a link",
|
|
70683
|
-
class: normalizeClass({ error: urlError.value }),
|
|
70684
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => rawUrl.value = $event),
|
|
70685
|
-
onKeydown: [
|
|
70686
|
-
withKeys(withModifiers(handleSubmit, ["stop", "prevent"]), ["enter"]),
|
|
70687
|
-
_cache[1] || (_cache[1] = ($event) => urlError.value = false)
|
|
70688
|
-
]
|
|
70689
|
-
}, null, 42, _hoisted_7), [
|
|
70690
|
-
[vModelText, rawUrl.value]
|
|
70691
|
-
]),
|
|
70692
|
-
createBaseVNode("div", {
|
|
70693
|
-
class: normalizeClass(["open-link-icon", { disabled: !validUrl.value }]),
|
|
70694
|
-
innerHTML: unref(toolbarIcons).openLink,
|
|
70695
|
-
onClick: openLink,
|
|
70696
|
-
"data-item": "btn-link-open"
|
|
70697
|
-
}, null, 10, _hoisted_8)
|
|
70698
|
-
]),
|
|
70699
|
-
createBaseVNode("div", _hoisted_9, [
|
|
70700
|
-
rawUrl.value ? (openBlock(), createElementBlock("button", {
|
|
70701
|
-
key: 0,
|
|
70702
|
-
class: "remove-btn",
|
|
70703
|
-
onClick: handleRemove,
|
|
70704
|
-
"data-item": "btn-link-remove"
|
|
70705
|
-
}, [
|
|
70706
|
-
createBaseVNode("div", {
|
|
70707
|
-
class: "remove-btn__icon",
|
|
70708
|
-
innerHTML: unref(toolbarIcons).removeLink
|
|
70709
|
-
}, null, 8, _hoisted_10),
|
|
70710
|
-
_cache[3] || (_cache[3] = createTextVNode(" Remove "))
|
|
70711
|
-
])) : createCommentVNode("", true),
|
|
70712
|
-
showApply.value ? (openBlock(), createElementBlock("button", {
|
|
70713
|
-
key: 1,
|
|
70714
|
-
class: normalizeClass(["submit-btn", { "disable-btn": isDisabled2.value }]),
|
|
70715
|
-
onClick: handleSubmit,
|
|
70716
|
-
"data-item": "btn-link-apply"
|
|
70717
|
-
}, toDisplayString(getApplyText.value), 3)) : createCommentVNode("", true)
|
|
70718
|
-
])
|
|
70719
|
-
])) : isAnchor.value ? (openBlock(), createElementBlock("div", _hoisted_11, [
|
|
70720
|
-
createBaseVNode("a", {
|
|
70721
|
-
onClick: _cache[2] || (_cache[2] = withModifiers((...args) => __props.goToAnchor && __props.goToAnchor(...args), ["stop", "prevent"]))
|
|
70722
|
-
}, "Go to " + toDisplayString(rawUrl.value.startsWith("#_") ? rawUrl.value.substring(2) : rawUrl.value), 1)
|
|
70723
|
-
])) : createCommentVNode("", true)
|
|
70724
|
-
], 2);
|
|
70725
|
-
};
|
|
70726
|
-
}
|
|
70727
|
-
};
|
|
70728
|
-
const LinkInput = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-2632571a"]]);
|
|
70729
70843
|
const onMarginClickCursorChange = (event, editor) => {
|
|
70730
70844
|
const y = event.clientY;
|
|
70731
70845
|
const x = event.clientX;
|
|
@@ -70754,7 +70868,7 @@ const onMarginClickCursorChange = (event, editor) => {
|
|
|
70754
70868
|
cursorPos = node2?.isText && charAtPos !== " " ? pos - 1 : pos;
|
|
70755
70869
|
}
|
|
70756
70870
|
const transaction = view.state.tr.setSelection(
|
|
70757
|
-
TextSelection.create(view.state.doc, cursorPos)
|
|
70871
|
+
TextSelection$1.create(view.state.doc, cursorPos)
|
|
70758
70872
|
);
|
|
70759
70873
|
view.dispatch(transaction);
|
|
70760
70874
|
view.focus();
|
|
@@ -70833,7 +70947,7 @@ function moveCursorToMouseEvent(event, editor) {
|
|
|
70833
70947
|
const pos = view.posAtCoords(coords)?.pos;
|
|
70834
70948
|
if (typeof pos === "number") {
|
|
70835
70949
|
const tr = view.state.tr.setSelection(
|
|
70836
|
-
TextSelection.create(view.state.doc, pos)
|
|
70950
|
+
TextSelection$1.create(view.state.doc, pos)
|
|
70837
70951
|
);
|
|
70838
70952
|
view.dispatch(tr);
|
|
70839
70953
|
view.focus();
|
|
@@ -71810,8 +71924,9 @@ const _sfc_main$2 = {
|
|
|
71810
71924
|
style: { "width": "70%" }
|
|
71811
71925
|
})
|
|
71812
71926
|
])) : createCommentVNode("", true),
|
|
71813
|
-
|
|
71814
|
-
|
|
71927
|
+
editor.value ? (openBlock(), createBlock(GenericPopover, {
|
|
71928
|
+
key: 2,
|
|
71929
|
+
editor: editor.value,
|
|
71815
71930
|
visible: popoverControls.visible,
|
|
71816
71931
|
position: popoverControls.position,
|
|
71817
71932
|
onClose: closePopover
|
|
@@ -71820,12 +71935,12 @@ const _sfc_main$2 = {
|
|
|
71820
71935
|
(openBlock(), createBlock(resolveDynamicComponent(popoverControls.component), normalizeProps(guardReactiveProps({ ...popoverControls.props, editor: editor.value, closePopover })), null, 16))
|
|
71821
71936
|
]),
|
|
71822
71937
|
_: 1
|
|
71823
|
-
}, 8, ["editor", "visible", "position"])
|
|
71938
|
+
}, 8, ["editor", "visible", "position"])) : createCommentVNode("", true)
|
|
71824
71939
|
]);
|
|
71825
71940
|
};
|
|
71826
71941
|
}
|
|
71827
71942
|
};
|
|
71828
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
71943
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-d4ce5f62"]]);
|
|
71829
71944
|
const _sfc_main$1 = {
|
|
71830
71945
|
__name: "BasicUpload",
|
|
71831
71946
|
emits: ["file-change"],
|