@cyberyozh/text-editor 0.1.11 → 0.1.12

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_react37 = require("react");
38
+ var import_react36 = require("react");
39
39
  var import_state6 = require("@tiptap/pm/state");
40
40
  var import_model = require("@tiptap/pm/model");
41
- var import_react38 = require("@tiptap/react");
41
+ var import_react37 = 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");
@@ -1943,15 +1943,34 @@ var ImageDialog = ({
1943
1943
  const img = new Image();
1944
1944
  img.src = imageUrl;
1945
1945
  img.onload = () => {
1946
- const { width, height } = img;
1946
+ const naturalWidth = img.width;
1947
+ const naturalHeight = img.height;
1948
+ const naturalAspectRatio = naturalHeight / naturalWidth;
1949
+ let maxWidth;
1950
+ try {
1951
+ const editorElement = document.querySelector(".tiptap-content-wrapper");
1952
+ if (editorElement && editorElement.clientWidth > 0) {
1953
+ maxWidth = editorElement.clientWidth - 32;
1954
+ }
1955
+ } catch {
1956
+ }
1957
+ let finalWidth;
1958
+ let finalHeight;
1959
+ if (maxWidth && naturalWidth > maxWidth) {
1960
+ finalWidth = maxWidth;
1961
+ finalHeight = Math.round(maxWidth * naturalAspectRatio);
1962
+ } else {
1963
+ finalWidth = naturalWidth;
1964
+ finalHeight = naturalHeight;
1965
+ }
1947
1966
  setFormState((prev) => ({
1948
1967
  ...prev,
1949
1968
  file,
1950
1969
  fileUrl: imageUrl,
1951
1970
  title: file.name,
1952
1971
  alt: file.name,
1953
- width,
1954
- height
1972
+ width: finalWidth,
1973
+ height: finalHeight
1955
1974
  }));
1956
1975
  };
1957
1976
  };
@@ -2657,7 +2676,7 @@ var import_extension_mathematics = require("@tiptap/extension-mathematics");
2657
2676
  var import_extension_table = require("@tiptap/extension-table");
2658
2677
 
2659
2678
  // src/extensions/editor/callout.ts
2660
- var import_react29 = require("@tiptap/react");
2679
+ var import_react28 = require("@tiptap/react");
2661
2680
 
2662
2681
  // src/utils/handle-exit-node.ts
2663
2682
  var import_state = require("@tiptap/pm/state");
@@ -3258,8 +3277,9 @@ var BaseFigure = import_extension_image.default.extend({
3258
3277
  isolating: true,
3259
3278
  selectable: false,
3260
3279
  addOptions() {
3280
+ const parentOptions = this.parent?.() || {};
3261
3281
  return {
3262
- HTMLAttributes: {},
3282
+ ...parentOptions,
3263
3283
  getImageById: void 0,
3264
3284
  onFigureClick: void 0
3265
3285
  };
@@ -3792,8 +3812,8 @@ var BaseLegacyFigure = import_extension_image2.default.extend({
3792
3812
  });
3793
3813
 
3794
3814
  // src/extensions/views/node-views/callout.tsx
3795
- var import_react20 = require("@tiptap/react");
3796
- var import_react21 = require("react");
3815
+ var import_react19 = require("@tiptap/react");
3816
+ var import_react20 = require("react");
3797
3817
 
3798
3818
  // src/icons/color/TiptapCalloutError.tsx
3799
3819
  var import_jsx_runtime71 = require("react/jsx-runtime");
@@ -4382,27 +4402,23 @@ var PromptContent = ({ children, isEmpty, placeholder }) => /* @__PURE__ */ (0,
4382
4402
  }
4383
4403
  ) });
4384
4404
 
4385
- // src/extensions/views/components/table.tsx
4386
- var import_react18 = require("react");
4387
- var import_jsx_runtime82 = require("react/jsx-runtime");
4388
-
4389
4405
  // src/extensions/views/components/video.tsx
4390
- var import_jsx_runtime83 = require("react/jsx-runtime");
4406
+ var import_jsx_runtime82 = require("react/jsx-runtime");
4391
4407
  var Video = ({ src, children }) => {
4392
4408
  const videoInfo = detectVideoHosting(src);
4393
4409
  if (!videoInfo?.embedUrl) {
4394
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "video-node", children: [
4395
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "video-error", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { children: "Unsupported or invalid video URL" }) }),
4410
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "video-node", children: [
4411
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "video-error", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: "Unsupported or invalid video URL" }) }),
4396
4412
  children
4397
4413
  ] });
4398
4414
  }
4399
- return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
4415
+ return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
4400
4416
  "div",
