@cyberyozh/text-editor 0.1.8 → 0.1.10

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/editor.js CHANGED
@@ -35,10 +35,10 @@ __export(editor_exports, {
35
35
  module.exports = __toCommonJS(editor_exports);
36
36
 
37
37
  // src/editor/editor.tsx
38
- var import_react36 = require("react");
38
+ var import_react37 = require("react");
39
39
  var import_state6 = require("@tiptap/pm/state");
40
40
  var import_model = require("@tiptap/pm/model");
41
- var import_react37 = require("@tiptap/react");
41
+ var import_react38 = require("@tiptap/react");
42
42
  var import_menus = require("@tiptap/react/menus");
43
43
  var import_github_dark = require("highlight.js/styles/github-dark.css");
44
44
  var import_katex_min = require("katex/dist/katex.min.css");
@@ -816,12 +816,8 @@ var BubbleMenuContent = ({ editor, onLinkClick }) => {
816
816
  editor.state.selection.$from.pos,
817
817
  editor.state.selection.$to.pos
818
818
  );
819
- let linkUrl;
820
- if (isLink) {
821
- const link = editor.getAttributes("link");
822
- linkUrl = link.href;
823
- }
824
- onLinkClick?.(selectedText, linkUrl);
819
+ const linkAttrs = editor.getAttributes("link");
820
+ onLinkClick?.({ title: selectedText, ...linkAttrs });
825
821
  openDialogCommand("link");
826
822
  };
827
823
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
@@ -1279,7 +1275,7 @@ var CalloutMenu = ({ isOpen, onClose, onColorSelect, editor, nodePos }) => {
1279
1275
  const b = parseInt(bgColor.slice(5, 7), 16);
1280
1276
  const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
1281
1277
  const textColor = brightness > 128 ? "#000000" : "#FFFFFF";
1282
- editor.chain().setTextSelection({ from, to }).setColor(textColor).setNodeSelection(nodePos).updateAttributes("callout", { bgColor }).run();
1278
+ editor.chain().setTextSelection({ from, to }).setColor(textColor).setNodeSelection(nodePos).updateAttributes("callout", { bgColor }).updateAttributes("calloutTip", { bgColor }).updateAttributes("calloutAlert", { bgColor }).run();
1283
1279
  }
1284
1280
  }
1285
1281
  },
