tiptap-notion-editor 0.7.0 → 0.7.2
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/lib/index.cjs +3 -3
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +82 -80
- package/lib/index.js.map +1 -1
- package/lib/styles/tokens.css +8 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as o, jsxs as m, Fragment as K } from "react/jsx-runtime";
|
|
2
|
-
import He, { useContext as vt, useMemo as F, createContext as yt, useState as
|
|
2
|
+
import He, { useContext as vt, useMemo as F, createContext as yt, useState as E, useEffect as V, useCallback as Re, useRef as P, useLayoutEffect as An, forwardRef as ze, useImperativeHandle as Ee } from "react";
|
|
3
3
|
import { useEditorState as j, findParentNodeClosestToPos as Mn, NodeViewWrapper as me, ReactNodeViewRenderer as fe, Node as xt, mergeAttributes as wt, ReactRenderer as De, useEditor as Tn, EditorContext as Sn, EditorContent as Ln } from "@tiptap/react";
|
|
4
4
|
import Hn from "@tiptap/extension-drag-handle-react";
|
|
5
|
-
import { ChevronRightIcon as Rn, TextAlignStart as kt, TextAlignCenter as Nt, TextAlignEnd as At, AlignVerticalJustifyStart as In, AlignVerticalJustifyCenter as
|
|
5
|
+
import { ChevronRightIcon as Rn, TextAlignStart as kt, TextAlignCenter as Nt, TextAlignEnd as At, AlignVerticalJustifyStart as In, AlignVerticalJustifyCenter as zn, AlignVerticalJustifyEnd as En, PaintBucket as Mt, EllipsisVerticalIcon as Dn, EllipsisIcon as Pn, ArrowUp as Bn, ArrowLeft as $n, ArrowDown as Vn, ArrowRight as On, SquareX as Tt, CopyIcon as Un, Trash as Pe, Plus as Be, GripVertical as Fn, RotateCcw as jn, Copy as _n, Clipboard as Wn, Link as St, Sparkles as qn, Download as Ie, RefreshCcw as Zn, Trash2 as Kn, CornerDownLeft as Gn, ExternalLink as Xn, ListIndentDecrease as Jn, ListIndentIncrease as Yn, EllipsisVertical as Qn, Subscript as eo, Superscript as to, TextAlignJustify as no, ChevronDown as Lt, Type as Ht, Heading1 as Rt, Heading2 as It, Heading3 as zt, TextQuote as Et, List as Dt, ListOrdered as $e, ListTodo as Pt, CodeXmlIcon as Bt, Bold as oo, Italic as ro, Underline as io, Strikethrough as lo, Code as ao, EqualIcon as so, FileText as rt, FileSpreadsheet as co, Presentation as uo, FileArchive as po, File as mo, Paperclip as $t, FileImage as fo, CloudUploadIcon as Vt, XIcon as ho, CheckIcon as go, Table as bo, SmilePlus as Co, Minus as vo, UploadCloud as yo } from "lucide-react";
|
|
6
6
|
import { cva as Ve } from "class-variance-authority";
|
|
7
7
|
import { Slot as xo, Tooltip as oe, DropdownMenu as O, ScrollArea as ue, Separator as wo, Popover as ye } from "radix-ui";
|
|
8
8
|
import { clsx as ko } from "clsx";
|
|
@@ -15,8 +15,8 @@ import { BubbleMenu as Kt } from "@tiptap/react/menus";
|
|
|
15
15
|
import { createPortal as We } from "react-dom";
|
|
16
16
|
import Ro from "@tiptap/extension-blockquote";
|
|
17
17
|
import { Bold as Io } from "@tiptap/extension-bold";
|
|
18
|
-
import { Code as
|
|
19
|
-
import
|
|
18
|
+
import { Code as zo } from "@tiptap/extension-code";
|
|
19
|
+
import Eo from "@tiptap/extension-code-block-lowlight";
|
|
20
20
|
import { Document as Do } from "@tiptap/extension-document";
|
|
21
21
|
import Po, { gitHubEmojis as Bo } from "@tiptap/extension-emoji";
|
|
22
22
|
import $o from "@tiptap/extension-hard-break";
|
|
@@ -223,7 +223,7 @@ function Rr({
|
|
|
223
223
|
"data-slot": "tooltip-content",
|
|
224
224
|
sideOffset: t,
|
|
225
225
|
className: x(
|
|
226
|
-
"z-
|
|
226
|
+
"z-(--notion-editor-z-tooltip) inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
227
227
|
e
|
|
228
228
|
),
|
|
229
229
|
...r,
|
|
@@ -277,7 +277,7 @@ function Xe({
|
|
|
277
277
|
sideOffset: n,
|
|
278
278
|
align: t,
|
|
279
279
|
className: x(
|
|
280
|
-
"z-
|
|
280
|
+
"z-(--notion-editor-z-menu) max-h-(--radix-dropdown-menu-content-available-height) w-(--radix-dropdown-menu-trigger-width) min-w-32 origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:overflow-hidden data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
281
281
|
e
|
|
282
282
|
),
|
|
283
283
|
...r
|
|
@@ -393,7 +393,7 @@ function Qe({
|
|
|
393
393
|
{
|
|
394
394
|
"data-slot": "dropdown-menu-sub-content",
|
|
395
395
|
className: x(
|
|
396
|
-
"z-
|
|
396
|
+
"z-(--notion-editor-z-menu) min-w-24 origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-lg ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
397
397
|
e
|
|
398
398
|
),
|
|
399
399
|
...t
|
|
@@ -452,7 +452,7 @@ function Ir({
|
|
|
452
452
|
}
|
|
453
453
|
);
|
|
454
454
|
}
|
|
455
|
-
const
|
|
455
|
+
const zr = (e) => /* @__PURE__ */ m(
|
|
456
456
|
"svg",
|
|
457
457
|
{
|
|
458
458
|
width: "24",
|
|
@@ -480,7 +480,7 @@ const Er = (e) => /* @__PURE__ */ m(
|
|
|
480
480
|
)
|
|
481
481
|
]
|
|
482
482
|
}
|
|
483
|
-
),
|
|
483
|
+
), Er = (e) => /* @__PURE__ */ m(
|
|
484
484
|
"svg",
|
|
485
485
|
{
|
|
486
486
|
width: "24",
|
|
@@ -1243,7 +1243,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1243
1243
|
{
|
|
1244
1244
|
sideOffset: 8,
|
|
1245
1245
|
alignOffset: -90,
|
|
1246
|
-
className: "w-50 z-
|
|
1246
|
+
className: "w-50 z-(--notion-editor-z-menu)",
|
|
1247
1247
|
children: [
|
|
1248
1248
|
/* @__PURE__ */ o(
|
|
1249
1249
|
$,
|
|
@@ -1293,7 +1293,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1293
1293
|
/* @__PURE__ */ o(
|
|
1294
1294
|
$,
|
|
1295
1295
|
{
|
|
1296
|
-
icon:
|
|
1296
|
+
icon: zn,
|
|
1297
1297
|
label: t.table.alignMiddle,
|
|
1298
1298
|
onClick: () => te(e, {
|
|
1299
1299
|
vertical: "middle"
|
|
@@ -1304,7 +1304,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1304
1304
|
/* @__PURE__ */ o(
|
|
1305
1305
|
$,
|
|
1306
1306
|
{
|
|
1307
|
-
icon:
|
|
1307
|
+
icon: En,
|
|
1308
1308
|
label: t.table.alignBottom,
|
|
1309
1309
|
onClick: () => te(e, {
|
|
1310
1310
|
vertical: "bottom"
|
|
@@ -1421,7 +1421,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1421
1421
|
}, nn = ({ editor: e }) => {
|
|
1422
1422
|
const t = S();
|
|
1423
1423
|
if (!e) return;
|
|
1424
|
-
const [n, r] =
|
|
1424
|
+
const [n, r] = E(() => {
|
|
1425
1425
|
const l = Ae();
|
|
1426
1426
|
return l.length > 0 ? [{ title: t.common.recentlyUsed, colors: l }, ...Y(t)] : Y(t);
|
|
1427
1427
|
});
|
|
@@ -1430,7 +1430,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1430
1430
|
/* @__PURE__ */ o(Mt, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
1431
1431
|
/* @__PURE__ */ o("span", { children: t.common.color })
|
|
1432
1432
|
] }),
|
|
1433
|
-
/* @__PURE__ */ o(Ke, { children: /* @__PURE__ */ o(Qe, { sideOffset: 8, className: "w-55 pr-px z-
|
|
1433
|
+
/* @__PURE__ */ o(Ke, { children: /* @__PURE__ */ o(Qe, { sideOffset: 8, className: "w-55 pr-px z-(--notion-editor-z-menu)", children: /* @__PURE__ */ o(se, { className: "h-90 p-0.5 pr-3", children: n.map((l) => /* @__PURE__ */ m(X, { children: [
|
|
1434
1434
|
/* @__PURE__ */ o(Xt, { className: "text-foreground", children: l.title }),
|
|
1435
1435
|
l.colors.map((i) => /* @__PURE__ */ o(
|
|
1436
1436
|
en,
|
|
@@ -1524,7 +1524,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1524
1524
|
type: t,
|
|
1525
1525
|
pluginKey: n
|
|
1526
1526
|
}) => {
|
|
1527
|
-
const r = S(), [l, i] =
|
|
1527
|
+
const r = S(), [l, i] = E(!1), a = t === "row", s = a ? Dn : Pn, d = a ? "w-3 h-full rounded flex items-center justify-center transition-colors" : "w-full h-3 rounded flex items-center justify-center transition-colors", c = (w) => {
|
|
1528
1528
|
i(w), e.chain().command(({ tr: C }) => (C.setMeta(n, { openedMenu: w }), !0)).run();
|
|
1529
1529
|
}, { isInsideTable: u, isFirstColumn: p, isLastColumn: h, isFirstRow: f, isLastRow: b } = Yr(e), g = pt(e, "row"), v = pt(e, "column");
|
|
1530
1530
|
return /* @__PURE__ */ m(Ze, { open: l, onOpenChange: c, children: [
|
|
@@ -1574,7 +1574,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1574
1574
|
/* @__PURE__ */ o(
|
|
1575
1575
|
$,
|
|
1576
1576
|
{
|
|
1577
|
-
icon: a ? Dr :
|
|
1577
|
+
icon: a ? Dr : zr,
|
|
1578
1578
|
label: a ? r.table.insertRowBefore : r.table.insertColumnBefore,
|
|
1579
1579
|
onClick: () => a ? e.chain().focus().addRowBefore().run() : e.chain().focus().addColumnBefore().run()
|
|
1580
1580
|
}
|
|
@@ -1582,7 +1582,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1582
1582
|
/* @__PURE__ */ o(
|
|
1583
1583
|
$,
|
|
1584
1584
|
{
|
|
1585
|
-
icon: a ? Pr :
|
|
1585
|
+
icon: a ? Pr : Er,
|
|
1586
1586
|
label: a ? r.table.insertRowAfter : r.table.insertColumnAfter,
|
|
1587
1587
|
onClick: () => a ? e.chain().focus().addRowAfter().run() : e.chain().focus().addColumnAfter().run()
|
|
1588
1588
|
}
|
|
@@ -1629,7 +1629,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1629
1629
|
editor: e,
|
|
1630
1630
|
setColor: t
|
|
1631
1631
|
}) => {
|
|
1632
|
-
const n = S(), [r, l] =
|
|
1632
|
+
const n = S(), [r, l] = E(() => {
|
|
1633
1633
|
const i = Ae();
|
|
1634
1634
|
return i.length > 0 ? [{ title: n.common.recentlyUsed, colors: i }, ...Y(n)] : Y(n);
|
|
1635
1635
|
});
|
|
@@ -1638,7 +1638,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1638
1638
|
/* @__PURE__ */ o(Mt, { className: "size-4 shrink-0 text-muted-foreground" }),
|
|
1639
1639
|
/* @__PURE__ */ o("span", { children: n.common.color })
|
|
1640
1640
|
] }),
|
|
1641
|
-
/* @__PURE__ */ o(Ke, { children: /* @__PURE__ */ o(Qe, { sideOffset: 8, className: "w-55 pr-px z-
|
|
1641
|
+
/* @__PURE__ */ o(Ke, { children: /* @__PURE__ */ o(Qe, { sideOffset: 8, className: "w-55 pr-px z-(--notion-editor-z-menu)", children: /* @__PURE__ */ o(se, { className: "h-90 p-0.5 pr-3", children: r.map((i) => /* @__PURE__ */ m(X, { children: [
|
|
1642
1642
|
/* @__PURE__ */ o(Xt, { className: "text-foreground", children: i.title }),
|
|
1643
1643
|
i.colors.map((a) => /* @__PURE__ */ o(
|
|
1644
1644
|
en,
|
|
@@ -1654,7 +1654,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1654
1654
|
placement: "left-start",
|
|
1655
1655
|
strategy: "absolute"
|
|
1656
1656
|
}, ti = ({ editor: e }) => {
|
|
1657
|
-
const t = S(), [n, r] =
|
|
1657
|
+
const t = S(), [n, r] = E(!1), [l, i] = E(null);
|
|
1658
1658
|
if (!e)
|
|
1659
1659
|
return;
|
|
1660
1660
|
const a = (c) => {
|
|
@@ -1814,7 +1814,7 @@ const at = (e, t) => e.chain().focus().command(({ state: n, dispatch: r }) => {
|
|
|
1814
1814
|
]
|
|
1815
1815
|
}
|
|
1816
1816
|
);
|
|
1817
|
-
},
|
|
1817
|
+
}, z = ({
|
|
1818
1818
|
onClick: e,
|
|
1819
1819
|
isActive: t,
|
|
1820
1820
|
icon: n,
|
|
@@ -1979,7 +1979,7 @@ const oi = (e) => /* @__PURE__ */ m(
|
|
|
1979
1979
|
children: [
|
|
1980
1980
|
/* @__PURE__ */ m("div", { className: " flex items-center gap-1 ", children: [
|
|
1981
1981
|
/* @__PURE__ */ o(
|
|
1982
|
-
|
|
1982
|
+
z,
|
|
1983
1983
|
{
|
|
1984
1984
|
tooltip: n.align.left,
|
|
1985
1985
|
icon: /* @__PURE__ */ o(oi, {}),
|
|
@@ -1988,7 +1988,7 @@ const oi = (e) => /* @__PURE__ */ m(
|
|
|
1988
1988
|
}
|
|
1989
1989
|
),
|
|
1990
1990
|
/* @__PURE__ */ o(
|
|
1991
|
-
|
|
1991
|
+
z,
|
|
1992
1992
|
{
|
|
1993
1993
|
tooltip: n.align.center,
|
|
1994
1994
|
icon: /* @__PURE__ */ o(ii, {}),
|
|
@@ -1997,7 +1997,7 @@ const oi = (e) => /* @__PURE__ */ m(
|
|
|
1997
1997
|
}
|
|
1998
1998
|
),
|
|
1999
1999
|
/* @__PURE__ */ o(
|
|
2000
|
-
|
|
2000
|
+
z,
|
|
2001
2001
|
{
|
|
2002
2002
|
tooltip: n.align.right,
|
|
2003
2003
|
icon: /* @__PURE__ */ o(ri, {}),
|
|
@@ -2009,16 +2009,16 @@ const oi = (e) => /* @__PURE__ */ m(
|
|
|
2009
2009
|
/* @__PURE__ */ o(J, { orientation: "vertical" }),
|
|
2010
2010
|
/* @__PURE__ */ m("div", { className: "flex gap-0.5", children: [
|
|
2011
2011
|
/* @__PURE__ */ o(
|
|
2012
|
-
|
|
2012
|
+
z,
|
|
2013
2013
|
{
|
|
2014
2014
|
tooltip: n.image.download,
|
|
2015
2015
|
icon: Ie,
|
|
2016
2016
|
onClick: () => e.chain().focus().toggleBold().run()
|
|
2017
2017
|
}
|
|
2018
2018
|
),
|
|
2019
|
-
/* @__PURE__ */ o(
|
|
2019
|
+
/* @__PURE__ */ o(z, { tooltip: "Replace", icon: Zn, onClick: i }),
|
|
2020
2020
|
/* @__PURE__ */ o(
|
|
2021
|
-
|
|
2021
|
+
z,
|
|
2022
2022
|
{
|
|
2023
2023
|
variant: "destructive",
|
|
2024
2024
|
tooltip: n.image.delete,
|
|
@@ -2054,7 +2054,7 @@ function Se({
|
|
|
2054
2054
|
align: t,
|
|
2055
2055
|
sideOffset: n,
|
|
2056
2056
|
className: x(
|
|
2057
|
-
"z-
|
|
2057
|
+
"z-(--notion-editor-z-menu) flex w-72 origin-(--radix-popover-content-transform-origin) flex-col gap-2.5 rounded-lg bg-popover p-2.5 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
2058
2058
|
e
|
|
2059
2059
|
),
|
|
2060
2060
|
...r
|
|
@@ -2062,7 +2062,7 @@ function Se({
|
|
|
2062
2062
|
) });
|
|
2063
2063
|
}
|
|
2064
2064
|
const ai = ({ editor: e }) => {
|
|
2065
|
-
const t = S(), [n, r] =
|
|
2065
|
+
const t = S(), [n, r] = E(!1), [l, i] = E(""), { isLink: a, activeUrl: s } = j({
|
|
2066
2066
|
editor: e,
|
|
2067
2067
|
selector: (p) => ({
|
|
2068
2068
|
isLink: p.editor.isActive("link"),
|
|
@@ -2150,7 +2150,7 @@ const ai = ({ editor: e }) => {
|
|
|
2150
2150
|
const t = S(), n = e.getAttributes("paragraph")["data-indent-level"] || e.getAttributes("heading")["data-indent-level"] || 0, r = n <= 0, l = n >= 10;
|
|
2151
2151
|
return /* @__PURE__ */ m("div", { className: "flex gap-0.5", children: [
|
|
2152
2152
|
/* @__PURE__ */ o(
|
|
2153
|
-
|
|
2153
|
+
z,
|
|
2154
2154
|
{
|
|
2155
2155
|
tooltip: t.bubble.decreaseIndent,
|
|
2156
2156
|
disabled: r,
|
|
@@ -2159,7 +2159,7 @@ const ai = ({ editor: e }) => {
|
|
|
2159
2159
|
}
|
|
2160
2160
|
),
|
|
2161
2161
|
/* @__PURE__ */ o(
|
|
2162
|
-
|
|
2162
|
+
z,
|
|
2163
2163
|
{
|
|
2164
2164
|
tooltip: t.bubble.increaseIndent,
|
|
2165
2165
|
disabled: l,
|
|
@@ -2169,7 +2169,7 @@ const ai = ({ editor: e }) => {
|
|
|
2169
2169
|
)
|
|
2170
2170
|
] });
|
|
2171
2171
|
}, ci = ({ editor: e }) => {
|
|
2172
|
-
const t = S(), [n, r] =
|
|
2172
|
+
const t = S(), [n, r] = E(!1), {
|
|
2173
2173
|
isSubscript: l,
|
|
2174
2174
|
isSuperscript: i,
|
|
2175
2175
|
isAlignLeft: a,
|
|
@@ -2199,7 +2199,7 @@ const ai = ({ editor: e }) => {
|
|
|
2199
2199
|
children: /* @__PURE__ */ m("div", { className: "flex gap-0.5", children: [
|
|
2200
2200
|
/* @__PURE__ */ m("div", { className: "flex gap-0.5", children: [
|
|
2201
2201
|
/* @__PURE__ */ o(
|
|
2202
|
-
|
|
2202
|
+
z,
|
|
2203
2203
|
{
|
|
2204
2204
|
tooltip: "Subscript",
|
|
2205
2205
|
isActive: l,
|
|
@@ -2208,7 +2208,7 @@ const ai = ({ editor: e }) => {
|
|
|
2208
2208
|
}
|
|
2209
2209
|
),
|
|
2210
2210
|
/* @__PURE__ */ o(
|
|
2211
|
-
|
|
2211
|
+
z,
|
|
2212
2212
|
{
|
|
2213
2213
|
tooltip: "Superscript",
|
|
2214
2214
|
isActive: i,
|
|
@@ -2220,7 +2220,7 @@ const ai = ({ editor: e }) => {
|
|
|
2220
2220
|
/* @__PURE__ */ o(J, { orientation: "vertical" }),
|
|
2221
2221
|
/* @__PURE__ */ m("div", { className: "flex gap-0.5", children: [
|
|
2222
2222
|
/* @__PURE__ */ o(
|
|
2223
|
-
|
|
2223
|
+
z,
|
|
2224
2224
|
{
|
|
2225
2225
|
tooltip: t.align.left,
|
|
2226
2226
|
isActive: a,
|
|
@@ -2229,7 +2229,7 @@ const ai = ({ editor: e }) => {
|
|
|
2229
2229
|
}
|
|
2230
2230
|
),
|
|
2231
2231
|
/* @__PURE__ */ o(
|
|
2232
|
-
|
|
2232
|
+
z,
|
|
2233
2233
|
{
|
|
2234
2234
|
tooltip: t.align.center,
|
|
2235
2235
|
isActive: d,
|
|
@@ -2238,7 +2238,7 @@ const ai = ({ editor: e }) => {
|
|
|
2238
2238
|
}
|
|
2239
2239
|
),
|
|
2240
2240
|
/* @__PURE__ */ o(
|
|
2241
|
-
|
|
2241
|
+
z,
|
|
2242
2242
|
{
|
|
2243
2243
|
tooltip: t.align.right,
|
|
2244
2244
|
isActive: s,
|
|
@@ -2247,7 +2247,7 @@ const ai = ({ editor: e }) => {
|
|
|
2247
2247
|
}
|
|
2248
2248
|
),
|
|
2249
2249
|
/* @__PURE__ */ o(
|
|
2250
|
-
|
|
2250
|
+
z,
|
|
2251
2251
|
{
|
|
2252
2252
|
tooltip: t.align.justify,
|
|
2253
2253
|
isActive: c,
|
|
@@ -2324,7 +2324,7 @@ const ai = ({ editor: e }) => {
|
|
|
2324
2324
|
}
|
|
2325
2325
|
) }) });
|
|
2326
2326
|
}, pi = ({ editor: e }) => {
|
|
2327
|
-
const t = S(), [n, r] =
|
|
2327
|
+
const t = S(), [n, r] = E(() => {
|
|
2328
2328
|
const a = Ae();
|
|
2329
2329
|
return a.length > 0 ? [{ title: t.common.recentlyUsed, colors: a }, ...Y(t)] : Y(t);
|
|
2330
2330
|
}), { textColor: l, highlightColor: i } = j({
|
|
@@ -2366,7 +2366,7 @@ const ai = ({ editor: e }) => {
|
|
|
2366
2366
|
Se,
|
|
2367
2367
|
{
|
|
2368
2368
|
onOpenAutoFocus: (r) => r.preventDefault(),
|
|
2369
|
-
className: "w-47 rounded-2xl p-0 pr-px bg-popover shadow-2xl z-
|
|
2369
|
+
className: "w-47 rounded-2xl p-0 pr-px bg-popover shadow-2xl z-(--notion-editor-z-menu) overflow-hidden",
|
|
2370
2370
|
children: /* @__PURE__ */ o(se, { className: "h-66.25 p-1.5 pr-2.5", children: e.map((r, l) => /* @__PURE__ */ o("div", { children: /* @__PURE__ */ m("div", { className: "min-w-max flex relative flex-col justify-center align-middle", children: [
|
|
2371
2371
|
/* @__PURE__ */ o("div", { className: "capitalize pt-3 pb-1 px-1.5 leading-normal font-medium text-xs text-muted-foreground", children: r.title }),
|
|
2372
2372
|
/* @__PURE__ */ o("div", { className: "grid grid-cols-5 gap-0.5 pl-1", children: r.colors.map(
|
|
@@ -2424,7 +2424,7 @@ const ai = ({ editor: e }) => {
|
|
|
2424
2424
|
title: "Heading 3",
|
|
2425
2425
|
description: "Small heading.",
|
|
2426
2426
|
searchTerms: ["h3", "subtitle", "small"],
|
|
2427
|
-
icon: /* @__PURE__ */ o(
|
|
2427
|
+
icon: /* @__PURE__ */ o(zt, {}),
|
|
2428
2428
|
command: ({ editor: e, range: t }) => {
|
|
2429
2429
|
e.chain().focus().deleteRange(t).setNode("heading", { level: 3 }).run();
|
|
2430
2430
|
}
|
|
@@ -2432,7 +2432,7 @@ const ai = ({ editor: e }) => {
|
|
|
2432
2432
|
title: "Blockquote",
|
|
2433
2433
|
description: "Add blockquote.",
|
|
2434
2434
|
searchTerms: ["quote", "blockquote"],
|
|
2435
|
-
icon: /* @__PURE__ */ o(
|
|
2435
|
+
icon: /* @__PURE__ */ o(Et, {}),
|
|
2436
2436
|
command: ({ editor: e, range: t }) => {
|
|
2437
2437
|
e.chain().focus().deleteRange(t).toggleBlockquote().run();
|
|
2438
2438
|
}
|
|
@@ -2485,7 +2485,7 @@ const ai = ({ editor: e }) => {
|
|
|
2485
2485
|
], gi = (e) => [
|
|
2486
2486
|
{ title: e.blocks.heading1.title, icon: Rt, level: 1 },
|
|
2487
2487
|
{ title: e.blocks.heading2.title, icon: It, level: 2 },
|
|
2488
|
-
{ title: e.blocks.heading3.title, icon:
|
|
2488
|
+
{ title: e.blocks.heading3.title, icon: zt, level: 3 }
|
|
2489
2489
|
], bi = ({ editor: e }) => {
|
|
2490
2490
|
const t = S(), n = gi(t), r = hi(t), {
|
|
2491
2491
|
activeBlock: l,
|
|
@@ -2520,7 +2520,7 @@ const ai = ({ editor: e }) => {
|
|
|
2520
2520
|
" ",
|
|
2521
2521
|
/* @__PURE__ */ o(Lt, {})
|
|
2522
2522
|
] }) }),
|
|
2523
|
-
/* @__PURE__ */ o(Se, { className: "w-48 rounded-2xl p-0 pr-px bg-popover shadow-2xl z-
|
|
2523
|
+
/* @__PURE__ */ o(Se, { className: "w-48 rounded-2xl p-0 pr-px bg-popover shadow-2xl z-(--notion-editor-z-menu) overflow-hidden", children: /* @__PURE__ */ o(se, { className: "h-66.25 p-1.5 pr-2.5", children: r.map((f, b) => /* @__PURE__ */ o("div", { children: /* @__PURE__ */ m("div", { className: "min-w-max flex relative flex-col justify-center align-middle", children: [
|
|
2524
2524
|
/* @__PURE__ */ o("div", { className: "capitalize pt-3 pb-1 px-1.5 leading-normal font-medium text-xs text-muted-foreground", children: f.title }),
|
|
2525
2525
|
/* @__PURE__ */ m("div", { className: "flex flex-col", children: [
|
|
2526
2526
|
/* @__PURE__ */ m(
|
|
@@ -2584,7 +2584,7 @@ const ai = ({ editor: e }) => {
|
|
|
2584
2584
|
className: "w-full justify-start",
|
|
2585
2585
|
onClick: () => e.chain().focus().toggleBlockquote().run(),
|
|
2586
2586
|
children: [
|
|
2587
|
-
/* @__PURE__ */ o(
|
|
2587
|
+
/* @__PURE__ */ o(Et, {}),
|
|
2588
2588
|
" ",
|
|
2589
2589
|
t.blocks.blockquote.title
|
|
2590
2590
|
]
|
|
@@ -2653,7 +2653,7 @@ const ai = ({ editor: e }) => {
|
|
|
2653
2653
|
/* @__PURE__ */ o(J, { orientation: "vertical" }),
|
|
2654
2654
|
/* @__PURE__ */ m("div", { className: " flex items-center gap-1 ", children: [
|
|
2655
2655
|
/* @__PURE__ */ o(
|
|
2656
|
-
|
|
2656
|
+
z,
|
|
2657
2657
|
{
|
|
2658
2658
|
tooltip: t.marks.bold,
|
|
2659
2659
|
icon: oo,
|
|
@@ -2663,7 +2663,7 @@ const ai = ({ editor: e }) => {
|
|
|
2663
2663
|
}
|
|
2664
2664
|
),
|
|
2665
2665
|
/* @__PURE__ */ o(
|
|
2666
|
-
|
|
2666
|
+
z,
|
|
2667
2667
|
{
|
|
2668
2668
|
tooltip: t.marks.italic,
|
|
2669
2669
|
icon: ro,
|
|
@@ -2673,7 +2673,7 @@ const ai = ({ editor: e }) => {
|
|
|
2673
2673
|
}
|
|
2674
2674
|
),
|
|
2675
2675
|
/* @__PURE__ */ o(
|
|
2676
|
-
|
|
2676
|
+
z,
|
|
2677
2677
|
{
|
|
2678
2678
|
tooltip: t.marks.underline,
|
|
2679
2679
|
icon: io,
|
|
@@ -2683,7 +2683,7 @@ const ai = ({ editor: e }) => {
|
|
|
2683
2683
|
}
|
|
2684
2684
|
),
|
|
2685
2685
|
/* @__PURE__ */ o(
|
|
2686
|
-
|
|
2686
|
+
z,
|
|
2687
2687
|
{
|
|
2688
2688
|
tooltip: "Strikethrough",
|
|
2689
2689
|
icon: lo,
|
|
@@ -2693,7 +2693,7 @@ const ai = ({ editor: e }) => {
|
|
|
2693
2693
|
}
|
|
2694
2694
|
),
|
|
2695
2695
|
/* @__PURE__ */ o(
|
|
2696
|
-
|
|
2696
|
+
z,
|
|
2697
2697
|
{
|
|
2698
2698
|
tooltip: t.marks.code,
|
|
2699
2699
|
icon: ao,
|
|
@@ -2946,7 +2946,7 @@ const ai = ({ editor: e }) => {
|
|
|
2946
2946
|
};
|
|
2947
2947
|
}, [n]), We(/* @__PURE__ */ o(K, { children: t }), r.current);
|
|
2948
2948
|
}, xi = ({ editor: e }) => {
|
|
2949
|
-
const t = S(), [n, r] =
|
|
2949
|
+
const t = S(), [n, r] = E(!1), { canMergeCell: l, canSplitCell: i, canClearContents: a } = j({
|
|
2950
2950
|
editor: e,
|
|
2951
2951
|
equalityFn: (s, d) => s.canMergeCell === d?.canMergeCell && s.canSplitCell === d.canSplitCell && s.canClearContents === d.canClearContents,
|
|
2952
2952
|
selector: (s) => {
|
|
@@ -3360,7 +3360,7 @@ const ht = ({
|
|
|
3360
3360
|
});
|
|
3361
3361
|
};
|
|
3362
3362
|
}, [n]), We(/* @__PURE__ */ o(K, { children: t }), l.current);
|
|
3363
|
-
}, Ii = 12,
|
|
3363
|
+
}, Ii = 12, zi = 4, Ei = Ii + zi;
|
|
3364
3364
|
function Di({
|
|
3365
3365
|
editor: e,
|
|
3366
3366
|
element: t,
|
|
@@ -3370,7 +3370,7 @@ function Di({
|
|
|
3370
3370
|
t.style.transition = "opacity 0.2s ease", t.style.opacity = a;
|
|
3371
3371
|
}, l = (a, s) => {
|
|
3372
3372
|
const d = a.getBoundingClientRect(), c = s.getBoundingClientRect();
|
|
3373
|
-
t.style.position = "absolute", t.style.top = `${c.top - d.top + a.scrollTop}px`, t.style.left = `${c.right - d.left + a.scrollLeft}px`, t.style.width = `${
|
|
3373
|
+
t.style.position = "absolute", t.style.top = `${c.top - d.top + a.scrollTop}px`, t.style.left = `${c.right - d.left + a.scrollLeft}px`, t.style.width = `${Ei}px`, t.style.height = `${c.height}px`;
|
|
3374
3374
|
}, i = () => {
|
|
3375
3375
|
const a = t.closest(".table-wrapper"), s = a?.querySelector("table");
|
|
3376
3376
|
a && s && l(a, s);
|
|
@@ -3542,7 +3542,7 @@ const Pi = ({ editor: e }) => {
|
|
|
3542
3542
|
scrollOver: n = !1
|
|
3543
3543
|
}) => {
|
|
3544
3544
|
if (!e) return null;
|
|
3545
|
-
const [r, l] =
|
|
3545
|
+
const [r, l] = E(null), i = j({
|
|
3546
3546
|
editor: e,
|
|
3547
3547
|
selector: (a) => a.editor.storage.tableOfContents?.content || []
|
|
3548
3548
|
});
|
|
@@ -3601,7 +3601,7 @@ function Wi({
|
|
|
3601
3601
|
alignment: a,
|
|
3602
3602
|
width: s,
|
|
3603
3603
|
height: d
|
|
3604
|
-
} = e.attrs, [c, u] =
|
|
3604
|
+
} = e.attrs, [c, u] = E(!1), p = P(null), h = P(null), f = P(null), b = Ui(
|
|
3605
3605
|
(v) => {
|
|
3606
3606
|
if (!f.current || !h.current) return;
|
|
3607
3607
|
v.preventDefault(), v.stopPropagation();
|
|
@@ -3843,7 +3843,7 @@ const Yi = Gt.create({
|
|
|
3843
3843
|
}
|
|
3844
3844
|
}), Qi = (e) => typeof e == "number" && e >= 0;
|
|
3845
3845
|
function el(e) {
|
|
3846
|
-
const t = S(), n = P(null), [r, l] =
|
|
3846
|
+
const t = S(), n = P(null), [r, l] = E(!1), i = e.extension.options, a = i.maxSize ?? 25 * 1024 * 1024, s = async (d) => {
|
|
3847
3847
|
if (!i.upload) {
|
|
3848
3848
|
i.onError?.(
|
|
3849
3849
|
new Error("[notion-editor] chưa cấu hình `uploadAttachment`.")
|
|
@@ -3983,7 +3983,7 @@ const rl = ({
|
|
|
3983
3983
|
onFile: e,
|
|
3984
3984
|
children: t
|
|
3985
3985
|
}) => {
|
|
3986
|
-
const [n, r] =
|
|
3986
|
+
const [n, r] = E(!1), [l, i] = E(!1);
|
|
3987
3987
|
return /* @__PURE__ */ o(
|
|
3988
3988
|
"div",
|
|
3989
3989
|
{
|
|
@@ -4052,7 +4052,7 @@ const rl = ({
|
|
|
4052
4052
|
] });
|
|
4053
4053
|
};
|
|
4054
4054
|
function al(e) {
|
|
4055
|
-
const [t, n] =
|
|
4055
|
+
const [t, n] = E([]), r = async (s) => {
|
|
4056
4056
|
if (s.size > e.maxSize) {
|
|
4057
4057
|
const p = new Error(
|
|
4058
4058
|
`File size exceeds maximum allowed (${e.maxSize / 1024 / 1024}MB)`
|
|
@@ -4294,12 +4294,14 @@ const sl = (e) => {
|
|
|
4294
4294
|
{
|
|
4295
4295
|
class: x("table-wrapper overflow-x-auto overflow-y-hidden p-4 -ml-4 relative")
|
|
4296
4296
|
},
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4297
|
+
[
|
|
4298
|
+
"table",
|
|
4299
|
+
qe(this.options.HTMLAttributes, t, {
|
|
4300
|
+
style: r ? `width: ${r}` : `min-width: ${l}`
|
|
4301
|
+
}),
|
|
4302
|
+
n,
|
|
4303
|
+
["tbody", 0]
|
|
4304
|
+
]
|
|
4303
4305
|
];
|
|
4304
4306
|
},
|
|
4305
4307
|
addNodeView() {
|
|
@@ -4647,8 +4649,8 @@ const gl = Ne.create({
|
|
|
4647
4649
|
)
|
|
4648
4650
|
}
|
|
4649
4651
|
);
|
|
4650
|
-
}, hn =
|
|
4651
|
-
const n = S(), { items: r } = e, [l, i] =
|
|
4652
|
+
}, hn = ze((e, t) => {
|
|
4653
|
+
const n = S(), { items: r } = e, [l, i] = E(0), a = (s) => {
|
|
4652
4654
|
const d = e.items[s];
|
|
4653
4655
|
d && e.command({ name: d.name });
|
|
4654
4656
|
};
|
|
@@ -4816,9 +4818,9 @@ function yn({
|
|
|
4816
4818
|
}
|
|
4817
4819
|
);
|
|
4818
4820
|
}
|
|
4819
|
-
const xn =
|
|
4821
|
+
const xn = ze(
|
|
4820
4822
|
(e, t) => {
|
|
4821
|
-
const n = S(), [r, l] =
|
|
4823
|
+
const n = S(), [r, l] = E(0), i = (c) => {
|
|
4822
4824
|
const u = e.items[c];
|
|
4823
4825
|
u && e.command(u);
|
|
4824
4826
|
}, a = () => {
|
|
@@ -4832,9 +4834,9 @@ const xn = Ee(
|
|
|
4832
4834
|
};
|
|
4833
4835
|
return V(() => {
|
|
4834
4836
|
l(0);
|
|
4835
|
-
}, [e.items]),
|
|
4837
|
+
}, [e.items]), Ee(t, () => ({
|
|
4836
4838
|
onKeyDown: ({ event: c }) => c.key === "ArrowUp" ? (a(), !0) : c.key === "ArrowDown" ? (s(), !0) : c.key === "Enter" ? (d(), !0) : !1
|
|
4837
|
-
})), /* @__PURE__ */ o(gn, { className: "border shadow-2xl w-55 z-
|
|
4839
|
+
})), /* @__PURE__ */ o(gn, { className: "border shadow-2xl w-55 z-(--notion-editor-z-menu)", loop: !0, children: /* @__PURE__ */ o(bn, { children: e.loading ? /* @__PURE__ */ m("div", { className: "item loading p-2 text-sm text-muted-foreground flex items-center gap-2", children: [
|
|
4838
4840
|
/* @__PURE__ */ o("span", { className: "loading-dot h-2 w-2 animate-pulse rounded-full bg-foreground" }),
|
|
4839
4841
|
"Loading…"
|
|
4840
4842
|
] }) : e.items.length > 0 ? /* @__PURE__ */ o(vn, { children: e.items.map((c, u) => /* @__PURE__ */ o(
|
|
@@ -5053,8 +5055,8 @@ const xl = Ne.create({
|
|
|
5053
5055
|
r.title
|
|
5054
5056
|
);
|
|
5055
5057
|
}) });
|
|
5056
|
-
}, kn =
|
|
5057
|
-
const n = S(), { items: r, command: l, query: i } = e, [a, s] =
|
|
5058
|
+
}, kn = ze((e, t) => {
|
|
5059
|
+
const n = S(), { items: r, command: l, query: i } = e, [a, s] = E(0), d = F(
|
|
5058
5060
|
() => r.flatMap((f) => f.commands),
|
|
5059
5061
|
[r]
|
|
5060
5062
|
), c = Rl(d, i);
|
|
@@ -5072,7 +5074,7 @@ const xl = Ne.create({
|
|
|
5072
5074
|
const b = d.length;
|
|
5073
5075
|
b && s((g) => (g + f + b) % b);
|
|
5074
5076
|
};
|
|
5075
|
-
return
|
|
5077
|
+
return Ee(t, () => ({
|
|
5076
5078
|
onKeyDown: ({ event: f }) => {
|
|
5077
5079
|
if (!d.length) return !1;
|
|
5078
5080
|
switch (f.key) {
|
|
@@ -5090,7 +5092,7 @@ const xl = Ne.create({
|
|
|
5090
5092
|
})), /* @__PURE__ */ o(
|
|
5091
5093
|
gn,
|
|
5092
5094
|
{
|
|
5093
|
-
className: "border shadow-2xl w-55 z-
|
|
5095
|
+
className: "border shadow-2xl w-55 z-(--notion-editor-z-menu)",
|
|
5094
5096
|
shouldFilter: !1,
|
|
5095
5097
|
value: String(a),
|
|
5096
5098
|
onValueChange: (f) => s(Number(f)),
|
|
@@ -5108,7 +5110,7 @@ const xl = Ne.create({
|
|
|
5108
5110
|
);
|
|
5109
5111
|
});
|
|
5110
5112
|
kn.displayName = "SlashMenu";
|
|
5111
|
-
const
|
|
5113
|
+
const zl = (e) => ({
|
|
5112
5114
|
// Phần trang trí bọc dấu "/": chữ gợi ý đi qua data-decoration-content
|
|
5113
5115
|
// rồi được CSS đọc bằng attr(), nên nó dịch được mà không cần sửa CSS.
|
|
5114
5116
|
decorationTag: "SlashFilter",
|
|
@@ -5154,7 +5156,7 @@ const El = (e) => ({
|
|
|
5154
5156
|
onExit: l
|
|
5155
5157
|
};
|
|
5156
5158
|
}
|
|
5157
|
-
}),
|
|
5159
|
+
}), El = dr(ur), Dl = (e) => {
|
|
5158
5160
|
if (!e.isEmpty) return !1;
|
|
5159
5161
|
let t = !0;
|
|
5160
5162
|
return e.state.doc.forEach((n) => {
|
|
@@ -5206,7 +5208,7 @@ function Bl(e = {}) {
|
|
|
5206
5208
|
Fo,
|
|
5207
5209
|
Go,
|
|
5208
5210
|
rr,
|
|
5209
|
-
|
|
5211
|
+
zo,
|
|
5210
5212
|
// Bộ gốc nạp cả CodeBlock "trần" lẫn CodeBlockLowlight ở dưới. Hai
|
|
5211
5213
|
// extension cùng đăng ký node "codeBlock" nên ProseMirror nhận hai plugin
|
|
5212
5214
|
// trùng key và ném RangeError ngay lúc dựng editor view.
|
|
@@ -5221,7 +5223,7 @@ function Bl(e = {}) {
|
|
|
5221
5223
|
tr,
|
|
5222
5224
|
nr,
|
|
5223
5225
|
or,
|
|
5224
|
-
xl.configure({ suggestion:
|
|
5226
|
+
xl.configure({ suggestion: zl(c) }),
|
|
5225
5227
|
Ko.configure({
|
|
5226
5228
|
placeholder: typeof n == "function" ? n : Pl(
|
|
5227
5229
|
n ? { ...c, placeholder: { ...c.placeholder, emptyDocument: n } } : c
|
|
@@ -5255,7 +5257,7 @@ function Bl(e = {}) {
|
|
|
5255
5257
|
HTMLAttributes: { class: "my-custom-divider" }
|
|
5256
5258
|
}),
|
|
5257
5259
|
bl.configure({ types: ["paragraph", "heading"], indentSize: 24 }),
|
|
5258
|
-
|
|
5260
|
+
Eo.configure({ lowlight: El }),
|
|
5259
5261
|
hl({ uploadImage: r, uploadAttachment: i })
|
|
5260
5262
|
];
|
|
5261
5263
|
return s && u.push(
|
|
@@ -5326,7 +5328,7 @@ function Ba({
|
|
|
5326
5328
|
});
|
|
5327
5329
|
return V(() => {
|
|
5328
5330
|
T && T.isEditable !== r && T.setEditable(r);
|
|
5329
|
-
}, [T, r]),
|
|
5331
|
+
}, [T, r]), Ee(
|
|
5330
5332
|
h,
|
|
5331
5333
|
() => ({
|
|
5332
5334
|
editor: T,
|