tiptap-markdown-react 1.3.3 → 1.4.0

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Markdown, MarkdownManager } from "@tiptap/markdown";
3
- import { g as getLocaleBundle, S as SearchIcon, d as ChevronUpIcon, e as ChevronDownIcon, X as XIcon, h as ReplaceIcon, i as ReplaceAllIcon, j as renderOrUpdateChart, k as destroyChart, l as CheckIcon, T as TrashIcon, n as CopyIcon, o as ChevronsUpDownIcon, G as GripIcon, E as EraserIcon, D as DownloadIcon, u as useIsMobile, K as KeyboardIcon, p as EditorToc, I as ImagePreviewHost, q as sameTocItems$1, A as AlignRightIcon, t as AlignCenterIcon, v as AlignLeftIcon, w as CropIcon, x as CaptionsIcon, y as ExpandIcon, z as requestImagePreview, B as RotateCcwIcon, F as ExternalLinkIcon, H as TableDeleteIcon, J as ColumnBeforeIcon, L as ColumnAfterIcon, M as ColumnDeleteIcon, N as RowBeforeIcon, O as RowAfterIcon, P as RowDeleteIcon, U as UndoIcon, Q as RedoIcon, V as BoldIcon, W as ItalicIcon, Y as UnderlineIcon, Z as StrikethroughIcon, _ as CodeIcon, $ as LinkIcon, a0 as ImageIcon, a1 as DetailsIcon, a2 as AlignJustifyIcon, a3 as IndentIncreaseIcon, a4 as IndentDecreaseIcon, a5 as LineHeightIcon, a6 as ListUnorderedIcon, a7 as ListOrderedIcon, a8 as ListChecksIcon } from "./ReportContentWithCharts-BOskBjBI.js";
4
- import { C, a9, aa, a, ab, ac, ad, ae, b, c, af, ag, ah, f, m, r, s } from "./ReportContentWithCharts-BOskBjBI.js";
3
+ import { g as getLocaleBundle, S as SearchIcon, d as ChevronUpIcon, e as ChevronDownIcon, X as XIcon, h as ReplaceIcon, i as ReplaceAllIcon, j as renderOrUpdateChart, k as destroyChart, l as CheckIcon, T as TrashIcon, n as CopyIcon, o as ChevronsUpDownIcon, G as GripIcon, E as EraserIcon, D as DownloadIcon, u as useIsMobile, K as KeyboardIcon, p as EditorToc, I as ImagePreviewHost, q as sameTocItems$1, A as AlignRightIcon, t as AlignCenterIcon, v as AlignLeftIcon, w as CropIcon, x as CaptionsIcon, y as ExpandIcon, z as requestImagePreview, B as RotateCcwIcon, F as ExternalLinkIcon, H as TableDeleteIcon, J as ColumnBeforeIcon, L as ColumnAfterIcon, M as ColumnDeleteIcon, N as RowBeforeIcon, O as RowAfterIcon, P as RowDeleteIcon, U as UndoIcon, Q as RedoIcon, V as BoldIcon, W as ItalicIcon, Y as UnderlineIcon, Z as StrikethroughIcon, _ as CodeIcon, $ as LinkIcon, a0 as ImageIcon, a1 as DetailsIcon, a2 as AlignJustifyIcon, a3 as IndentIncreaseIcon, a4 as IndentDecreaseIcon, a5 as LineHeightIcon, a6 as ListUnorderedIcon, a7 as ListOrderedIcon, a8 as ListChecksIcon } from "./ReportContentWithCharts-3cn7_5Tz.js";
4
+ import { C, a9, aa, a, ab, ac, ad, ae, b, c, af, ag, ah, f, m, r, s } from "./ReportContentWithCharts-3cn7_5Tz.js";
5
5
  import { jsx, jsxs, Fragment as Fragment$2 } from "react/jsx-runtime";
6
6
  import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