@@ -1313,7 +1309,7 @@ var DragHandle = ({ editor }) => {
1313
1309
  currentNodePosRef.current = pos;
1314
1310
  try {
1315
1311
  const node = editor.view.state.doc.nodeAt(pos);
1316
- const isCallout = node?.type.name === "callout";
1312
+ const isCallout = node?.type.name === "callout" || node?.type.name === "calloutAlert" || node?.type.name === "calloutTip";
1317
1313
  setIsCalloutNode(isCallout);
1318
1314
  if (prevPos !== null && prevPos !== pos) {
1319
1315
  setShowCalloutMenu(false);
@@ -1341,7 +1337,7 @@ var DragHandle = ({ editor }) => {
1341
1337
  if (node) {
1342
1338
  const from = pos + 1;
1343
1339
  const to = pos + node.nodeSize - 1;
1344
- editor.chain().setTextSelection({ from, to }).setColor(textColor).setNodeSelection(pos).updateAttributes("callout", { bgColor }).run();
1340
+ editor.chain().setTextSelection({ from, to }).setColor(textColor).setNodeSelection(pos).updateAttributes("callout", { bgColor }).updateAttributes("calloutTip", { bgColor }).updateAttributes("calloutAlert", { bgColor }).run();
1345
1341
  }
1346
1342
  setShowCalloutMenu(false);
1347
1343
  }
@@ -2010,7 +2006,8 @@ var ImageDialog = ({
2010
2006
  title: formState.title,
2011
2007
  caption: formState.caption,
2012
2008
  width: formState.width,
2013
- height: formState.height
2009
+ height: formState.height,
2010
+ storageKey: result.storageKey
2014
2011
  });
2015
2012
  handleClose();
2016
2013
  } finally {
@@ -2262,24 +2259,32 @@ var AddLinkDialog = ({
2262
2259
  open,
2263
2260
  onClose,
2264
2261
  onLinkAdd,
2265
- initialTitle = "",
2266
- initialUrl = ""
2262
+ linkDialogContext
2267
2263
  }) => {
2268
2264
  const translations2 = useTiptapTranslations();
2269
- const [title, setTitle] = (0, import_react15.useState)(initialTitle);
2270
- const [url, setUrl] = (0, import_react15.useState)(initialUrl);
2265
+ const initialLinkTarget = linkDialogContext?.target ? linkDialogContext.target === "_blank" : true;
2266
+ const initialLinkRel = linkDialogContext?.rel ? linkDialogContext.rel?.includes("noopener") : true;
2267
+ const [title, setTitle] = (0, import_react15.useState)(linkDialogContext?.title);
2268
+ const [url, setUrl] = (0, import_react15.useState)(linkDialogContext?.href);
2269
+ const [openInNewTab, setOpenInNewTab] = (0, import_react15.useState)(initialLinkTarget);
2270
+ const [addNoopener, setAddNoopener] = (0, import_react15.useState)(initialLinkRel);
2271
2271
  const [error, setError] = (0, import_react15.useState)("");
2272
2272
  const titleInputRef = (0, import_react15.useRef)(null);
2273
+ const clearDialogState = () => {
2274
+ setTitle(linkDialogContext?.title);
2275
+ setUrl(linkDialogContext?.href);
2276
+ setOpenInNewTab(initialLinkTarget);
2277
+ setAddNoopener(initialLinkRel);
2278
+ setError("");
2279
+ };
2273
2280
  (0, import_react15.useEffect)(() => {
2274
2281
  if (open) {
2275
- setTitle(initialTitle);
2276
- setUrl(initialUrl);
2277
- setError("");
2282
+ clearDialogState();
2278
2283
  setTimeout(() => {
2279
2284
  titleInputRef.current?.focus();
2280
2285
  }, 0);
2281
2286
  }
2282
- }, [open, initialTitle, initialUrl]);
2287
+ }, [open, linkDialogContext]);
2283
2288
  const validateUrl = (urlStr) => {
2284
2289
  if (!urlStr.trim()) {
2285
2290
  setError(translations2.link.emptyUrl);
@@ -2305,22 +2310,22 @@ var AddLinkDialog = ({
2305
2310
  };
2306
2311
  const handleSubmit = () => {
2307
2312
  setError("");
2308
- if (!title.trim()) {
2313
+ if (!title?.trim()) {
2309
2314
  setError(translations2.link.titleError);
2310
2315
  return;
2311
2316
  }
2312
- if (!validateUrl(url)) {
2317
+ if (!validateUrl(url ?? "")) {
2313
2318
  return;
2314
2319
  }
2315
- const hasProtocol = url.includes("://") || url.startsWith("mailto:") || url.startsWith("tel:");
2320
+ const hasProtocol = url?.includes("://") || url?.startsWith("mailto:") || url?.startsWith("tel:");
2316
2321
  const finalUrl = hasProtocol ? url : `https://${url}`;
2317
- onLinkAdd(title, finalUrl);
2322
+ const target = openInNewTab ? "_blank" : "_self";
2323
+ const rel = addNoopener ? "noopener noreferrer nofollow" : null;
2324
+ onLinkAdd({ title, href: finalUrl ?? "", target, rel });
2318
2325
  handleClose();
2319
2326
  };
2320
2327
  const handleClose = () => {
2321
- setTitle(initialTitle);
2322
- setUrl(initialUrl);
2323
- setError("");
2328
+ clearDialogState();
2324
2329
  onClose();
2325
2330
  };
2326
2331
  const handleKeyDown = (e) => {
@@ -2335,7 +2340,7 @@ var AddLinkDialog = ({
2335
2340
  open,
2336
2341
  handleClose,
2337
2342
  children: [
2338
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "link-dialog-title", children: initialUrl ? translations2.link.editLink : translations2.link.addLink }),
2343
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "link-dialog-title", children: linkDialogContext?.href ? translations2.link.editLink : translations2.link.addLink }),
2339
2344
  /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("hr", { className: "link-dialog-divider" }),
2340
2345
  /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "link-dialog-content", children: [
2341
2346
  /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "link-dialog-form-group", children: [
@@ -2377,12 +2382,40 @@ var AddLinkDialog = ({
2377
2382
  type: "text",
2378
2383
  className: "link-dialog-input",
2379
2384
  placeholder: translations2.link.urlPlaceholder,
2380
- value: url,
2385
+ value: url ?? "",
2381
2386
  onChange: (e) => setUrl(e.target.value),
2382
2387
  onKeyDown: handleKeyDown
2383
2388
  }
2384
2389
  )
2385
2390
  ] }),
2391
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "link-dialog-form-group", children: [
2392
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("label", { className: "link-dialog-checkbox-label", children: [
2393
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
2394
+ "input",
2395
+ {
2396
+ type: "checkbox",
2397
+ checked: openInNewTab,
2398
+ onChange: (e) => setOpenInNewTab(e.target.checked)
2399
+ }
2400
+ ),
2401
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: translations2.link.openInNewTab })
2402
+ ] }),
2403
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "link-dialog-help-text", children: translations2.link.openInNewTabHelp })
2404
+ ] }),
2405
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "link-dialog-form-group", children: [
2406
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("label", { className: "link-dialog-checkbox-label", children: [
2407
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
2408
+ "input",
2409
+ {
2410
+ type: "checkbox",
2411
+ checked: addNoopener,
2412
+ onChange: (e) => setAddNoopener(e.target.checked)
2413
+ }
2414
+ ),
2415
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { children: translations2.link.addNofollow })
2416
+ ] }),
2417
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "link-dialog-help-text", children: translations2.link.addNofollowHelp })
2418
+ ] }),
2386
2419
  error && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "link-dialog-error", children: error })
2387
2420
  ] }),
2388
2421
  /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "link-dialog-actions", children: [
@@ -2401,7 +2434,7 @@ var AddLinkDialog = ({
2401
2434
  className: "link-dialog-button-submit",
2402
2435
  onClick: handleSubmit,
2403
2436
  type: "button",
2404
- children: initialUrl ? translations2.link.editLink : translations2.link.addLink
2437
+ children: linkDialogContext?.href ? translations2.link.editLink : translations2.link.addLink
2405
2438
  }
2406
2439
  )
2407
2440
  ] })
@@ -2624,7 +2657,7 @@ var import_extension_mathematics = require("@tiptap/extension-mathematics");
2624
2657
  var import_extension_table = require("@tiptap/extension-table");
2625
2658
 
2626
2659
  // src/extensions/editor/callout.ts
