@underverse-ui/underverse 1.0.186 → 1.0.187

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/index.d.cts CHANGED
@@ -3783,6 +3783,7 @@ declare const underverseMessages: {
3783
3783
  };
3784
3784
  linkInput: {
3785
3785
  placeholder: string;
3786
+ invalid: string;
3786
3787
  };
3787
3788
  imageInput: {
3788
3789
  urlTab: string;
@@ -4208,6 +4209,7 @@ declare const underverseMessages: {
4208
4209
  };
4209
4210
  linkInput: {
4210
4211
  placeholder: string;
4212
+ invalid: string;
4211
4213
  };
4212
4214
  imageInput: {
4213
4215
  urlTab: string;
@@ -4633,6 +4635,7 @@ declare const underverseMessages: {
4633
4635
  };
4634
4636
  linkInput: {
4635
4637
  placeholder: string;
4638
+ invalid: string;
4636
4639
  };
4637
4640
  imageInput: {
4638
4641
  urlTab: string;
@@ -5058,6 +5061,7 @@ declare const underverseMessages: {
5058
5061
  };
5059
5062
  linkInput: {
5060
5063
  placeholder: string;
5064
+ invalid: string;
5061
5065
  };
5062
5066
  imageInput: {
5063
5067
  urlTab: string;
@@ -5486,6 +5490,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
5486
5490
  };
5487
5491
  linkInput: {
5488
5492
  placeholder: string;
5493
+ invalid: string;
5489
5494
  };
5490
5495
  imageInput: {
5491
5496
  urlTab: string;
@@ -5910,6 +5915,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
5910
5915
  };
5911
5916
  linkInput: {
5912
5917
  placeholder: string;
5918
+ invalid: string;
5913
5919
  };
5914
5920
  imageInput: {
5915
5921
  urlTab: string;
@@ -6334,6 +6340,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
6334
6340
  };
6335
6341
  linkInput: {
6336
6342
  placeholder: string;
6343
+ invalid: string;
6337
6344
  };
6338
6345
  imageInput: {
6339
6346
  urlTab: string;
@@ -6758,6 +6765,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
6758
6765
  };
6759
6766
  linkInput: {
6760
6767
  placeholder: string;
6768
+ invalid: string;
6761
6769
  };
6762
6770
  imageInput: {
6763
6771
  urlTab: string;
package/dist/index.d.ts CHANGED
@@ -3783,6 +3783,7 @@ declare const underverseMessages: {
3783
3783
  };
3784
3784
  linkInput: {
3785
3785
  placeholder: string;
3786
+ invalid: string;
3786
3787
  };
3787
3788
  imageInput: {
3788
3789
  urlTab: string;
@@ -4208,6 +4209,7 @@ declare const underverseMessages: {
4208
4209
  };
4209
4210
  linkInput: {
4210
4211
  placeholder: string;
4212
+ invalid: string;
4211
4213
  };
4212
4214
  imageInput: {
4213
4215
  urlTab: string;
@@ -4633,6 +4635,7 @@ declare const underverseMessages: {
4633
4635
  };
4634
4636
  linkInput: {
4635
4637
  placeholder: string;
4638
+ invalid: string;
4636
4639
  };
4637
4640
  imageInput: {
4638
4641
  urlTab: string;
@@ -5058,6 +5061,7 @@ declare const underverseMessages: {
5058
5061
  };
5059
5062
  linkInput: {
5060
5063
  placeholder: string;
5064
+ invalid: string;
5061
5065
  };
5062
5066
  imageInput: {
5063
5067
  urlTab: string;
@@ -5486,6 +5490,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
5486
5490
  };
5487
5491
  linkInput: {
5488
5492
  placeholder: string;
5493
+ invalid: string;
5489
5494
  };
5490
5495
  imageInput: {
5491
5496
  urlTab: string;
@@ -5910,6 +5915,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
5910
5915
  };
5911
5916
  linkInput: {
5912
5917
  placeholder: string;
5918
+ invalid: string;
5913
5919
  };
5914
5920
  imageInput: {
5915
5921
  urlTab: string;
@@ -6334,6 +6340,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
6334
6340
  };
6335
6341
  linkInput: {
6336
6342
  placeholder: string;
6343
+ invalid: string;
6337
6344
  };
6338
6345
  imageInput: {
6339
6346
  urlTab: string;
@@ -6758,6 +6765,7 @@ declare function getUnderverseMessages(locale?: UnderverseLocale): {
6758
6765
  };
6759
6766
  linkInput: {
6760
6767
  placeholder: string;
6768
+ invalid: string;
6761
6769
  };
6762
6770
  imageInput: {
6763
6771
  urlTab: string;
package/dist/index.js CHANGED
@@ -815,7 +815,8 @@ var en_default = {
815
815
  addBlock: "Add block"
816
816
  },
817
817
  linkInput: {
818
- placeholder: "Paste or type a link..."
818
+ placeholder: "Paste or type a link...",
819
+ invalid: "Enter a valid link, such as https://example.com."
819
820
  },
820
821
  imageInput: {
821
822
  urlTab: "URL",
@@ -1242,7 +1243,8 @@ var vi_default = {
1242
1243
  addBlock: "Th\xEAm kh\u1ED1i"
1243
1244
  },
1244
1245
  linkInput: {
1245
- placeholder: "D\xE1n ho\u1EB7c nh\u1EADp li\xEAn k\u1EBFt..."
1246
+ placeholder: "D\xE1n ho\u1EB7c nh\u1EADp li\xEAn k\u1EBFt...",
1247
+ invalid: "Vui l\xF2ng nh\u1EADp li\xEAn k\u1EBFt h\u1EE3p l\u1EC7, v\xED d\u1EE5: https://example.com."
1246
1248
  },
1247
1249
  imageInput: {
1248
1250
  urlTab: "URL",
@@ -1669,7 +1671,8 @@ var ko_default = {
1669
1671
  addBlock: "\uBE14\uB85D \uCD94\uAC00"
1670
1672
  },
1671
1673
  linkInput: {
1672
- placeholder: "\uB9C1\uD06C \uBD99\uC5EC\uB123\uAE30 \uB610\uB294 \uC785\uB825..."
1674
+ placeholder: "\uB9C1\uD06C \uBD99\uC5EC\uB123\uAE30 \uB610\uB294 \uC785\uB825...",
1675
+ invalid: "https://example.com\uACFC \uAC19\uC740 \uC62C\uBC14\uB978 \uB9C1\uD06C\uB97C \uC785\uB825\uD574 \uC8FC\uC138\uC694."
1673
1676
  },
1674
1677
  imageInput: {
1675
1678
  urlTab: "URL",
@@ -2096,7 +2099,8 @@ var ja_default = {
2096
2099
  addBlock: "\u30D6\u30ED\u30C3\u30AF\u3092\u8FFD\u52A0"
2097
2100
  },
2098
2101
  linkInput: {
2099
- placeholder: "\u30EA\u30F3\u30AF\u3092\u8CBC\u308A\u4ED8\u3051\u307E\u305F\u306F\u5165\u529B..."
2102
+ placeholder: "\u30EA\u30F3\u30AF\u3092\u8CBC\u308A\u4ED8\u3051\u307E\u305F\u306F\u5165\u529B...",
2103
+ invalid: "https://example.com \u306E\u3088\u3046\u306A\u6709\u52B9\u306A\u30EA\u30F3\u30AF\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
2100
2104
  },
2101
2105
  imageInput: {
2102
2106
  urlTab: "URL",
@@ -27566,6 +27570,32 @@ function isProtocolRelativeUrl(value) {
27566
27570
  function isRelativeUrl(value) {
27567
27571
  return value.startsWith("/") || value.startsWith("./") || value.startsWith("../") || value.startsWith("#");
27568
27572
  }
27573
+ function isValidIpv4Hostname(hostname) {
27574
+ const parts = hostname.split(".");
27575
+ return parts.length === 4 && parts.every((part) => /^\d{1,3}$/.test(part) && Number(part) <= 255);
27576
+ }
27577
+ function isValidWebHostname(hostname) {
27578
+ const normalized = hostname.toLowerCase();
27579
+ if (normalized === "localhost" || isValidIpv4Hostname(normalized)) return true;
27580
+ if (normalized.startsWith("[") && normalized.endsWith("]") && normalized.includes(":")) return true;
27581
+ const labels = normalized.split(".");
27582
+ if (labels.length < 2) return false;
27583
+ const validLabel = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)$/;
27584
+ return labels.every((label) => validLabel.test(label)) && /[a-z]/.test(labels.at(-1) ?? "");
27585
+ }
27586
+ function isValidLinkUrl(parsed) {
27587
+ if (parsed.protocol === "http:" || parsed.protocol === "https:") {
27588
+ return isValidWebHostname(parsed.hostname);
27589
+ }
27590
+ if (parsed.protocol === "mailto:") {
27591
+ return /^[^@]+@[^@]+\.[^@]+$/.test(decodeURIComponent(parsed.pathname));
27592
+ }
27593
+ if (parsed.protocol === "tel:") {
27594
+ const number = decodeURIComponent(parsed.pathname);
27595
+ return /^\+?[\d().-]+$/.test(number) && (number.match(/\d/g)?.length ?? 0) >= 3;
27596
+ }
27597
+ return false;
27598
+ }
27569
27599
  function isDataImageUrl(value) {
27570
27600
  return /^data:image\/(?:png|jpe?g|gif|webp|svg\+xml|bmp|x-icon|avif);base64,/i.test(value);
27571
27601
  }
@@ -27583,7 +27613,7 @@ function isSafeUEditorUrl(raw, kind) {
27583
27613
  const parsed = new URL(value);
27584
27614
  if (kind === "image") return IMAGE_PROTOCOLS.has(parsed.protocol);
27585
27615
  if (kind === "file") return FILE_PROTOCOLS.has(parsed.protocol);
27586
- return LINK_PROTOCOLS.has(parsed.protocol);
27616
+ return LINK_PROTOCOLS.has(parsed.protocol) && isValidLinkUrl(parsed);
27587
27617
  } catch {
27588
27618
  return false;
27589
27619
  }
@@ -32379,7 +32409,7 @@ function deleteSelectedImage(editor) {
32379
32409
  }
32380
32410
 
32381
32411
  // src/components/UEditor/inputs.tsx
32382
- import { useEffect as useEffect36, useRef as useRef32, useState as useState48 } from "react";
32412
+ import { useEffect as useEffect36, useId as useId15, useRef as useRef32, useState as useState48 } from "react";
32383
32413
  import { Check as Check13, X as X19 } from "lucide-react";
32384
32414
  import { jsx as jsx90, jsxs as jsxs74 } from "react/jsx-runtime";
32385
32415
  function normalizeUrl(raw) {
@@ -32392,7 +32422,9 @@ var LinkInput = ({
32392
32422
  }) => {
32393
32423
  const t = useSmartTranslations("UEditor");
32394
32424
  const [url, setUrl] = useState48(initialUrl);
32425
+ const [error, setError] = useState48("");
32395
32426
  const inputRef = useRef32(null);
32427
+ const errorId = useId15();
32396
32428
  useEffect36(() => {
32397
32429
  inputRef.current?.focus();
32398
32430
  inputRef.current?.select();
@@ -32400,22 +32432,35 @@ var LinkInput = ({
32400
32432
  const handleSubmit = (e) => {
32401
32433
  e.preventDefault();
32402
32434
  const normalized = normalizeUrl(url);
32403
- if (normalized) onSubmit(normalized);
32435
+ if (!normalized) {
32436
+ setError(t("linkInput.invalid"));
32437
+ return;
32438
+ }
32439
+ setError("");
32440
+ onSubmit(normalized);
32404
32441
  };
32405
- return /* @__PURE__ */ jsxs74("form", { onSubmit: handleSubmit, className: "flex items-center gap-2 p-2", children: [
32406
- /* @__PURE__ */ jsx90(
32407
- "input",
32408
- {
32409
- ref: inputRef,
32410
- type: "text",
32411
- value: url,
32412
- onChange: (e) => setUrl(e.target.value),
32413
- placeholder: t("linkInput.placeholder"),
32414
- className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20"
32415
- }
32416
- ),
32417
- /* @__PURE__ */ jsx90("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ jsx90(Check13, { className: "w-4 h-4" }) }),
32418
- /* @__PURE__ */ jsx90("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ jsx90(X19, { className: "w-4 h-4" }) })
32442
+ return /* @__PURE__ */ jsxs74("form", { onSubmit: handleSubmit, className: "p-2", children: [
32443
+ /* @__PURE__ */ jsxs74("div", { className: "flex items-center gap-2", children: [
32444
+ /* @__PURE__ */ jsx90(
32445
+ "input",
32446
+ {
32447
+ ref: inputRef,
32448
+ type: "text",
32449
+ value: url,
32450
+ onChange: (e) => {
32451
+ setUrl(e.target.value);
32452
+ if (error) setError("");
32453
+ },
32454
+ placeholder: t("linkInput.placeholder"),
32455
+ "aria-invalid": Boolean(error),
32456
+ "aria-describedby": error ? errorId : void 0,
32457
+ className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20 aria-invalid:ring-2 aria-invalid:ring-destructive/40"
32458
+ }
32459
+ ),
32460
+ /* @__PURE__ */ jsx90("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ jsx90(Check13, { className: "w-4 h-4" }) }),
32461
+ /* @__PURE__ */ jsx90("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ jsx90(X19, { className: "w-4 h-4" }) })
32462
+ ] }),
32463
+ error ? /* @__PURE__ */ jsx90("p", { id: errorId, role: "alert", className: "mt-1.5 px-1 text-xs text-destructive", children: error }) : null
32419
32464
  ] });
32420
32465
  };
32421
32466
  var ImageInput = ({ onSubmit, onCancel }) => {
@@ -32476,8 +32521,28 @@ var ImageInput = ({ onSubmit, onCancel }) => {
32476
32521
  ] });
32477
32522
  };
32478
32523
 
32479
- // src/components/UEditor/table-cell-commands.ts
32524
+ // src/components/UEditor/link-commands.ts
32480
32525
  import { TextSelection as TextSelection2 } from "@tiptap/pm/state";
32526
+ function applyEditorLink(editor, href) {
32527
+ const isEditingLink = editor.isActive("link");
32528
+ const hasSelectedText = !editor.state.selection.empty;
32529
+ const chain = editor.chain().focus();
32530
+ if (isEditingLink) {
32531
+ chain.extendMarkRange("link");
32532
+ }
32533
+ chain.setLink({ href });
32534
+ if (!hasSelectedText && !isEditingLink) {
32535
+ chain.insertContent(href);
32536
+ }
32537
+ return chain.command(({ tr }) => {
32538
+ tr.setSelection(TextSelection2.create(tr.doc, tr.selection.to));
32539
+ tr.removeStoredMark(editor.schema.marks.link);
32540
+ return true;
32541
+ }).run();
32542
+ }
32543
+
32544
+ // src/components/UEditor/table-cell-commands.ts
32545
+ import { TextSelection as TextSelection3 } from "@tiptap/pm/state";
32481
32546
  import { selectedRect, TableMap as TableMap2 } from "@tiptap/pm/tables";
32482
32547
  function getCellSelectionPositions(selection) {
32483
32548
  const value = selection;
@@ -32511,7 +32576,7 @@ function getFocusableCellPos(editor, cellPos) {
32511
32576
  return node?.isTextblock ? offset + 1 : cellPos + 1;
32512
32577
  }
32513
32578
  function focusCell(editor, cellPos) {
32514
- const selection = TextSelection2.near(editor.state.doc.resolve(getFocusableCellPos(editor, cellPos)));
32579
+ const selection = TextSelection3.near(editor.state.doc.resolve(getFocusableCellPos(editor, cellPos)));
32515
32580
  editor.view.dispatch(editor.state.tr.setSelection(selection));
32516
32581
  editor.view.focus();
32517
32582
  }
@@ -33057,7 +33122,7 @@ var EditorToolbar = ({
33057
33122
  {
33058
33123
  initialUrl: String(editor.getAttributes("link").href ?? ""),
33059
33124
  onSubmit: (url) => {
33060
- editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
33125
+ applyEditorLink(editor, url);
33061
33126
  setShowLinkInput(false);
33062
33127
  },
33063
33128
  onCancel: () => setShowLinkInput(false)
@@ -33294,7 +33359,7 @@ var EditorToolbar = ({
33294
33359
  {
33295
33360
  initialUrl: String(editor.getAttributes("link").href ?? ""),
33296
33361
  onSubmit: (url) => {
33297
- editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
33362
+ applyEditorLink(editor, url);
33298
33363
  setShowLinkInput(false);
33299
33364
  },
33300
33365
  onCancel: () => setShowLinkInput(false)
@@ -33916,7 +33981,7 @@ import {
33916
33981
  } from "lucide-react";
33917
33982
 
33918
33983
  // src/components/UEditor/table-formula-commands.ts
33919
- import { TextSelection as TextSelection3 } from "@tiptap/pm/state";
33984
+ import { TextSelection as TextSelection4 } from "@tiptap/pm/state";
33920
33985
  import { selectedRect as selectedRect2, setCellAttr as setCellAttr2, TableMap as TableMap3 } from "@tiptap/pm/tables";
33921
33986
 
33922
33987
  // src/components/UEditor/table-formula.ts
@@ -34532,7 +34597,7 @@ function restoreSelectionAtTableCell(editor, anchor) {
34532
34597
  if (!cellNode || cellNode.type.name !== "tableCell" && cellNode.type.name !== "tableHeader") return false;
34533
34598
  const selectionPos = Math.min(cellPos + 2, editor.state.doc.content.size);
34534
34599
  editor.view.dispatch(
34535
- editor.state.tr.setSelection(TextSelection3.near(editor.state.doc.resolve(selectionPos))).setMeta("addToHistory", false)
34600
+ editor.state.tr.setSelection(TextSelection4.near(editor.state.doc.resolve(selectionPos))).setMeta("addToHistory", false)
34536
34601
  );
34537
34602
  return true;
34538
34603
  }
@@ -34609,7 +34674,7 @@ function removeSelectedTableCellFormula(editor, clearContent) {
34609
34674
  );
34610
34675
  let transaction = editor.state.tr.replaceWith(selectedCell.cellPos, selectedCell.cellPos + selectedCell.node.nodeSize, nextCell2).setMeta(UEDITOR_TABLE_FORMULA_RECALCULATE_META, true);
34611
34676
  const selectionPos = Math.min(selectedCell.cellPos + 2, transaction.doc.content.size);
34612
- transaction = transaction.setSelection(TextSelection3.near(transaction.doc.resolve(selectionPos)));
34677
+ transaction = transaction.setSelection(TextSelection4.near(transaction.doc.resolve(selectionPos)));
34613
34678
  editor.view.dispatch(transaction);
34614
34679
  recalculateActiveTableFormulas(editor);
34615
34680
  restoreSelectionAtTableCell(editor, selectedCell);
@@ -35095,7 +35160,7 @@ var BubbleMenuContent = ({
35095
35160
  {
35096
35161
  initialUrl: editor.getAttributes("link").href || "",
35097
35162
  onSubmit: (url) => {
35098
- editor.chain().focus().extendMarkRange("link").setLink({ href: url }).run();
35163
+ applyEditorLink(editor, url);
35099
35164
  setShowLinkInput(false);
35100
35165
  requestAnimationFrame(() => editor.commands.focus());
35101
35166
  },
@@ -38952,7 +39017,7 @@ var Selection = class {
38952
39017
  found.
38953
39018
  */
38954
39019
  static findFrom($pos, dir, textOnly = false) {
38955
- let inner = $pos.parent.inlineContent ? new TextSelection4($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
39020
+ let inner = $pos.parent.inlineContent ? new TextSelection5($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);
38956
39021
  if (inner)
38957
39022
  return inner;
38958
39023
  for (let depth = $pos.depth - 1; depth >= 0; depth--) {
@@ -39021,7 +39086,7 @@ var Selection = class {
39021
39086
  returns the bookmark for that.
39022
39087
  */
39023
39088
  getBookmark() {
39024
- return TextSelection4.between(this.$anchor, this.$head).getBookmark();
39089
+ return TextSelection5.between(this.$anchor, this.$head).getBookmark();
39025
39090
  }
39026
39091
  };
39027
39092
  Selection.prototype.visible = true;
@@ -39041,7 +39106,7 @@ function checkTextSelection($pos) {
39041
39106
  console["warn"]("TextSelection endpoint not pointing into a node with inline content (" + $pos.parent.type.name + ")");
39042
39107
  }
39043
39108
  }
39044
- var TextSelection4 = class _TextSelection extends Selection {
39109
+ var TextSelection5 = class _TextSelection extends Selection {
39045
39110
  /**
39046
39111
  Construct a text selection between the given points.
39047
39112
  */
@@ -39127,7 +39192,7 @@ var TextSelection4 = class _TextSelection extends Selection {
39127
39192
  return new _TextSelection($anchor, $head);
39128
39193
  }
39129
39194
  };
39130
- Selection.jsonID("text", TextSelection4);
39195
+ Selection.jsonID("text", TextSelection5);
39131
39196
  var TextBookmark = class _TextBookmark {
39132
39197
  constructor(anchor, head) {
39133
39198
  this.anchor = anchor;
@@ -39137,7 +39202,7 @@ var TextBookmark = class _TextBookmark {
39137
39202
  return new _TextBookmark(mapping.map(this.anchor), mapping.map(this.head));
39138
39203
  }
39139
39204
  resolve(doc) {
39140
- return TextSelection4.between(doc.resolve(this.anchor), doc.resolve(this.head));
39205
+ return TextSelection5.between(doc.resolve(this.anchor), doc.resolve(this.head));
39141
39206
  }
39142
39207
  };
39143
39208
  var NodeSelection2 = class _NodeSelection extends Selection {
@@ -39256,7 +39321,7 @@ var AllBookmark = {
39256
39321
  };
39257
39322
  function findSelectionIn(doc, node, pos, index, dir, text = false) {
39258
39323
  if (node.inlineContent)
39259
- return TextSelection4.create(doc, pos);
39324
+ return TextSelection5.create(doc, pos);
39260
39325
  for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {
39261
39326
  let child = node.child(i);
39262
39327
  if (!child.isAtom) {
@@ -39848,7 +39913,7 @@ var CellSelection = class CellSelection2 extends Selection {
39848
39913
  else if (tableChanged && this.isColSelection()) return CellSelection2.colSelection($anchorCell, $headCell);
39849
39914
  else return new CellSelection2($anchorCell, $headCell);
39850
39915
  }
39851
- return TextSelection4.between($anchorCell, $headCell);
39916
+ return TextSelection5.between($anchorCell, $headCell);
39852
39917
  }
39853
39918
  content() {
39854
39919
  const table = this.$anchorCell.node(-1);
@@ -40463,7 +40528,7 @@ function shiftArrow(axis, dir) {
40463
40528
  };
40464
40529
  }
40465
40530
  function atEndOfCell(view, axis, dir) {
40466
- if (!(view.state.selection instanceof TextSelection4)) return null;
40531
+ if (!(view.state.selection instanceof TextSelection5)) return null;
40467
40532
  const { $head } = view.state.selection;
40468
40533
  for (let d = $head.depth - 1; d >= 0; d--) {
40469
40534
  const parent = $head.node(d);
@@ -42365,7 +42430,7 @@ import { useEffect as useEffect39, useRef as useRef37 } from "react";
42365
42430
  import { TableMap as TableMap6 } from "@tiptap/pm/tables";
42366
42431
 
42367
42432
  // src/components/UEditor/table-formula-range-picker.ts
42368
- import { TextSelection as TextSelection5 } from "@tiptap/pm/state";
42433
+ import { TextSelection as TextSelection6 } from "@tiptap/pm/state";
42369
42434
  import { TableMap as TableMap5 } from "@tiptap/pm/tables";
42370
42435
  function getCellText2(cellNode) {
42371
42436
  return cellNode.textBetween(0, cellNode.content.size, "\n").trim();
@@ -42443,7 +42508,7 @@ function cancelFormulaEditing(view) {
42443
42508
  if (!context) return false;
42444
42509
  let tr = view.state.tr.delete(context.cellContentStart, context.cellContentEnd);
42445
42510
  const selectionPos = Math.min(context.cellContentStart, tr.doc.content.size);
42446
- tr = tr.setSelection(TextSelection5.near(tr.doc.resolve(selectionPos)));
42511
+ tr = tr.setSelection(TextSelection6.near(tr.doc.resolve(selectionPos)));
42447
42512
  view.dispatch(tr);
42448
42513
  view.focus();
42449
42514
  return true;
@@ -42520,7 +42585,7 @@ function replacePickedLabel(view, pickState, nextLabel, currentCell) {
42520
42585
  }
42521
42586
  let tr = view.state.tr.insertText(nextLabel, pickState.insertedFrom, pickState.insertedTo);
42522
42587
  const nextTo = pickState.insertedFrom + nextLabel.length;
42523
- tr = tr.setSelection(TextSelection5.create(tr.doc, nextTo));
42588
+ tr = tr.setSelection(TextSelection6.create(tr.doc, nextTo));
42524
42589
  view.dispatch(tr);
42525
42590
  return {
42526
42591
  ...pickState,
@@ -42557,7 +42622,7 @@ function beginFormulaRangePick(view, event) {
42557
42622
  const insertedText = `${prefix}${picked.label}`;
42558
42623
  const insertedFrom = from + prefix.length;
42559
42624
  let tr = view.state.tr.insertText(insertedText, from, to);
42560
- tr = tr.setSelection(TextSelection5.create(tr.doc, from + insertedText.length));
42625
+ tr = tr.setSelection(TextSelection6.create(tr.doc, from + insertedText.length));
42561
42626
  view.dispatch(tr);
42562
42627
  view.focus();
42563
42628
  event.preventDefault();
@@ -43524,7 +43589,7 @@ var MenuBar = ({
43524
43589
  closeInsertMenu();
43525
43590
  };
43526
43591
  const handleLinkSubmit = (url) => {
43527
- editor.chain().focus().setLink({ href: url }).run();
43592
+ applyEditorLink(editor, url);
43528
43593
  closeInsertMenu();
43529
43594
  };
43530
43595
  const insertMenuItems = [