7
7
  import FindAndReplace, { FindAndReplacePluginKey, createSearchRegex } from "@tiptap/extension-find-and-replace";
@@ -14,10 +14,10 @@ import { NodeViewWrapper, ReactNodeViewRenderer, useEditorState, ReactRenderer,
14
14
  import { Extension, Node as Node$1, mergeAttributes } from "@tiptap/core";
15
15
  import { createPortal } from "react-dom";
16
16
  import { useState, useEffect, useCallback, useRef, useMemo, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useImperativeHandle, Fragment as Fragment$1, useContext, createContext } from "react";
17
- import { q as normalizeImageAlign, l as normalizeImageCrop, m as cropImageBox, e as enrichMarkdownCitations, o as styles$e, i as imageMarkdownTokenizer, c as imageParseMarkdown, d as imageRenderMarkdown, f as imageNodeHtml, g as imageFigureParseRule, h as imageCropAttribute, j as imageCaptionAttribute, k as imageAlignAttribute, r as normalizeImageCaption } from "./ReportContent-Bc5q1bYp.js";
18
- import { R, a as a2, b as b2, s as s2 } from "./ReportContent-Bc5q1bYp.js";
19
- import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, p as prepareChartMarkdown, j as reportChart, f as CommentMark, b as baseExtensions, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, a as pureCodeBlock, c as pureImage, n as renderMathInto, o as readCurrentNumberingFormat, q as subscribeMathClick, t as applyNumberingFormat, N as NUMBERING_FORMAT_IDS, u as NUMBERING_FORMAT_LABELS, v as NUMBERING_FORMAT_PREVIEWS, d as pureChart } from "./extractToc-DiI2437D.js";
20
- import { P, g, e, s as s3 } from "./extractToc-DiI2437D.js";
17
+ import { q as normalizeImageAlign, l as normalizeImageCrop, m as cropImageBox, e as enrichMarkdownCitations, o as styles$e, i as imageMarkdownTokenizer, c as imageParseMarkdown, d as imageRenderMarkdown, f as imageNodeHtml, g as imageFigureParseRule, h as imageCropAttribute, j as imageCaptionAttribute, k as imageAlignAttribute, r as normalizeImageCaption } from "./ReportContent-B0HdrWAi.js";
18
+ import { R, a as a2, b as b2, s as s2 } from "./ReportContent-B0HdrWAi.js";
19
+ import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, p as prepareChartMarkdown, j as reportChart, f as CommentMark, b as baseExtensions, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, a as pureCodeBlock, c as pureImage, n as renderMathInto, o as readCurrentNumberingFormat, q as subscribeMathClick, t as applyNumberingFormat, N as NUMBERING_FORMAT_IDS, u as NUMBERING_FORMAT_LABELS, v as NUMBERING_FORMAT_PREVIEWS, d as pureChart } from "./extractToc-Bz924Nh4.js";
20
+ import { P, g, e, s as s3 } from "./extractToc-Bz924Nh4.js";
21
21
  import { Slice, Fragment } from "@tiptap/pm/model";
22
22
  import { PluginKey, Plugin, Selection, TextSelection, NodeSelection } from "@tiptap/pm/state";
23
23
  import { DecorationSet, Decoration } from "@tiptap/pm/view";
@@ -4292,57 +4292,61 @@ function splitTopLevelBlocks(markdown) {
4292
4292
  function stripToPlainText(markdown) {
4293
4293
  return markdown.replace(/!\[[^\]]*\]\([^)]+\)/g, "").replace(/\[([^\]]+)\]\([^)]+\)/g, "$1").replace(/^#{1,6}\s+/gm, "").replace(/^[ \t]*[-*+]\s+/gm, "").replace(/^[ \t]*\d+\.\s+/gm, "").replace(/[*_~`]+/g, "").replace(/<[^>]+>/g, "").replace(/\|/g, " ").replace(/\s+/g, " ").trim();
4294
4294
  }