2627
- var import_react28 = require("@tiptap/react");
2660
+ var import_react29 = require("@tiptap/react");
2628
2661
 
2629
2662
  // src/utils/handle-exit-node.ts
2630
2663
  var import_state = require("@tiptap/pm/state");
@@ -3248,6 +3281,13 @@ var BaseFigure = import_extension_image.default.extend({
3248
3281
  caption: {
3249
3282
  default: null,
3250
3283
  parseHTML: (element) => element.querySelector("figcaption")?.textContent || null
3284
+ },
3285
+ storageKey: {
3286
+ default: null,
3287
+ parseHTML: (element) => element.getAttribute("data-storage-key"),
3288
+ renderHTML: (attributes) => ({
3289
+ "data-storage-key": attributes.storageKey
3290
+ })
3251
3291
  }
3252
3292
  };
3253
3293
  },
@@ -3338,6 +3378,32 @@ var BaseLegacyBookAlert = import_core8.Node.create({
3338
3378
  return {
3339
3379
  type: {
3340
3380
  default: "error"
3381
+ },
3382
+ bgColor: {
3383
+ default: null,
3384
+ parseHTML: (element) => {
3385
+ if (typeof element === "string") return null;
3386
+ return element.getAttribute("data-bg-color");
3387
+ },
3388
+ renderHTML: (attributes) => {
3389
+ if (!attributes.bgColor) return {};
3390
+ return {
3391
+ "data-bg-color": attributes.bgColor
3392
+ };
3393
+ }
3394
+ },
3395
+ emoji: {
3396
+ default: null,
3397
+ parseHTML: (element) => {
3398
+ if (typeof element === "string") return null;
3399
+ return element.getAttribute("data-emoji");
3400
+ },
3401
+ renderHTML: (attributes) => {
3402
+ if (!attributes.emoji) return {};
3403
+ return {
3404
+ "data-emoji": attributes.emoji
3405
+ };
3406
+ }
3341
3407
  }
3342
3408
  };
3343
3409
  },
@@ -3367,6 +3433,32 @@ var BaseLegacyBookTip = import_core8.Node.create({
3367
3433
  return {
3368
3434
  type: {
3369
3435
  default: "info"
3436
+ },
3437
+ bgColor: {
3438
+ default: null,
3439
+ parseHTML: (element) => {
3440
+ if (typeof element === "string") return null;
3441
+ return element.getAttribute("data-bg-color");
3442
+ },
3443
+ renderHTML: (attributes) => {
3444
+ if (!attributes.bgColor) return {};
3445
+ return {
3446
+ "data-bg-color": attributes.bgColor
3447
+ };
3448
+ }
3449
+ },
3450
+ emoji: {
3451
+ default: null,
3452
+ parseHTML: (element) => {
3453
+ if (typeof element === "string") return null;
3454
+ return element.getAttribute("data-emoji");
3455
+ },
3456
+ renderHTML: (attributes) => {
3457
+ if (!attributes.emoji) return {};
3458
+ return {
3459
+ "data-emoji": attributes.emoji
3460
+ };
3461
+ }
3370
3462
  }
3371
3463
  };
3372
3464
  },
@@ -3700,8 +3792,8 @@ var BaseLegacyFigure = import_extension_image2.default.extend({
3700
3792
  });
3701
3793
 
3702
3794
  // src/extensions/views/node-views/callout.tsx
3703
- var import_react19 = require("@tiptap/react");
3704
- var import_react20 = require("react");
3795
+ var import_react20 = require("@tiptap/react");
3796
+ var import_react21 = require("react");
3705
3797
 
3706
3798
  // src/icons/color/TiptapCalloutError.tsx
3707
3799
  var import_jsx_runtime71 = require("react/jsx-runtime");
@@ -4291,6 +4383,7 @@ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
4291
4383
  ) });
4292
4384
 
4293
4385
  // src/extensions/views/components/table.tsx
4386
+ var import_react18 = require("react");
4294
4387
  var import_jsx_runtime82 = require("react/jsx-runtime");
4295
4388
 
4296
4389
  // src/extensions/views/components/video.tsx
@@ -4326,13 +4419,13 @@ var Video = ({ src, children }) => {
4326
4419
  };
4327
4420
 
4328
4421
  // src/editor/controls/emoji-picker.tsx
4329
- var import_react18 = require("react");
4422
+ var import_react19 = require("react");
4330
4423
  var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
4331
4424
  var import_jsx_runtime84 = require("react/jsx-runtime");
4332
4425
  var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
4333
- const pickerRef = (0, import_react18.useRef)(null);
4426
+ const pickerRef = (0, import_react19.useRef)(null);
4334
4427
  const translations2 = useTiptapTranslations();
4335
- (0, import_react18.useEffect)(() => {
4428
+ (0, import_react19.useEffect)(() => {
4336
4429
  const handleClickOutside = (event) => {
4337
4430
  if (pickerRef.current && !pickerRef.current.contains(event.target)) {
4338
4431
  onClose();
@@ -4381,7 +4474,7 @@ var CalloutView = (props) => {
4381
4474
  const type = props.node.attrs.type || "info";
4382
4475
  const bgColor = props.node.attrs.bgColor;
4383
4476
  const emoji = props.node.attrs.emoji;
4384
- const [showEmojiPicker, setShowEmojiPicker] = (0, import_react20.useState)(false);
4477
+ const [showEmojiPicker, setShowEmojiPicker] = (0, import_react21.useState)(false);
4385
4478
  const handleIconClick = (e) => {
4386
4479
  e.preventDefault();
4387
4480
  e.stopPropagation();
@@ -4391,7 +4484,7 @@ var CalloutView = (props) => {
4391
4484
  props.updateAttributes({ emoji: newEmoji });
4392
4485
  setShowEmojiPicker(false);
4393
4486
  };
4394
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react19.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4487
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react20.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4395
4488
  Callout,
4396
4489
  {
4397
4490
  type,
@@ -4416,89 +4509,89 @@ var CalloutView = (props) => {
4416
4509
  }
4417
4510
  )
4418
4511
  ] }),
4419
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react19.NodeViewContent, { as: "div" })
4512
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react20.NodeViewContent, { as: "div" })
4420
4513
  }
4421
4514
  ) });
