tiptap-markdown-react 0.15.0 → 0.16.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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Markdown, MarkdownManager } from "@tiptap/markdown";
3
- import { c as renderOrUpdateChart, d as destroyChart } from "./scrollToTocHeading-DTphNbqx.js";
4
- import { C, a, R, b, f, m, r, s } from "./scrollToTocHeading-DTphNbqx.js";
3
+ import { c as renderOrUpdateChart, d as destroyChart } from "./scrollToTocHeading-CBvptTaQ.js";
4
+ import { C, a, R, b, f, m, r, s } from "./scrollToTocHeading-CBvptTaQ.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";
@@ -11,10 +11,10 @@ import { TableOfContents } from "@tiptap/extension-table-of-contents";
11
11
  import { NodeViewWrapper, ReactNodeViewRenderer, useEditorState, ReactRenderer, NodeViewContent, useEditor, EditorContent } from "@tiptap/react";
12
12
  import { createPortal } from "react-dom";
13
13
  import { useState, useEffect, useCallback, useRef, useMemo, forwardRef, useImperativeHandle, Fragment as Fragment$1, useId, useContext, createContext } from "react";
14
- import { e as enrichMarkdownCitations, c as styles$8 } from "./ReportContent-JC-DkC9D.js";
15
- import { R as R2, a as a2, b as b2, s as s2 } from "./ReportContent-JC-DkC9D.js";
16
- import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, p as prepareChartMarkdown, j as reportChart, b as baseExtensions, f as CommentMark, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, a as pureCodeBlock, c as pureImage, n as renderMathInto, o as subscribeMathClick, d as pureChart } from "./extractToc-FJquRnX7.js";
17
- import { g, e, s as s3 } from "./extractToc-FJquRnX7.js";
14
+ import { e as enrichMarkdownCitations, c as styles$8 } from "./ReportContent-CwcppHl8.js";
15
+ import { R as R2, a as a2, b as b2, s as s2 } from "./ReportContent-CwcppHl8.js";
16
+ import { C as CitationRef, i as mergeCommentIntervals, h as mapCommentAnchors, p as prepareChartMarkdown, j as reportChart, b as baseExtensions, f as CommentMark, l as lowlight, m as makeTocGetId, k as parseCodeTokenAsChartOrCodeBlock, a as pureCodeBlock, c as pureImage, n as renderMathInto, o as subscribeMathClick, d as pureChart } from "./extractToc-CheLC9kh.js";
17
+ import { g, e, s as s3 } from "./extractToc-CheLC9kh.js";
18
18
  import { Slice, Fragment } from "@tiptap/pm/model";
19
19
  import { Extension, Node as Node$1 } from "@tiptap/core";
20
20
  import { PluginKey, Plugin, NodeSelection, TextSelection } from "@tiptap/pm/state";
@@ -2120,7 +2120,8 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
2120
2120
  slashMenu = true,
2121
2121
  slashMenuLabels,
2122
2122
  shortcutPanel = true,
2123
- shortcutLabels
2123
+ shortcutLabels,
2124
+ shortcutFabContainer
2124
2125
  }, ref) {
2125
2126
  const preparedInitial = prepareChartMarkdown(
2126
2127
  enrichMarkdownCitations(initialMarkdown, sources ?? [])
@@ -2344,6 +2345,19 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
2344
2345
  () => ({ ...defaultShortcutLabels, ...shortcutLabels }),
2345
2346
  [shortcutLabels]
2346
2347
  );
2348
+ const shortcutFabTarget = typeof shortcutFabContainer === "function" ? shortcutFabContainer() : shortcutFabContainer ?? null;
2349
+ const shortcutFabNode = shortcutPanel && editable ? /* @__PURE__ */ jsx(
2350
+ "button",
2351
+ {
2352
+ type: "button",
2353
+ className: shortcutFabTarget ? `${styles$8.shortcutFab} ${styles$8.shortcutFabHosted}` : styles$8.shortcutFab,
2354
+ title: shortcutT.panelTitle,
2355
+ "aria-label": shortcutT.panelTitle,
2356
+ "aria-expanded": shortcutsOpen,
2357
+ onClick: () => setShortcutsOpen((v) => !v),
2358
+ children: /* @__PURE__ */ jsx(KeyboardIcon, { size: 18 })
2359
+ }
2360
+ ) : null;
2347
2361
  return /* @__PURE__ */ jsxs("div", { className: styles$8.editorHost, children: [
2348
2362
  findBarNode && !findBarTarget ? /* @__PURE__ */ jsx("div", { className: styles$8.findBarAnchor, children: findBarNode }) : null,
2349
2363
  findBarNode && findBarTarget ? createPortal(findBarNode, findBarTarget) : null,
@@ -2354,18 +2368,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
2354
2368
  className: className ? `${styles$8.editorScroll} ${className}` : styles$8.editorScroll
2355
2369
  }
2356
2370
  ),
2357
- shortcutPanel && editable ? /* @__PURE__ */ jsx(
2358
- "button",
2359
- {
2360
- type: "button",
2361
- className: styles$8.shortcutFab,
2362
- title: shortcutT.panelTitle,
2363
- "aria-label": shortcutT.panelTitle,
2364
- "aria-expanded": shortcutsOpen,
2365
- onClick: () => setShortcutsOpen((v) => !v),
2366
- children: /* @__PURE__ */ jsx(KeyboardIcon, { size: 18 })
2367
- }
2368
- ) : null,
2371
+ shortcutFabNode && shortcutFabTarget ? createPortal(shortcutFabNode, shortcutFabTarget) : shortcutFabNode,
2369
2372
  shortcutPanel && editable ? /* @__PURE__ */ jsx(
2370
2373
  ShortcutPanel,
2371
2374
  {