4401
4417
  {
4402
4418
  className: "video-node",
4403
4419
  "data-video": "",
4404
4420
  children: [
4405
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "video-player-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
4421
+ /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "video-player-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
4406
4422
  "iframe",
4407
4423
  {
4408
4424
  className: "video-iframe",
@@ -4419,13 +4435,13 @@ var Video = ({ src, children }) => {
4419
4435
  };
4420
4436
 
4421
4437
  // src/editor/controls/emoji-picker.tsx
4422
- var import_react19 = require("react");
4438
+ var import_react18 = require("react");
4423
4439
  var import_emoji_picker_react = __toESM(require("emoji-picker-react"));
4424
- var import_jsx_runtime84 = require("react/jsx-runtime");
4440
+ var import_jsx_runtime83 = require("react/jsx-runtime");
4425
4441
  var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
4426
- const pickerRef = (0, import_react19.useRef)(null);
4442
+ const pickerRef = (0, import_react18.useRef)(null);
4427
4443
  const translations2 = useTiptapTranslations();
4428
- (0, import_react19.useEffect)(() => {
4444
+ (0, import_react18.useEffect)(() => {
4429
4445
  const handleClickOutside = (event) => {
4430
4446
  if (pickerRef.current && !pickerRef.current.contains(event.target)) {
4431
4447
  onClose();
@@ -4439,12 +4455,12 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
4439
4455
  };
4440
4456
  }, [isOpen, onClose]);
4441
4457
  if (!isOpen) return null;
4442
- return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
4458
+ return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
4443
4459
  "div",
4444
4460
  {
4445
4461
  ref: pickerRef,
4446
4462
  className: "tiptap__emoji-picker-wrapper",
4447
- children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
4463
+ children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
4448
4464
  import_emoji_picker_react.default,
4449
4465
  {
4450
4466
  skinTonesDisabled: true,
@@ -4469,12 +4485,12 @@ var EmojiPickerComponent = ({ isOpen, onClose, onEmojiSelect }) => {
4469
4485
  };
4470
4486
 
4471
4487
  // src/extensions/views/node-views/callout.tsx
4472
- var import_jsx_runtime85 = require("react/jsx-runtime");
4488
+ var import_jsx_runtime84 = require("react/jsx-runtime");
4473
4489
  var CalloutView = (props) => {
4474
4490
  const type = props.node.attrs.type || "info";
4475
4491
  const bgColor = props.node.attrs.bgColor;
4476
4492
  const emoji = props.node.attrs.emoji;
4477
- const [showEmojiPicker, setShowEmojiPicker] = (0, import_react21.useState)(false);
4493
+ const [showEmojiPicker, setShowEmojiPicker] = (0, import_react20.useState)(false);
4478
4494
  const handleIconClick = (e) => {
4479
4495
  e.preventDefault();
4480
4496
  e.stopPropagation();
@@ -4484,23 +4500,23 @@ var CalloutView = (props) => {
4484
4500
  props.updateAttributes({ emoji: newEmoji });
4485
4501
  setShowEmojiPicker(false);
4486
4502
  };
4487
- return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react20.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4503
+ return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react19.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
4488
4504
  Callout,
4489
4505
  {
4490
4506
  type,
4491
4507
  bgColor,
4492
4508
  emoji,
4493
- iconWrapper: (icon) => /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "callout-icon-wrapper", children: [
4494
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4509
+ iconWrapper: (icon) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "callout-icon-wrapper", children: [
4510
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
4495
4511
  "button",
4496
4512
  {
4497
4513
  className: "callout-icon-button",
4498
4514
  onClick: handleIconClick,
4499
4515
  type: "button",
4500
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "callout-icon", children: icon })
4516
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "callout-icon", children: icon })
4501
4517
  }
4502
4518
  ),
4503
- /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4519
+ /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
4504
4520
  EmojiPickerComponent,
4505
4521
  {
4506
4522
  isOpen: showEmojiPicker,
@@ -4509,101 +4525,101 @@ var CalloutView = (props) => {
4509
4525
  }
4510
4526
  )
4511
4527
  ] }),
4512
- children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react20.NodeViewContent, { as: "div" })
4528
+ children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_react19.NodeViewContent, { as: "div" })
4513
4529
  }
4514
4530
  ) });
4515
4531
  };
4516
4532
 
4517
4533
  // src/extensions/views/node-views/code-block.tsx
4518
- var import_react22 = require("react");
4519
- var import_react23 = require("@tiptap/react");
4520
- var import_jsx_runtime86 = require("react/jsx-runtime");
4534
+ var import_react21 = require("react");
4535
+ var import_react22 = require("@tiptap/react");
4536
+ var import_jsx_runtime85 = require("react/jsx-runtime");
4521
4537
  var CodeBlockView = (props) => {
4522
- const [selectedLanguage, setSelectedLanguage] = (0, import_react22.useState)(props.node.attrs.language ?? "");
4538
+ const [selectedLanguage, setSelectedLanguage] = (0, import_react21.useState)(props.node.attrs.language ?? "");
4523
4539
  const translations2 = useTiptapTranslations();
4524
4540
  const handleLanguageChange = (language) => {
4525
4541
  props.updateAttributes({ language });
4526
4542
  setSelectedLanguage(language);
4527
4543
  };
4528
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
4544
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react22.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4529
4545
  CodeBlock,
4530
4546
  {
4531
4547
  language: selectedLanguage,
4532
4548
  isEditable: props.editor.isEditable,
4533
4549
  onLanguageChange: handleLanguageChange,
4534
4550
  translations: translations2,
4535
- children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.NodeViewContent, {})
4551
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react22.NodeViewContent, {})
4536
4552
  }