4422
4515
  };
4423
4516
 
4424
4517
  // src/extensions/views/node-views/code-block.tsx
4425
- var import_react21 = require("react");
4426
- var import_react22 = require("@tiptap/react");
4518
+ var import_react22 = require("react");
4519
+ var import_react23 = require("@tiptap/react");
4427
4520
  var import_jsx_runtime86 = require("react/jsx-runtime");
4428
4521
  var CodeBlockView = (props) => {
4429
- const [selectedLanguage, setSelectedLanguage] = (0, import_react21.useState)(props.node.attrs.language ?? "");
4522
+ const [selectedLanguage, setSelectedLanguage] = (0, import_react22.useState)(props.node.attrs.language ?? "");
4430
4523
  const translations2 = useTiptapTranslations();
4431
4524
  const handleLanguageChange = (language) => {
4432
4525
  props.updateAttributes({ language });
4433
4526
  setSelectedLanguage(language);
4434
4527
  };
4435
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react22.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
4528
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
4436
4529
  CodeBlock,
4437
4530
  {
4438
4531
  language: selectedLanguage,
4439
4532
  isEditable: props.editor.isEditable,
4440
4533
  onLanguageChange: handleLanguageChange,
4441
4534
  translations: translations2,
4442
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react22.NodeViewContent, {})
4535
+ children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.NodeViewContent, {})
4443
4536
  }
4444
4537
  ) });
4445
4538
  };
4446
4539
 
4447
4540
  // src/extensions/views/node-views/copyable-text.tsx
4448
- var import_react23 = require("@tiptap/react");
4541
+ var import_react24 = require("@tiptap/react");
4449
4542
  var import_jsx_runtime87 = require("react/jsx-runtime");
4450
4543
  var CopyableTextView = () => {
4451
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CopyableText2, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react23.MarkViewContent, {}) });
4544
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CopyableText2, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.MarkViewContent, {}) });
4452
4545
  };
4453
4546
 
4454
4547
  // src/extensions/views/node-views/custom-quote.tsx
4455
- var import_react24 = require("@tiptap/react");
4548
+ var import_react25 = require("@tiptap/react");
4456
4549
  var import_jsx_runtime88 = require("react/jsx-runtime");
4457
4550
  var CustomQuoteView = () => {
4458
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(CustomQuote, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, {}) }) });
4551
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(CustomQuote, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, {}) }) });
4459
4552
  };
4460
4553
  var CustomQuoteTextView = (props) => {
4461
4554
  const isEmpty = !props.node.content.size;
4462
4555
  const translations2 = useTiptapTranslations();
4463
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4556
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4464
4557
  CustomQuoteText,
4465
4558
  {
4466
4559
  isEmpty,
4467
4560
  placeholder: translations2.customQuote.textPlaceholder,
4468
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4561
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4469
4562
  }
4470
4563
  ) });
4471
4564
  };
4472
4565
  var CustomQuoteAuthorView = (props) => {
4473
4566
  const isEmpty = !props.node.content.size;
4474
4567
  const translations2 = useTiptapTranslations();
4475
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4568
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4476
4569
  CustomQuoteAuthor,
4477
4570
  {
4478
4571
  isEmpty,
4479
4572
  placeholder: translations2.customQuote.authorPlaceholder,
4480
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4573
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4481
4574
  }
4482
4575
  ) });
4483
4576
  };
4484
4577
  var CustomQuoteSignView = (props) => {
4485
4578
  const isEmpty = !props.node.content.size;
4486
4579
  const translations2 = useTiptapTranslations();
4487
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4580
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4488
4581
  CustomQuoteSign,
4489
4582
  {
4490
4583
  isEmpty,
4491
4584
  placeholder: translations2.customQuote.signPlaceholder,
4492
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4585
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4493
4586
  }
4494
4587
  ) });
4495
4588
  };
4496
4589
 
4497
4590
  // src/extensions/views/node-views/figure.tsx
4498
- var import_react25 = require("@tiptap/react");
4591
+ var import_react26 = require("@tiptap/react");
4499
4592
  var import_jsx_runtime89 = require("react/jsx-runtime");