4295
- const toolbar = "_toolbar_1l6t0_2";
4296
- const inner = "_inner_1l6t0_15";
4297
- const btn$2 = "_btn_1l6t0_35";
4298
- const btnActive$1 = "_btnActive_1l6t0_58";
4299
- const txtIcon = "_txtIcon_1l6t0_74";
4300
- const colorIcon = "_colorIcon_1l6t0_82";
4301
- const colorIconGlyph = "_colorIconGlyph_1l6t0_90";
4302
- const colorIconBar = "_colorIconBar_1l6t0_96";
4303
- const scriptTrigger = "_scriptTrigger_1l6t0_103";
4304
- const scriptTriggerGlyph = "_scriptTriggerGlyph_1l6t0_123";
4305
- const divider$2 = "_divider_1l6t0_131";
4306
- const styleTrigger = "_styleTrigger_1l6t0_140";
4307
- const styleTriggerLabel = "_styleTriggerLabel_1l6t0_174";
4308
- const styleTriggerCaret = "_styleTriggerCaret_1l6t0_183";
4309
- const iconTrigger = "_iconTrigger_1l6t0_190";
4310
- const styleItem = "_styleItem_1l6t0_198";
4311
- const styleIcon = "_styleIcon_1l6t0_204";
4312
- const scriptGlyph = "_scriptGlyph_1l6t0_214";
4313
- const menu = "_menu_1l6t0_226";
4314
- const menuItem = "_menuItem_1l6t0_237";
4315
- const menuItemSelected = "_menuItemSelected_1l6t0_264";
4316
- const listSplit = "_listSplit_1l6t0_279";
4317
- const listSplitActive = "_listSplitActive_1l6t0_285";
4318
- const numberingCaret = "_numberingCaret_1l6t0_297";
4319
- const numberingCaretActive = "_numberingCaretActive_1l6t0_327";
4320
- const numberingMenu = "_numberingMenu_1l6t0_331";
4321
- const numberingGrid = "_numberingGrid_1l6t0_341";
4322
- const numberingOption = "_numberingOption_1l6t0_347";
4323
- const numberingOptionActive = "_numberingOptionActive_1l6t0_362";
4324
- const numberingPreview = "_numberingPreview_1l6t0_367";
4325
- const numberingPreviewRow = "_numberingPreviewRow_1l6t0_373";
4326
- const numberingPreviewMarker = "_numberingPreviewMarker_1l6t0_388";
4327
- const numberingPreviewLine = "_numberingPreviewLine_1l6t0_396";
4328
- const tableInsertCaret = "_tableInsertCaret_1l6t0_402";
4329
- const tableSizePicker = "_tableSizePicker_1l6t0_410";
4330
- const tableSizeGrid = "_tableSizeGrid_1l6t0_420";
4331
- const tableSizeCell = "_tableSizeCell_1l6t0_425";
4332
- const tableSizeCellActive = "_tableSizeCellActive_1l6t0_435";
4333
- const tableSizeLabel = "_tableSizeLabel_1l6t0_440";
4334
- const popoverContent$1 = "_popoverContent_1l6t0_449";
4335
- const mathLayer = "_mathLayer_1l6t0_453";
4336
- const mathStack = "_mathStack_1l6t0_458";
4337
- const mathStackBlock = "_mathStackBlock_1l6t0_465";
4338
- const mathHint = "_mathHint_1l6t0_470";
4339
- const mathHintBlock = "_mathHintBlock_1l6t0_482";
4340
- const mathHintIcon = "_mathHintIcon_1l6t0_488";
4341
- const mathField = "_mathField_1l6t0_519";
4342
- const mathFieldBlock = "_mathFieldBlock_1l6t0_531";
4343
- const mathInput = "_mathInput_1l6t0_538";
4344
- const mathDone = "_mathDone_1l6t0_556";
4345
- const mathDoneKbd = "_mathDoneKbd_1l6t0_581";
4295
+ const toolbar = "_toolbar_1vr0x_2";
4296
+ const inner = "_inner_1vr0x_15";
4297
+ const btn$2 = "_btn_1vr0x_35";
4298
+ const btnActive$1 = "_btnActive_1vr0x_58";
4299
+ const txtIcon = "_txtIcon_1vr0x_74";
4300
+ const colorIcon = "_colorIcon_1vr0x_82";
4301
+ const colorIconGlyph = "_colorIconGlyph_1vr0x_90";
4302
+ const colorIconBar = "_colorIconBar_1vr0x_96";
4303
+ const scriptTrigger = "_scriptTrigger_1vr0x_103";
4304
+ const scriptTriggerGlyph = "_scriptTriggerGlyph_1vr0x_123";
4305
+ const divider$2 = "_divider_1vr0x_131";
4306
+ const styleTrigger = "_styleTrigger_1vr0x_140";
4307
+ const styleTriggerLabel = "_styleTriggerLabel_1vr0x_174";
4308
+ const styleTriggerStable = "_styleTriggerStable_1vr0x_184";
4309
+ const styleTriggerLabelStable = "_styleTriggerLabelStable_1vr0x_188";
4310
+ const styleTriggerSizer = "_styleTriggerSizer_1vr0x_193";
4311
+ const styleTriggerValue = "_styleTriggerValue_1vr0x_194";
4312
+ const styleTriggerCaret = "_styleTriggerCaret_1vr0x_209";
4313
+ const iconTrigger = "_iconTrigger_1vr0x_216";
4314
+ const styleItem = "_styleItem_1vr0x_224";
4315
+ const styleIcon = "_styleIcon_1vr0x_230";
4316
+ const scriptGlyph = "_scriptGlyph_1vr0x_240";
4317
+ const menu = "_menu_1vr0x_252";
4318
+ const menuItem = "_menuItem_1vr0x_263";
4319
+ const menuItemSelected = "_menuItemSelected_1vr0x_290";
4320
+ const listSplit = "_listSplit_1vr0x_305";
4321
+ const listSplitActive = "_listSplitActive_1vr0x_311";
4322
+ const numberingCaret = "_numberingCaret_1vr0x_323";
4323
+ const numberingCaretActive = "_numberingCaretActive_1vr0x_353";
4324
+ const numberingMenu = "_numberingMenu_1vr0x_357";
4325
+ const numberingGrid = "_numberingGrid_1vr0x_367";
4326
+ const numberingOption = "_numberingOption_1vr0x_373";
4327
+ const numberingOptionActive = "_numberingOptionActive_1vr0x_388";
4328
+ const numberingPreview = "_numberingPreview_1vr0x_393";
4329
+ const numberingPreviewRow = "_numberingPreviewRow_1vr0x_399";
4330
+ const numberingPreviewMarker = "_numberingPreviewMarker_1vr0x_414";
4331
+ const numberingPreviewLine = "_numberingPreviewLine_1vr0x_422";
4332
+ const tableInsertCaret = "_tableInsertCaret_1vr0x_428";
4333
+ const tableSizePicker = "_tableSizePicker_1vr0x_436";
4334
+ const tableSizeGrid = "_tableSizeGrid_1vr0x_446";
4335
+ const tableSizeCell = "_tableSizeCell_1vr0x_451";
4336
+ const tableSizeCellActive = "_tableSizeCellActive_1vr0x_461";
4337
+ const tableSizeLabel = "_tableSizeLabel_1vr0x_466";
4338
+ const popoverContent$1 = "_popoverContent_1vr0x_475";
4339
+ const mathLayer = "_mathLayer_1vr0x_479";
4340
+ const mathStack = "_mathStack_1vr0x_484";
4341
+ const mathStackBlock = "_mathStackBlock_1vr0x_491";
4342
+ const mathHint = "_mathHint_1vr0x_496";
4343
+ const mathHintBlock = "_mathHintBlock_1vr0x_508";
4344
+ const mathHintIcon = "_mathHintIcon_1vr0x_514";
4345
+ const mathField = "_mathField_1vr0x_545";
4346
+ const mathFieldBlock = "_mathFieldBlock_1vr0x_557";
4347
+ const mathInput = "_mathInput_1vr0x_564";
4348
+ const mathDone = "_mathDone_1vr0x_582";
4349
+ const mathDoneKbd = "_mathDoneKbd_1vr0x_607";
4346
4350
  const styles$6 = {
4347
4351
  toolbar,
4348
4352
  inner,
@@ -4357,6 +4361,10 @@ const styles$6 = {
4357
4361
  divider: divider$2,
4358
4362
  styleTrigger,
4359
4363
  styleTriggerLabel,
4364
+ styleTriggerStable,
4365
+ styleTriggerLabelStable,
4366
+ styleTriggerSizer,
4367
+ styleTriggerValue,
4360
4368
  styleTriggerCaret,
4361
4369
  iconTrigger,
4362
4370
  styleItem,
@@ -6668,11 +6676,18 @@ function EditorToolbar({
6668
6676
  "button",
6669
6677
  {
6670
6678
  type: "button",
6671
- className: styles$6.styleTrigger,
6672
- title: t.style,
6679
+ className: `${styles$6.styleTrigger} ${styles$6.styleTriggerStable}`,
6680
+ title: state.headingLevel ? t.headingLabel(state.headingLevel) : t.normalText,
6681
+ "aria-label": t.style,
6673
6682
  onMouseDown: (e2) => e2.preventDefault(),
6674
6683
  children: [
6675
- /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerLabel, children: t.style }),
6684
+ /* @__PURE__ */ jsxs("span", { className: `${styles$6.styleTriggerLabel} ${styles$6.styleTriggerLabelStable}`, children: [
6685
+ /* @__PURE__ */ jsxs("span", { className: styles$6.styleTriggerSizer, "aria-hidden": "true", children: [
6686
+ /* @__PURE__ */ jsx("span", { children: t.normalText }),
6687
+ HEADING_LEVELS.map((lv) => /* @__PURE__ */ jsx("span", { children: `H${lv}` }, lv))
6688
+ ] }),
6689
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerValue, children: state.headingLevel ? `H${state.headingLevel}` : t.normalText })
6690
+ ] }),
6676
6691
  /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6677
6692
  ]
6678
6693
  }
