tiptap-markdown-react 0.15.0 → 0.16.1
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/{ReportContent-JC-DkC9D.js → ReportContent-CwcppHl8.js} +10 -8
- package/dist/{ReportContent-JC-DkC9D.js.map → ReportContent-CwcppHl8.js.map} +1 -1
- package/dist/components/MarkdownWysiwygEditor.d.ts +8 -0
- package/dist/components/shortcutFabContainer.test.d.ts +1 -0
- package/dist/{extractToc-FJquRnX7.js → extractToc-CheLC9kh.js} +2 -2
- package/dist/{extractToc-FJquRnX7.js.map → extractToc-CheLC9kh.js.map} +1 -1
- package/dist/index.js +30 -20
- package/dist/index.js.map +1 -1
- package/dist/reader.js +2 -2
- package/dist/{scrollToTocHeading-DTphNbqx.js → scrollToTocHeading-CBvptTaQ.js} +2 -2
- package/dist/{scrollToTocHeading-DTphNbqx.js.map → scrollToTocHeading-CBvptTaQ.js.map} +1 -1
- package/dist/server.js +4 -4
- package/dist/style.css +61 -54
- package/package.json +1 -1
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-
|
|
4
|
-
import { C, a, R, b, f, m, r, s } from "./scrollToTocHeading-
|
|
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";
|
|
@@ -10,11 +10,11 @@ import Image from "@tiptap/extension-image";
|
|
|
10
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
|
-
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-
|
|
15
|
-
import { R as R2, a as a2, b as b2, s as s2 } from "./ReportContent-
|
|
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-
|
|
17
|
-
import { g, e, s as s3 } from "./extractToc-
|
|
13
|
+
import { useState, useEffect, useCallback, useRef, useMemo, forwardRef, useImperativeHandle, Fragment as Fragment$1, useLayoutEffect, useId, useContext, createContext } from "react";
|
|
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,26 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
2344
2345
|
() => ({ ...defaultShortcutLabels, ...shortcutLabels }),
|
|
2345
2346
|
[shortcutLabels]
|
|
2346
2347
|
);
|
|
2348
|
+
const [shortcutFabTarget, setShortcutFabTarget] = useState(
|
|
2349
|
+
null
|
|
2350
|
+
);
|
|
2351
|
+
const useIsoLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
2352
|
+
useIsoLayoutEffect(() => {
|
|
2353
|
+
const target = typeof shortcutFabContainer === "function" ? shortcutFabContainer() : shortcutFabContainer ?? null;
|
|
2354
|
+
setShortcutFabTarget((prev) => prev === target ? prev : target);
|
|
2355
|
+
});
|
|
2356
|
+
const shortcutFabNode = shortcutPanel && editable ? /* @__PURE__ */ jsx(
|
|
2357
|
+
"button",
|
|
2358
|
+
{
|
|
2359
|
+
type: "button",
|
|
2360
|
+
className: shortcutFabTarget ? `${styles$8.shortcutFab} ${styles$8.shortcutFabHosted}` : styles$8.shortcutFab,
|
|
2361
|
+
title: shortcutT.panelTitle,
|
|
2362
|
+
"aria-label": shortcutT.panelTitle,
|
|
2363
|
+
"aria-expanded": shortcutsOpen,
|
|
2364
|
+
onClick: () => setShortcutsOpen((v) => !v),
|
|
2365
|
+
children: /* @__PURE__ */ jsx(KeyboardIcon, { size: 18 })
|
|
2366
|
+
}
|
|
2367
|
+
) : null;
|
|
2347
2368
|
return /* @__PURE__ */ jsxs("div", { className: styles$8.editorHost, children: [
|
|
2348
2369
|
findBarNode && !findBarTarget ? /* @__PURE__ */ jsx("div", { className: styles$8.findBarAnchor, children: findBarNode }) : null,
|
|
2349
2370
|
findBarNode && findBarTarget ? createPortal(findBarNode, findBarTarget) : null,
|
|
@@ -2354,18 +2375,7 @@ const MarkdownWysiwygEditor = forwardRef(function MarkdownWysiwygEditor2({
|
|
|
2354
2375
|
className: className ? `${styles$8.editorScroll} ${className}` : styles$8.editorScroll
|
|
2355
2376
|
}
|
|
2356
2377
|
),
|
|
2357
|
-
|
|
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,
|
|
2378
|
+
shortcutFabNode && shortcutFabTarget ? createPortal(shortcutFabNode, shortcutFabTarget) : shortcutFabNode,
|
|
2369
2379
|
shortcutPanel && editable ? /* @__PURE__ */ jsx(
|
|
2370
2380
|
ShortcutPanel,
|
|
2371
2381
|
{
|