4500
4593
  var FigureView = ({ node, getPos, editor }) => {
4501
- const { fileId, src, alt, title, caption, width, height } = node.attrs;
4594
+ const { fileId, src, alt, title, caption, width, height, storageKey } = node.attrs;
4502
4595
  const imageExtension = editor.extensionManager.extensions.find((ext) => ext.name === "image");
4503
4596
  const getImageById = imageExtension?.options.getImageById;
4504
4597
  const onFigureClick = imageExtension?.options.onFigureClick;
@@ -4506,7 +4599,7 @@ var FigureView = ({ node, getPos, editor }) => {
4506
4599
  onFigureClick?.(node.attrs, getPos());
4507
4600
  };
4508
4601
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
4509
- import_react25.NodeViewWrapper,
4602
+ import_react26.NodeViewWrapper,
4510
4603
  {
4511
4604
  className: "figure-node-view",
4512
4605
  "data-drag-handle": true,
@@ -4530,40 +4623,40 @@ var FigureView = ({ node, getPos, editor }) => {
4530
4623
  };
4531
4624
 
4532
4625
  // src/extensions/views/node-views/prompt.tsx
4533
- var import_react26 = require("@tiptap/react");
4626
+ var import_react27 = require("@tiptap/react");
4534
4627
  var import_jsx_runtime90 = require("react/jsx-runtime");
4535
4628
  var PromptHeaderView = (props) => {
4536
4629
  const isEmpty = !props.node.content.size;
4537
4630
  const translations2 = useTiptapTranslations();
4538
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4631
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4539
4632
  PromptHeader,
4540
4633
  {
4541
4634
  isEmpty,
4542
4635
  placeholder: translations2.prompt.headerPlaceholder,
4543
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4636
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4544
4637
  }
4545
4638
  ) });
4546
4639
  };
4547
4640
  var PromptContentView = (props) => {
4548
4641
  const isEmpty = !props.node.content.size;
4549
4642
  const translations2 = useTiptapTranslations();
4550
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4643
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4551
4644
  PromptContent,
4552
4645
  {
4553
4646
  isEmpty,
4554
4647
  placeholder: translations2.prompt.contentPlaceholder,
4555
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react26.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4648
+ children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4556
4649
  }
4557
4650
  ) });
4558
4651
  };
4559
4652
 
4560
4653
  // src/extensions/views/node-views/video.tsx
4561
- var import_react27 = require("@tiptap/react");
4654
+ var import_react28 = require("@tiptap/react");
4562
4655
  var import_jsx_runtime91 = require("react/jsx-runtime");
4563
4656
  var VideoView = (props) => {
4564
4657
  const { src } = props.node.attrs;
4565
- return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Video, { src, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
4566
- import_react27.NodeViewContent,
4658
+ return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_react28.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Video, { src, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
4659
+ import_react28.NodeViewContent,
4567
4660
  {
4568
4661
  as: "div",
4569
4662
  className: "video-content"
@@ -4574,66 +4667,66 @@ var VideoView = (props) => {
4574
4667
  // src/extensions/editor/callout.ts
4575
4668
  var Callout2 = BaseCallout.extend({
4576
4669
  addNodeView() {
4577
- return (0, import_react28.ReactNodeViewRenderer)(CalloutView);
4670
+ return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
4578
4671
  }
4579
4672
  });
4580
4673
  var LegacyBookAlert = BaseLegacyBookAlert.extend({
4581
4674
  addNodeView() {
4582
- return (0, import_react28.ReactNodeViewRenderer)(CalloutView);
4675
+ return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
4583
4676
  }
4584
4677
  });
4585
4678
  var LegacyBookTip = BaseLegacyBookTip.extend({
4586
4679
  addNodeView() {
4587
- return (0, import_react28.ReactNodeViewRenderer)(CalloutView);
4680
+ return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
4588
4681
  }
4589
4682
  });
4590
4683
 
4591
4684
  // src/extensions/editor/code-block.ts
4592
- var import_react29 = require("@tiptap/react");
4685
+ var import_react30 = require("@tiptap/react");
4593
4686
  var CodeBlock2 = BaseCodeBlock.extend({
4594
4687
  addNodeView() {
4595
- return (0, import_react29.ReactNodeViewRenderer)(CodeBlockView);
4688
+ return (0, import_react30.ReactNodeViewRenderer)(CodeBlockView);
4596
4689
  }
4597
4690
  });
4598
4691
 
4599
4692
  // src/extensions/editor/custom-quote.ts
4600
- var import_react30 = require("@tiptap/react");
4693
+ var import_react31 = require("@tiptap/react");
4601
4694
  var CustomQuote2 = BaseCustomQuote.extend({
4602
4695
  addNodeView() {
4603
- return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteView);
4696
+ return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteView);
4604
4697
  }
4605
4698
  });
4606
4699
  var CustomQuoteText2 = BaseCustomQuoteText.extend({
4607
4700
  addNodeView() {
4608
- return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteTextView);
4701
+ return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteTextView);
4609
4702
  }
4610
4703
  });
4611
4704
  var CustomQuoteAuthor2 = BaseCustomQuoteAuthor.extend({
4612
4705
  addNodeView() {
4613
- return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteAuthorView);
4706
+ return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteAuthorView);
4614
4707
  }
4615
4708
  });
4616
4709
  var CustomQuoteSign2 = BaseCustomQuoteSign.extend({
4617
4710
  addNodeView() {
4618
- return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteSignView);
4711
+ return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteSignView);
4619
4712
  }
4620
4713
  });
4621
4714
  var LegacySEQuote = BaseLegacySEQuote.extend({
4622
4715
  addNodeView() {
4623
- return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteView);
4716
+ return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteView);
4624
4717
  }
4625
4718
  });
4626
4719
 
4627
4720
  // src/extensions/editor/video.ts