4537
4553
  ) });
4538
4554
  };
4539
4555
 
4540
4556
  // src/extensions/views/node-views/copyable-text.tsx
4541
- var import_react24 = require("@tiptap/react");
4542
- var import_jsx_runtime87 = require("react/jsx-runtime");
4557
+ var import_react23 = require("@tiptap/react");
4558
+ var import_jsx_runtime86 = require("react/jsx-runtime");
4543
4559
  var CopyableTextView = () => {
4544
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CopyableText2, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.MarkViewContent, {}) });
4560
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(CopyableText2, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_react23.MarkViewContent, {}) });
4545
4561
  };
4546
4562
 
4547
4563
  // src/extensions/views/node-views/custom-quote.tsx
4548
- var import_react25 = require("@tiptap/react");
4549
- var import_jsx_runtime88 = require("react/jsx-runtime");
4564
+ var import_react24 = require("@tiptap/react");
4565
+ var import_jsx_runtime87 = require("react/jsx-runtime");
4550
4566
  var CustomQuoteView = () => {
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, {}) }) });
4567
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(CustomQuote, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewContent, {}) }) });
4552
4568
  };
4553
4569
  var CustomQuoteTextView = (props) => {
4554
4570
  const isEmpty = !props.node.content.size;
4555
4571
  const translations2 = useTiptapTranslations();
4556
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4572
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
4557
4573
  CustomQuoteText,
4558
4574
  {
4559
4575
  isEmpty,
4560
4576
  placeholder: translations2.customQuote.textPlaceholder,
4561
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4577
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4562
4578
  }
4563
4579
  ) });
4564
4580
  };
4565
4581
  var CustomQuoteAuthorView = (props) => {
4566
4582
  const isEmpty = !props.node.content.size;
4567
4583
  const translations2 = useTiptapTranslations();
4568
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4584
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
4569
4585
  CustomQuoteAuthor,
4570
4586
  {
4571
4587
  isEmpty,
4572
4588
  placeholder: translations2.customQuote.authorPlaceholder,
4573
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4589
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4574
4590
  }
4575
4591
  ) });
4576
4592
  };
4577
4593
  var CustomQuoteSignView = (props) => {
4578
4594
  const isEmpty = !props.node.content.size;
4579
4595
  const translations2 = useTiptapTranslations();
4580
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4596
+ return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
4581
4597
  CustomQuoteSign,
4582
4598
  {
4583
4599
  isEmpty,
4584
4600
  placeholder: translations2.customQuote.signPlaceholder,
4585
- children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_react25.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4601
+ children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_react24.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4586
4602
  }
4587
4603
  ) });
4588
4604
  };
4589
4605
 
4590
4606
  // src/extensions/views/node-views/figure.tsx
4591
- var import_react26 = require("@tiptap/react");
4592
- var import_jsx_runtime89 = require("react/jsx-runtime");
4607
+ var import_react25 = require("@tiptap/react");
4608
+ var import_jsx_runtime88 = require("react/jsx-runtime");
4593
4609
  var FigureView = ({ node, getPos, editor }) => {
4594
- const { fileId, src, alt, title, caption, width, height, storageKey } = node.attrs;
4610
+ const { fileId, src, alt, title, caption, width, height } = node.attrs;
4595
4611
  const imageExtension = editor.extensionManager.extensions.find((ext) => ext.name === "image");
4596
4612
  const getImageById = imageExtension?.options.getImageById;
4597
4613
  const onFigureClick = imageExtension?.options.onFigureClick;
4598
4614
  const handleEditClick = () => {
4599
4615
  onFigureClick?.(node.attrs, getPos());
4600
4616
  };
4601
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
4602
- import_react26.NodeViewWrapper,
4617
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4618
+ import_react25.NodeViewWrapper,
4603
4619
  {
4604
4620
  className: "figure-node-view",
4605
4621
  "data-drag-handle": true,
4606
- children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
4622
+ children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4607
4623
  Figure,
4608
4624
  {
4609
4625
  fileId,
@@ -4623,40 +4639,40 @@ var FigureView = ({ node, getPos, editor }) => {
4623
4639
  };
4624
4640
 
4625
4641
  // src/extensions/views/node-views/prompt.tsx
4626
- var import_react27 = require("@tiptap/react");
4627
- var import_jsx_runtime90 = require("react/jsx-runtime");
4642
+ var import_react26 = require("@tiptap/react");
4643
+ var import_jsx_runtime89 = require("react/jsx-runtime");
4628
4644
  var PromptHeaderView = (props) => {
4629
4645
  const isEmpty = !props.node.content.size;
4630
4646
  const translations2 = useTiptapTranslations();
4631
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4647
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react26.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
4632
4648
  PromptHeader,
4633
4649
  {
4634
4650
  isEmpty,
4635
4651
  placeholder: translations2.prompt.headerPlaceholder,
4636
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4652
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react26.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4637
4653
  }
4638
4654
  ) });
4639
4655
  };