@@ -6711,13 +6726,19 @@ function EditorToolbar({
6711
6726
  "button",
6712
6727
  {
6713
6728
  type: "button",
6714
- className: styles$6.styleTrigger,
6715
- title: t.fontSize,
6729
+ className: `${styles$6.styleTrigger} ${styles$6.styleTriggerStable}`,
6730
+ title: state.fontSize || t.fontSize,
6716
6731
  "aria-label": t.fontSize,
6717
6732
  disabled: !canEditFontSize,
6718
6733
  onMouseDown: (e2) => e2.preventDefault(),
6719
6734
  children: [
6720
- /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerLabel, children: state.fontSize || t.fontSize }),
6735
+ /* @__PURE__ */ jsxs("span", { className: `${styles$6.styleTriggerLabel} ${styles$6.styleTriggerLabelStable}`, children: [
6736
+ /* @__PURE__ */ jsxs("span", { className: styles$6.styleTriggerSizer, "aria-hidden": "true", children: [
6737
+ /* @__PURE__ */ jsx("span", { children: t.fontSize }),
6738
+ FONT_SIZES.map((size) => /* @__PURE__ */ jsx("span", { children: size }, size))
6739
+ ] }),
6740
+ /* @__PURE__ */ jsx("span", { className: styles$6.styleTriggerValue, children: state.fontSize || t.fontSize })
6741
+ ] }),
6721
6742
  /* @__PURE__ */ jsx(ChevronDownIcon, { size: 12, className: styles$6.styleTriggerCaret })
6722
6743
  ]
6723
6744
  }