4628
- var import_react31 = require("@tiptap/react");
4721
+ var import_react32 = require("@tiptap/react");
4629
4722
  var Video2 = BaseVideo.extend({
4630
4723
  addNodeView() {
4631
- return (0, import_react31.ReactNodeViewRenderer)(VideoView);
4724
+ return (0, import_react32.ReactNodeViewRenderer)(VideoView);
4632
4725
  }
4633
4726
  });
4634
4727
  var LegacyYouTube = BaseLegacyYouTube.extend({
4635
4728
  addNodeView() {
4636
- return (0, import_react31.ReactNodeViewRenderer)(VideoView);
4729
+ return (0, import_react32.ReactNodeViewRenderer)(VideoView);
4637
4730
  }
4638
4731
  });
4639
4732
 
@@ -5049,46 +5142,46 @@ function getSharedExtensions() {
5049
5142
  }
5050
5143
 
5051
5144
  // src/extensions/editor/copyable-text.ts
5052
- var import_react32 = require("@tiptap/react");
5145
+ var import_react33 = require("@tiptap/react");
5053
5146
  var CopyableText3 = CopyableText.extend({
5054
5147
  addMarkView() {
5055
- return (0, import_react32.ReactMarkViewRenderer)(CopyableTextView);
5148
+ return (0, import_react33.ReactMarkViewRenderer)(CopyableTextView);
5056
5149
  }
5057
5150
  });
5058
5151
 
5059
5152
  // src/extensions/editor/prompt.ts
5060
- var import_react33 = require("@tiptap/react");
5153
+ var import_react34 = require("@tiptap/react");
5061
5154
  var PromptHeader2 = BasePromptHeader.extend({
5062
5155
  addNodeView() {
5063
- return (0, import_react33.ReactNodeViewRenderer)(PromptHeaderView);
5156
+ return (0, import_react34.ReactNodeViewRenderer)(PromptHeaderView);
5064
5157
  }
5065
5158
  });
5066
5159
  var PromptContent2 = BasePromptContent.extend({
5067
5160
  addNodeView() {
5068
- return (0, import_react33.ReactNodeViewRenderer)(PromptContentView);
5161
+ return (0, import_react34.ReactNodeViewRenderer)(PromptContentView);
5069
5162
  }
5070
5163
  });
5071
5164
  var LegacyPromptSEHeader = BaseLegacyPromptSEHeader.extend({
5072
5165
  addNodeView() {
5073
- return (0, import_react33.ReactNodeViewRenderer)(PromptHeaderView);
5166
+ return (0, import_react34.ReactNodeViewRenderer)(PromptHeaderView);
5074
5167
  }
5075
5168
  });
5076
5169
  var LegacyPromptSEContent = BaseLegacyPromptSEContent.extend({
5077
5170
  addNodeView() {
5078
- return (0, import_react33.ReactNodeViewRenderer)(PromptContentView);
5171
+ return (0, import_react34.ReactNodeViewRenderer)(PromptContentView);
5079
5172
  }
5080
5173
  });
5081
5174
 
5082
5175
  // src/extensions/editor/figure.ts
5083
- var import_react34 = require("@tiptap/react");
5176
+ var import_react35 = require("@tiptap/react");
5084
5177
  var Figure2 = BaseFigure.extend({
5085
5178
  addNodeView() {
5086
- return (0, import_react34.ReactNodeViewRenderer)(FigureView);
5179
+ return (0, import_react35.ReactNodeViewRenderer)(FigureView);
5087
5180
  }
5088
5181
  });
5089
5182
  var LegacyFigure = BaseLegacyFigure.extend({
5090
5183
  addNodeView() {
5091
- return (0, import_react34.ReactNodeViewRenderer)(FigureView);
5184
+ return (0, import_react35.ReactNodeViewRenderer)(FigureView);
5092
5185
  }
5093
5186
  });
5094
5187
 
@@ -5188,7 +5281,6 @@ var createHandleImageAdd = (editor, closeDialogCommand, savedPos) => {
5188
5281
  };