4640
4656
  var PromptContentView = (props) => {
4641
4657
  const isEmpty = !props.node.content.size;
4642
4658
  const translations2 = useTiptapTranslations();
4643
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4659
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react26.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
4644
4660
  PromptContent,
4645
4661
  {
4646
4662
  isEmpty,
4647
4663
  placeholder: translations2.prompt.contentPlaceholder,
4648
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4664
+ children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react26.NodeViewContent, { className: isEmpty ? "is-empty" : "" })
4649
4665
  }
4650
4666
  ) });
4651
4667
  };
4652
4668
 
4653
4669
  // src/extensions/views/node-views/video.tsx
4654
- var import_react28 = require("@tiptap/react");
4655
- var import_jsx_runtime91 = require("react/jsx-runtime");
4670
+ var import_react27 = require("@tiptap/react");
4671
+ var import_jsx_runtime90 = require("react/jsx-runtime");
4656
4672
  var VideoView = (props) => {
4657
4673
  const { src } = props.node.attrs;
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,
4674
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react27.NodeViewWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Video, { src, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4675
+ import_react27.NodeViewContent,
4660
4676
  {
4661
4677
  as: "div",
4662
4678
  className: "video-content"
@@ -4667,66 +4683,66 @@ var VideoView = (props) => {
4667
4683
  // src/extensions/editor/callout.ts
4668
4684
  var Callout2 = BaseCallout.extend({
4669
4685
  addNodeView() {
4670
- return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
4686
+ return (0, import_react28.ReactNodeViewRenderer)(CalloutView);
4671
4687
  }
4672
4688
  });
4673
4689
  var LegacyBookAlert = BaseLegacyBookAlert.extend({
4674
4690
  addNodeView() {
4675
- return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
4691
+ return (0, import_react28.ReactNodeViewRenderer)(CalloutView);
4676
4692
  }
4677
4693
  });
4678
4694
  var LegacyBookTip = BaseLegacyBookTip.extend({
4679
4695
  addNodeView() {
4680
- return (0, import_react29.ReactNodeViewRenderer)(CalloutView);
4696
+ return (0, import_react28.ReactNodeViewRenderer)(CalloutView);
4681
4697
  }
4682
4698
  });
4683
4699
 
4684
4700
  // src/extensions/editor/code-block.ts
4685
- var import_react30 = require("@tiptap/react");
4701
+ var import_react29 = require("@tiptap/react");
4686
4702
  var CodeBlock2 = BaseCodeBlock.extend({
4687
4703
  addNodeView() {
4688
- return (0, import_react30.ReactNodeViewRenderer)(CodeBlockView);
4704
+ return (0, import_react29.ReactNodeViewRenderer)(CodeBlockView);
4689
4705
  }
4690
4706
  });
4691
4707
 
4692
4708
  // src/extensions/editor/custom-quote.ts
4693
- var import_react31 = require("@tiptap/react");
4709
+ var import_react30 = require("@tiptap/react");
4694
4710
  var CustomQuote2 = BaseCustomQuote.extend({
4695
4711
  addNodeView() {
4696
- return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteView);
4712
+ return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteView);
4697
4713
  }
4698
4714
  });
4699
4715
  var CustomQuoteText2 = BaseCustomQuoteText.extend({
4700
4716
  addNodeView() {
4701
- return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteTextView);
4717
+ return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteTextView);
4702
4718
  }
4703
4719
  });
4704
4720
  var CustomQuoteAuthor2 = BaseCustomQuoteAuthor.extend({
4705
4721
  addNodeView() {
4706
- return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteAuthorView);
4722
+ return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteAuthorView);
4707
4723
  }
4708
4724
  });
4709
4725
  var CustomQuoteSign2 = BaseCustomQuoteSign.extend({
4710
4726
  addNodeView() {
4711
- return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteSignView);
4727
+ return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteSignView);
4712
4728
  }
4713
4729
  });
4714
4730
  var LegacySEQuote = BaseLegacySEQuote.extend({
4715
4731
  addNodeView() {
4716
- return (0, import_react31.ReactNodeViewRenderer)(CustomQuoteView);
4732
+ return (0, import_react30.ReactNodeViewRenderer)(CustomQuoteView);
4717
4733
  }
4718
4734
  });
4719
4735
 
4720
4736
  // src/extensions/editor/video.ts
4721
- var import_react32 = require("@tiptap/react");
4737
+ var import_react31 = require("@tiptap/react");
4722
4738
  var Video2 = BaseVideo.extend({
4723
4739
  addNodeView() {
4724
- return (0, import_react32.ReactNodeViewRenderer)(VideoView);
4740
+ return (0, import_react31.ReactNodeViewRenderer)(VideoView);
4725
4741
  }
4726
4742
  });
4727
4743
  var LegacyYouTube = BaseLegacyYouTube.extend({
4728
4744
  addNodeView() {
4729
- return (0, import_react32.ReactNodeViewRenderer)(VideoView);
4745
+ return (0, import_react31.ReactNodeViewRenderer)(VideoView);
4730
4746
  }
4731
4747
  });
4732
4748
 
@@ -5142,46 +5158,196 @@ function getSharedExtensions() {
5142
5158
  }
5143
5159
 
5144
5160
  // src/extensions/editor/copyable-text.ts