5189
5282
  var createHandleImageEdit = (editor, closeDialogCommand, pos) => {
5190
5283
  return (attrs) => {
5191
- console.log("\u{1F440} ~ createHandleImageEdit ~ attrs:", attrs);
5192
5284
  if (!editor || pos === void 0) return;
5193
5285
  editor.chain().focus().setNodeSelection(pos).updateFigure(attrs).run();
5194
5286
  closeDialogCommand();
@@ -5214,30 +5306,30 @@ var createHandleVideoAdd = (editor, closeDialogCommand, savedPos) => {
5214
5306
  closeDialogCommand();
5215
5307
  };
5216
5308
  };
5217
- var createHandleLinkAdd = (editor, closeDialogCommand, savedPos) => {
5218
- return (title, url) => {
5219
- if (!editor) return;
5220
- const hasSelection = !editor.state.selection.empty;
5221
- if (hasSelection) {
5222
- editor.chain().focus().command(({ tr, state }) => {
5223
- const { from, to } = state.selection;
5224
- tr.insertText(title, from, to);
5225
- tr.addMark(from, from + title.length, editor.schema.marks.link.create({ href: url }));
5226
- return true;
5227
- }).run();
5228
- } else {
5229
- const { state } = editor;
5230
- const insertPos = savedPos ?? state.selection.from;
5231
- editor.chain().focus().command(({ tr }) => {
5232
- const linkMark = editor.schema.marks.link.create({ href: url });
5233
- const textNode = editor.schema.text(title, [linkMark]);
5234
- tr.insert(insertPos, textNode);
5235
- tr.setSelection(import_state5.TextSelection.create(tr.doc, insertPos, insertPos + title.length));
5236
- return true;
5237
- }).run();
5238
- }
5239
- closeDialogCommand();
5240
- };
5309
+ var createHandleLinkAdd = (editor, closeDialogCommand, linkParams, savedPos) => {
5310
+ if (!editor) return;
5311
+ const hasSelection = !editor.state.selection.empty;
5312
+ const titleLength = linkParams.title?.length ?? 0;
5313
+ if (hasSelection) {
5314
+ editor.chain().focus().command(({ tr, state }) => {
5315
+ const { from, to } = state.selection;
5316
+ tr.insertText(linkParams.title ?? "", from, to);
5317
+ tr.addMark(from, from + titleLength, editor.schema.marks.link.create({ ...linkParams }));
5318
+ return true;
5319
+ }).run();
5320
+ } else {
5321
+ const { state } = editor;
5322
+ const insertPos = savedPos ?? state.selection.from;
5323
+ const titleLength2 = linkParams.title?.length ?? 0;
5324
+ editor.chain().focus().command(({ tr }) => {
5325
+ const linkMark = editor.schema.marks.link.create({ ...linkParams });
5326
+ const textNode = editor.schema.text(linkParams.title ?? "", [linkMark]);
5327
+ tr.insert(insertPos, textNode);
5328
+ tr.setSelection(import_state5.TextSelection.create(tr.doc, insertPos, insertPos + titleLength2));
5329
+ return true;
5330
+ }).run();
5331
+ }
5332
+ closeDialogCommand();
5241
5333
  };
5242
5334
  var createHandleKatexAdd = (editor, closeDialogCommand, savedPos) => {
5243
5335
  return (latex, pos) => {
@@ -5261,7 +5353,7 @@ var createHandleKatexAdd = (editor, closeDialogCommand, savedPos) => {
5261
5353
  // src/editor/commands/suggestion.tsx
5262
5354
  var import_dom = require("@floating-ui/dom");
5263
5355
  var import_core17 = require("@tiptap/core");
5264
- var import_react35 = require("@tiptap/react");
5356
+ var import_react36 = require("@tiptap/react");
5265
5357
 
5266
5358
  // src/editor/commands/items.ts
5267
5359
  var getCommandItems = (translations2, hasImageHandlers) => [
@@ -5594,7 +5686,7 @@ var createSuggestions = (translations2, hasImageHandlers) => ({
5594
5686
  render: () => {
5595
5687
  return {
5596
5688
  onStart: async (props) => {
5597
- component = new import_react35.ReactRenderer(CommandsList, {
5689
+ component = new import_react36.ReactRenderer(CommandsList, {
5598
5690
  props,
5599
5691
  editor: props.editor
5600
5692
  });
@@ -5704,7 +5796,11 @@ var ru_default = {
5704
5796
  invalidUrl: "\u041D\u0435\u0432\u0435\u0440\u043D\u044B\u0439 URL",
5705
5797
  emptyUrl: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 URL \u0441\u0441\u044B\u043B\u043A\u0438",
5706
5798
  addLinkTitle: "\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443",
5707
- removeLinkTitle: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443"
5799
+ removeLinkTitle: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443",
5800
+ openInNewTab: "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0432 \u043D\u043E\u0432\u043E\u0439 \u0432\u043A\u043B\u0430\u0434\u043A\u0435",
5801
+ openInNewTabHelp: "\u0421\u0441\u044B\u043B\u043A\u0430 \u043E\u0442\u043A\u0440\u043E\u0435\u0442\u0441\u044F \u0432 \u043D\u043E\u0432\u043E\u043C \u043E\u043A\u043D\u0435 \u0438\u043B\u0438 \u0432\u043A\u043B\u0430\u0434\u043A\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430",
5802
+ addNofollow: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C rel="nofollow"',
5803
+ addNofollowHelp: "\u0423\u043A\u0430\u0437\u044B\u0432\u0430\u0435\u0442 \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u044B\u043C \u0441\u0438\u0441\u0442\u0435\u043C\u0430\u043C \u043D\u0435 \u0443\u0447\u0438\u0442\u044B\u0432\u0430\u0442\u044C \u0441\u0441\u044B\u043B\u043A\u0443 \u043F\u0440\u0438 \u0440\u0430\u0441\u0447\u0435\u0442\u0435 \u0440\u0435\u0439\u0442\u0438\u043D\u0433\u0430 \u0438 \u0438\u043D\u0434\u0435\u043A\u0441\u0430\u0446\u0438\u0438 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u044B, \u043D\u0430 \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u043E\u043D\u0438 \u0440\u0430\u0437\u043C\u0435\u0449\u0435\u043D\u044B. \u0420\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0443\u0435\u0442\u0441\u044F \u043F\u0440\u0438\u043C\u0435\u043D\u044F\u0442\u044C \u043A\u043E \u0432\u0441\u0435\u043C \u0441\u0441\u044B\u043B\u043A\u0430\u043C \u043D\u0430 \u0441\u0442\u043E\u0440\u043E\u043D\u043D\u0438\u0435 \u0441\u0430\u0439\u0442\u044B."
5708
5804
  },
5709
5805
  lists: {
5710
5806
  bulletList: "\u041D\u0435\u043D\u0443\u043C\u0435\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u0441\u043F\u0438\u0441\u043E\u043A",
@@ -5864,7 +5960,11 @@ var en_default = {
5864
5960
  invalidUrl: "Invalid URL",
5865
5961
  emptyUrl: "Enter link URL",
5866
5962
  addLinkTitle: "Add link",
5867
- removeLinkTitle: "Remove link"
5963
+ removeLinkTitle: "Remove link",
5964
+ openInNewTab: "Open in new tab",
5965
+ openInNewTabHelp: "Link will open in a new browser window or tab",
5966
+ addNofollow: 'Add rel="nofollow"',
5967
+ addNofollowHelp: "Tells search engines not to count this link when calculating page rankings and indexing. Recommended for all external links."
5868
5968
  },
5869
5969
  lists: {
5870
5970
  bulletList: "Bullet list",
@@ -6009,12 +6109,12 @@ function TiptapContent({
6009
6109
  lang,
6010
6110
  error
6011
6111
  }) {
6012
- const [linkDialogContext, setLinkDialogContext] = (0, import_react36.useState)(null);
6013
- const [katexDialogContext, setKatexDialogContext] = (0, import_react36.useState)(
6112
+ const [linkDialogContext, setLinkDialogContext] = (0, import_react37.useState)(null);
6113
+ const [katexDialogContext, setKatexDialogContext] = (0, import_react37.useState)(
6014
6114
  null
6015
6115
  );
6016
- const [editFigureContext, setEditFigureContext] = (0, import_react36.useState)(null);
6017
- const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react36.useState)(void 0);
6116
+ const [editFigureContext, setEditFigureContext] = (0, import_react37.useState)(null);
6117
+ const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react37.useState)(void 0);
6018
6118
  const { activeDialog, closeDialogCommand, openDialogCommand } = useDialogCommand();
6019
6119
  const translations2 = useTiptapTranslations();
6020
6120
  let safeContent;
@@ -6023,7 +6123,7 @@ function TiptapContent({
6023
6123
  } catch {
6024
6124
  safeContent = { type: "doc", content: [{ type: "paragraph" }] };
6025
6125
  }
6026
- const editor = (0, import_react37.useEditor)(
6126
+ const editor = (0, import_react38.useEditor)(
6027
6127
  {
6028
6128
  editable: isEditable && !isDisabled,
6029
6129
  extensions: getEditorExtensions({
@@ -6060,11 +6160,12 @@ function TiptapContent({
6060
6160
  return false;
6061
6161
  }
6062
6162
  },
6163
+ onCreate: ({ editor: editor2 }) => handleChange?.(editor2.getJSON()),
6063
6164
  onBlur: ({ editor: editor2 }) => handleChange?.(editor2.getJSON())
6064
6165
  },
6065
6166
  [lang]
6066
6167
  );
6067
- (0, import_react36.useEffect)(() => {
6168
+ (0, import_react37.useEffect)(() => {
6068
6169
  if (activeDialog && editor && !editor.isDestroyed) {
6069
6170
  const pos = editor.state.selection.from;
6070
6171
  setSavedDialogCursorPos(pos);
@@ -6084,14 +6185,14 @@ function TiptapContent({
6084
6185
  const handleVideoAdd = (url) => {
6085
6186
  createHandleVideoAdd(editor, handleCloseDialog, savedDialogCursorPos)(url);
6086
6187
  };
6087
- const handleLinkAdd = (title, url) => {
6088
- createHandleLinkAdd(editor, handleCloseDialog, savedDialogCursorPos)(title, url);
6188
+ const handleLinkAdd = (params) => {
6189
+ createHandleLinkAdd(editor, handleCloseDialog, params, savedDialogCursorPos);
6089
6190
  };
6090
6191
  const handleKatexAdd = (latex) => {
6091
6192
  const katexHandler = createHandleKatexAdd(editor, handleCloseDialog, savedDialogCursorPos);
6092
6193
  katexHandler(latex, katexDialogContext?.pos);
6093
6194
  };
6094
- (0, import_react36.useEffect)(() => {
6195
+ (0, import_react37.useEffect)(() => {
6095
6196
  if (!editor || editor.isDestroyed) return;
6096
6197
  editor.commands.setContent(safeContent, {
6097
6198
  emitUpdate: false
@@ -6123,7 +6224,7 @@ function TiptapContent({
6123
6224
  BubbleMenuContent,
6124
6225
  {
6125
6226
  editor,
6126
- onLinkClick: (selectedText, url) => setLinkDialogContext({ selectedText, url })
6227
+ onLinkClick: (params) => setLinkDialogContext(params)
6127
6228
  }
6128
6229
  )
6129
6230
  }
@@ -6133,7 +6234,7 @@ function TiptapContent({
6133
6234
  {
6134
6235
  className: `tiptap-content-wrapper ${!!error ? "has-error" : ""} ${isDisabled ? "is-disabled" : ""}`,
6135
6236
  children: [
6136
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react37.EditorContent, { editor }),
6237
+ /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react38.EditorContent, { editor }),
6137
6238
  isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CharacterCount, { editor })
6138
6239
  ]
6139
6240
  }
@@ -6159,8 +6260,7 @@ function TiptapContent({
6159
6260
  open: true,
6160
6261
  onClose: handleCloseDialog,
6161
6262
  onLinkAdd: handleLinkAdd,
6162
- initialTitle: linkDialogContext?.selectedText || "",
6163
- initialUrl: linkDialogContext?.url || ""
6263
+ linkDialogContext
6164
6264
  }
6165
6265
  ),
6166
6266
  activeDialog === "video" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(