5145
- var import_react33 = require("@tiptap/react");
5161
+ var import_react32 = require("@tiptap/react");
5146
5162
  var CopyableText3 = CopyableText.extend({
5147
5163
  addMarkView() {
5148
- return (0, import_react33.ReactMarkViewRenderer)(CopyableTextView);
5164
+ return (0, import_react32.ReactMarkViewRenderer)(CopyableTextView);
5149
5165
  }
5150
5166
  });
5151
5167
 
5152
5168
  // src/extensions/editor/prompt.ts
5153
- var import_react34 = require("@tiptap/react");
5169
+ var import_react33 = require("@tiptap/react");
5154
5170
  var PromptHeader2 = BasePromptHeader.extend({
5155
5171
  addNodeView() {
5156
- return (0, import_react34.ReactNodeViewRenderer)(PromptHeaderView);
5172
+ return (0, import_react33.ReactNodeViewRenderer)(PromptHeaderView);
5157
5173
  }
5158
5174
  });
5159
5175
  var PromptContent2 = BasePromptContent.extend({
5160
5176
  addNodeView() {
5161
- return (0, import_react34.ReactNodeViewRenderer)(PromptContentView);
5177
+ return (0, import_react33.ReactNodeViewRenderer)(PromptContentView);
5162
5178
  }
5163
5179
  });
5164
5180
  var LegacyPromptSEHeader = BaseLegacyPromptSEHeader.extend({
5165
5181
  addNodeView() {
5166
- return (0, import_react34.ReactNodeViewRenderer)(PromptHeaderView);
5182
+ return (0, import_react33.ReactNodeViewRenderer)(PromptHeaderView);
5167
5183
  }
5168
5184
  });
5169
5185
  var LegacyPromptSEContent = BaseLegacyPromptSEContent.extend({
5170
5186
  addNodeView() {
5171
- return (0, import_react34.ReactNodeViewRenderer)(PromptContentView);
5187
+ return (0, import_react33.ReactNodeViewRenderer)(PromptContentView);
5172
5188
  }
5173
5189
  });
5174
5190
 
5175
5191
  // src/extensions/editor/figure.ts
5176
- var import_react35 = require("@tiptap/react");
5192
+ var import_react34 = require("@tiptap/react");
5193
+ var import_core17 = require("@tiptap/core");
5177
5194
  var Figure2 = BaseFigure.extend({
5178
5195
  addNodeView() {
5179
- return (0, import_react35.ReactNodeViewRenderer)(FigureView);
5196
+ const resizeOptions = this.options.resize;
5197
+ if (!resizeOptions) {
5198
+ return (0, import_react34.ReactNodeViewRenderer)(FigureView);
5199
+ }
5200
+ return (props) => {
5201
+ const { node, getPos, editor } = props;
5202
+ const attrs = node.attrs;
5203
+ const imageExtension = editor.extensionManager.extensions.find(
5204
+ (ext) => ext.name === "image"
5205
+ );
5206
+ const getImageById = imageExtension?.options.getImageById;
5207
+ let imgSrc = attrs.src;
5208
+ if (attrs.fileId && getImageById) {
5209
+ const resolvedSrc = getImageById(attrs.fileId);
5210
+ if (resolvedSrc) imgSrc = resolvedSrc;
5211
+ }
5212
+ let maxWidth;
5213
+ try {
5214
+ if (editor.view?.dom) {
5215
+ const contentWrapper = editor.view.dom.closest(".tiptap-content-wrapper");
5216
+ if (contentWrapper && contentWrapper.clientWidth > 0) {
5217
+ maxWidth = contentWrapper.clientWidth - 32;
5218
+ }
5219
+ }
5220
+ } catch {
5221
+ }
5222
+ let naturalAspectRatio;
5223
+ let maxHeight;
5224
+ const constrainDimensions = (w, h) => {
5225
+ let constrainedW = w;
5226
+ let constrainedH = h;
5227
+ if (maxWidth && maxHeight && naturalAspectRatio && w >= maxWidth) {
5228
+ constrainedW = maxWidth;
5229
+ constrainedH = maxHeight;
5230
+ }
5231
+ return { width: constrainedW, height: constrainedH };
5232
+ };
5233
+ const updateImageDimensions = (width, height) => {
5234
+ imageContainer.style.width = `${width}px`;
5235
+ imageContainer.style.height = `${height}px`;
5236
+ };
5237
+ const figure = document.createElement("figure");
5238
+ figure.setAttribute("data-drag-handle", "");
5239
+ const imageContainer = document.createElement("div");
5240
+ imageContainer.className = "figure-image-container";
5241
+ const img = document.createElement("img");
5242
+ img.src = imgSrc || "";
5243
+ if (attrs.alt) img.alt = attrs.alt;
5244
+ if (attrs.title) img.title = attrs.title;
5245
+ if (attrs.width && attrs.height) {
5246
+ imageContainer.style.width = `${attrs.width}px`;
5247
+ imageContainer.style.height = `${attrs.height}px`;
5248
+ }
5249
+ img.onload = () => {
5250
+ naturalAspectRatio = img.naturalHeight / img.naturalWidth;
5251
+ if (maxWidth && naturalAspectRatio) {
5252
+ maxHeight = Math.round(maxWidth * naturalAspectRatio);
5253
+ }
5254
+ };
5255
+ imageContainer.appendChild(img);
5256
+ if (editor.isEditable) {
5257
+ const editButton = document.createElement("button");
5258
+ editButton.type = "button";
5259
+ editButton.className = "figure-edit-button";
5260
+ editButton.contentEditable = "false";
5261
+ editButton.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="21" height="20" viewBox="0 0 21 20" fill="none"><path d="M2.52441 14.3751V17.5001H5.64941L14.8661 8.28346L11.7411 5.15846L2.52441 14.3751ZM17.2827 5.8668C17.6077 5.5418 17.6077 5.0168 17.2827 4.6918L15.3327 2.7418C15.0077 2.4168 14.4827 2.4168 14.1577 2.7418L12.6327 4.2668L15.7577 7.3918L17.2827 5.8668Z" fill="currentColor"/></svg>';
5262
+ editButton.addEventListener("click", () => {
5263
+ const onFigureClick = imageExtension?.options.onFigureClick;
5264
+ const pos = getPos();
5265
+ if (onFigureClick && typeof pos === "number") {
5266
+ onFigureClick(attrs, pos);
5267
+ }
5268
+ });
5269
+ imageContainer.appendChild(editButton);
5270
+ }
5271
+ const resizableView = new import_core17.ResizableNodeView({
5272
+ element: imageContainer,
5273
+ node,
5274
+ getPos,
5275
+ onResize: (w, h) => {
5276
+ const { width, height } = constrainDimensions(w, h);
5277
+ updateImageDimensions(width, height);
5278
+ },
5279
+ onCommit: (w, h) => {
5280
+ const { width, height } = constrainDimensions(w, h);
5281
+ const pos = getPos();
5282
+ if (typeof pos === "number") {
5283
+ updateImageDimensions(Math.round(width), Math.round(height));
5284
+ editor.chain().focus().setNodeSelection(pos).updateAttributes("image", {
5285
+ width: Math.round(width),
5286
+ height: Math.round(height)
5287
+ }).run();
5288
+ }
5289
+ },
5290
+ onUpdate: (updatedNode) => {
5291
+ if (updatedNode.attrs.width) {
5292
+ imageContainer.style.width = `${updatedNode.attrs.width}px`;
5293
+ }
5294
+ if (updatedNode.attrs.height) {
5295
+ imageContainer.style.height = `${updatedNode.attrs.height}px`;
5296
+ }
5297
+ const existingCaption = figure.querySelector("figcaption");
5298
+ if (updatedNode.attrs.caption && !existingCaption) {
5299
+ const figcaption = document.createElement("figcaption");
5300
+ figcaption.textContent = updatedNode.attrs.caption;
5301
+ figure.appendChild(figcaption);
5302
+ } else if (existingCaption) {
5303
+ if (updatedNode.attrs.caption) {
5304
+ existingCaption.textContent = updatedNode.attrs.caption;
5305
+ } else {
5306
+ existingCaption.remove();
5307
+ }
5308
+ }
5309
+ if (updatedNode.type !== node.type) return false;
5310
+ return true;
5311
+ },
5312
+ options: {
5313
+ directions: resizeOptions.directions || [
5314
+ "bottom-right",
5315
+ "bottom-left",
5316
+ "top-right",
5317
+ "top-left"
5318
+ ],
5319
+ min: {
5320
+ width: resizeOptions.minWidth || 100,
5321
+ height: resizeOptions.minHeight || 100
5322
+ },
5323
+ max: maxWidth && maxHeight ? { width: maxWidth, height: maxHeight } : void 0,
5324
+ preserveAspectRatio: true,
5325
+ className: {
5326
+ container: "tiptap-resize-container",
5327
+ wrapper: "tiptap-resize-wrapper",
5328
+ handle: "tiptap-resize-handle",
5329
+ resizing: "is-resizing"
5330
+ }
5331
+ }
5332
+ });
5333
+ figure.appendChild(resizableView.dom);
5334
+ if (attrs.caption) {
5335
+ const figcaption = document.createElement("figcaption");
5336
+ figcaption.textContent = attrs.caption;
5337
+ figure.appendChild(figcaption);
5338
+ }
5339
+ return {
5340
+ dom: figure,
5341
+ contentDOM: resizableView.contentDOM,
5342
+ update: resizableView.update.bind(resizableView),
5343
+ destroy: resizableView.destroy?.bind(resizableView)
5344
+ };
5345
+ };
5180
5346
  }
5181
5347
  });
5182
5348
  var LegacyFigure = BaseLegacyFigure.extend({
5183
5349
  addNodeView() {
5184
- return (0, import_react35.ReactNodeViewRenderer)(FigureView);
5350
+ return (0, import_react34.ReactNodeViewRenderer)(FigureView);
5185
5351
  }
5186
5352
  });
5187
5353
 
@@ -5210,8 +5376,14 @@ function getEditorExtensions(options) {
5210
5376
  PromptHeader2,
5211
5377
  PromptContent2,
5212
5378
  Video2,
5213
- // Configure with optional getImageById for URL resolution and onFigureClick callback
5214
- Figure2.configure({ getImageById, onFigureClick }),
5379
+ Figure2.configure({
5380
+ getImageById,
5381
+ onFigureClick,
5382
+ resize: {
5383
+ enabled: true,
5384
+ directions: ["top-left", "top-right", "bottom-left", "bottom-right"]
5385
+ }
5386
+ }),
5215
5387
  import_extension_mathematics.Mathematics.configure({
5216
5388
  katexOptions: {
5217
5389
  throwOnError: false
@@ -5352,8 +5524,8 @@ var createHandleKatexAdd = (editor, closeDialogCommand, savedPos) => {
5352
5524
 
5353
5525
  // src/editor/commands/suggestion.tsx
5354
5526
  var import_dom = require("@floating-ui/dom");
5355
- var import_core17 = require("@tiptap/core");
5356
- var import_react36 = require("@tiptap/react");
5527
+ var import_core18 = require("@tiptap/core");
5528
+ var import_react35 = require("@tiptap/react");
5357
5529
 
5358
5530
  // src/editor/commands/items.ts
5359
5531
  var getCommandItems = (translations2, hasImageHandlers) => [
@@ -5654,7 +5826,7 @@ var filterCommandItems = (items, query) => {
5654
5826
  };
5655
5827
 
5656
5828
  // src/editor/commands/suggestion.tsx
5657
- var import_jsx_runtime92 = require("react/jsx-runtime");
5829
+ var import_jsx_runtime91 = require("react/jsx-runtime");
5658
5830
  var component = null;
5659
5831
  var closeMenu = () => {
5660
5832
  if (component) {
@@ -5668,7 +5840,7 @@ var mapCommandMenuItemToCommandItem = (item) => {
5668
5840
  const IconComponent = item.icon;
5669
5841
  return {
5670
5842
  title: item.title,
5671
- icon: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(IconComponent, {}),
5843
+ icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(IconComponent, {}),
5672
5844
  command: ({ editor, range }) => {
5673
5845
  editor.chain().focus().deleteRange(range).run();
5674
5846
  item.onClick(editor);
@@ -5686,7 +5858,7 @@ var createSuggestions = (translations2, hasImageHandlers) => ({
5686
5858
  render: () => {
5687
5859
  return {
5688
5860
  onStart: async (props) => {
5689
- component = new import_react36.ReactRenderer(CommandsList, {
5861
+ component = new import_react35.ReactRenderer(CommandsList, {
5690
5862
  props,
5691
5863
  editor: props.editor
5692
5864
  });
@@ -5696,7 +5868,7 @@ var createSuggestions = (translations2, hasImageHandlers) => ({
5696
5868
  component.element.style.position = "absolute";
5697
5869
  document.body.appendChild(component.element);
5698
5870
  const virtualElement = {
5699
- getBoundingClientRect: () => (0, import_core17.posToDOMRect)(
5871
+ getBoundingClientRect: () => (0, import_core18.posToDOMRect)(
5700
5872
  props.editor.view,
5701
5873
  props.editor.state.selection.from,
5702
5874
  props.editor.state.selection.to
@@ -5723,7 +5895,7 @@ var createSuggestions = (translations2, hasImageHandlers) => ({
5723
5895
  return;
5724
5896
  }
5725
5897
  const virtualElement = {
5726
- getBoundingClientRect: () => (0, import_core17.posToDOMRect)(
5898
+ getBoundingClientRect: () => (0, import_core18.posToDOMRect)(
5727
5899
  props.editor.view,
5728
5900
  props.editor.state.selection.from,
5729
5901
  props.editor.state.selection.to
@@ -6099,7 +6271,7 @@ function getTranslations(lang) {
6099
6271
  }
6100
6272
 
6101
6273
  // src/editor/editor.tsx
6102
- var import_jsx_runtime93 = require("react/jsx-runtime");
6274
+ var import_jsx_runtime92 = require("react/jsx-runtime");
6103
6275
  function TiptapContent({
6104
6276
  content,
6105
6277
  handleChange,
@@ -6109,12 +6281,12 @@ function TiptapContent({
6109
6281
  lang,
6110
6282
  error
6111
6283
  }) {
6112
- const [linkDialogContext, setLinkDialogContext] = (0, import_react37.useState)(null);
6113
- const [katexDialogContext, setKatexDialogContext] = (0, import_react37.useState)(
6284
+ const [linkDialogContext, setLinkDialogContext] = (0, import_react36.useState)(null);
6285
+ const [katexDialogContext, setKatexDialogContext] = (0, import_react36.useState)(
6114
6286
  null
6115
6287
  );
6116
- const [editFigureContext, setEditFigureContext] = (0, import_react37.useState)(null);
6117
- const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react37.useState)(void 0);
6288
+ const [editFigureContext, setEditFigureContext] = (0, import_react36.useState)(null);
6289
+ const [savedDialogCursorPos, setSavedDialogCursorPos] = (0, import_react36.useState)(void 0);
6118
6290
  const { activeDialog, closeDialogCommand, openDialogCommand } = useDialogCommand();
6119
6291
  const translations2 = useTiptapTranslations();
6120
6292
  let safeContent;
@@ -6123,7 +6295,7 @@ function TiptapContent({
6123
6295
  } catch {
6124
6296
  safeContent = { type: "doc", content: [{ type: "paragraph" }] };
6125
6297
  }
6126
- const editor = (0, import_react38.useEditor)(
6298
+ const editor = (0, import_react37.useEditor)(
6127
6299
  {
6128
6300
  editable: isEditable && !isDisabled,
6129
6301
  extensions: getEditorExtensions({
@@ -6165,7 +6337,7 @@ function TiptapContent({
6165
6337
  },
6166
6338
  [lang]
6167
6339
  );
6168
- (0, import_react37.useEffect)(() => {
6340
+ (0, import_react36.useEffect)(() => {
6169
6341
  if (activeDialog && editor && !editor.isDestroyed) {
6170
6342
  const pos = editor.state.selection.from;
6171
6343
  setSavedDialogCursorPos(pos);
@@ -6192,7 +6364,7 @@ function TiptapContent({
6192
6364
  const katexHandler = createHandleKatexAdd(editor, handleCloseDialog, savedDialogCursorPos);
6193
6365
  katexHandler(latex, katexDialogContext?.pos);
6194
6366
  };
6195
- (0, import_react37.useEffect)(() => {
6367
+ (0, import_react36.useEffect)(() => {
6196
6368
  if (!editor || editor.isDestroyed) return;
6197
6369
  editor.commands.setContent(safeContent, {
6198
6370
  emitUpdate: false
@@ -6211,16 +6383,16 @@ function TiptapContent({
6211
6383
  return true;
6212
6384
  };
6213
6385
  if (!editor) return null;
6214
- return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
6215
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DragHandle, { editor }),
6216
- isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TableMenu, { editor }),
6217
- isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
6386
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
6387
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DragHandle, { editor }),
6388
+ isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TableMenu, { editor }),
6389
+ isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
6218
6390
  import_menus.BubbleMenu,
6219
6391
  {
6220
6392
  shouldShow: shouldBubbleMenuShow,
6221
6393
  editor,
6222
6394
  options: { placement: "bottom", offset: 8, flip: true },
6223
- children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
6395
+ children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
6224
6396
  BubbleMenuContent,
6225
6397
  {
6226
6398
  editor,
@@ -6229,19 +6401,19 @@ function TiptapContent({
6229
6401
  )
6230
6402
  }
6231
6403
  ),
6232
- /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(
6404
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
6233
6405
  "div",
6234
6406
  {
6235
6407
  className: `tiptap-content-wrapper ${!!error ? "has-error" : ""} ${isDisabled ? "is-disabled" : ""}`,
6236
6408
  children: [
6237
- /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_react38.EditorContent, { editor }),
6238
- isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(CharacterCount, { editor })
6409
+ /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(import_react37.EditorContent, { editor }),
6410
+ isEditable && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(CharacterCount, { editor })
6239
6411
  ]
6240
6412
  }
6241
6413
  ),
6242
- !!error && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "tiptap-error-message", children: error }),
6243
- isEditable && /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
6244
- activeDialog === "image" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
6414
+ !!error && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "tiptap-error-message", children: error }),
6415
+ isEditable && /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(import_jsx_runtime92.Fragment, { children: [
6416
+ activeDialog === "image" && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
6245
6417
  ImageDialog,
6246
6418
  {
6247
6419
  open: true,
@@ -6254,7 +6426,7 @@ function TiptapContent({
6254
6426
  mode: editFigureContext ? "edit" : "add"
6255
6427
  }
6256
6428
  ),
6257
- activeDialog === "link" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
6429
+ activeDialog === "link" && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
6258
6430
  AddLinkDialog,
6259
6431
  {
6260
6432
  open: true,
@@ -6263,7 +6435,7 @@ function TiptapContent({
6263
6435
  linkDialogContext
6264
6436
  }
6265
6437
  ),
6266
- activeDialog === "video" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
6438
+ activeDialog === "video" && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
6267
6439
  AddVideoDialog,
6268
6440
  {
6269
6441
  open: true,
@@ -6271,7 +6443,7 @@ function TiptapContent({
6271
6443
  onVideoAdd: handleVideoAdd
6272
6444
  }
6273
6445
  ),
6274
- activeDialog === "katex" && /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
6446
+ activeDialog === "katex" && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
6275
6447
  AddKatexDialog,
6276
6448
  {
6277
6449
  open: true,
@@ -6286,7 +6458,7 @@ function TiptapContent({
6286
6458
  var Tiptap = (props) => {
6287
6459
  const { lang = "ru" } = props;
6288
6460
  const translations2 = getTranslations(lang);
6289
- return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TiptapTranslationsProvider, { translations: translations2, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DialogCommandProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TiptapContent, { ...props }) }) });
6461
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TiptapTranslationsProvider, { translations: translations2, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(DialogCommandProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TiptapContent, { ...props }) }) });
6290
6462
  };
6291
6463
  // Annotate the CommonJS export names for ESM import in node:
6292
6464
  0 && (module.exports = {