@lumir-company/editor 0.4.19 → 0.4.22
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/README.md +44 -19
- package/dist/index.d.mts +31 -17
- package/dist/index.d.ts +31 -17
- package/dist/index.js +1089 -687
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +769 -374
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +72 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24,7 +24,11 @@ __export(index_exports, {
|
|
|
24
24
|
BACKGROUND_COLORS: () => BACKGROUND_COLORS,
|
|
25
25
|
ContentUtils: () => ContentUtils,
|
|
26
26
|
EditorConfig: () => EditorConfig,
|
|
27
|
+
FONT_SIZE_DEFAULT_PX: () => FONT_SIZE_DEFAULT_PX,
|
|
28
|
+
FONT_SIZE_MAX: () => FONT_SIZE_MAX,
|
|
29
|
+
FONT_SIZE_MIN: () => FONT_SIZE_MIN,
|
|
27
30
|
FONT_SIZE_PRESETS: () => FONT_SIZE_PRESETS,
|
|
31
|
+
FONT_SIZE_STEP: () => FONT_SIZE_STEP,
|
|
28
32
|
FloatingMenu: () => FloatingMenu,
|
|
29
33
|
FontSize: () => FontSize,
|
|
30
34
|
FontSizeButton: () => FontSizeButton2,
|
|
@@ -34,21 +38,24 @@ __export(index_exports, {
|
|
|
34
38
|
LumirEditor: () => LumirEditor,
|
|
35
39
|
LumirEditorError: () => LumirEditorError,
|
|
36
40
|
TEXT_COLORS: () => TEXT_COLORS,
|
|
41
|
+
clampFontSizePx: () => clampFontSizePx,
|
|
37
42
|
clearMetadataCache: () => clearMetadataCache,
|
|
38
43
|
cn: () => cn,
|
|
39
44
|
createS3Uploader: () => createS3Uploader,
|
|
40
45
|
fetchLinkMetadata: () => fetchLinkMetadata,
|
|
41
46
|
getHexFromColorValue: () => getHexFromColorValue,
|
|
42
47
|
liftFontSize: () => liftFontSize,
|
|
43
|
-
lowerFontSize: () => lowerFontSize
|
|
48
|
+
lowerFontSize: () => lowerFontSize,
|
|
49
|
+
parseFontSizePx: () => parseFontSizePx,
|
|
50
|
+
toFontSizeValue: () => toFontSizeValue
|
|
44
51
|
});
|
|
45
52
|
module.exports = __toCommonJS(index_exports);
|
|
46
53
|
|
|
47
54
|
// src/components/LumirEditor.tsx
|
|
48
|
-
var
|
|
49
|
-
var
|
|
55
|
+
var import_react36 = require("react");
|
|
56
|
+
var import_react37 = require("@blocknote/react");
|
|
50
57
|
var import_mantine = require("@blocknote/mantine");
|
|
51
|
-
var
|
|
58
|
+
var import_core11 = require("@blocknote/core");
|
|
52
59
|
var import_locales = require("@blocknote/core/locales");
|
|
53
60
|
|
|
54
61
|
// src/utils/cn.ts
|
|
@@ -285,8 +292,8 @@ var createS3Uploader = (config) => {
|
|
|
285
292
|
};
|
|
286
293
|
|
|
287
294
|
// src/blocks/HtmlPreview.tsx
|
|
288
|
-
var
|
|
289
|
-
var
|
|
295
|
+
var import_react5 = require("@blocknote/react");
|
|
296
|
+
var import_core4 = require("@blocknote/core");
|
|
290
297
|
|
|
291
298
|
// src/blocks/LinkPreview.tsx
|
|
292
299
|
var import_react = require("@blocknote/react");
|
|
@@ -1490,6 +1497,16 @@ var ColumnList = (0, import_core.createStronglyTypedTiptapNode)({
|
|
|
1490
1497
|
name: "columnList",
|
|
1491
1498
|
group: "childContainer bnBlock blockGroupChild",
|
|
1492
1499
|
content: "column column+",
|
|
1500
|
+
addAttributes() {
|
|
1501
|
+
return {
|
|
1502
|
+
// 블록별 중앙 세로 구분선 표시 여부(드래그핸들 메뉴에서 토글). data-divider로 렌더.
|
|
1503
|
+
showDivider: {
|
|
1504
|
+
default: false,
|
|
1505
|
+
parseHTML: (element) => element.getAttribute("data-divider") === "true",
|
|
1506
|
+
renderHTML: (attributes) => attributes.showDivider ? { "data-divider": "true" } : {}
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
},
|
|
1493
1510
|
parseHTML() {
|
|
1494
1511
|
return [{ tag: 'div[data-node-type="columnList"]' }];
|
|
1495
1512
|
},
|
|
@@ -1551,15 +1568,22 @@ var Column = (0, import_core2.createStronglyTypedTiptapNode)({
|
|
|
1551
1568
|
});
|
|
1552
1569
|
|
|
1553
1570
|
// src/styles/FontSizeStyle.tsx
|
|
1554
|
-
var
|
|
1555
|
-
var
|
|
1556
|
-
var FontSize = (0, import_react5.createReactStyleSpec)(
|
|
1571
|
+
var import_core3 = require("@blocknote/core");
|
|
1572
|
+
var FontSize = (0, import_core3.createStyleSpec)(
|
|
1557
1573
|
{
|
|
1558
1574
|
type: "fontSize",
|
|
1559
1575
|
propSchema: "string"
|
|
1560
1576
|
},
|
|
1561
1577
|
{
|
|
1562
|
-
|
|
1578
|
+
// 바닐라(동기) 스타일 스펙: DOM을 직접 반환한다.
|
|
1579
|
+
// createReactStyleSpec는 span 내용이 비동기 렌더되어, 적용 직후 동기 시점에
|
|
1580
|
+
// 선택 영역의 DOM 좌표가 (0,0)으로 잡혀 BlockNote 포매팅 툴바가 좌상단으로
|
|
1581
|
+
// 튀는 문제가 있었다(굵게/기울임 등 네이티브 마크는 동기 렌더라 정상).
|
|
1582
|
+
render: (value) => {
|
|
1583
|
+
const span = document.createElement("span");
|
|
1584
|
+
span.style.fontSize = value;
|
|
1585
|
+
return { dom: span, contentDOM: span };
|
|
1586
|
+
}
|
|
1563
1587
|
}
|
|
1564
1588
|
);
|
|
1565
1589
|
var FONT_SIZE_PRESETS = [
|
|
@@ -1572,10 +1596,24 @@ var FONT_SIZE_PRESETS = [
|
|
|
1572
1596
|
"24px",
|
|
1573
1597
|
"28px"
|
|
1574
1598
|
];
|
|
1599
|
+
var FONT_SIZE_MIN = 8;
|
|
1600
|
+
var FONT_SIZE_MAX = 96;
|
|
1601
|
+
var FONT_SIZE_DEFAULT_PX = 14;
|
|
1602
|
+
var FONT_SIZE_STEP = 1;
|
|
1603
|
+
function parseFontSizePx(size) {
|
|
1604
|
+
const n = parseInt(size, 10);
|
|
1605
|
+
return Number.isFinite(n) ? n : FONT_SIZE_DEFAULT_PX;
|
|
1606
|
+
}
|
|
1607
|
+
function clampFontSizePx(px) {
|
|
1608
|
+
return Math.min(FONT_SIZE_MAX, Math.max(FONT_SIZE_MIN, Math.round(px)));
|
|
1609
|
+
}
|
|
1610
|
+
function toFontSizeValue(px) {
|
|
1611
|
+
return `${clampFontSizePx(px)}px`;
|
|
1612
|
+
}
|
|
1575
1613
|
|
|
1576
1614
|
// src/blocks/HtmlPreview.tsx
|
|
1577
|
-
var
|
|
1578
|
-
var
|
|
1615
|
+
var import_react6 = require("react");
|
|
1616
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1579
1617
|
var MIN_HEIGHT = 100;
|
|
1580
1618
|
var MAX_HEIGHT = 1200;
|
|
1581
1619
|
var ensureCharset = (html) => {
|
|
@@ -1613,7 +1651,7 @@ var createSecureBlobUrl = (htmlContent) => {
|
|
|
1613
1651
|
});
|
|
1614
1652
|
return URL.createObjectURL(blob);
|
|
1615
1653
|
};
|
|
1616
|
-
var HtmlPreviewBlock = (0,
|
|
1654
|
+
var HtmlPreviewBlock = (0, import_react5.createReactBlockSpec)(
|
|
1617
1655
|
{
|
|
1618
1656
|
type: "htmlPreview",
|
|
1619
1657
|
propSchema: {
|
|
@@ -1631,15 +1669,15 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1631
1669
|
},
|
|
1632
1670
|
{
|
|
1633
1671
|
render: (props) => {
|
|
1634
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
1635
|
-
const [isResizing, setIsResizing] = (0,
|
|
1636
|
-
const [blobUrl, setBlobUrl] = (0,
|
|
1637
|
-
const containerRef = (0,
|
|
1672
|
+
const [isExpanded, setIsExpanded] = (0, import_react6.useState)(true);
|
|
1673
|
+
const [isResizing, setIsResizing] = (0, import_react6.useState)(false);
|
|
1674
|
+
const [blobUrl, setBlobUrl] = (0, import_react6.useState)("");
|
|
1675
|
+
const containerRef = (0, import_react6.useRef)(null);
|
|
1638
1676
|
const htmlContent = props.block.props.htmlContent || "";
|
|
1639
1677
|
const fileName = props.block.props.fileName || "HTML Document";
|
|
1640
1678
|
const savedHeight = props.block.props.height || "400px";
|
|
1641
1679
|
const currentHeight = parseInt(savedHeight, 10) || 400;
|
|
1642
|
-
(0,
|
|
1680
|
+
(0, import_react6.useEffect)(() => {
|
|
1643
1681
|
if (htmlContent) {
|
|
1644
1682
|
const url = createSecureBlobUrl(htmlContent);
|
|
1645
1683
|
setBlobUrl(url);
|
|
@@ -1648,7 +1686,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1648
1686
|
};
|
|
1649
1687
|
}
|
|
1650
1688
|
}, [htmlContent]);
|
|
1651
|
-
const handleResizeStart = (0,
|
|
1689
|
+
const handleResizeStart = (0, import_react6.useCallback)(
|
|
1652
1690
|
(e) => {
|
|
1653
1691
|
e.preventDefault();
|
|
1654
1692
|
e.stopPropagation();
|
|
@@ -1675,7 +1713,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1675
1713
|
},
|
|
1676
1714
|
[currentHeight, props.editor, props.block]
|
|
1677
1715
|
);
|
|
1678
|
-
const handleExport = (0,
|
|
1716
|
+
const handleExport = (0, import_react6.useCallback)(
|
|
1679
1717
|
(e) => {
|
|
1680
1718
|
e.stopPropagation();
|
|
1681
1719
|
const safeFileName = sanitizeFileName(fileName);
|
|
@@ -1696,7 +1734,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1696
1734
|
},
|
|
1697
1735
|
[htmlContent, fileName]
|
|
1698
1736
|
);
|
|
1699
|
-
const handleOpenNewWindow = (0,
|
|
1737
|
+
const handleOpenNewWindow = (0, import_react6.useCallback)(
|
|
1700
1738
|
(e) => {
|
|
1701
1739
|
e.stopPropagation();
|
|
1702
1740
|
if (typeof window === "undefined") return;
|
|
@@ -1710,7 +1748,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1710
1748
|
},
|
|
1711
1749
|
[htmlContent]
|
|
1712
1750
|
);
|
|
1713
|
-
return /* @__PURE__ */ (0,
|
|
1751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1714
1752
|
"div",
|
|
1715
1753
|
{
|
|
1716
1754
|
ref: containerRef,
|
|
@@ -1726,7 +1764,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1726
1764
|
boxShadow: "none"
|
|
1727
1765
|
},
|
|
1728
1766
|
children: [
|
|
1729
|
-
/* @__PURE__ */ (0,
|
|
1767
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1730
1768
|
"div",
|
|
1731
1769
|
{
|
|
1732
1770
|
style: {
|
|
@@ -1738,7 +1776,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1738
1776
|
borderBottom: isExpanded ? "1px solid #e0e0e0" : "none"
|
|
1739
1777
|
},
|
|
1740
1778
|
children: [
|
|
1741
|
-
/* @__PURE__ */ (0,
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1742
1780
|
"div",
|
|
1743
1781
|
{
|
|
1744
1782
|
style: {
|
|
@@ -1750,7 +1788,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1750
1788
|
},
|
|
1751
1789
|
onClick: () => setIsExpanded(!isExpanded),
|
|
1752
1790
|
children: [
|
|
1753
|
-
/* @__PURE__ */ (0,
|
|
1791
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1754
1792
|
"svg",
|
|
1755
1793
|
{
|
|
1756
1794
|
width: "16",
|
|
@@ -1765,15 +1803,15 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1765
1803
|
transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
1766
1804
|
transition: "transform 0.2s"
|
|
1767
1805
|
},
|
|
1768
|
-
children: /* @__PURE__ */ (0,
|
|
1806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
1769
1807
|
}
|
|
1770
1808
|
),
|
|
1771
|
-
/* @__PURE__ */ (0,
|
|
1809
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontWeight: 500, fontSize: "14px" }, children: fileName })
|
|
1772
1810
|
]
|
|
1773
1811
|
}
|
|
1774
1812
|
),
|
|
1775
|
-
/* @__PURE__ */ (0,
|
|
1776
|
-
/* @__PURE__ */ (0,
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1814
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1777
1815
|
"button",
|
|
1778
1816
|
{
|
|
1779
1817
|
onClick: handleOpenNewWindow,
|
|
@@ -1796,7 +1834,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1796
1834
|
onMouseLeave: (e) => {
|
|
1797
1835
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1798
1836
|
},
|
|
1799
|
-
children: /* @__PURE__ */ (0,
|
|
1837
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1800
1838
|
"svg",
|
|
1801
1839
|
{
|
|
1802
1840
|
width: "16",
|
|
@@ -1808,15 +1846,15 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1808
1846
|
strokeLinecap: "round",
|
|
1809
1847
|
strokeLinejoin: "round",
|
|
1810
1848
|
children: [
|
|
1811
|
-
/* @__PURE__ */ (0,
|
|
1812
|
-
/* @__PURE__ */ (0,
|
|
1813
|
-
/* @__PURE__ */ (0,
|
|
1849
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1850
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1814
1852
|
]
|
|
1815
1853
|
}
|
|
1816
1854
|
)
|
|
1817
1855
|
}
|
|
1818
1856
|
),
|
|
1819
|
-
/* @__PURE__ */ (0,
|
|
1857
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1820
1858
|
"button",
|
|
1821
1859
|
{
|
|
1822
1860
|
onClick: handleExport,
|
|
@@ -1839,7 +1877,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1839
1877
|
onMouseLeave: (e) => {
|
|
1840
1878
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1841
1879
|
},
|
|
1842
|
-
children: /* @__PURE__ */ (0,
|
|
1880
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1843
1881
|
"svg",
|
|
1844
1882
|
{
|
|
1845
1883
|
width: "16",
|
|
@@ -1851,9 +1889,9 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1851
1889
|
strokeLinecap: "round",
|
|
1852
1890
|
strokeLinejoin: "round",
|
|
1853
1891
|
children: [
|
|
1854
|
-
/* @__PURE__ */ (0,
|
|
1855
|
-
/* @__PURE__ */ (0,
|
|
1856
|
-
/* @__PURE__ */ (0,
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1893
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
1894
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
1857
1895
|
]
|
|
1858
1896
|
}
|
|
1859
1897
|
)
|
|
@@ -1863,7 +1901,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1863
1901
|
]
|
|
1864
1902
|
}
|
|
1865
1903
|
),
|
|
1866
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
1904
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1867
1905
|
"div",
|
|
1868
1906
|
{
|
|
1869
1907
|
style: {
|
|
@@ -1872,7 +1910,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1872
1910
|
position: "relative"
|
|
1873
1911
|
},
|
|
1874
1912
|
children: [
|
|
1875
|
-
/* @__PURE__ */ (0,
|
|
1913
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1876
1914
|
"iframe",
|
|
1877
1915
|
{
|
|
1878
1916
|
src: blobUrl || "about:blank",
|
|
@@ -1889,7 +1927,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1889
1927
|
loading: "lazy"
|
|
1890
1928
|
}
|
|
1891
1929
|
),
|
|
1892
|
-
/* @__PURE__ */ (0,
|
|
1930
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1893
1931
|
"div",
|
|
1894
1932
|
{
|
|
1895
1933
|
onMouseDown: handleResizeStart,
|
|
@@ -1914,7 +1952,7 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1914
1952
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1915
1953
|
}
|
|
1916
1954
|
},
|
|
1917
|
-
children: /* @__PURE__ */ (0,
|
|
1955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1918
1956
|
"div",
|
|
1919
1957
|
{
|
|
1920
1958
|
style: {
|
|
@@ -1936,83 +1974,84 @@ var HtmlPreviewBlock = (0, import_react6.createReactBlockSpec)(
|
|
|
1936
1974
|
}
|
|
1937
1975
|
}
|
|
1938
1976
|
);
|
|
1939
|
-
var ColumnListBlock = (0,
|
|
1977
|
+
var ColumnListBlock = (0, import_core4.createBlockSpecFromStronglyTypedTiptapNode)(
|
|
1940
1978
|
ColumnList,
|
|
1941
|
-
|
|
1979
|
+
// showDivider를 블록 prop으로 등록 → onContentChange JSON 직렬화 + 재로드 라운드트립.
|
|
1980
|
+
{ showDivider: { default: false } }
|
|
1942
1981
|
);
|
|
1943
|
-
var ColumnBlock = (0,
|
|
1944
|
-
var schema =
|
|
1982
|
+
var ColumnBlock = (0, import_core4.createBlockSpecFromStronglyTypedTiptapNode)(Column, {});
|
|
1983
|
+
var schema = import_core4.BlockNoteSchema.create({
|
|
1945
1984
|
blockSpecs: {
|
|
1946
|
-
...
|
|
1985
|
+
...import_core4.defaultBlockSpecs,
|
|
1947
1986
|
htmlPreview: HtmlPreviewBlock,
|
|
1948
1987
|
linkPreview: LinkPreviewBlock,
|
|
1949
1988
|
video: VideoBlock,
|
|
1950
1989
|
columnList: ColumnListBlock,
|
|
1951
1990
|
column: ColumnBlock
|
|
1952
1991
|
},
|
|
1953
|
-
inlineContentSpecs:
|
|
1992
|
+
inlineContentSpecs: import_core4.defaultInlineContentSpecs,
|
|
1954
1993
|
styleSpecs: {
|
|
1955
|
-
...
|
|
1994
|
+
...import_core4.defaultStyleSpecs,
|
|
1956
1995
|
// 인라인 글자 크기. 저장 JSON 직렬화는 형제 키 방식(font-size-serialization.ts) 사용.
|
|
1957
1996
|
fontSize: FontSize
|
|
1958
1997
|
}
|
|
1959
1998
|
});
|
|
1960
1999
|
|
|
1961
2000
|
// src/components/FloatingMenu/index.tsx
|
|
1962
|
-
var
|
|
2001
|
+
var import_react18 = require("react");
|
|
1963
2002
|
|
|
1964
2003
|
// src/components/FloatingMenu/Icons.tsx
|
|
1965
|
-
var
|
|
2004
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1966
2005
|
var Icons = {
|
|
1967
|
-
undo: /* @__PURE__ */ (0,
|
|
1968
|
-
redo: /* @__PURE__ */ (0,
|
|
1969
|
-
bold: /* @__PURE__ */ (0,
|
|
1970
|
-
italic: /* @__PURE__ */ (0,
|
|
1971
|
-
underline: /* @__PURE__ */ (0,
|
|
1972
|
-
strikethrough: /* @__PURE__ */ (0,
|
|
1973
|
-
alignLeft: /* @__PURE__ */ (0,
|
|
1974
|
-
alignCenter: /* @__PURE__ */ (0,
|
|
1975
|
-
alignRight: /* @__PURE__ */ (0,
|
|
1976
|
-
bulletList: /* @__PURE__ */ (0,
|
|
1977
|
-
numberedList: /* @__PURE__ */ (0,
|
|
1978
|
-
image: /* @__PURE__ */ (0,
|
|
1979
|
-
expandMore: /* @__PURE__ */ (0,
|
|
1980
|
-
textColor: /* @__PURE__ */ (0,
|
|
1981
|
-
bgColor: /* @__PURE__ */ (0,
|
|
1982
|
-
/* @__PURE__ */ (0,
|
|
1983
|
-
/* @__PURE__ */ (0,
|
|
2006
|
+
undo: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z" }) }),
|
|
2007
|
+
redo: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z" }) }),
|
|
2008
|
+
bold: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z" }) }),
|
|
2009
|
+
italic: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z" }) }),
|
|
2010
|
+
underline: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z" }) }),
|
|
2011
|
+
strikethrough: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z" }) }),
|
|
2012
|
+
alignLeft: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" }) }),
|
|
2013
|
+
alignCenter: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" }) }),
|
|
2014
|
+
alignRight: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" }) }),
|
|
2015
|
+
bulletList: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z" }) }),
|
|
2016
|
+
numberedList: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" }) }),
|
|
2017
|
+
image: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z" }) }),
|
|
2018
|
+
expandMore: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" }) }),
|
|
2019
|
+
textColor: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z" }) }),
|
|
2020
|
+
bgColor: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
2021
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M16.56 8.94L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z" }),
|
|
2022
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { fillOpacity: ".36", d: "M0 20h24v4H0z" })
|
|
1984
2023
|
] }),
|
|
1985
|
-
link: /* @__PURE__ */ (0,
|
|
1986
|
-
chevronRight: /* @__PURE__ */ (0,
|
|
1987
|
-
chevronLeft: /* @__PURE__ */ (0,
|
|
1988
|
-
table: /* @__PURE__ */ (0,
|
|
1989
|
-
htmlFile: /* @__PURE__ */ (0,
|
|
2024
|
+
link: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z" }) }),
|
|
2025
|
+
chevronRight: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) }),
|
|
2026
|
+
chevronLeft: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) }),
|
|
2027
|
+
table: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M20 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM10 17H5v-2h5v2zm0-4H5v-2h5v2zm0-4H5V7h5v2zm9 8h-7v-2h7v2zm0-4h-7v-2h7v2zm0-4h-7V7h7v2z" }) }),
|
|
2028
|
+
htmlFile: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm-1 2v5h5l-5-5zm-4 14H7v-1h2v1zm0-2H7v-1h2v1zm-2-2h2v1H7v-1zm4 4h-2v-1h2v1zm0-2h-2v-1h2v1zm0-2h-2v-1h2v1zm6 4h-4v-1h4v1zm0-2h-4v-1h4v1zm0-2h-4v-1h4v1z" }) })
|
|
1990
2029
|
};
|
|
1991
2030
|
var BlockTypeIcons = {
|
|
1992
|
-
paragraph: /* @__PURE__ */ (0,
|
|
1993
|
-
h1: /* @__PURE__ */ (0,
|
|
1994
|
-
h2: /* @__PURE__ */ (0,
|
|
1995
|
-
h3: /* @__PURE__ */ (0,
|
|
1996
|
-
h4: /* @__PURE__ */ (0,
|
|
1997
|
-
h5: /* @__PURE__ */ (0,
|
|
1998
|
-
h6: /* @__PURE__ */ (0,
|
|
1999
|
-
toggleH1: /* @__PURE__ */ (0,
|
|
2000
|
-
/* @__PURE__ */ (0,
|
|
2001
|
-
/* @__PURE__ */ (0,
|
|
2031
|
+
paragraph: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M5 5h14v2H5zM5 11h14v2H5zM5 17h10v2H5z" }) }),
|
|
2032
|
+
h1: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H1" }),
|
|
2033
|
+
h2: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H2" }),
|
|
2034
|
+
h3: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H3" }),
|
|
2035
|
+
h4: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H4" }),
|
|
2036
|
+
h5: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H5" }),
|
|
2037
|
+
h6: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H6" }),
|
|
2038
|
+
toggleH1: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "lumir-block-icon-toggle", children: [
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 5v14l11-7z" }) }),
|
|
2040
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H1" })
|
|
2002
2041
|
] }),
|
|
2003
|
-
toggleH2: /* @__PURE__ */ (0,
|
|
2004
|
-
/* @__PURE__ */ (0,
|
|
2005
|
-
/* @__PURE__ */ (0,
|
|
2042
|
+
toggleH2: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "lumir-block-icon-toggle", children: [
|
|
2043
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 5v14l11-7z" }) }),
|
|
2044
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H2" })
|
|
2006
2045
|
] }),
|
|
2007
|
-
toggleH3: /* @__PURE__ */ (0,
|
|
2008
|
-
/* @__PURE__ */ (0,
|
|
2009
|
-
/* @__PURE__ */ (0,
|
|
2046
|
+
toggleH3: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "lumir-block-icon-toggle", children: [
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 5v14l11-7z" }) }),
|
|
2048
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H3" })
|
|
2010
2049
|
] }),
|
|
2011
|
-
quote: /* @__PURE__ */ (0,
|
|
2012
|
-
codeBlock: /* @__PURE__ */ (0,
|
|
2013
|
-
toggleList: /* @__PURE__ */ (0,
|
|
2014
|
-
/* @__PURE__ */ (0,
|
|
2015
|
-
/* @__PURE__ */ (0,
|
|
2050
|
+
quote: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
|
|
2051
|
+
codeBlock: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z" }) }),
|
|
2052
|
+
toggleList: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 6h10v2H10zM10 11h10v2H10zM10 16h10v2H10z" }),
|
|
2054
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2016
2055
|
"path",
|
|
2017
2056
|
{
|
|
2018
2057
|
d: "M4 8l4 4-4 4",
|
|
@@ -2024,15 +2063,15 @@ var BlockTypeIcons = {
|
|
|
2024
2063
|
}
|
|
2025
2064
|
)
|
|
2026
2065
|
] }),
|
|
2027
|
-
bulletList: /* @__PURE__ */ (0,
|
|
2028
|
-
/* @__PURE__ */ (0,
|
|
2029
|
-
/* @__PURE__ */ (0,
|
|
2030
|
-
/* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2066
|
+
bulletList: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
2067
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "4", cy: "6", r: "1.5" }),
|
|
2068
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "4", cy: "12", r: "1.5" }),
|
|
2069
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "4", cy: "18", r: "1.5" }),
|
|
2070
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 5h12v2H8zM8 11h12v2H8zM8 17h12v2H8z" })
|
|
2032
2071
|
] }),
|
|
2033
|
-
numberedList: /* @__PURE__ */ (0,
|
|
2034
|
-
checkList: /* @__PURE__ */ (0,
|
|
2035
|
-
/* @__PURE__ */ (0,
|
|
2072
|
+
numberedList: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" }) }),
|
|
2073
|
+
checkList: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
2074
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2036
2075
|
"rect",
|
|
2037
2076
|
{
|
|
2038
2077
|
x: "3",
|
|
@@ -2045,7 +2084,7 @@ var BlockTypeIcons = {
|
|
|
2045
2084
|
strokeWidth: "1.5"
|
|
2046
2085
|
}
|
|
2047
2086
|
),
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2087
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2049
2088
|
"path",
|
|
2050
2089
|
{
|
|
2051
2090
|
d: "M4.5 7l1.5 1.5 3-3",
|
|
@@ -2056,8 +2095,8 @@ var BlockTypeIcons = {
|
|
|
2056
2095
|
strokeLinejoin: "round"
|
|
2057
2096
|
}
|
|
2058
2097
|
),
|
|
2059
|
-
/* @__PURE__ */ (0,
|
|
2060
|
-
/* @__PURE__ */ (0,
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 6h8v2h-8z" }),
|
|
2099
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
2061
2100
|
"rect",
|
|
2062
2101
|
{
|
|
2063
2102
|
x: "3",
|
|
@@ -2070,37 +2109,37 @@ var BlockTypeIcons = {
|
|
|
2070
2109
|
strokeWidth: "1.5"
|
|
2071
2110
|
}
|
|
2072
2111
|
),
|
|
2073
|
-
/* @__PURE__ */ (0,
|
|
2112
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 16h8v2h-8z" })
|
|
2074
2113
|
] })
|
|
2075
2114
|
};
|
|
2076
2115
|
|
|
2077
2116
|
// src/components/FloatingMenu/components/ToolbarDivider.tsx
|
|
2078
|
-
var
|
|
2079
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0,
|
|
2117
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2118
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "lumir-toolbar-divider" });
|
|
2080
2119
|
|
|
2081
2120
|
// src/components/FloatingMenu/components/UndoRedoButtons.tsx
|
|
2082
|
-
var
|
|
2083
|
-
var
|
|
2121
|
+
var import_react7 = require("react");
|
|
2122
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2084
2123
|
var UndoRedoButtons = ({ editor }) => {
|
|
2085
|
-
const handleUndo = (0,
|
|
2124
|
+
const handleUndo = (0, import_react7.useCallback)(() => {
|
|
2086
2125
|
try {
|
|
2087
2126
|
editor?.undo?.();
|
|
2088
2127
|
} catch (err) {
|
|
2089
2128
|
console.error("Undo failed:", err);
|
|
2090
2129
|
}
|
|
2091
2130
|
}, [editor]);
|
|
2092
|
-
const handleRedo = (0,
|
|
2131
|
+
const handleRedo = (0, import_react7.useCallback)(() => {
|
|
2093
2132
|
try {
|
|
2094
2133
|
editor?.redo?.();
|
|
2095
2134
|
} catch (err) {
|
|
2096
2135
|
console.error("Redo failed:", err);
|
|
2097
2136
|
}
|
|
2098
2137
|
}, [editor]);
|
|
2099
|
-
const handleMouseDown2 = (0,
|
|
2138
|
+
const handleMouseDown2 = (0, import_react7.useCallback)((e) => {
|
|
2100
2139
|
e.preventDefault();
|
|
2101
2140
|
}, []);
|
|
2102
|
-
return /* @__PURE__ */ (0,
|
|
2103
|
-
/* @__PURE__ */ (0,
|
|
2141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2104
2143
|
"button",
|
|
2105
2144
|
{
|
|
2106
2145
|
className: "lumir-toolbar-btn",
|
|
@@ -2111,7 +2150,7 @@ var UndoRedoButtons = ({ editor }) => {
|
|
|
2111
2150
|
children: Icons.undo
|
|
2112
2151
|
}
|
|
2113
2152
|
),
|
|
2114
|
-
/* @__PURE__ */ (0,
|
|
2153
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2115
2154
|
"button",
|
|
2116
2155
|
{
|
|
2117
2156
|
className: "lumir-toolbar-btn",
|
|
@@ -2126,8 +2165,8 @@ var UndoRedoButtons = ({ editor }) => {
|
|
|
2126
2165
|
};
|
|
2127
2166
|
|
|
2128
2167
|
// src/components/FloatingMenu/components/TextStyleButton.tsx
|
|
2129
|
-
var
|
|
2130
|
-
var
|
|
2168
|
+
var import_react8 = require("react");
|
|
2169
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2131
2170
|
var iconMap = {
|
|
2132
2171
|
bold: Icons.bold,
|
|
2133
2172
|
italic: Icons.italic,
|
|
@@ -2153,17 +2192,17 @@ var TextStyleButton = ({
|
|
|
2153
2192
|
}
|
|
2154
2193
|
};
|
|
2155
2194
|
const isActive = getIsActive();
|
|
2156
|
-
const handleClick = (0,
|
|
2195
|
+
const handleClick = (0, import_react8.useCallback)(() => {
|
|
2157
2196
|
try {
|
|
2158
2197
|
editor?.toggleStyles?.({ [style]: true });
|
|
2159
2198
|
} catch (err) {
|
|
2160
2199
|
console.error(`Toggle ${style} failed:`, err);
|
|
2161
2200
|
}
|
|
2162
2201
|
}, [editor, style]);
|
|
2163
|
-
const handleMouseDown2 = (0,
|
|
2202
|
+
const handleMouseDown2 = (0, import_react8.useCallback)((e) => {
|
|
2164
2203
|
e.preventDefault();
|
|
2165
2204
|
}, []);
|
|
2166
|
-
return /* @__PURE__ */ (0,
|
|
2205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
2167
2206
|
"button",
|
|
2168
2207
|
{
|
|
2169
2208
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -2177,7 +2216,7 @@ var TextStyleButton = ({
|
|
|
2177
2216
|
};
|
|
2178
2217
|
|
|
2179
2218
|
// src/components/FloatingMenu/components/AlignButton.tsx
|
|
2180
|
-
var
|
|
2219
|
+
var import_react9 = require("react");
|
|
2181
2220
|
|
|
2182
2221
|
// src/utils/prosemirror-table-utils.ts
|
|
2183
2222
|
function getSelectedCellPositions(editor) {
|
|
@@ -2273,7 +2312,7 @@ function getTableAlignment(editor, blockId) {
|
|
|
2273
2312
|
}
|
|
2274
2313
|
|
|
2275
2314
|
// src/components/FloatingMenu/components/AlignButton.tsx
|
|
2276
|
-
var
|
|
2315
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2277
2316
|
var iconMap2 = {
|
|
2278
2317
|
left: Icons.alignLeft,
|
|
2279
2318
|
center: Icons.alignCenter,
|
|
@@ -2300,7 +2339,7 @@ var AlignButton = ({
|
|
|
2300
2339
|
}
|
|
2301
2340
|
};
|
|
2302
2341
|
const isActive = getCurrentAlignment() === alignment;
|
|
2303
|
-
const handleClick = (0,
|
|
2342
|
+
const handleClick = (0, import_react9.useCallback)(() => {
|
|
2304
2343
|
try {
|
|
2305
2344
|
if (setSelectedCellsAttr(editor, "textAlignment", alignment)) {
|
|
2306
2345
|
return;
|
|
@@ -2313,10 +2352,10 @@ var AlignButton = ({
|
|
|
2313
2352
|
console.error(`Set alignment ${alignment} failed:`, err);
|
|
2314
2353
|
}
|
|
2315
2354
|
}, [editor, alignment]);
|
|
2316
|
-
const handleMouseDown2 = (0,
|
|
2355
|
+
const handleMouseDown2 = (0, import_react9.useCallback)((e) => {
|
|
2317
2356
|
e.preventDefault();
|
|
2318
2357
|
}, []);
|
|
2319
|
-
return /* @__PURE__ */ (0,
|
|
2358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
2320
2359
|
"button",
|
|
2321
2360
|
{
|
|
2322
2361
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -2330,8 +2369,8 @@ var AlignButton = ({
|
|
|
2330
2369
|
};
|
|
2331
2370
|
|
|
2332
2371
|
// src/components/FloatingMenu/components/ListButton.tsx
|
|
2333
|
-
var
|
|
2334
|
-
var
|
|
2372
|
+
var import_react10 = require("react");
|
|
2373
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2335
2374
|
var iconMap3 = {
|
|
2336
2375
|
bullet: Icons.bulletList,
|
|
2337
2376
|
numbered: Icons.numberedList
|
|
@@ -2351,7 +2390,7 @@ var ListButton = ({ editor, type }) => {
|
|
|
2351
2390
|
}
|
|
2352
2391
|
};
|
|
2353
2392
|
const isActive = getIsActive();
|
|
2354
|
-
const handleClick = (0,
|
|
2393
|
+
const handleClick = (0, import_react10.useCallback)(() => {
|
|
2355
2394
|
try {
|
|
2356
2395
|
const block = editor?.getTextCursorPosition()?.block;
|
|
2357
2396
|
if (block && editor?.updateBlock) {
|
|
@@ -2363,10 +2402,10 @@ var ListButton = ({ editor, type }) => {
|
|
|
2363
2402
|
console.error(`List toggle failed:`, err);
|
|
2364
2403
|
}
|
|
2365
2404
|
}, [editor, type]);
|
|
2366
|
-
const handleMouseDown2 = (0,
|
|
2405
|
+
const handleMouseDown2 = (0, import_react10.useCallback)((e) => {
|
|
2367
2406
|
e.preventDefault();
|
|
2368
2407
|
}, []);
|
|
2369
|
-
return /* @__PURE__ */ (0,
|
|
2408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
2370
2409
|
"button",
|
|
2371
2410
|
{
|
|
2372
2411
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -2380,13 +2419,13 @@ var ListButton = ({ editor, type }) => {
|
|
|
2380
2419
|
};
|
|
2381
2420
|
|
|
2382
2421
|
// src/components/FloatingMenu/components/ImageButton.tsx
|
|
2383
|
-
var
|
|
2384
|
-
var
|
|
2422
|
+
var import_react11 = require("react");
|
|
2423
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2385
2424
|
var ImageButton = ({
|
|
2386
2425
|
editor,
|
|
2387
2426
|
onImageUpload
|
|
2388
2427
|
}) => {
|
|
2389
|
-
const handleClick = (0,
|
|
2428
|
+
const handleClick = (0, import_react11.useCallback)(() => {
|
|
2390
2429
|
if (onImageUpload) {
|
|
2391
2430
|
onImageUpload();
|
|
2392
2431
|
} else {
|
|
@@ -2411,10 +2450,10 @@ var ImageButton = ({
|
|
|
2411
2450
|
input.click();
|
|
2412
2451
|
}
|
|
2413
2452
|
}, [editor, onImageUpload]);
|
|
2414
|
-
const handleMouseDown2 = (0,
|
|
2453
|
+
const handleMouseDown2 = (0, import_react11.useCallback)((e) => {
|
|
2415
2454
|
e.preventDefault();
|
|
2416
2455
|
}, []);
|
|
2417
|
-
return /* @__PURE__ */ (0,
|
|
2456
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2418
2457
|
"button",
|
|
2419
2458
|
{
|
|
2420
2459
|
className: "lumir-toolbar-btn",
|
|
@@ -2428,7 +2467,7 @@ var ImageButton = ({
|
|
|
2428
2467
|
};
|
|
2429
2468
|
|
|
2430
2469
|
// src/components/FloatingMenu/components/ColorButton.tsx
|
|
2431
|
-
var
|
|
2470
|
+
var import_react12 = require("react");
|
|
2432
2471
|
|
|
2433
2472
|
// src/constants/colors.ts
|
|
2434
2473
|
var TEXT_COLORS = [
|
|
@@ -2462,13 +2501,13 @@ var getHexFromColorValue = (value, type) => {
|
|
|
2462
2501
|
};
|
|
2463
2502
|
|
|
2464
2503
|
// src/components/FloatingMenu/components/ColorButton.tsx
|
|
2465
|
-
var
|
|
2504
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2466
2505
|
var ColorButton = ({ editor, type }) => {
|
|
2467
|
-
const [isOpen, setIsOpen] = (0,
|
|
2468
|
-
const [currentColor, setCurrentColor] = (0,
|
|
2469
|
-
const dropdownRef = (0,
|
|
2506
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
2507
|
+
const [currentColor, setCurrentColor] = (0, import_react12.useState)("default");
|
|
2508
|
+
const dropdownRef = (0, import_react12.useRef)(null);
|
|
2470
2509
|
const colors = type === "text" ? TEXT_COLORS : BACKGROUND_COLORS;
|
|
2471
|
-
const getCurrentColor = (0,
|
|
2510
|
+
const getCurrentColor = (0, import_react12.useCallback)(() => {
|
|
2472
2511
|
try {
|
|
2473
2512
|
if (isInTableCell(editor)) {
|
|
2474
2513
|
const attr = type === "text" ? "textColor" : "backgroundColor";
|
|
@@ -2484,13 +2523,13 @@ var ColorButton = ({ editor, type }) => {
|
|
|
2484
2523
|
}
|
|
2485
2524
|
return "default";
|
|
2486
2525
|
}, [editor, type]);
|
|
2487
|
-
(0,
|
|
2526
|
+
(0, import_react12.useEffect)(() => {
|
|
2488
2527
|
if (isOpen) {
|
|
2489
2528
|
const color = getCurrentColor();
|
|
2490
2529
|
setCurrentColor(color);
|
|
2491
2530
|
}
|
|
2492
2531
|
}, [isOpen, getCurrentColor]);
|
|
2493
|
-
(0,
|
|
2532
|
+
(0, import_react12.useEffect)(() => {
|
|
2494
2533
|
const handleClickOutside = (e) => {
|
|
2495
2534
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2496
2535
|
setIsOpen(false);
|
|
@@ -2499,7 +2538,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
2499
2538
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2500
2539
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2501
2540
|
}, []);
|
|
2502
|
-
const handleColorSelect = (0,
|
|
2541
|
+
const handleColorSelect = (0, import_react12.useCallback)(
|
|
2503
2542
|
(color) => {
|
|
2504
2543
|
try {
|
|
2505
2544
|
if (!editor) return;
|
|
@@ -2518,11 +2557,11 @@ var ColorButton = ({ editor, type }) => {
|
|
|
2518
2557
|
},
|
|
2519
2558
|
[editor, type]
|
|
2520
2559
|
);
|
|
2521
|
-
const handleMouseDown2 = (0,
|
|
2560
|
+
const handleMouseDown2 = (0, import_react12.useCallback)((e) => {
|
|
2522
2561
|
e.preventDefault();
|
|
2523
2562
|
}, []);
|
|
2524
|
-
return /* @__PURE__ */ (0,
|
|
2525
|
-
/* @__PURE__ */ (0,
|
|
2563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
2526
2565
|
"button",
|
|
2527
2566
|
{
|
|
2528
2567
|
className: "lumir-toolbar-btn lumir-color-btn",
|
|
@@ -2532,7 +2571,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
2532
2571
|
type: "button",
|
|
2533
2572
|
children: [
|
|
2534
2573
|
type === "text" ? Icons.textColor : Icons.bgColor,
|
|
2535
|
-
/* @__PURE__ */ (0,
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2536
2575
|
"span",
|
|
2537
2576
|
{
|
|
2538
2577
|
className: "lumir-color-indicator",
|
|
@@ -2544,7 +2583,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
2544
2583
|
]
|
|
2545
2584
|
}
|
|
2546
2585
|
),
|
|
2547
|
-
isOpen && /* @__PURE__ */ (0,
|
|
2586
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lumir-dropdown-menu lumir-color-menu", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "lumir-color-grid", children: colors.map((color) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2548
2587
|
"button",
|
|
2549
2588
|
{
|
|
2550
2589
|
className: cn(
|
|
@@ -2563,13 +2602,13 @@ var ColorButton = ({ editor, type }) => {
|
|
|
2563
2602
|
};
|
|
2564
2603
|
|
|
2565
2604
|
// src/components/FloatingMenu/components/FontSizeButton.tsx
|
|
2566
|
-
var
|
|
2567
|
-
var
|
|
2605
|
+
var import_react13 = require("react");
|
|
2606
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2568
2607
|
var DEFAULT_LABEL = "\uAE30\uBCF8";
|
|
2569
2608
|
var toLabel = (size) => size.replace(/px$/, "");
|
|
2570
2609
|
var FontSizeButton = ({ editor }) => {
|
|
2571
|
-
const [isOpen, setIsOpen] = (0,
|
|
2572
|
-
const dropdownRef = (0,
|
|
2610
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
2611
|
+
const dropdownRef = (0, import_react13.useRef)(null);
|
|
2573
2612
|
const getCurrentSize = () => {
|
|
2574
2613
|
try {
|
|
2575
2614
|
return editor?.getActiveStyles?.()?.fontSize || "";
|
|
@@ -2578,7 +2617,12 @@ var FontSizeButton = ({ editor }) => {
|
|
|
2578
2617
|
}
|
|
2579
2618
|
};
|
|
2580
2619
|
const currentSize = getCurrentSize();
|
|
2581
|
-
|
|
2620
|
+
const currentPx = parseFontSizePx(currentSize);
|
|
2621
|
+
const [inputValue, setInputValue] = (0, import_react13.useState)(String(currentPx));
|
|
2622
|
+
(0, import_react13.useEffect)(() => {
|
|
2623
|
+
setInputValue(String(currentPx));
|
|
2624
|
+
}, [currentPx]);
|
|
2625
|
+
(0, import_react13.useEffect)(() => {
|
|
2582
2626
|
const handleClickOutside = (e) => {
|
|
2583
2627
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2584
2628
|
setIsOpen(false);
|
|
@@ -2587,7 +2631,7 @@ var FontSizeButton = ({ editor }) => {
|
|
|
2587
2631
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2588
2632
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2589
2633
|
}, []);
|
|
2590
|
-
const handleSizeSelect = (0,
|
|
2634
|
+
const handleSizeSelect = (0, import_react13.useCallback)(
|
|
2591
2635
|
(size) => {
|
|
2592
2636
|
try {
|
|
2593
2637
|
if (!editor) return;
|
|
@@ -2604,11 +2648,35 @@ var FontSizeButton = ({ editor }) => {
|
|
|
2604
2648
|
},
|
|
2605
2649
|
[editor]
|
|
2606
2650
|
);
|
|
2607
|
-
const
|
|
2651
|
+
const stepBy = (0, import_react13.useCallback)(
|
|
2652
|
+
(delta) => {
|
|
2653
|
+
try {
|
|
2654
|
+
editor?.addStyles?.({
|
|
2655
|
+
fontSize: toFontSizeValue(currentPx + delta)
|
|
2656
|
+
});
|
|
2657
|
+
} catch (err) {
|
|
2658
|
+
console.error("Font size step failed:", err);
|
|
2659
|
+
}
|
|
2660
|
+
},
|
|
2661
|
+
[editor, currentPx]
|
|
2662
|
+
);
|
|
2663
|
+
const applyInput = (0, import_react13.useCallback)(() => {
|
|
2664
|
+
const n = parseInt(inputValue, 10);
|
|
2665
|
+
if (Number.isFinite(n)) {
|
|
2666
|
+
try {
|
|
2667
|
+
editor?.addStyles?.({ fontSize: toFontSizeValue(n) });
|
|
2668
|
+
} catch (err) {
|
|
2669
|
+
console.error("Font size apply failed:", err);
|
|
2670
|
+
}
|
|
2671
|
+
} else {
|
|
2672
|
+
setInputValue(String(currentPx));
|
|
2673
|
+
}
|
|
2674
|
+
}, [editor, inputValue, currentPx]);
|
|
2675
|
+
const handleMouseDown2 = (0, import_react13.useCallback)((e) => {
|
|
2608
2676
|
e.preventDefault();
|
|
2609
2677
|
}, []);
|
|
2610
|
-
return /* @__PURE__ */ (0,
|
|
2611
|
-
/* @__PURE__ */ (0,
|
|
2678
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
2612
2680
|
"button",
|
|
2613
2681
|
{
|
|
2614
2682
|
className: "lumir-dropdown-btn lumir-font-size-btn",
|
|
@@ -2617,13 +2685,64 @@ var FontSizeButton = ({ editor }) => {
|
|
|
2617
2685
|
title: "\uAE00\uC790 \uD06C\uAE30",
|
|
2618
2686
|
type: "button",
|
|
2619
2687
|
children: [
|
|
2620
|
-
/* @__PURE__ */ (0,
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "lumir-font-size-label", children: currentSize ? toLabel(currentSize) : DEFAULT_LABEL }),
|
|
2621
2689
|
Icons.expandMore
|
|
2622
2690
|
]
|
|
2623
2691
|
}
|
|
2624
2692
|
),
|
|
2625
|
-
isOpen && /* @__PURE__ */ (0,
|
|
2626
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lumir-dropdown-menu lumir-font-size-menu", children: [
|
|
2694
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lumir-fs-stepper", children: [
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2696
|
+
"button",
|
|
2697
|
+
{
|
|
2698
|
+
type: "button",
|
|
2699
|
+
className: "lumir-fs-stepper-btn",
|
|
2700
|
+
"aria-label": "\uAE00\uC790 \uD06C\uAE30 1px \uC904\uC774\uAE30",
|
|
2701
|
+
disabled: currentPx <= FONT_SIZE_MIN,
|
|
2702
|
+
onMouseDown: handleMouseDown2,
|
|
2703
|
+
onClick: () => stepBy(-1),
|
|
2704
|
+
children: "\u2212"
|
|
2705
|
+
}
|
|
2706
|
+
),
|
|
2707
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2708
|
+
"input",
|
|
2709
|
+
{
|
|
2710
|
+
className: "lumir-fs-stepper-input",
|
|
2711
|
+
type: "text",
|
|
2712
|
+
inputMode: "numeric",
|
|
2713
|
+
"aria-label": "\uAE00\uC790 \uD06C\uAE30 \uC785\uB825",
|
|
2714
|
+
value: inputValue,
|
|
2715
|
+
onChange: (e) => setInputValue(e.target.value.replace(/[^0-9]/g, "")),
|
|
2716
|
+
onKeyDown: (e) => {
|
|
2717
|
+
e.stopPropagation();
|
|
2718
|
+
if (e.key === "Enter") {
|
|
2719
|
+
e.preventDefault();
|
|
2720
|
+
applyInput();
|
|
2721
|
+
} else if (e.key === "ArrowUp") {
|
|
2722
|
+
e.preventDefault();
|
|
2723
|
+
stepBy(1);
|
|
2724
|
+
} else if (e.key === "ArrowDown") {
|
|
2725
|
+
e.preventDefault();
|
|
2726
|
+
stepBy(-1);
|
|
2727
|
+
}
|
|
2728
|
+
},
|
|
2729
|
+
onBlur: applyInput
|
|
2730
|
+
}
|
|
2731
|
+
),
|
|
2732
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2733
|
+
"button",
|
|
2734
|
+
{
|
|
2735
|
+
type: "button",
|
|
2736
|
+
className: "lumir-fs-stepper-btn",
|
|
2737
|
+
"aria-label": "\uAE00\uC790 \uD06C\uAE30 1px \uB298\uB9AC\uAE30",
|
|
2738
|
+
disabled: currentPx >= FONT_SIZE_MAX,
|
|
2739
|
+
onMouseDown: handleMouseDown2,
|
|
2740
|
+
onClick: () => stepBy(1),
|
|
2741
|
+
children: "+"
|
|
2742
|
+
}
|
|
2743
|
+
)
|
|
2744
|
+
] }),
|
|
2745
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2627
2746
|
"button",
|
|
2628
2747
|
{
|
|
2629
2748
|
className: cn(
|
|
@@ -2636,7 +2755,7 @@ var FontSizeButton = ({ editor }) => {
|
|
|
2636
2755
|
children: DEFAULT_LABEL
|
|
2637
2756
|
}
|
|
2638
2757
|
),
|
|
2639
|
-
FONT_SIZE_PRESETS.map((size) => /* @__PURE__ */ (0,
|
|
2758
|
+
FONT_SIZE_PRESETS.map((size) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2640
2759
|
"button",
|
|
2641
2760
|
{
|
|
2642
2761
|
className: cn(
|
|
@@ -2655,8 +2774,8 @@ var FontSizeButton = ({ editor }) => {
|
|
|
2655
2774
|
};
|
|
2656
2775
|
|
|
2657
2776
|
// src/components/FloatingMenu/components/LinkButton.tsx
|
|
2658
|
-
var
|
|
2659
|
-
var
|
|
2777
|
+
var import_react14 = require("react");
|
|
2778
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2660
2779
|
var isDangerousProtocol = (url) => {
|
|
2661
2780
|
const trimmedUrl = url.trim().toLowerCase();
|
|
2662
2781
|
const dangerousPatterns = [
|
|
@@ -2682,13 +2801,13 @@ var normalizeUrl = (url) => {
|
|
|
2682
2801
|
return `https://${trimmedUrl}`;
|
|
2683
2802
|
};
|
|
2684
2803
|
var LinkButton = ({ editor }) => {
|
|
2685
|
-
const [isOpen, setIsOpen] = (0,
|
|
2686
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
2687
|
-
const [errorMsg, setErrorMsg] = (0,
|
|
2688
|
-
const dropdownRef = (0,
|
|
2689
|
-
const inputRef = (0,
|
|
2690
|
-
const hasSelectionRef = (0,
|
|
2691
|
-
(0,
|
|
2804
|
+
const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
|
|
2805
|
+
const [linkUrl, setLinkUrl] = (0, import_react14.useState)("");
|
|
2806
|
+
const [errorMsg, setErrorMsg] = (0, import_react14.useState)(null);
|
|
2807
|
+
const dropdownRef = (0, import_react14.useRef)(null);
|
|
2808
|
+
const inputRef = (0, import_react14.useRef)(null);
|
|
2809
|
+
const hasSelectionRef = (0, import_react14.useRef)(false);
|
|
2810
|
+
(0, import_react14.useEffect)(() => {
|
|
2692
2811
|
const handleClickOutside = (e) => {
|
|
2693
2812
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2694
2813
|
setIsOpen(false);
|
|
@@ -2699,7 +2818,7 @@ var LinkButton = ({ editor }) => {
|
|
|
2699
2818
|
document.addEventListener("mousedown", handleClickOutside);
|
|
2700
2819
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2701
2820
|
}, []);
|
|
2702
|
-
(0,
|
|
2821
|
+
(0, import_react14.useEffect)(() => {
|
|
2703
2822
|
if (isOpen && inputRef.current) {
|
|
2704
2823
|
try {
|
|
2705
2824
|
const selectedText = editor?.getSelectedText?.() || "";
|
|
@@ -2710,7 +2829,7 @@ var LinkButton = ({ editor }) => {
|
|
|
2710
2829
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
2711
2830
|
}
|
|
2712
2831
|
}, [isOpen, editor]);
|
|
2713
|
-
const handleSubmit = (0,
|
|
2832
|
+
const handleSubmit = (0, import_react14.useCallback)(
|
|
2714
2833
|
(e) => {
|
|
2715
2834
|
e?.preventDefault();
|
|
2716
2835
|
setErrorMsg(null);
|
|
@@ -2737,15 +2856,15 @@ var LinkButton = ({ editor }) => {
|
|
|
2737
2856
|
},
|
|
2738
2857
|
[editor, linkUrl]
|
|
2739
2858
|
);
|
|
2740
|
-
const handleCancel = (0,
|
|
2859
|
+
const handleCancel = (0, import_react14.useCallback)(() => {
|
|
2741
2860
|
setIsOpen(false);
|
|
2742
2861
|
setLinkUrl("");
|
|
2743
2862
|
setErrorMsg(null);
|
|
2744
2863
|
}, []);
|
|
2745
|
-
const handleMouseDown2 = (0,
|
|
2864
|
+
const handleMouseDown2 = (0, import_react14.useCallback)((e) => {
|
|
2746
2865
|
e.preventDefault();
|
|
2747
2866
|
}, []);
|
|
2748
|
-
const handleKeyDown = (0,
|
|
2867
|
+
const handleKeyDown = (0, import_react14.useCallback)(
|
|
2749
2868
|
(e) => {
|
|
2750
2869
|
if (e.key === "Enter") {
|
|
2751
2870
|
handleSubmit();
|
|
@@ -2755,8 +2874,8 @@ var LinkButton = ({ editor }) => {
|
|
|
2755
2874
|
},
|
|
2756
2875
|
[handleSubmit, handleCancel]
|
|
2757
2876
|
);
|
|
2758
|
-
return /* @__PURE__ */ (0,
|
|
2759
|
-
/* @__PURE__ */ (0,
|
|
2877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2760
2879
|
"button",
|
|
2761
2880
|
{
|
|
2762
2881
|
className: "lumir-toolbar-btn",
|
|
@@ -2767,8 +2886,8 @@ var LinkButton = ({ editor }) => {
|
|
|
2767
2886
|
children: Icons.link
|
|
2768
2887
|
}
|
|
2769
2888
|
),
|
|
2770
|
-
isOpen && /* @__PURE__ */ (0,
|
|
2771
|
-
/* @__PURE__ */ (0,
|
|
2889
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "lumir-dropdown-menu lumir-link-menu", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("form", { onSubmit: handleSubmit, className: "lumir-link-form", children: [
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2772
2891
|
"input",
|
|
2773
2892
|
{
|
|
2774
2893
|
ref: inputRef,
|
|
@@ -2784,7 +2903,7 @@ var LinkButton = ({ editor }) => {
|
|
|
2784
2903
|
onMouseDown: handleMouseDown2
|
|
2785
2904
|
}
|
|
2786
2905
|
),
|
|
2787
|
-
errorMsg && /* @__PURE__ */ (0,
|
|
2906
|
+
errorMsg && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2788
2907
|
"div",
|
|
2789
2908
|
{
|
|
2790
2909
|
style: {
|
|
@@ -2796,8 +2915,8 @@ var LinkButton = ({ editor }) => {
|
|
|
2796
2915
|
children: errorMsg
|
|
2797
2916
|
}
|
|
2798
2917
|
),
|
|
2799
|
-
/* @__PURE__ */ (0,
|
|
2800
|
-
/* @__PURE__ */ (0,
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "lumir-link-actions", children: [
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2801
2920
|
"button",
|
|
2802
2921
|
{
|
|
2803
2922
|
type: "button",
|
|
@@ -2807,7 +2926,7 @@ var LinkButton = ({ editor }) => {
|
|
|
2807
2926
|
children: "\uCDE8\uC18C"
|
|
2808
2927
|
}
|
|
2809
2928
|
),
|
|
2810
|
-
/* @__PURE__ */ (0,
|
|
2929
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2811
2930
|
"button",
|
|
2812
2931
|
{
|
|
2813
2932
|
type: "submit",
|
|
@@ -2823,10 +2942,10 @@ var LinkButton = ({ editor }) => {
|
|
|
2823
2942
|
};
|
|
2824
2943
|
|
|
2825
2944
|
// src/components/FloatingMenu/components/TableButton.tsx
|
|
2826
|
-
var
|
|
2827
|
-
var
|
|
2945
|
+
var import_react15 = require("react");
|
|
2946
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2828
2947
|
var TableButton = ({ editor }) => {
|
|
2829
|
-
const handleClick = (0,
|
|
2948
|
+
const handleClick = (0, import_react15.useCallback)(() => {
|
|
2830
2949
|
try {
|
|
2831
2950
|
const block = editor?.getTextCursorPosition()?.block;
|
|
2832
2951
|
if (!block || !editor?.insertBlocks) return;
|
|
@@ -2848,10 +2967,10 @@ var TableButton = ({ editor }) => {
|
|
|
2848
2967
|
console.error("Table insert failed:", err);
|
|
2849
2968
|
}
|
|
2850
2969
|
}, [editor]);
|
|
2851
|
-
const handleMouseDown2 = (0,
|
|
2970
|
+
const handleMouseDown2 = (0, import_react15.useCallback)((e) => {
|
|
2852
2971
|
e.preventDefault();
|
|
2853
2972
|
}, []);
|
|
2854
|
-
return /* @__PURE__ */ (0,
|
|
2973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2855
2974
|
"button",
|
|
2856
2975
|
{
|
|
2857
2976
|
className: "lumir-toolbar-btn",
|
|
@@ -2865,13 +2984,13 @@ var TableButton = ({ editor }) => {
|
|
|
2865
2984
|
};
|
|
2866
2985
|
|
|
2867
2986
|
// src/components/FloatingMenu/components/HTMLImportButton.tsx
|
|
2868
|
-
var
|
|
2869
|
-
var
|
|
2987
|
+
var import_react16 = require("react");
|
|
2988
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2870
2989
|
var HTMLImportButton = ({
|
|
2871
2990
|
editor
|
|
2872
2991
|
}) => {
|
|
2873
|
-
const fileInputRef = (0,
|
|
2874
|
-
const handleFileUpload = (0,
|
|
2992
|
+
const fileInputRef = (0, import_react16.useRef)(null);
|
|
2993
|
+
const handleFileUpload = (0, import_react16.useCallback)(
|
|
2875
2994
|
(e) => {
|
|
2876
2995
|
const file = e.target.files?.[0];
|
|
2877
2996
|
if (!file) return;
|
|
@@ -2907,14 +3026,14 @@ var HTMLImportButton = ({
|
|
|
2907
3026
|
},
|
|
2908
3027
|
[editor]
|
|
2909
3028
|
);
|
|
2910
|
-
const handleClick = (0,
|
|
3029
|
+
const handleClick = (0, import_react16.useCallback)(() => {
|
|
2911
3030
|
fileInputRef.current?.click();
|
|
2912
3031
|
}, []);
|
|
2913
|
-
const handleMouseDown2 = (0,
|
|
3032
|
+
const handleMouseDown2 = (0, import_react16.useCallback)((e) => {
|
|
2914
3033
|
e.preventDefault();
|
|
2915
3034
|
}, []);
|
|
2916
|
-
return /* @__PURE__ */ (0,
|
|
2917
|
-
/* @__PURE__ */ (0,
|
|
3035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
3036
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2918
3037
|
"input",
|
|
2919
3038
|
{
|
|
2920
3039
|
ref: fileInputRef,
|
|
@@ -2924,7 +3043,7 @@ var HTMLImportButton = ({
|
|
|
2924
3043
|
style: { display: "none" }
|
|
2925
3044
|
}
|
|
2926
3045
|
),
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2928
3047
|
"button",
|
|
2929
3048
|
{
|
|
2930
3049
|
className: "lumir-toolbar-btn",
|
|
@@ -2939,8 +3058,8 @@ var HTMLImportButton = ({
|
|
|
2939
3058
|
};
|
|
2940
3059
|
|
|
2941
3060
|
// src/components/FloatingMenu/components/BlockTypeSelect.tsx
|
|
2942
|
-
var
|
|
2943
|
-
var
|
|
3061
|
+
var import_react17 = require("react");
|
|
3062
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2944
3063
|
var blockTypeCategories = [
|
|
2945
3064
|
{
|
|
2946
3065
|
category: "Headings",
|
|
@@ -2970,8 +3089,8 @@ var blockTypes = blockTypeCategories.flatMap(
|
|
|
2970
3089
|
(cat) => cat.items
|
|
2971
3090
|
);
|
|
2972
3091
|
var BlockTypeSelect = ({ editor }) => {
|
|
2973
|
-
const [isOpen, setIsOpen] = (0,
|
|
2974
|
-
const dropdownRef = (0,
|
|
3092
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
3093
|
+
const dropdownRef = (0, import_react17.useRef)(null);
|
|
2975
3094
|
const getCurrentBlock = () => {
|
|
2976
3095
|
try {
|
|
2977
3096
|
return editor?.getTextCursorPosition()?.block;
|
|
@@ -2983,7 +3102,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2983
3102
|
const currentType = currentBlock?.type || "paragraph";
|
|
2984
3103
|
const currentLevel = currentBlock?.props?.level;
|
|
2985
3104
|
const isCurrentToggle = currentType === "heading" && currentBlock?.props?.isToggleable === true;
|
|
2986
|
-
(0,
|
|
3105
|
+
(0, import_react17.useEffect)(() => {
|
|
2987
3106
|
const handleClickOutside = (e) => {
|
|
2988
3107
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2989
3108
|
setIsOpen(false);
|
|
@@ -3012,7 +3131,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
3012
3131
|
console.error("Block type change failed:", err);
|
|
3013
3132
|
}
|
|
3014
3133
|
};
|
|
3015
|
-
const handleMouseDown2 = (0,
|
|
3134
|
+
const handleMouseDown2 = (0, import_react17.useCallback)((e) => {
|
|
3016
3135
|
e.preventDefault();
|
|
3017
3136
|
}, []);
|
|
3018
3137
|
const getCurrentLabel = () => {
|
|
@@ -3043,8 +3162,8 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
3043
3162
|
}
|
|
3044
3163
|
return currentType === bt.type;
|
|
3045
3164
|
};
|
|
3046
|
-
return /* @__PURE__ */ (0,
|
|
3047
|
-
/* @__PURE__ */ (0,
|
|
3165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
3166
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3048
3167
|
"button",
|
|
3049
3168
|
{
|
|
3050
3169
|
className: "lumir-dropdown-btn lumir-block-type-btn",
|
|
@@ -3052,15 +3171,15 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
3052
3171
|
onMouseDown: handleMouseDown2,
|
|
3053
3172
|
type: "button",
|
|
3054
3173
|
children: [
|
|
3055
|
-
/* @__PURE__ */ (0,
|
|
3056
|
-
/* @__PURE__ */ (0,
|
|
3174
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "lumir-block-icon", children: BlockTypeIcons[getCurrentIcon()] }),
|
|
3175
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "lumir-block-label", children: getCurrentLabel() }),
|
|
3057
3176
|
Icons.expandMore
|
|
3058
3177
|
]
|
|
3059
3178
|
}
|
|
3060
3179
|
),
|
|
3061
|
-
isOpen && /* @__PURE__ */ (0,
|
|
3062
|
-
/* @__PURE__ */ (0,
|
|
3063
|
-
category.items.map((bt) => /* @__PURE__ */ (0,
|
|
3180
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lumir-dropdown-menu lumir-block-menu", children: blockTypeCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-block-category", children: [
|
|
3181
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lumir-block-category-title", children: category.category }),
|
|
3182
|
+
category.items.map((bt) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
3064
3183
|
"button",
|
|
3065
3184
|
{
|
|
3066
3185
|
className: cn(
|
|
@@ -3070,8 +3189,8 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
3070
3189
|
onClick: () => handleTypeChange(bt.type, bt.level, bt.isToggle),
|
|
3071
3190
|
onMouseDown: handleMouseDown2,
|
|
3072
3191
|
children: [
|
|
3073
|
-
/* @__PURE__ */ (0,
|
|
3074
|
-
/* @__PURE__ */ (0,
|
|
3192
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "lumir-block-icon", children: BlockTypeIcons[bt.icon] }),
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "lumir-block-item-title", children: bt.label })
|
|
3075
3194
|
]
|
|
3076
3195
|
},
|
|
3077
3196
|
bt.icon
|
|
@@ -3081,7 +3200,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
3081
3200
|
};
|
|
3082
3201
|
|
|
3083
3202
|
// src/components/FloatingMenu/index.tsx
|
|
3084
|
-
var
|
|
3203
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3085
3204
|
var COMPACT_BREAKPOINT = 700;
|
|
3086
3205
|
var MINIMIZED_BREAKPOINT = 400;
|
|
3087
3206
|
var FloatingMenu = ({
|
|
@@ -3090,12 +3209,12 @@ var FloatingMenu = ({
|
|
|
3090
3209
|
className,
|
|
3091
3210
|
onImageUpload
|
|
3092
3211
|
}) => {
|
|
3093
|
-
const wrapperRef = (0,
|
|
3094
|
-
const [isCompact, setIsCompact] = (0,
|
|
3095
|
-
const [isMinimizable, setIsMinimizable] = (0,
|
|
3096
|
-
const [isMinimized, setIsMinimized] = (0,
|
|
3097
|
-
const [, setSelectionTick] = (0,
|
|
3098
|
-
(0,
|
|
3212
|
+
const wrapperRef = (0, import_react18.useRef)(null);
|
|
3213
|
+
const [isCompact, setIsCompact] = (0, import_react18.useState)(false);
|
|
3214
|
+
const [isMinimizable, setIsMinimizable] = (0, import_react18.useState)(false);
|
|
3215
|
+
const [isMinimized, setIsMinimized] = (0, import_react18.useState)(false);
|
|
3216
|
+
const [, setSelectionTick] = (0, import_react18.useState)(0);
|
|
3217
|
+
(0, import_react18.useEffect)(() => {
|
|
3099
3218
|
if (!editor) return;
|
|
3100
3219
|
let debounceTimer = null;
|
|
3101
3220
|
const DEBOUNCE_DELAY = 150;
|
|
@@ -3119,7 +3238,7 @@ var FloatingMenu = ({
|
|
|
3119
3238
|
unsubscribeContent?.();
|
|
3120
3239
|
};
|
|
3121
3240
|
}, [editor]);
|
|
3122
|
-
(0,
|
|
3241
|
+
(0, import_react18.useEffect)(() => {
|
|
3123
3242
|
const checkWidth = () => {
|
|
3124
3243
|
if (wrapperRef.current) {
|
|
3125
3244
|
const width = wrapperRef.current.offsetWidth;
|
|
@@ -3134,8 +3253,8 @@ var FloatingMenu = ({
|
|
|
3134
3253
|
}
|
|
3135
3254
|
return () => resizeObserver.disconnect();
|
|
3136
3255
|
}, []);
|
|
3137
|
-
const MinimizedLayout = () => /* @__PURE__ */ (0,
|
|
3138
|
-
/* @__PURE__ */ (0,
|
|
3256
|
+
const MinimizedLayout = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3257
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3139
3258
|
"button",
|
|
3140
3259
|
{
|
|
3141
3260
|
className: "lumir-toolbar-button lumir-toggle-button",
|
|
@@ -3146,120 +3265,120 @@ var FloatingMenu = ({
|
|
|
3146
3265
|
children: isMinimized ? Icons.chevronRight : Icons.chevronLeft
|
|
3147
3266
|
}
|
|
3148
3267
|
),
|
|
3149
|
-
!isMinimized && /* @__PURE__ */ (0,
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3151
|
-
/* @__PURE__ */ (0,
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3153
|
-
/* @__PURE__ */ (0,
|
|
3154
|
-
/* @__PURE__ */ (0,
|
|
3155
|
-
/* @__PURE__ */ (0,
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
3157
|
-
/* @__PURE__ */ (0,
|
|
3158
|
-
/* @__PURE__ */ (0,
|
|
3159
|
-
/* @__PURE__ */ (0,
|
|
3268
|
+
!isMinimized && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3269
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3270
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UndoRedoButtons, { editor }),
|
|
3271
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3272
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BlockTypeSelect, { editor }) }),
|
|
3273
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3274
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3275
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "bold" }),
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "italic" }),
|
|
3277
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "underline" }),
|
|
3278
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "strike" })
|
|
3160
3279
|
] }),
|
|
3161
|
-
/* @__PURE__ */ (0,
|
|
3162
|
-
/* @__PURE__ */ (0,
|
|
3163
|
-
/* @__PURE__ */ (0,
|
|
3164
|
-
/* @__PURE__ */ (0,
|
|
3165
|
-
/* @__PURE__ */ (0,
|
|
3280
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3281
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "left" }),
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "center" }),
|
|
3284
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "right" })
|
|
3166
3285
|
] }),
|
|
3167
|
-
/* @__PURE__ */ (0,
|
|
3168
|
-
/* @__PURE__ */ (0,
|
|
3169
|
-
/* @__PURE__ */ (0,
|
|
3170
|
-
/* @__PURE__ */ (0,
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3287
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3288
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ListButton, { editor, type: "bullet" }),
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ListButton, { editor, type: "numbered" })
|
|
3171
3290
|
] }),
|
|
3172
|
-
/* @__PURE__ */ (0,
|
|
3173
|
-
/* @__PURE__ */ (0,
|
|
3174
|
-
/* @__PURE__ */ (0,
|
|
3175
|
-
/* @__PURE__ */ (0,
|
|
3176
|
-
/* @__PURE__ */ (0,
|
|
3291
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3292
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3293
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FontSizeButton, { editor }),
|
|
3294
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorButton, { editor, type: "text" }),
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorButton, { editor, type: "background" })
|
|
3177
3296
|
] }),
|
|
3178
|
-
/* @__PURE__ */ (0,
|
|
3179
|
-
/* @__PURE__ */ (0,
|
|
3180
|
-
/* @__PURE__ */ (0,
|
|
3181
|
-
/* @__PURE__ */ (0,
|
|
3182
|
-
/* @__PURE__ */ (0,
|
|
3183
|
-
/* @__PURE__ */ (0,
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3298
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3299
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageButton, { editor, onImageUpload }),
|
|
3300
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LinkButton, { editor }),
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableButton, { editor }),
|
|
3302
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HTMLImportButton, { editor })
|
|
3184
3303
|
] })
|
|
3185
3304
|
] })
|
|
3186
3305
|
] });
|
|
3187
|
-
const SingleRowLayout = () => /* @__PURE__ */ (0,
|
|
3188
|
-
/* @__PURE__ */ (0,
|
|
3189
|
-
/* @__PURE__ */ (0,
|
|
3190
|
-
/* @__PURE__ */ (0,
|
|
3191
|
-
/* @__PURE__ */ (0,
|
|
3192
|
-
/* @__PURE__ */ (0,
|
|
3193
|
-
/* @__PURE__ */ (0,
|
|
3194
|
-
/* @__PURE__ */ (0,
|
|
3195
|
-
/* @__PURE__ */ (0,
|
|
3196
|
-
/* @__PURE__ */ (0,
|
|
3306
|
+
const SingleRowLayout = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3307
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UndoRedoButtons, { editor }),
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3309
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BlockTypeSelect, { editor }) }),
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3311
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3312
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "bold" }),
|
|
3313
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "italic" }),
|
|
3314
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "underline" }),
|
|
3315
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "strike" })
|
|
3197
3316
|
] }),
|
|
3198
|
-
/* @__PURE__ */ (0,
|
|
3199
|
-
/* @__PURE__ */ (0,
|
|
3200
|
-
/* @__PURE__ */ (0,
|
|
3201
|
-
/* @__PURE__ */ (0,
|
|
3202
|
-
/* @__PURE__ */ (0,
|
|
3317
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3318
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3319
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "left" }),
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "center" }),
|
|
3321
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "right" })
|
|
3203
3322
|
] }),
|
|
3204
|
-
/* @__PURE__ */ (0,
|
|
3205
|
-
/* @__PURE__ */ (0,
|
|
3206
|
-
/* @__PURE__ */ (0,
|
|
3207
|
-
/* @__PURE__ */ (0,
|
|
3323
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3324
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3325
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ListButton, { editor, type: "bullet" }),
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ListButton, { editor, type: "numbered" })
|
|
3208
3327
|
] }),
|
|
3209
|
-
/* @__PURE__ */ (0,
|
|
3210
|
-
/* @__PURE__ */ (0,
|
|
3211
|
-
/* @__PURE__ */ (0,
|
|
3212
|
-
/* @__PURE__ */ (0,
|
|
3213
|
-
/* @__PURE__ */ (0,
|
|
3328
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3329
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3330
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FontSizeButton, { editor }),
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorButton, { editor, type: "text" }),
|
|
3332
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorButton, { editor, type: "background" })
|
|
3214
3333
|
] }),
|
|
3215
|
-
/* @__PURE__ */ (0,
|
|
3216
|
-
/* @__PURE__ */ (0,
|
|
3217
|
-
/* @__PURE__ */ (0,
|
|
3218
|
-
/* @__PURE__ */ (0,
|
|
3219
|
-
/* @__PURE__ */ (0,
|
|
3220
|
-
/* @__PURE__ */ (0,
|
|
3334
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3335
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3336
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageButton, { editor, onImageUpload }),
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LinkButton, { editor }),
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableButton, { editor }),
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HTMLImportButton, { editor })
|
|
3221
3340
|
] })
|
|
3222
3341
|
] });
|
|
3223
|
-
const TwoRowLayout = () => /* @__PURE__ */ (0,
|
|
3224
|
-
/* @__PURE__ */ (0,
|
|
3225
|
-
/* @__PURE__ */ (0,
|
|
3226
|
-
/* @__PURE__ */ (0,
|
|
3227
|
-
/* @__PURE__ */ (0,
|
|
3228
|
-
/* @__PURE__ */ (0,
|
|
3229
|
-
/* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3231
|
-
/* @__PURE__ */ (0,
|
|
3342
|
+
const TwoRowLayout = () => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3343
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-row", children: [
|
|
3344
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(UndoRedoButtons, { editor }),
|
|
3345
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "bold" }),
|
|
3348
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "italic" }),
|
|
3349
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "underline" }),
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TextStyleButton, { editor, style: "strike" })
|
|
3232
3351
|
] }),
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3234
|
-
/* @__PURE__ */ (0,
|
|
3235
|
-
/* @__PURE__ */ (0,
|
|
3236
|
-
/* @__PURE__ */ (0,
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3352
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3353
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3354
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "left" }),
|
|
3355
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "center" }),
|
|
3356
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AlignButton, { editor, alignment: "right" })
|
|
3238
3357
|
] }),
|
|
3239
|
-
/* @__PURE__ */ (0,
|
|
3240
|
-
/* @__PURE__ */ (0,
|
|
3241
|
-
/* @__PURE__ */ (0,
|
|
3242
|
-
/* @__PURE__ */ (0,
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3359
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3360
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ListButton, { editor, type: "bullet" }),
|
|
3361
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ListButton, { editor, type: "numbered" })
|
|
3243
3362
|
] })
|
|
3244
3363
|
] }),
|
|
3245
|
-
/* @__PURE__ */ (0,
|
|
3246
|
-
/* @__PURE__ */ (0,
|
|
3247
|
-
/* @__PURE__ */ (0,
|
|
3248
|
-
/* @__PURE__ */ (0,
|
|
3249
|
-
/* @__PURE__ */ (0,
|
|
3250
|
-
/* @__PURE__ */ (0,
|
|
3251
|
-
/* @__PURE__ */ (0,
|
|
3364
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-row", children: [
|
|
3365
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BlockTypeSelect, { editor }) }),
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FontSizeButton, { editor }),
|
|
3369
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorButton, { editor, type: "text" }),
|
|
3370
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ColorButton, { editor, type: "background" })
|
|
3252
3371
|
] }),
|
|
3253
|
-
/* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3255
|
-
/* @__PURE__ */ (0,
|
|
3256
|
-
/* @__PURE__ */ (0,
|
|
3257
|
-
/* @__PURE__ */ (0,
|
|
3258
|
-
/* @__PURE__ */ (0,
|
|
3372
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolbarDivider, {}),
|
|
3373
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
3374
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ImageButton, { editor, onImageUpload }),
|
|
3375
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LinkButton, { editor }),
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TableButton, { editor }),
|
|
3377
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(HTMLImportButton, { editor })
|
|
3259
3378
|
] })
|
|
3260
3379
|
] })
|
|
3261
3380
|
] });
|
|
3262
|
-
return /* @__PURE__ */ (0,
|
|
3381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3263
3382
|
"div",
|
|
3264
3383
|
{
|
|
3265
3384
|
ref: wrapperRef,
|
|
@@ -3269,7 +3388,7 @@ var FloatingMenu = ({
|
|
|
3269
3388
|
className
|
|
3270
3389
|
),
|
|
3271
3390
|
"data-position": position,
|
|
3272
|
-
children: /* @__PURE__ */ (0,
|
|
3391
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3273
3392
|
"div",
|
|
3274
3393
|
{
|
|
3275
3394
|
className: cn(
|
|
@@ -3278,7 +3397,7 @@ var FloatingMenu = ({
|
|
|
3278
3397
|
isMinimizable && "is-minimizable",
|
|
3279
3398
|
isMinimized && "is-minimized"
|
|
3280
3399
|
),
|
|
3281
|
-
children: isMinimizable ? /* @__PURE__ */ (0,
|
|
3400
|
+
children: isMinimizable ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MinimizedLayout, {}) : isCompact ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TwoRowLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SingleRowLayout, {})
|
|
3282
3401
|
}
|
|
3283
3402
|
)
|
|
3284
3403
|
}
|
|
@@ -3378,8 +3497,8 @@ var LumirEditorError = class _LumirEditorError extends Error {
|
|
|
3378
3497
|
};
|
|
3379
3498
|
|
|
3380
3499
|
// src/extensions/VerticalAlignmentExtension.ts
|
|
3381
|
-
var
|
|
3382
|
-
var VerticalAlignmentExtension =
|
|
3500
|
+
var import_core5 = require("@tiptap/core");
|
|
3501
|
+
var VerticalAlignmentExtension = import_core5.Extension.create({
|
|
3383
3502
|
name: "verticalAlignment",
|
|
3384
3503
|
addGlobalAttributes() {
|
|
3385
3504
|
return [
|
|
@@ -3410,7 +3529,7 @@ var VerticalAlignmentExtension = import_core4.Extension.create({
|
|
|
3410
3529
|
});
|
|
3411
3530
|
|
|
3412
3531
|
// src/extensions/RowHeightExtension.ts
|
|
3413
|
-
var
|
|
3532
|
+
var import_core6 = require("@tiptap/core");
|
|
3414
3533
|
|
|
3415
3534
|
// src/extensions/rowResizing.ts
|
|
3416
3535
|
var import_prosemirror_state3 = require("prosemirror-state");
|
|
@@ -3998,7 +4117,7 @@ function tableCellAttrPreserve() {
|
|
|
3998
4117
|
}
|
|
3999
4118
|
|
|
4000
4119
|
// src/extensions/RowHeightExtension.ts
|
|
4001
|
-
var RowHeightExtension =
|
|
4120
|
+
var RowHeightExtension = import_core6.Extension.create({
|
|
4002
4121
|
name: "rowHeight",
|
|
4003
4122
|
addOptions() {
|
|
4004
4123
|
return { resizable: true };
|
|
@@ -4044,7 +4163,7 @@ var RowHeightExtension = import_core5.Extension.create({
|
|
|
4044
4163
|
});
|
|
4045
4164
|
|
|
4046
4165
|
// src/extensions/TableAlignmentExtension.ts
|
|
4047
|
-
var
|
|
4166
|
+
var import_core7 = require("@tiptap/core");
|
|
4048
4167
|
var import_prosemirror_state6 = require("prosemirror-state");
|
|
4049
4168
|
var import_prosemirror_view4 = require("prosemirror-view");
|
|
4050
4169
|
var tableAlignmentDecoKey = new import_prosemirror_state6.PluginKey("lumirTableAlignmentDeco");
|
|
@@ -4073,7 +4192,7 @@ function tableAlignmentDecorationPlugin() {
|
|
|
4073
4192
|
}
|
|
4074
4193
|
});
|
|
4075
4194
|
}
|
|
4076
|
-
var TableAlignmentExtension =
|
|
4195
|
+
var TableAlignmentExtension = import_core7.Extension.create({
|
|
4077
4196
|
name: "tableAlignment",
|
|
4078
4197
|
addGlobalAttributes() {
|
|
4079
4198
|
return [
|
|
@@ -4099,9 +4218,56 @@ var TableAlignmentExtension = import_core6.Extension.create({
|
|
|
4099
4218
|
}
|
|
4100
4219
|
});
|
|
4101
4220
|
|
|
4221
|
+
// src/extensions/TableSelectAllExtension.ts
|
|
4222
|
+
var import_core8 = require("@tiptap/core");
|
|
4223
|
+
var import_prosemirror_tables3 = require("prosemirror-tables");
|
|
4224
|
+
var TableSelectAllExtension = import_core8.Extension.create({
|
|
4225
|
+
name: "lumirTableSelectAll",
|
|
4226
|
+
priority: 1e3,
|
|
4227
|
+
addKeyboardShortcuts() {
|
|
4228
|
+
return {
|
|
4229
|
+
"Mod-a": () => {
|
|
4230
|
+
const view = this.editor.view;
|
|
4231
|
+
const { state } = view;
|
|
4232
|
+
const sel = state.selection;
|
|
4233
|
+
const $from = sel.$from;
|
|
4234
|
+
let depth = -1;
|
|
4235
|
+
for (let d = $from.depth; d > 0; d--) {
|
|
4236
|
+
if ($from.node(d).type.name === "table") {
|
|
4237
|
+
depth = d;
|
|
4238
|
+
break;
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
if (depth < 0) return false;
|
|
4242
|
+
const table = $from.node(depth);
|
|
4243
|
+
const tableStart = $from.start(depth);
|
|
4244
|
+
const map = import_prosemirror_tables3.TableMap.get(table);
|
|
4245
|
+
const firstRel = map.map[0];
|
|
4246
|
+
const lastRel = map.map[map.map.length - 1];
|
|
4247
|
+
if (sel instanceof import_prosemirror_tables3.CellSelection) {
|
|
4248
|
+
const a = sel.$anchorCell.pos - tableStart;
|
|
4249
|
+
const h = sel.$headCell.pos - tableStart;
|
|
4250
|
+
if (Math.min(a, h) === firstRel && Math.max(a, h) === lastRel) {
|
|
4251
|
+
return false;
|
|
4252
|
+
}
|
|
4253
|
+
}
|
|
4254
|
+
const tr = state.tr.setSelection(
|
|
4255
|
+
import_prosemirror_tables3.CellSelection.create(
|
|
4256
|
+
state.doc,
|
|
4257
|
+
tableStart + firstRel,
|
|
4258
|
+
tableStart + lastRel
|
|
4259
|
+
)
|
|
4260
|
+
);
|
|
4261
|
+
view.dispatch(tr);
|
|
4262
|
+
return true;
|
|
4263
|
+
}
|
|
4264
|
+
};
|
|
4265
|
+
}
|
|
4266
|
+
});
|
|
4267
|
+
|
|
4102
4268
|
// src/blocks/columns/insertColumns.ts
|
|
4103
4269
|
var import_prosemirror_state7 = require("prosemirror-state");
|
|
4104
|
-
function insertTwoColumns(editor) {
|
|
4270
|
+
function insertTwoColumns(editor, showDivider = false) {
|
|
4105
4271
|
const tiptap = editor?._tiptapEditor;
|
|
4106
4272
|
if (!tiptap) {
|
|
4107
4273
|
return false;
|
|
@@ -4128,7 +4294,7 @@ function insertTwoColumns(editor) {
|
|
|
4128
4294
|
const insertPos = $from.after(depth);
|
|
4129
4295
|
const mkBlock = () => blockContainer.create(null, paragraph.create());
|
|
4130
4296
|
const mkColumn = () => column.create(null, mkBlock());
|
|
4131
|
-
const list = columnList.create(
|
|
4297
|
+
const list = columnList.create({ showDivider }, [mkColumn(), mkColumn()]);
|
|
4132
4298
|
try {
|
|
4133
4299
|
let tr = state.tr.insert(insertPos, list);
|
|
4134
4300
|
try {
|
|
@@ -4143,18 +4309,18 @@ function insertTwoColumns(editor) {
|
|
|
4143
4309
|
}
|
|
4144
4310
|
|
|
4145
4311
|
// src/components/CustomFormattingToolbar.tsx
|
|
4146
|
-
var
|
|
4312
|
+
var import_react29 = require("@blocknote/react");
|
|
4147
4313
|
|
|
4148
4314
|
// src/components/TextAlignButtonWithVA.tsx
|
|
4149
|
-
var
|
|
4150
|
-
var
|
|
4151
|
-
var
|
|
4152
|
-
var
|
|
4315
|
+
var import_core9 = require("@blocknote/core");
|
|
4316
|
+
var import_react19 = require("react");
|
|
4317
|
+
var import_react20 = require("@blocknote/react");
|
|
4318
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4153
4319
|
var icons = {
|
|
4154
|
-
left: /* @__PURE__ */ (0,
|
|
4155
|
-
center: /* @__PURE__ */ (0,
|
|
4156
|
-
right: /* @__PURE__ */ (0,
|
|
4157
|
-
justify: /* @__PURE__ */ (0,
|
|
4320
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" }) }),
|
|
4321
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" }) }),
|
|
4322
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" }) }),
|
|
4323
|
+
justify: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("path", { d: "M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zM3 3v2h18V3H3z" }) })
|
|
4158
4324
|
};
|
|
4159
4325
|
var tooltipMap = {
|
|
4160
4326
|
left: "\uC67C\uCABD \uC815\uB82C",
|
|
@@ -4163,12 +4329,12 @@ var tooltipMap = {
|
|
|
4163
4329
|
justify: "\uC591\uCABD \uC815\uB82C"
|
|
4164
4330
|
};
|
|
4165
4331
|
var TextAlignButtonWithVA = (props) => {
|
|
4166
|
-
const Components = (0,
|
|
4167
|
-
const editor = (0,
|
|
4168
|
-
const selectedBlocks = (0,
|
|
4169
|
-
const textAlignment = (0,
|
|
4332
|
+
const Components = (0, import_react20.useComponentsContext)();
|
|
4333
|
+
const editor = (0, import_react20.useBlockNoteEditor)();
|
|
4334
|
+
const selectedBlocks = (0, import_react20.useSelectedBlocks)(editor);
|
|
4335
|
+
const textAlignment = (0, import_react19.useMemo)(() => {
|
|
4170
4336
|
const block = selectedBlocks[0];
|
|
4171
|
-
if ((0,
|
|
4337
|
+
if ((0, import_core9.checkBlockHasDefaultProp)("textAlignment", block, editor)) {
|
|
4172
4338
|
return block.props.textAlignment;
|
|
4173
4339
|
}
|
|
4174
4340
|
if (block.type === "table") {
|
|
@@ -4177,7 +4343,7 @@ var TextAlignButtonWithVA = (props) => {
|
|
|
4177
4343
|
return;
|
|
4178
4344
|
}
|
|
4179
4345
|
const allCellsInTable = cellSelection.cells.map(
|
|
4180
|
-
({ row, col }) => (0,
|
|
4346
|
+
({ row, col }) => (0, import_core9.mapTableCell)(
|
|
4181
4347
|
block.content.rows[row].cells[col]
|
|
4182
4348
|
).props.textAlignment
|
|
4183
4349
|
);
|
|
@@ -4188,7 +4354,7 @@ var TextAlignButtonWithVA = (props) => {
|
|
|
4188
4354
|
}
|
|
4189
4355
|
return;
|
|
4190
4356
|
}, [editor, selectedBlocks]);
|
|
4191
|
-
const setTextAlignment = (0,
|
|
4357
|
+
const setTextAlignment = (0, import_react19.useCallback)(
|
|
4192
4358
|
(newAlignment) => {
|
|
4193
4359
|
editor.focus();
|
|
4194
4360
|
for (const block of selectedBlocks) {
|
|
@@ -4209,7 +4375,7 @@ var TextAlignButtonWithVA = (props) => {
|
|
|
4209
4375
|
}
|
|
4210
4376
|
}
|
|
4211
4377
|
tiptap.view?.dispatch(tr);
|
|
4212
|
-
} else if ((0,
|
|
4378
|
+
} else if ((0, import_core9.checkBlockTypeHasDefaultProp)("textAlignment", block.type, editor)) {
|
|
4213
4379
|
editor.updateBlock(block, {
|
|
4214
4380
|
props: { textAlignment: newAlignment }
|
|
4215
4381
|
});
|
|
@@ -4218,7 +4384,7 @@ var TextAlignButtonWithVA = (props) => {
|
|
|
4218
4384
|
},
|
|
4219
4385
|
[editor, selectedBlocks]
|
|
4220
4386
|
);
|
|
4221
|
-
const show = (0,
|
|
4387
|
+
const show = (0, import_react19.useMemo)(() => {
|
|
4222
4388
|
return !!selectedBlocks.find(
|
|
4223
4389
|
(block) => "textAlignment" in block.props || block.type === "table" && block.children
|
|
4224
4390
|
);
|
|
@@ -4226,7 +4392,7 @@ var TextAlignButtonWithVA = (props) => {
|
|
|
4226
4392
|
if (!show || !editor.isEditable) {
|
|
4227
4393
|
return null;
|
|
4228
4394
|
}
|
|
4229
|
-
return /* @__PURE__ */ (0,
|
|
4395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4230
4396
|
Components.FormattingToolbar.Button,
|
|
4231
4397
|
{
|
|
4232
4398
|
className: "bn-button",
|
|
@@ -4241,21 +4407,21 @@ var TextAlignButtonWithVA = (props) => {
|
|
|
4241
4407
|
};
|
|
4242
4408
|
|
|
4243
4409
|
// src/components/VerticalAlignButton.tsx
|
|
4244
|
-
var
|
|
4245
|
-
var
|
|
4246
|
-
var
|
|
4410
|
+
var import_react21 = require("react");
|
|
4411
|
+
var import_react22 = require("@blocknote/react");
|
|
4412
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4247
4413
|
var icons2 = {
|
|
4248
|
-
top: /* @__PURE__ */ (0,
|
|
4249
|
-
/* @__PURE__ */ (0,
|
|
4250
|
-
/* @__PURE__ */ (0,
|
|
4414
|
+
top: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
4415
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "2", y: "2", width: "12", height: "12", rx: "1" }),
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "5", y1: "5", x2: "11", y2: "5" })
|
|
4251
4417
|
] }),
|
|
4252
|
-
middle: /* @__PURE__ */ (0,
|
|
4253
|
-
/* @__PURE__ */ (0,
|
|
4254
|
-
/* @__PURE__ */ (0,
|
|
4418
|
+
middle: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
4419
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "2", y: "2", width: "12", height: "12", rx: "1" }),
|
|
4420
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "5", y1: "8", x2: "11", y2: "8" })
|
|
4255
4421
|
] }),
|
|
4256
|
-
bottom: /* @__PURE__ */ (0,
|
|
4257
|
-
/* @__PURE__ */ (0,
|
|
4258
|
-
/* @__PURE__ */ (0,
|
|
4422
|
+
bottom: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
4423
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("rect", { x: "2", y: "2", width: "12", height: "12", rx: "1" }),
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("line", { x1: "5", y1: "11", x2: "11", y2: "11" })
|
|
4259
4425
|
] })
|
|
4260
4426
|
};
|
|
4261
4427
|
var tooltips = {
|
|
@@ -4277,13 +4443,13 @@ function getCurrentVerticalAlignment(editor) {
|
|
|
4277
4443
|
return alignments.every((a) => a === first) ? first : void 0;
|
|
4278
4444
|
}
|
|
4279
4445
|
var VerticalAlignButton = (props) => {
|
|
4280
|
-
const Components = (0,
|
|
4281
|
-
const editor = (0,
|
|
4282
|
-
const selectedBlocks = (0,
|
|
4283
|
-
const currentAlignment = (0,
|
|
4446
|
+
const Components = (0, import_react22.useComponentsContext)();
|
|
4447
|
+
const editor = (0, import_react22.useBlockNoteEditor)();
|
|
4448
|
+
const selectedBlocks = (0, import_react22.useSelectedBlocks)(editor);
|
|
4449
|
+
const currentAlignment = (0, import_react21.useMemo)(() => {
|
|
4284
4450
|
return getCurrentVerticalAlignment(editor);
|
|
4285
4451
|
}, [editor, selectedBlocks]);
|
|
4286
|
-
const setVerticalAlignment = (0,
|
|
4452
|
+
const setVerticalAlignment = (0, import_react21.useCallback)(
|
|
4287
4453
|
(alignment) => {
|
|
4288
4454
|
const tiptap = editor._tiptapEditor;
|
|
4289
4455
|
if (!tiptap) return;
|
|
@@ -4305,13 +4471,13 @@ var VerticalAlignButton = (props) => {
|
|
|
4305
4471
|
},
|
|
4306
4472
|
[editor]
|
|
4307
4473
|
);
|
|
4308
|
-
const isInTable = (0,
|
|
4474
|
+
const isInTable = (0, import_react21.useMemo)(() => {
|
|
4309
4475
|
return selectedBlocks.some((block) => block.type === "table");
|
|
4310
4476
|
}, [selectedBlocks]);
|
|
4311
4477
|
if (!isInTable || !editor.isEditable) {
|
|
4312
4478
|
return null;
|
|
4313
4479
|
}
|
|
4314
|
-
return /* @__PURE__ */ (0,
|
|
4480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4315
4481
|
Components.FormattingToolbar.Button,
|
|
4316
4482
|
{
|
|
4317
4483
|
className: "bn-button",
|
|
@@ -4326,24 +4492,24 @@ var VerticalAlignButton = (props) => {
|
|
|
4326
4492
|
};
|
|
4327
4493
|
|
|
4328
4494
|
// src/components/TableAlignButton.tsx
|
|
4329
|
-
var
|
|
4330
|
-
var
|
|
4331
|
-
var
|
|
4495
|
+
var import_react23 = require("react");
|
|
4496
|
+
var import_react24 = require("@blocknote/react");
|
|
4497
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4332
4498
|
var icons3 = {
|
|
4333
|
-
left: /* @__PURE__ */ (0,
|
|
4334
|
-
/* @__PURE__ */ (0,
|
|
4335
|
-
/* @__PURE__ */ (0,
|
|
4336
|
-
/* @__PURE__ */ (0,
|
|
4499
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: [
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "1.5", y: "4", width: "7", height: "8", rx: "1", fill: "currentColor", stroke: "none" }),
|
|
4501
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("line", { x1: "1.5", y1: "1.5", x2: "14.5", y2: "1.5" }),
|
|
4502
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("line", { x1: "1.5", y1: "14.5", x2: "14.5", y2: "14.5" })
|
|
4337
4503
|
] }),
|
|
4338
|
-
center: /* @__PURE__ */ (0,
|
|
4339
|
-
/* @__PURE__ */ (0,
|
|
4340
|
-
/* @__PURE__ */ (0,
|
|
4341
|
-
/* @__PURE__ */ (0,
|
|
4504
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: [
|
|
4505
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "4.5", y: "4", width: "7", height: "8", rx: "1", fill: "currentColor", stroke: "none" }),
|
|
4506
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("line", { x1: "1.5", y1: "1.5", x2: "14.5", y2: "1.5" }),
|
|
4507
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("line", { x1: "1.5", y1: "14.5", x2: "14.5", y2: "14.5" })
|
|
4342
4508
|
] }),
|
|
4343
|
-
right: /* @__PURE__ */ (0,
|
|
4344
|
-
/* @__PURE__ */ (0,
|
|
4345
|
-
/* @__PURE__ */ (0,
|
|
4346
|
-
/* @__PURE__ */ (0,
|
|
4509
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: [
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("rect", { x: "7.5", y: "4", width: "7", height: "8", rx: "1", fill: "currentColor", stroke: "none" }),
|
|
4511
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("line", { x1: "1.5", y1: "1.5", x2: "14.5", y2: "1.5" }),
|
|
4512
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("line", { x1: "1.5", y1: "14.5", x2: "14.5", y2: "14.5" })
|
|
4347
4513
|
] })
|
|
4348
4514
|
};
|
|
4349
4515
|
var tooltips2 = {
|
|
@@ -4352,18 +4518,18 @@ var tooltips2 = {
|
|
|
4352
4518
|
right: "\uD45C \uC624\uB978\uCABD \uC815\uB82C"
|
|
4353
4519
|
};
|
|
4354
4520
|
var TableAlignButton = (props) => {
|
|
4355
|
-
const Components = (0,
|
|
4356
|
-
const editor = (0,
|
|
4357
|
-
const selectedBlocks = (0,
|
|
4358
|
-
const tableBlock = (0,
|
|
4521
|
+
const Components = (0, import_react24.useComponentsContext)();
|
|
4522
|
+
const editor = (0, import_react24.useBlockNoteEditor)();
|
|
4523
|
+
const selectedBlocks = (0, import_react24.useSelectedBlocks)(editor);
|
|
4524
|
+
const tableBlock = (0, import_react23.useMemo)(
|
|
4359
4525
|
() => selectedBlocks.find((block) => block.type === "table"),
|
|
4360
4526
|
[selectedBlocks]
|
|
4361
4527
|
);
|
|
4362
|
-
const current = (0,
|
|
4528
|
+
const current = (0, import_react23.useMemo)(() => {
|
|
4363
4529
|
if (!tableBlock?.id) return "left";
|
|
4364
4530
|
return getTableAlignment(editor, tableBlock.id);
|
|
4365
4531
|
}, [editor, tableBlock, selectedBlocks]);
|
|
4366
|
-
const apply = (0,
|
|
4532
|
+
const apply = (0, import_react23.useCallback)(() => {
|
|
4367
4533
|
if (!tableBlock?.id) return;
|
|
4368
4534
|
editor.focus();
|
|
4369
4535
|
setTableAlignment(editor, tableBlock.id, props.alignment);
|
|
@@ -4371,7 +4537,7 @@ var TableAlignButton = (props) => {
|
|
|
4371
4537
|
if (!tableBlock || !editor.isEditable) {
|
|
4372
4538
|
return null;
|
|
4373
4539
|
}
|
|
4374
|
-
return /* @__PURE__ */ (0,
|
|
4540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4375
4541
|
Components.FormattingToolbar.Button,
|
|
4376
4542
|
{
|
|
4377
4543
|
className: "bn-button",
|
|
@@ -4386,13 +4552,13 @@ var TableAlignButton = (props) => {
|
|
|
4386
4552
|
};
|
|
4387
4553
|
|
|
4388
4554
|
// src/components/FontSizeButton.tsx
|
|
4389
|
-
var
|
|
4390
|
-
var
|
|
4391
|
-
var
|
|
4555
|
+
var import_react25 = require("@blocknote/react");
|
|
4556
|
+
var import_react26 = require("react");
|
|
4557
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4392
4558
|
var DEFAULT_LABEL2 = "\uAE30\uBCF8";
|
|
4393
4559
|
var toLabel2 = (size) => size.replace(/px$/, "");
|
|
4394
4560
|
function FontSizeIcon({ size }) {
|
|
4395
|
-
return /* @__PURE__ */ (0,
|
|
4561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4396
4562
|
"span",
|
|
4397
4563
|
{
|
|
4398
4564
|
style: {
|
|
@@ -4407,21 +4573,26 @@ function FontSizeIcon({ size }) {
|
|
|
4407
4573
|
);
|
|
4408
4574
|
}
|
|
4409
4575
|
function FontSizeButton2() {
|
|
4410
|
-
const Components = (0,
|
|
4411
|
-
const editor = (0,
|
|
4576
|
+
const Components = (0, import_react25.useComponentsContext)();
|
|
4577
|
+
const editor = (0, import_react25.useBlockNoteEditor)();
|
|
4412
4578
|
const ed = editor;
|
|
4413
4579
|
const styleSchema = editor.schema.styleSchema;
|
|
4414
4580
|
const fontSizeInSchema = styleSchema.fontSize?.type === "fontSize" && styleSchema.fontSize?.propSchema === "string";
|
|
4415
|
-
const selectedBlocks = (0,
|
|
4416
|
-
const [currentSize, setCurrentSize] = (0,
|
|
4581
|
+
const selectedBlocks = (0, import_react25.useSelectedBlocks)(editor);
|
|
4582
|
+
const [currentSize, setCurrentSize] = (0, import_react26.useState)(
|
|
4417
4583
|
fontSizeInSchema ? ed.getActiveStyles().fontSize || "" : ""
|
|
4418
4584
|
);
|
|
4419
|
-
(0,
|
|
4585
|
+
(0, import_react25.useEditorContentOrSelectionChange)(() => {
|
|
4420
4586
|
if (fontSizeInSchema) {
|
|
4421
4587
|
setCurrentSize(ed.getActiveStyles().fontSize || "");
|
|
4422
4588
|
}
|
|
4423
4589
|
}, editor);
|
|
4424
|
-
const
|
|
4590
|
+
const currentPx = parseFontSizePx(currentSize);
|
|
4591
|
+
const [inputValue, setInputValue] = (0, import_react26.useState)(String(currentPx));
|
|
4592
|
+
(0, import_react26.useEffect)(() => {
|
|
4593
|
+
setInputValue(String(currentPx));
|
|
4594
|
+
}, [currentPx]);
|
|
4595
|
+
const setFontSize = (0, import_react26.useCallback)(
|
|
4425
4596
|
(size) => {
|
|
4426
4597
|
size === "" ? ed.removeStyles({ fontSize: "" }) : ed.addStyles({ fontSize: size });
|
|
4427
4598
|
setTimeout(() => editor.focus());
|
|
@@ -4429,7 +4600,22 @@ function FontSizeButton2() {
|
|
|
4429
4600
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4430
4601
|
[editor]
|
|
4431
4602
|
);
|
|
4432
|
-
const
|
|
4603
|
+
const stepBy = (0, import_react26.useCallback)(
|
|
4604
|
+
(delta) => {
|
|
4605
|
+
ed.addStyles({ fontSize: toFontSizeValue(currentPx + delta) });
|
|
4606
|
+
},
|
|
4607
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4608
|
+
[currentPx]
|
|
4609
|
+
);
|
|
4610
|
+
const applyInput = (0, import_react26.useCallback)(() => {
|
|
4611
|
+
const n = parseInt(inputValue, 10);
|
|
4612
|
+
if (Number.isFinite(n)) {
|
|
4613
|
+
ed.addStyles({ fontSize: toFontSizeValue(n) });
|
|
4614
|
+
} else {
|
|
4615
|
+
setInputValue(String(currentPx));
|
|
4616
|
+
}
|
|
4617
|
+
}, [inputValue, currentPx]);
|
|
4618
|
+
const show = (0, import_react26.useMemo)(() => {
|
|
4433
4619
|
if (!fontSizeInSchema) {
|
|
4434
4620
|
return false;
|
|
4435
4621
|
}
|
|
@@ -4444,20 +4630,76 @@ function FontSizeButton2() {
|
|
|
4444
4630
|
return null;
|
|
4445
4631
|
}
|
|
4446
4632
|
const tooltip = "\uAE00\uC790 \uD06C\uAE30";
|
|
4447
|
-
|
|
4448
|
-
|
|
4633
|
+
const preventBlur = (e) => e.preventDefault();
|
|
4634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Components.Generic.Menu.Root, { children: [
|
|
4635
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4449
4636
|
Components.FormattingToolbar.Button,
|
|
4450
4637
|
{
|
|
4451
4638
|
className: "bn-button",
|
|
4452
4639
|
"data-test": "font-size",
|
|
4453
4640
|
label: tooltip,
|
|
4454
4641
|
mainTooltip: tooltip,
|
|
4455
|
-
icon: /* @__PURE__ */ (0,
|
|
4642
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FontSizeIcon, { size: currentSize })
|
|
4456
4643
|
}
|
|
4457
4644
|
) }),
|
|
4458
|
-
/* @__PURE__ */ (0,
|
|
4459
|
-
/* @__PURE__ */ (0,
|
|
4460
|
-
/* @__PURE__ */ (0,
|
|
4645
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Components.Generic.Menu.Dropdown, { className: "bn-menu-dropdown", children: [
|
|
4646
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Components.Generic.Menu.Label, { children: "\uAE00\uC790 \uD06C\uAE30" }),
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "lumir-fs-stepper", children: [
|
|
4648
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4649
|
+
"button",
|
|
4650
|
+
{
|
|
4651
|
+
type: "button",
|
|
4652
|
+
className: "lumir-fs-stepper-btn",
|
|
4653
|
+
"aria-label": "\uAE00\uC790 \uD06C\uAE30 1px \uC904\uC774\uAE30",
|
|
4654
|
+
"data-test": "font-size-decrease",
|
|
4655
|
+
disabled: currentPx <= FONT_SIZE_MIN,
|
|
4656
|
+
onMouseDown: preventBlur,
|
|
4657
|
+
onClick: () => stepBy(-1),
|
|
4658
|
+
children: "\u2212"
|
|
4659
|
+
}
|
|
4660
|
+
),
|
|
4661
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4662
|
+
"input",
|
|
4663
|
+
{
|
|
4664
|
+
className: "lumir-fs-stepper-input",
|
|
4665
|
+
type: "text",
|
|
4666
|
+
inputMode: "numeric",
|
|
4667
|
+
"aria-label": "\uAE00\uC790 \uD06C\uAE30 \uC785\uB825",
|
|
4668
|
+
"data-test": "font-size-input",
|
|
4669
|
+
value: inputValue,
|
|
4670
|
+
onChange: (e) => setInputValue(e.target.value.replace(/[^0-9]/g, "")),
|
|
4671
|
+
onClick: (e) => e.stopPropagation(),
|
|
4672
|
+
onKeyDown: (e) => {
|
|
4673
|
+
e.stopPropagation();
|
|
4674
|
+
if (e.key === "Enter") {
|
|
4675
|
+
e.preventDefault();
|
|
4676
|
+
applyInput();
|
|
4677
|
+
} else if (e.key === "ArrowUp") {
|
|
4678
|
+
e.preventDefault();
|
|
4679
|
+
stepBy(1);
|
|
4680
|
+
} else if (e.key === "ArrowDown") {
|
|
4681
|
+
e.preventDefault();
|
|
4682
|
+
stepBy(-1);
|
|
4683
|
+
}
|
|
4684
|
+
},
|
|
4685
|
+
onBlur: applyInput
|
|
4686
|
+
}
|
|
4687
|
+
),
|
|
4688
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4689
|
+
"button",
|
|
4690
|
+
{
|
|
4691
|
+
type: "button",
|
|
4692
|
+
className: "lumir-fs-stepper-btn",
|
|
4693
|
+
"aria-label": "\uAE00\uC790 \uD06C\uAE30 1px \uB298\uB9AC\uAE30",
|
|
4694
|
+
"data-test": "font-size-increase",
|
|
4695
|
+
disabled: currentPx >= FONT_SIZE_MAX,
|
|
4696
|
+
onMouseDown: preventBlur,
|
|
4697
|
+
onClick: () => stepBy(1),
|
|
4698
|
+
children: "+"
|
|
4699
|
+
}
|
|
4700
|
+
)
|
|
4701
|
+
] }),
|
|
4702
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4461
4703
|
Components.Generic.Menu.Item,
|
|
4462
4704
|
{
|
|
4463
4705
|
onClick: () => setFontSize(""),
|
|
@@ -4467,7 +4709,7 @@ function FontSizeButton2() {
|
|
|
4467
4709
|
},
|
|
4468
4710
|
"font-size-default"
|
|
4469
4711
|
),
|
|
4470
|
-
FONT_SIZE_PRESETS.map((size) => /* @__PURE__ */ (0,
|
|
4712
|
+
FONT_SIZE_PRESETS.map((size) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4471
4713
|
Components.Generic.Menu.Item,
|
|
4472
4714
|
{
|
|
4473
4715
|
onClick: () => setFontSize(size),
|
|
@@ -4482,10 +4724,10 @@ function FontSizeButton2() {
|
|
|
4482
4724
|
}
|
|
4483
4725
|
|
|
4484
4726
|
// src/components/color/LumirColorControls.tsx
|
|
4485
|
-
var
|
|
4486
|
-
var
|
|
4487
|
-
var
|
|
4488
|
-
var
|
|
4727
|
+
var import_core10 = require("@blocknote/core");
|
|
4728
|
+
var import_react27 = require("@blocknote/react");
|
|
4729
|
+
var import_react28 = require("react");
|
|
4730
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4489
4731
|
var COLORS = [
|
|
4490
4732
|
"default",
|
|
4491
4733
|
"gray",
|
|
@@ -4502,7 +4744,7 @@ function ColorIcon(props) {
|
|
|
4502
4744
|
const textColor = props.textColor || "default";
|
|
4503
4745
|
const backgroundColor = props.backgroundColor || "default";
|
|
4504
4746
|
const size = props.size || 16;
|
|
4505
|
-
return /* @__PURE__ */ (0,
|
|
4747
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4506
4748
|
"div",
|
|
4507
4749
|
{
|
|
4508
4750
|
className: "bn-color-icon",
|
|
@@ -4521,7 +4763,7 @@ function ColorIcon(props) {
|
|
|
4521
4763
|
);
|
|
4522
4764
|
}
|
|
4523
4765
|
function CellFillIcon({ size = 18 }) {
|
|
4524
|
-
return /* @__PURE__ */ (0,
|
|
4766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4525
4767
|
"svg",
|
|
4526
4768
|
{
|
|
4527
4769
|
width: size,
|
|
@@ -4530,17 +4772,17 @@ function CellFillIcon({ size = 18 }) {
|
|
|
4530
4772
|
fill: "currentColor",
|
|
4531
4773
|
style: { pointerEvents: "none" },
|
|
4532
4774
|
"aria-hidden": "true",
|
|
4533
|
-
children: /* @__PURE__ */ (0,
|
|
4775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M16.56 8.94 7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10 10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z" })
|
|
4534
4776
|
}
|
|
4535
4777
|
);
|
|
4536
4778
|
}
|
|
4537
4779
|
function LumirColorPicker(props) {
|
|
4538
|
-
const Components = (0,
|
|
4539
|
-
const dict = (0,
|
|
4540
|
-
return /* @__PURE__ */ (0,
|
|
4541
|
-
props.text ? /* @__PURE__ */ (0,
|
|
4542
|
-
/* @__PURE__ */ (0,
|
|
4543
|
-
COLORS.map((color) => /* @__PURE__ */ (0,
|
|
4780
|
+
const Components = (0, import_react27.useComponentsContext)();
|
|
4781
|
+
const dict = (0, import_react27.useDictionary)();
|
|
4782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4783
|
+
props.text ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Components.Generic.Menu.Label, { children: props.textTitle ?? dict.color_picker.text_title }),
|
|
4785
|
+
COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4544
4786
|
Components.Generic.Menu.Item,
|
|
4545
4787
|
{
|
|
4546
4788
|
onClick: () => {
|
|
@@ -4548,16 +4790,16 @@ function LumirColorPicker(props) {
|
|
|
4548
4790
|
props.text.setColor(color);
|
|
4549
4791
|
},
|
|
4550
4792
|
"data-test": "text-color-" + color,
|
|
4551
|
-
icon: /* @__PURE__ */ (0,
|
|
4793
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ColorIcon, { textColor: color, size: props.iconSize }),
|
|
4552
4794
|
checked: props.text.color === color,
|
|
4553
4795
|
children: dict.color_picker.colors[color]
|
|
4554
4796
|
},
|
|
4555
4797
|
"text-color-" + color
|
|
4556
4798
|
))
|
|
4557
4799
|
] }) : null,
|
|
4558
|
-
props.background ? /* @__PURE__ */ (0,
|
|
4559
|
-
/* @__PURE__ */ (0,
|
|
4560
|
-
COLORS.map((color) => /* @__PURE__ */ (0,
|
|
4800
|
+
props.background ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4801
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Components.Generic.Menu.Label, { children: props.backgroundTitle ?? dict.color_picker.background_title }),
|
|
4802
|
+
COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4561
4803
|
Components.Generic.Menu.Item,
|
|
4562
4804
|
{
|
|
4563
4805
|
onClick: () => {
|
|
@@ -4565,7 +4807,7 @@ function LumirColorPicker(props) {
|
|
|
4565
4807
|
props.background.setColor(color);
|
|
4566
4808
|
},
|
|
4567
4809
|
"data-test": "background-color-" + color,
|
|
4568
|
-
icon: /* @__PURE__ */ (0,
|
|
4810
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ColorIcon, { backgroundColor: color, size: props.iconSize }),
|
|
4569
4811
|
checked: props.background.color === color,
|
|
4570
4812
|
children: dict.color_picker.colors[color]
|
|
4571
4813
|
},
|
|
@@ -4575,20 +4817,20 @@ function LumirColorPicker(props) {
|
|
|
4575
4817
|
] });
|
|
4576
4818
|
}
|
|
4577
4819
|
function LumirColorStyleButton() {
|
|
4578
|
-
const Components = (0,
|
|
4579
|
-
const editor = (0,
|
|
4820
|
+
const Components = (0, import_react27.useComponentsContext)();
|
|
4821
|
+
const editor = (0, import_react27.useBlockNoteEditor)();
|
|
4580
4822
|
const ed = editor;
|
|
4581
4823
|
const styleSchema = editor.schema.styleSchema;
|
|
4582
4824
|
const textColorInSchema = styleSchema.textColor?.type === "textColor" && styleSchema.textColor?.propSchema === "string";
|
|
4583
4825
|
const backgroundColorInSchema = styleSchema.backgroundColor?.type === "backgroundColor" && styleSchema.backgroundColor?.propSchema === "string";
|
|
4584
|
-
const selectedBlocks = (0,
|
|
4585
|
-
const [currentTextColor, setCurrentTextColor] = (0,
|
|
4826
|
+
const selectedBlocks = (0, import_react27.useSelectedBlocks)(editor);
|
|
4827
|
+
const [currentTextColor, setCurrentTextColor] = (0, import_react28.useState)(
|
|
4586
4828
|
textColorInSchema ? ed.getActiveStyles().textColor || "default" : "default"
|
|
4587
4829
|
);
|
|
4588
|
-
const [currentBackgroundColor, setCurrentBackgroundColor] = (0,
|
|
4830
|
+
const [currentBackgroundColor, setCurrentBackgroundColor] = (0, import_react28.useState)(
|
|
4589
4831
|
backgroundColorInSchema ? ed.getActiveStyles().backgroundColor || "default" : "default"
|
|
4590
4832
|
);
|
|
4591
|
-
(0,
|
|
4833
|
+
(0, import_react27.useEditorContentOrSelectionChange)(() => {
|
|
4592
4834
|
const active = ed.getActiveStyles();
|
|
4593
4835
|
if (textColorInSchema) {
|
|
4594
4836
|
setCurrentTextColor(active.textColor || "default");
|
|
@@ -4597,7 +4839,7 @@ function LumirColorStyleButton() {
|
|
|
4597
4839
|
setCurrentBackgroundColor(active.backgroundColor || "default");
|
|
4598
4840
|
}
|
|
4599
4841
|
}, editor);
|
|
4600
|
-
const setTextColor = (0,
|
|
4842
|
+
const setTextColor = (0, import_react28.useCallback)(
|
|
4601
4843
|
(color) => {
|
|
4602
4844
|
color === "default" ? ed.removeStyles({ textColor: color }) : ed.addStyles({ textColor: color });
|
|
4603
4845
|
setTimeout(() => editor.focus());
|
|
@@ -4605,7 +4847,7 @@ function LumirColorStyleButton() {
|
|
|
4605
4847
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4606
4848
|
[editor]
|
|
4607
4849
|
);
|
|
4608
|
-
const setBackgroundColor = (0,
|
|
4850
|
+
const setBackgroundColor = (0, import_react28.useCallback)(
|
|
4609
4851
|
(color) => {
|
|
4610
4852
|
color === "default" ? ed.removeStyles({ backgroundColor: color }) : ed.addStyles({ backgroundColor: color });
|
|
4611
4853
|
setTimeout(() => editor.focus());
|
|
@@ -4613,7 +4855,7 @@ function LumirColorStyleButton() {
|
|
|
4613
4855
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4614
4856
|
[editor]
|
|
4615
4857
|
);
|
|
4616
|
-
const show = (0,
|
|
4858
|
+
const show = (0, import_react28.useMemo)(() => {
|
|
4617
4859
|
if (!textColorInSchema && !backgroundColorInSchema) {
|
|
4618
4860
|
return false;
|
|
4619
4861
|
}
|
|
@@ -4628,15 +4870,15 @@ function LumirColorStyleButton() {
|
|
|
4628
4870
|
return null;
|
|
4629
4871
|
}
|
|
4630
4872
|
const tooltip = "\uD14D\uC2A4\uD2B8 \uC0C9\xB7\uBC30\uACBD";
|
|
4631
|
-
return /* @__PURE__ */ (0,
|
|
4632
|
-
/* @__PURE__ */ (0,
|
|
4873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Components.Generic.Menu.Root, { children: [
|
|
4874
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4633
4875
|
Components.FormattingToolbar.Button,
|
|
4634
4876
|
{
|
|
4635
4877
|
className: "bn-button",
|
|
4636
4878
|
"data-test": "colors",
|
|
4637
4879
|
label: tooltip,
|
|
4638
4880
|
mainTooltip: tooltip,
|
|
4639
|
-
icon: /* @__PURE__ */ (0,
|
|
4881
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4640
4882
|
ColorIcon,
|
|
4641
4883
|
{
|
|
4642
4884
|
textColor: currentTextColor,
|
|
@@ -4646,11 +4888,11 @@ function LumirColorStyleButton() {
|
|
|
4646
4888
|
)
|
|
4647
4889
|
}
|
|
4648
4890
|
) }),
|
|
4649
|
-
/* @__PURE__ */ (0,
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4650
4892
|
Components.Generic.Menu.Dropdown,
|
|
4651
4893
|
{
|
|
4652
4894
|
className: "bn-menu-dropdown bn-color-picker-dropdown",
|
|
4653
|
-
children: /* @__PURE__ */ (0,
|
|
4895
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4654
4896
|
LumirColorPicker,
|
|
4655
4897
|
{
|
|
4656
4898
|
textTitle: "\uD14D\uC2A4\uD2B8 \uC0C9",
|
|
@@ -4664,18 +4906,18 @@ function LumirColorStyleButton() {
|
|
|
4664
4906
|
] });
|
|
4665
4907
|
}
|
|
4666
4908
|
function LumirCellColorToolbarButton() {
|
|
4667
|
-
const Components = (0,
|
|
4668
|
-
const editor = (0,
|
|
4669
|
-
const selectedBlocks = (0,
|
|
4670
|
-
const isMultiCell = (0,
|
|
4909
|
+
const Components = (0, import_react27.useComponentsContext)();
|
|
4910
|
+
const editor = (0, import_react27.useBlockNoteEditor)();
|
|
4911
|
+
const selectedBlocks = (0, import_react27.useSelectedBlocks)(editor);
|
|
4912
|
+
const isMultiCell = (0, import_react28.useMemo)(() => {
|
|
4671
4913
|
if (selectedBlocks.length !== 1 || selectedBlocks[0].type !== "table") {
|
|
4672
4914
|
return false;
|
|
4673
4915
|
}
|
|
4674
4916
|
const cs = editor.tableHandles?.getCellSelection();
|
|
4675
4917
|
return !!cs && cs.cells.length > 1;
|
|
4676
4918
|
}, [editor, selectedBlocks]);
|
|
4677
|
-
const stashRef = (0,
|
|
4678
|
-
const applyBackground = (0,
|
|
4919
|
+
const stashRef = (0, import_react28.useRef)([]);
|
|
4920
|
+
const applyBackground = (0, import_react28.useCallback)(
|
|
4679
4921
|
(color) => {
|
|
4680
4922
|
const live = getSelectedCellPositions(editor);
|
|
4681
4923
|
const positions = live.length > 0 ? live : stashRef.current;
|
|
@@ -4688,7 +4930,7 @@ function LumirCellColorToolbarButton() {
|
|
|
4688
4930
|
return null;
|
|
4689
4931
|
}
|
|
4690
4932
|
const tooltip = "\uC140 \uBC30\uACBD\uC0C9";
|
|
4691
|
-
return /* @__PURE__ */ (0,
|
|
4933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4692
4934
|
Components.Generic.Menu.Root,
|
|
4693
4935
|
{
|
|
4694
4936
|
onOpenChange: (open) => {
|
|
@@ -4697,21 +4939,21 @@ function LumirCellColorToolbarButton() {
|
|
|
4697
4939
|
}
|
|
4698
4940
|
},
|
|
4699
4941
|
children: [
|
|
4700
|
-
/* @__PURE__ */ (0,
|
|
4942
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Components.Generic.Menu.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4701
4943
|
Components.FormattingToolbar.Button,
|
|
4702
4944
|
{
|
|
4703
4945
|
className: "bn-button",
|
|
4704
4946
|
"data-test": "cell-colors",
|
|
4705
4947
|
label: tooltip,
|
|
4706
4948
|
mainTooltip: tooltip,
|
|
4707
|
-
icon: /* @__PURE__ */ (0,
|
|
4949
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CellFillIcon, { size: 18 })
|
|
4708
4950
|
}
|
|
4709
4951
|
) }),
|
|
4710
|
-
/* @__PURE__ */ (0,
|
|
4952
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4711
4953
|
Components.Generic.Menu.Dropdown,
|
|
4712
4954
|
{
|
|
4713
4955
|
className: "bn-menu-dropdown bn-color-picker-dropdown",
|
|
4714
|
-
children: /* @__PURE__ */ (0,
|
|
4956
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4715
4957
|
LumirColorPicker,
|
|
4716
4958
|
{
|
|
4717
4959
|
backgroundTitle: "\uC140 \uBC30\uACBD",
|
|
@@ -4725,12 +4967,12 @@ function LumirCellColorToolbarButton() {
|
|
|
4725
4967
|
);
|
|
4726
4968
|
}
|
|
4727
4969
|
function LumirCellColorPickerButton(props) {
|
|
4728
|
-
const Components = (0,
|
|
4729
|
-
const editor = (0,
|
|
4970
|
+
const Components = (0, import_react27.useComponentsContext)();
|
|
4971
|
+
const editor = (0, import_react27.useBlockNoteEditor)();
|
|
4730
4972
|
const updateColor = (color, type) => {
|
|
4731
4973
|
const newTable = props.block.content.rows.map((row) => ({
|
|
4732
4974
|
...row,
|
|
4733
|
-
cells: row.cells.map((cell) => (0,
|
|
4975
|
+
cells: row.cells.map((cell) => (0, import_core10.mapTableCell)(cell))
|
|
4734
4976
|
}));
|
|
4735
4977
|
if (type === "text") {
|
|
4736
4978
|
newTable[props.rowIndex].cells[props.colIndex].props.textColor = color;
|
|
@@ -4747,25 +4989,25 @@ function LumirCellColorPickerButton(props) {
|
|
|
4747
4989
|
if (!currentCell || editor.settings.tables.cellTextColor === false && editor.settings.tables.cellBackgroundColor === false) {
|
|
4748
4990
|
return null;
|
|
4749
4991
|
}
|
|
4750
|
-
return /* @__PURE__ */ (0,
|
|
4751
|
-
/* @__PURE__ */ (0,
|
|
4752
|
-
/* @__PURE__ */ (0,
|
|
4992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Components.Generic.Menu.Root, { position: "right", sub: true, children: [
|
|
4993
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Components.Generic.Menu.Trigger, { sub: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Components.Generic.Menu.Item, { className: "bn-menu-item", subTrigger: true, children: "\uC140 \uC0C9\xB7\uBC30\uACBD" }) }),
|
|
4994
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4753
4995
|
Components.Generic.Menu.Dropdown,
|
|
4754
4996
|
{
|
|
4755
4997
|
sub: true,
|
|
4756
4998
|
className: "bn-menu-dropdown bn-color-picker-dropdown",
|
|
4757
|
-
children: /* @__PURE__ */ (0,
|
|
4999
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4758
5000
|
LumirColorPicker,
|
|
4759
5001
|
{
|
|
4760
5002
|
iconSize: 18,
|
|
4761
5003
|
textTitle: "\uC140 \uAE00\uC790\uC0C9",
|
|
4762
5004
|
backgroundTitle: "\uC140 \uBC30\uACBD",
|
|
4763
5005
|
text: editor.settings.tables.cellTextColor ? {
|
|
4764
|
-
color: (0,
|
|
5006
|
+
color: (0, import_core10.isTableCell)(currentCell) ? currentCell.props.textColor : "default",
|
|
4765
5007
|
setColor: (color) => updateColor(color, "text")
|
|
4766
5008
|
} : void 0,
|
|
4767
5009
|
background: editor.settings.tables.cellBackgroundColor ? {
|
|
4768
|
-
color: (0,
|
|
5010
|
+
color: (0, import_core10.isTableCell)(currentCell) ? currentCell.props.backgroundColor : "default",
|
|
4769
5011
|
setColor: (color) => updateColor(color, "background")
|
|
4770
5012
|
} : void 0
|
|
4771
5013
|
}
|
|
@@ -4775,21 +5017,21 @@ function LumirCellColorPickerButton(props) {
|
|
|
4775
5017
|
] });
|
|
4776
5018
|
}
|
|
4777
5019
|
function LumirTableCellMenu(props) {
|
|
4778
|
-
const Components = (0,
|
|
4779
|
-
return /* @__PURE__ */ (0,
|
|
5020
|
+
const Components = (0, import_react27.useComponentsContext)();
|
|
5021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4780
5022
|
Components.Generic.Menu.Dropdown,
|
|
4781
5023
|
{
|
|
4782
5024
|
className: "bn-menu-dropdown bn-drag-handle-menu",
|
|
4783
|
-
children: props.children || /* @__PURE__ */ (0,
|
|
4784
|
-
/* @__PURE__ */ (0,
|
|
4785
|
-
|
|
5025
|
+
children: props.children || /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
5026
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
5027
|
+
import_react27.SplitButton,
|
|
4786
5028
|
{
|
|
4787
5029
|
block: props.block,
|
|
4788
5030
|
rowIndex: props.rowIndex,
|
|
4789
5031
|
colIndex: props.colIndex
|
|
4790
5032
|
}
|
|
4791
5033
|
),
|
|
4792
|
-
/* @__PURE__ */ (0,
|
|
5034
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4793
5035
|
LumirCellColorPickerButton,
|
|
4794
5036
|
{
|
|
4795
5037
|
block: props.block,
|
|
@@ -4803,99 +5045,99 @@ function LumirTableCellMenu(props) {
|
|
|
4803
5045
|
}
|
|
4804
5046
|
|
|
4805
5047
|
// src/components/CustomFormattingToolbar.tsx
|
|
4806
|
-
var
|
|
5048
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4807
5049
|
var CustomFormattingToolbar = () => {
|
|
4808
|
-
return /* @__PURE__ */ (0,
|
|
4809
|
-
/* @__PURE__ */ (0,
|
|
4810
|
-
/* @__PURE__ */ (0,
|
|
4811
|
-
/* @__PURE__ */ (0,
|
|
4812
|
-
/* @__PURE__ */ (0,
|
|
4813
|
-
/* @__PURE__ */ (0,
|
|
4814
|
-
/* @__PURE__ */ (0,
|
|
4815
|
-
/* @__PURE__ */ (0,
|
|
4816
|
-
/* @__PURE__ */ (0,
|
|
4817
|
-
/* @__PURE__ */ (0,
|
|
4818
|
-
/* @__PURE__ */ (0,
|
|
4819
|
-
|
|
5050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react29.FormattingToolbar, { children: [
|
|
5051
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.BlockTypeSelect, {}, "blockTypeSelect"),
|
|
5052
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.TableCellMergeButton, {}, "tableCellMergeButton"),
|
|
5053
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.FileCaptionButton, {}, "fileCaptionButton"),
|
|
5054
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.FileReplaceButton, {}, "replaceFileButton"),
|
|
5055
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.FileRenameButton, {}, "fileRenameButton"),
|
|
5056
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.FileDeleteButton, {}, "fileDeleteButton"),
|
|
5057
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.FileDownloadButton, {}, "fileDownloadButton"),
|
|
5058
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.FilePreviewButton, {}, "filePreviewButton"),
|
|
5059
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.BasicTextStyleButton, { basicTextStyle: "bold" }, "boldStyleButton"),
|
|
5060
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5061
|
+
import_react29.BasicTextStyleButton,
|
|
4820
5062
|
{
|
|
4821
5063
|
basicTextStyle: "italic"
|
|
4822
5064
|
},
|
|
4823
5065
|
"italicStyleButton"
|
|
4824
5066
|
),
|
|
4825
|
-
/* @__PURE__ */ (0,
|
|
4826
|
-
|
|
5067
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5068
|
+
import_react29.BasicTextStyleButton,
|
|
4827
5069
|
{
|
|
4828
5070
|
basicTextStyle: "underline"
|
|
4829
5071
|
},
|
|
4830
5072
|
"underlineStyleButton"
|
|
4831
5073
|
),
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
4833
|
-
|
|
5074
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
5075
|
+
import_react29.BasicTextStyleButton,
|
|
4834
5076
|
{
|
|
4835
5077
|
basicTextStyle: "strike"
|
|
4836
5078
|
},
|
|
4837
5079
|
"strikeStyleButton"
|
|
4838
5080
|
),
|
|
4839
|
-
/* @__PURE__ */ (0,
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
5081
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TextAlignButtonWithVA, { textAlignment: "left" }, "textAlignLeftButton"),
|
|
5082
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4841
5083
|
TextAlignButtonWithVA,
|
|
4842
5084
|
{
|
|
4843
5085
|
textAlignment: "center"
|
|
4844
5086
|
},
|
|
4845
5087
|
"textAlignCenterButton"
|
|
4846
5088
|
),
|
|
4847
|
-
/* @__PURE__ */ (0,
|
|
4848
|
-
/* @__PURE__ */ (0,
|
|
5089
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TextAlignButtonWithVA, { textAlignment: "right" }, "textAlignRightButton"),
|
|
5090
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4849
5091
|
VerticalAlignButton,
|
|
4850
5092
|
{
|
|
4851
5093
|
verticalAlignment: "top"
|
|
4852
5094
|
},
|
|
4853
5095
|
"verticalAlignTop"
|
|
4854
5096
|
),
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
5097
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4856
5098
|
VerticalAlignButton,
|
|
4857
5099
|
{
|
|
4858
5100
|
verticalAlignment: "middle"
|
|
4859
5101
|
},
|
|
4860
5102
|
"verticalAlignMiddle"
|
|
4861
5103
|
),
|
|
4862
|
-
/* @__PURE__ */ (0,
|
|
5104
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4863
5105
|
VerticalAlignButton,
|
|
4864
5106
|
{
|
|
4865
5107
|
verticalAlignment: "bottom"
|
|
4866
5108
|
},
|
|
4867
5109
|
"verticalAlignBottom"
|
|
4868
5110
|
),
|
|
4869
|
-
/* @__PURE__ */ (0,
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
4871
|
-
/* @__PURE__ */ (0,
|
|
4872
|
-
/* @__PURE__ */ (0,
|
|
4873
|
-
/* @__PURE__ */ (0,
|
|
4874
|
-
/* @__PURE__ */ (0,
|
|
4875
|
-
/* @__PURE__ */ (0,
|
|
4876
|
-
/* @__PURE__ */ (0,
|
|
4877
|
-
/* @__PURE__ */ (0,
|
|
5111
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableAlignButton, { alignment: "left" }, "tableAlignLeft"),
|
|
5112
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableAlignButton, { alignment: "center" }, "tableAlignCenter"),
|
|
5113
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TableAlignButton, { alignment: "right" }, "tableAlignRight"),
|
|
5114
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FontSizeButton2, {}, "fontSizeButton"),
|
|
5115
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LumirColorStyleButton, {}, "colorStyleButton"),
|
|
5116
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(LumirCellColorToolbarButton, {}, "cellColorButton"),
|
|
5117
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.NestBlockButton, {}, "nestBlockButton"),
|
|
5118
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.UnnestBlockButton, {}, "unnestBlockButton"),
|
|
5119
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react29.CreateLinkButton, {}, "createLinkButton")
|
|
4878
5120
|
] });
|
|
4879
5121
|
};
|
|
4880
5122
|
|
|
4881
5123
|
// src/components/LumirDragHandleMenu.tsx
|
|
4882
|
-
var
|
|
4883
|
-
var
|
|
5124
|
+
var import_react30 = require("@blocknote/react");
|
|
5125
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4884
5126
|
var TABLE_ALIGN_ICONS = {
|
|
4885
|
-
left: /* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4888
|
-
/* @__PURE__ */ (0,
|
|
5127
|
+
left: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: [
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: "1.5", y: "4", width: "7", height: "8", rx: "1", fill: "currentColor", stroke: "none" }),
|
|
5129
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "1.5", y1: "1.5", x2: "14.5", y2: "1.5" }),
|
|
5130
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "1.5", y1: "14.5", x2: "14.5", y2: "14.5" })
|
|
4889
5131
|
] }),
|
|
4890
|
-
center: /* @__PURE__ */ (0,
|
|
4891
|
-
/* @__PURE__ */ (0,
|
|
4892
|
-
/* @__PURE__ */ (0,
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
5132
|
+
center: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: [
|
|
5133
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: "4.5", y: "4", width: "7", height: "8", rx: "1", fill: "currentColor", stroke: "none" }),
|
|
5134
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "1.5", y1: "1.5", x2: "14.5", y2: "1.5" }),
|
|
5135
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "1.5", y1: "14.5", x2: "14.5", y2: "14.5" })
|
|
4894
5136
|
] }),
|
|
4895
|
-
right: /* @__PURE__ */ (0,
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
4897
|
-
/* @__PURE__ */ (0,
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
5137
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", children: [
|
|
5138
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("rect", { x: "7.5", y: "4", width: "7", height: "8", rx: "1", fill: "currentColor", stroke: "none" }),
|
|
5139
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "1.5", y1: "1.5", x2: "14.5", y2: "1.5" }),
|
|
5140
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("line", { x1: "1.5", y1: "14.5", x2: "14.5", y2: "14.5" })
|
|
4899
5141
|
] })
|
|
4900
5142
|
};
|
|
4901
5143
|
var TABLE_ALIGN_LABELS = {
|
|
@@ -4904,13 +5146,13 @@ var TABLE_ALIGN_LABELS = {
|
|
|
4904
5146
|
right: "\uD45C \uC624\uB978\uCABD \uC815\uB82C"
|
|
4905
5147
|
};
|
|
4906
5148
|
function TableAlignmentItems(props) {
|
|
4907
|
-
const Components = (0,
|
|
4908
|
-
const editor = (0,
|
|
5149
|
+
const Components = (0, import_react30.useComponentsContext)();
|
|
5150
|
+
const editor = (0, import_react30.useBlockNoteEditor)();
|
|
4909
5151
|
if (props.block?.type !== "table" || !props.block?.id) {
|
|
4910
5152
|
return null;
|
|
4911
5153
|
}
|
|
4912
5154
|
const current = getTableAlignment(editor, props.block.id);
|
|
4913
|
-
return /* @__PURE__ */ (0,
|
|
5155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: ["left", "center", "right"].map((align) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4914
5156
|
Components.Generic.Menu.Item,
|
|
4915
5157
|
{
|
|
4916
5158
|
icon: TABLE_ALIGN_ICONS[align],
|
|
@@ -4925,39 +5167,39 @@ function TableAlignmentItems(props) {
|
|
|
4925
5167
|
)) });
|
|
4926
5168
|
}
|
|
4927
5169
|
var LumirDragHandleMenu = (props) => {
|
|
4928
|
-
const dict = (0,
|
|
4929
|
-
return /* @__PURE__ */ (0,
|
|
4930
|
-
/* @__PURE__ */ (0,
|
|
4931
|
-
/* @__PURE__ */ (0,
|
|
4932
|
-
/* @__PURE__ */ (0,
|
|
4933
|
-
/* @__PURE__ */ (0,
|
|
4934
|
-
/* @__PURE__ */ (0,
|
|
5170
|
+
const dict = (0, import_react30.useDictionary)();
|
|
5171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react30.DragHandleMenu, { ...props, children: [
|
|
5172
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react30.RemoveBlockItem, { ...props, children: dict.drag_handle.delete_menuitem }),
|
|
5173
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react30.BlockColorsItem, { ...props, children: dict.drag_handle.colors_menuitem }),
|
|
5174
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react30.TableRowHeaderItem, { ...props, children: dict.drag_handle.header_row_menuitem }),
|
|
5175
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react30.TableColumnHeaderItem, { ...props, children: dict.drag_handle.header_column_menuitem }),
|
|
5176
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TableAlignmentItems, { block: props.block })
|
|
4935
5177
|
] });
|
|
4936
5178
|
};
|
|
4937
5179
|
|
|
4938
5180
|
// src/components/LumirTableHandlesController.tsx
|
|
4939
|
-
var
|
|
4940
|
-
var
|
|
4941
|
-
var
|
|
5181
|
+
var import_react33 = require("@blocknote/react");
|
|
5182
|
+
var import_react34 = require("@floating-ui/react");
|
|
5183
|
+
var import_react35 = require("react");
|
|
4942
5184
|
|
|
4943
5185
|
// src/components/hooks/useFocusedCellHandlePositioning.ts
|
|
4944
|
-
var
|
|
4945
|
-
var
|
|
5186
|
+
var import_react31 = require("@floating-ui/react");
|
|
5187
|
+
var import_react32 = require("react");
|
|
4946
5188
|
function useFocusedCellHandlePositioning(cellEl, tbodyEl, orientation, show) {
|
|
4947
|
-
const { refs, floatingStyles, context, update } = (0,
|
|
5189
|
+
const { refs, floatingStyles, context, update } = (0, import_react31.useFloating)({
|
|
4948
5190
|
open: show,
|
|
4949
5191
|
placement: orientation === "row" ? "left" : orientation === "col" ? "top" : orientation === "corner" ? "bottom-start" : "right",
|
|
4950
5192
|
// col/row/cell: 가장자리에 14px hit-area 중앙 정렬(-7).
|
|
4951
5193
|
// corner: 18px hit-zone이 표 우하단 모서리에 걸치도록 위/좌로 살짝 당김(모서리 hover 자연).
|
|
4952
5194
|
middleware: [
|
|
4953
|
-
(0,
|
|
5195
|
+
(0, import_react31.offset)(
|
|
4954
5196
|
orientation === "corner" ? { mainAxis: -6, crossAxis: -6 } : -7
|
|
4955
5197
|
)
|
|
4956
5198
|
],
|
|
4957
|
-
whileElementsMounted:
|
|
5199
|
+
whileElementsMounted: import_react31.autoUpdate
|
|
4958
5200
|
});
|
|
4959
|
-
const { isMounted, styles } = (0,
|
|
4960
|
-
(0,
|
|
5201
|
+
const { isMounted, styles } = (0, import_react31.useTransitionStyles)(context);
|
|
5202
|
+
(0, import_react32.useEffect)(() => {
|
|
4961
5203
|
if (!show || !tbodyEl) {
|
|
4962
5204
|
return;
|
|
4963
5205
|
}
|
|
@@ -4965,7 +5207,7 @@ function useFocusedCellHandlePositioning(cellEl, tbodyEl, orientation, show) {
|
|
|
4965
5207
|
ro.observe(tbodyEl);
|
|
4966
5208
|
return () => ro.disconnect();
|
|
4967
5209
|
}, [show, tbodyEl, update]);
|
|
4968
|
-
(0,
|
|
5210
|
+
(0, import_react32.useEffect)(() => {
|
|
4969
5211
|
if (!cellEl) {
|
|
4970
5212
|
refs.setReference(null);
|
|
4971
5213
|
return;
|
|
@@ -4988,7 +5230,7 @@ function useFocusedCellHandlePositioning(cellEl, tbodyEl, orientation, show) {
|
|
|
4988
5230
|
}
|
|
4989
5231
|
});
|
|
4990
5232
|
}, [cellEl, tbodyEl, orientation, refs]);
|
|
4991
|
-
return (0,
|
|
5233
|
+
return (0, import_react32.useMemo)(
|
|
4992
5234
|
() => ({
|
|
4993
5235
|
isMounted,
|
|
4994
5236
|
ref: refs.setFloating,
|
|
@@ -5002,15 +5244,15 @@ function useFocusedCellHandlePositioning(cellEl, tbodyEl, orientation, show) {
|
|
|
5002
5244
|
);
|
|
5003
5245
|
}
|
|
5004
5246
|
function useTableCornerPositioning(referencePosTable, show) {
|
|
5005
|
-
const { refs, floatingStyles, context } = (0,
|
|
5247
|
+
const { refs, floatingStyles, context } = (0, import_react31.useFloating)({
|
|
5006
5248
|
open: show,
|
|
5007
5249
|
placement: "bottom-start",
|
|
5008
5250
|
// 18px hit-zone을 모서리에서 안쪽(위/좌)으로 당겨 표 위에 걸치게 한다.
|
|
5009
|
-
middleware: [(0,
|
|
5010
|
-
whileElementsMounted:
|
|
5251
|
+
middleware: [(0, import_react31.offset)({ mainAxis: -12, crossAxis: -12 })],
|
|
5252
|
+
whileElementsMounted: import_react31.autoUpdate
|
|
5011
5253
|
});
|
|
5012
|
-
const { isMounted, styles } = (0,
|
|
5013
|
-
(0,
|
|
5254
|
+
const { isMounted, styles } = (0, import_react31.useTransitionStyles)(context);
|
|
5255
|
+
(0, import_react32.useEffect)(() => {
|
|
5014
5256
|
if (!referencePosTable) {
|
|
5015
5257
|
refs.setReference(null);
|
|
5016
5258
|
return;
|
|
@@ -5019,7 +5261,7 @@ function useTableCornerPositioning(referencePosTable, show) {
|
|
|
5019
5261
|
getBoundingClientRect: () => new DOMRect(referencePosTable.right, referencePosTable.bottom, 0, 0)
|
|
5020
5262
|
});
|
|
5021
5263
|
}, [referencePosTable, refs]);
|
|
5022
|
-
return (0,
|
|
5264
|
+
return (0, import_react32.useMemo)(
|
|
5023
5265
|
() => ({
|
|
5024
5266
|
isMounted,
|
|
5025
5267
|
ref: refs.setFloating,
|
|
@@ -5030,7 +5272,7 @@ function useTableCornerPositioning(referencePosTable, show) {
|
|
|
5030
5272
|
}
|
|
5031
5273
|
|
|
5032
5274
|
// src/components/LumirTableHandlesController.tsx
|
|
5033
|
-
var
|
|
5275
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5034
5276
|
function syncCoreHoverToFocusedCell(cellEl) {
|
|
5035
5277
|
const r = cellEl.getBoundingClientRect();
|
|
5036
5278
|
cellEl.dispatchEvent(
|
|
@@ -5044,18 +5286,18 @@ function syncCoreHoverToFocusedCell(cellEl) {
|
|
|
5044
5286
|
);
|
|
5045
5287
|
}
|
|
5046
5288
|
function LumirTableHandlesController() {
|
|
5047
|
-
const editor = (0,
|
|
5048
|
-
const [focused, setFocused] = (0,
|
|
5049
|
-
const [menuContainerRef, setMenuContainerRef] = (0,
|
|
5050
|
-
const [overlayEl, setOverlayEl] = (0,
|
|
5051
|
-
const [openMenu, setOpenMenu] = (0,
|
|
5052
|
-
const frozenRef = (0,
|
|
5053
|
-
const menuOpenRef = (0,
|
|
5054
|
-
const draggingRef = (0,
|
|
5055
|
-
(0,
|
|
5289
|
+
const editor = (0, import_react33.useBlockNoteEditor)();
|
|
5290
|
+
const [focused, setFocused] = (0, import_react35.useState)(null);
|
|
5291
|
+
const [menuContainerRef, setMenuContainerRef] = (0, import_react35.useState)(null);
|
|
5292
|
+
const [overlayEl, setOverlayEl] = (0, import_react35.useState)(null);
|
|
5293
|
+
const [openMenu, setOpenMenu] = (0, import_react35.useState)(null);
|
|
5294
|
+
const frozenRef = (0, import_react35.useRef)(false);
|
|
5295
|
+
const menuOpenRef = (0, import_react35.useRef)(false);
|
|
5296
|
+
const draggingRef = (0, import_react35.useRef)(false);
|
|
5297
|
+
(0, import_react35.useEffect)(() => {
|
|
5056
5298
|
editor.__lumirActiveTableId = focused?.block?.id ?? null;
|
|
5057
5299
|
}, [editor, focused]);
|
|
5058
|
-
const recompute = (0,
|
|
5300
|
+
const recompute = (0, import_react35.useCallback)(() => {
|
|
5059
5301
|
if (frozenRef.current) {
|
|
5060
5302
|
return;
|
|
5061
5303
|
}
|
|
@@ -5103,11 +5345,11 @@ function LumirTableHandlesController() {
|
|
|
5103
5345
|
widgetContainer
|
|
5104
5346
|
});
|
|
5105
5347
|
}, [editor]);
|
|
5106
|
-
(0,
|
|
5107
|
-
(0,
|
|
5348
|
+
(0, import_react33.useEditorContentOrSelectionChange)(recompute, editor);
|
|
5349
|
+
(0, import_react35.useEffect)(() => {
|
|
5108
5350
|
recompute();
|
|
5109
5351
|
}, [recompute]);
|
|
5110
|
-
(0,
|
|
5352
|
+
(0, import_react35.useEffect)(() => {
|
|
5111
5353
|
const onUp = () => {
|
|
5112
5354
|
requestAnimationFrame(() => {
|
|
5113
5355
|
if (!menuOpenRef.current && !draggingRef.current && frozenRef.current) {
|
|
@@ -5119,7 +5361,7 @@ function LumirTableHandlesController() {
|
|
|
5119
5361
|
window.addEventListener("pointerup", onUp);
|
|
5120
5362
|
return () => window.removeEventListener("pointerup", onUp);
|
|
5121
5363
|
}, [recompute]);
|
|
5122
|
-
(0,
|
|
5364
|
+
(0, import_react35.useEffect)(() => {
|
|
5123
5365
|
const f = focused;
|
|
5124
5366
|
if (!f || !overlayEl) {
|
|
5125
5367
|
return;
|
|
@@ -5144,7 +5386,7 @@ function LumirTableHandlesController() {
|
|
|
5144
5386
|
overlayEl.style.height = `${bottom - top}px`;
|
|
5145
5387
|
};
|
|
5146
5388
|
update();
|
|
5147
|
-
const stopAutoUpdate = (0,
|
|
5389
|
+
const stopAutoUpdate = (0, import_react34.autoUpdate)(f.cellEl, overlayEl, update);
|
|
5148
5390
|
const ro = new ResizeObserver(update);
|
|
5149
5391
|
ro.observe(f.tbodyEl);
|
|
5150
5392
|
return () => {
|
|
@@ -5164,25 +5406,25 @@ function LumirTableHandlesController() {
|
|
|
5164
5406
|
show
|
|
5165
5407
|
);
|
|
5166
5408
|
const th = editor.tableHandles;
|
|
5167
|
-
const coreState = (0,
|
|
5409
|
+
const coreState = (0, import_react33.useUIPluginState)(
|
|
5168
5410
|
editor.tableHandles.onUpdate.bind(editor.tableHandles)
|
|
5169
5411
|
);
|
|
5170
|
-
const { addOrRemoveColumnsButton, addOrRemoveRowsButton } = (0,
|
|
5412
|
+
const { addOrRemoveColumnsButton, addOrRemoveRowsButton } = (0, import_react33.useExtendButtonsPositioning)(
|
|
5171
5413
|
coreState?.showAddOrRemoveColumnsButton || false,
|
|
5172
5414
|
coreState?.showAddOrRemoveRowsButton || false,
|
|
5173
5415
|
coreState?.referencePosTable || null
|
|
5174
5416
|
);
|
|
5175
|
-
const onStartExtend = (0,
|
|
5417
|
+
const onStartExtend = (0, import_react35.useCallback)(() => {
|
|
5176
5418
|
editor.tableHandles?.freezeHandles();
|
|
5177
5419
|
}, [editor]);
|
|
5178
|
-
const onEndExtend = (0,
|
|
5420
|
+
const onEndExtend = (0, import_react35.useCallback)(() => {
|
|
5179
5421
|
editor.tableHandles?.unfreezeHandles();
|
|
5180
5422
|
}, [editor]);
|
|
5181
5423
|
const tableCorner = useTableCornerPositioning(
|
|
5182
5424
|
coreState?.referencePosTable ?? null,
|
|
5183
5425
|
!!coreState?.widgetContainer
|
|
5184
5426
|
);
|
|
5185
|
-
const menuHandlers = (0,
|
|
5427
|
+
const menuHandlers = (0, import_react35.useMemo)(() => {
|
|
5186
5428
|
const mk = (kind) => ({
|
|
5187
5429
|
freeze: () => {
|
|
5188
5430
|
menuOpenRef.current = true;
|
|
@@ -5200,10 +5442,10 @@ function LumirTableHandlesController() {
|
|
|
5200
5442
|
});
|
|
5201
5443
|
return { col: mk("col"), row: mk("row"), cell: mk("cell") };
|
|
5202
5444
|
}, [editor, recompute]);
|
|
5203
|
-
const onGutterPointerDown = (0,
|
|
5445
|
+
const onGutterPointerDown = (0, import_react35.useCallback)(() => {
|
|
5204
5446
|
frozenRef.current = true;
|
|
5205
5447
|
}, []);
|
|
5206
|
-
const onGutterPointerEnter = (0,
|
|
5448
|
+
const onGutterPointerEnter = (0, import_react35.useCallback)(
|
|
5207
5449
|
(e) => {
|
|
5208
5450
|
if (e.buttons === 0 && focused) {
|
|
5209
5451
|
syncCoreHoverToFocusedCell(focused.cellEl);
|
|
@@ -5211,7 +5453,7 @@ function LumirTableHandlesController() {
|
|
|
5211
5453
|
},
|
|
5212
5454
|
[focused]
|
|
5213
5455
|
);
|
|
5214
|
-
const makeDragStart = (0,
|
|
5456
|
+
const makeDragStart = (0, import_react35.useCallback)(
|
|
5215
5457
|
(dir) => (e) => {
|
|
5216
5458
|
draggingRef.current = true;
|
|
5217
5459
|
frozenRef.current = true;
|
|
@@ -5223,15 +5465,15 @@ function LumirTableHandlesController() {
|
|
|
5223
5465
|
},
|
|
5224
5466
|
[editor]
|
|
5225
5467
|
);
|
|
5226
|
-
const onDragEnd = (0,
|
|
5468
|
+
const onDragEnd = (0, import_react35.useCallback)(() => {
|
|
5227
5469
|
editor.tableHandles?.dragEnd();
|
|
5228
5470
|
draggingRef.current = false;
|
|
5229
5471
|
frozenRef.current = false;
|
|
5230
5472
|
recompute();
|
|
5231
5473
|
}, [editor, recompute]);
|
|
5232
|
-
const noop = (0,
|
|
5474
|
+
const noop = (0, import_react35.useCallback)(() => {
|
|
5233
5475
|
}, []);
|
|
5234
|
-
const onScaleStart = (0,
|
|
5476
|
+
const onScaleStart = (0, import_react35.useCallback)(
|
|
5235
5477
|
(e) => {
|
|
5236
5478
|
e.preventDefault();
|
|
5237
5479
|
e.stopPropagation();
|
|
@@ -5273,11 +5515,11 @@ function LumirTableHandlesController() {
|
|
|
5273
5515
|
},
|
|
5274
5516
|
[editor, coreState]
|
|
5275
5517
|
);
|
|
5276
|
-
return /* @__PURE__ */ (0,
|
|
5277
|
-
/* @__PURE__ */ (0,
|
|
5278
|
-
th && focused && menuContainerRef && /* @__PURE__ */ (0,
|
|
5279
|
-
/* @__PURE__ */ (0,
|
|
5280
|
-
colHandle.isMounted && /* @__PURE__ */ (0,
|
|
5518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
5519
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: setMenuContainerRef }),
|
|
5520
|
+
th && focused && menuContainerRef && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react34.FloatingPortal, { root: focused.widgetContainer, children: [
|
|
5521
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: setOverlayEl, className: "lumir-tbl-cell-focus" }),
|
|
5522
|
+
colHandle.isMounted && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5281
5523
|
"div",
|
|
5282
5524
|
{
|
|
5283
5525
|
ref: colHandle.ref,
|
|
@@ -5286,9 +5528,9 @@ function LumirTableHandlesController() {
|
|
|
5286
5528
|
onPointerEnter: onGutterPointerEnter,
|
|
5287
5529
|
onPointerDown: onGutterPointerDown,
|
|
5288
5530
|
children: [
|
|
5289
|
-
/* @__PURE__ */ (0,
|
|
5290
|
-
/* @__PURE__ */ (0,
|
|
5291
|
-
|
|
5531
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "lumir-tbl-gutter" }),
|
|
5532
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lumir-tbl-grip", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5533
|
+
import_react33.TableHandle,
|
|
5292
5534
|
{
|
|
5293
5535
|
editor,
|
|
5294
5536
|
orientation: "column",
|
|
@@ -5306,7 +5548,7 @@ function LumirTableHandlesController() {
|
|
|
5306
5548
|
]
|
|
5307
5549
|
}
|
|
5308
5550
|
),
|
|
5309
|
-
rowHandle.isMounted && /* @__PURE__ */ (0,
|
|
5551
|
+
rowHandle.isMounted && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5310
5552
|
"div",
|
|
5311
5553
|
{
|
|
5312
5554
|
ref: rowHandle.ref,
|
|
@@ -5315,9 +5557,9 @@ function LumirTableHandlesController() {
|
|
|
5315
5557
|
onPointerEnter: onGutterPointerEnter,
|
|
5316
5558
|
onPointerDown: onGutterPointerDown,
|
|
5317
5559
|
children: [
|
|
5318
|
-
/* @__PURE__ */ (0,
|
|
5319
|
-
/* @__PURE__ */ (0,
|
|
5320
|
-
|
|
5560
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "lumir-tbl-gutter" }),
|
|
5561
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lumir-tbl-grip", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5562
|
+
import_react33.TableHandle,
|
|
5321
5563
|
{
|
|
5322
5564
|
editor,
|
|
5323
5565
|
orientation: "row",
|
|
@@ -5335,7 +5577,7 @@ function LumirTableHandlesController() {
|
|
|
5335
5577
|
]
|
|
5336
5578
|
}
|
|
5337
5579
|
),
|
|
5338
|
-
cellHandle.isMounted && openMenu !== "col" && openMenu !== "row" && /* @__PURE__ */ (0,
|
|
5580
|
+
cellHandle.isMounted && openMenu !== "col" && openMenu !== "row" && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
5339
5581
|
"div",
|
|
5340
5582
|
{
|
|
5341
5583
|
ref: cellHandle.ref,
|
|
@@ -5343,9 +5585,9 @@ function LumirTableHandlesController() {
|
|
|
5343
5585
|
className: "lumir-tbl-gutter-wrap lumir-tbl-gutter-wrap--cell" + (openMenu === "cell" ? " lumir-tbl-gutter-wrap--active" : ""),
|
|
5344
5586
|
onPointerDown: onGutterPointerDown,
|
|
5345
5587
|
children: [
|
|
5346
|
-
/* @__PURE__ */ (0,
|
|
5347
|
-
/* @__PURE__ */ (0,
|
|
5348
|
-
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "lumir-tbl-gutter" }),
|
|
5589
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "lumir-tbl-grip", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5590
|
+
import_react33.TableCellButton,
|
|
5349
5591
|
{
|
|
5350
5592
|
editor,
|
|
5351
5593
|
rowIndex: focused.rowIndex,
|
|
@@ -5361,9 +5603,9 @@ function LumirTableHandlesController() {
|
|
|
5361
5603
|
}
|
|
5362
5604
|
)
|
|
5363
5605
|
] }),
|
|
5364
|
-
th && coreState?.widgetContainer && /* @__PURE__ */ (0,
|
|
5365
|
-
/* @__PURE__ */ (0,
|
|
5366
|
-
|
|
5606
|
+
th && coreState?.widgetContainer && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_react34.FloatingPortal, { root: coreState.widgetContainer, children: [
|
|
5607
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { ref: addOrRemoveRowsButton.ref, style: addOrRemoveRowsButton.style, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5608
|
+
import_react33.ExtendButton,
|
|
5367
5609
|
{
|
|
5368
5610
|
editor,
|
|
5369
5611
|
orientation: "addOrRemoveRows",
|
|
@@ -5372,13 +5614,13 @@ function LumirTableHandlesController() {
|
|
|
5372
5614
|
onMouseUp: onEndExtend
|
|
5373
5615
|
}
|
|
5374
5616
|
) }),
|
|
5375
|
-
/* @__PURE__ */ (0,
|
|
5617
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5376
5618
|
"div",
|
|
5377
5619
|
{
|
|
5378
5620
|
ref: addOrRemoveColumnsButton.ref,
|
|
5379
5621
|
style: addOrRemoveColumnsButton.style,
|
|
5380
|
-
children: /* @__PURE__ */ (0,
|
|
5381
|
-
|
|
5622
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5623
|
+
import_react33.ExtendButton,
|
|
5382
5624
|
{
|
|
5383
5625
|
editor,
|
|
5384
5626
|
orientation: "addOrRemoveColumns",
|
|
@@ -5389,7 +5631,7 @@ function LumirTableHandlesController() {
|
|
|
5389
5631
|
)
|
|
5390
5632
|
}
|
|
5391
5633
|
),
|
|
5392
|
-
tableCorner.isMounted && /* @__PURE__ */ (0,
|
|
5634
|
+
tableCorner.isMounted && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
5393
5635
|
"div",
|
|
5394
5636
|
{
|
|
5395
5637
|
ref: tableCorner.ref,
|
|
@@ -5654,7 +5896,7 @@ function liftFontSize(blocks) {
|
|
|
5654
5896
|
}
|
|
5655
5897
|
|
|
5656
5898
|
// src/utils/table-delete.ts
|
|
5657
|
-
var
|
|
5899
|
+
var import_prosemirror_tables4 = require("prosemirror-tables");
|
|
5658
5900
|
function measureRowHeights(view, tablePos) {
|
|
5659
5901
|
try {
|
|
5660
5902
|
const at = view?.domAtPos?.(tablePos + 1);
|
|
@@ -5673,7 +5915,7 @@ function measureRowHeights(view, tablePos) {
|
|
|
5673
5915
|
function buildDeleteColumnTr(state, tablePos, col, rowPx) {
|
|
5674
5916
|
const table = state.doc.nodeAt(tablePos);
|
|
5675
5917
|
if (!table || table.type.name !== "table") return null;
|
|
5676
|
-
const map =
|
|
5918
|
+
const map = import_prosemirror_tables4.TableMap.get(table);
|
|
5677
5919
|
const W = map.width;
|
|
5678
5920
|
const H = map.height;
|
|
5679
5921
|
if (col < 0 || col >= W || W <= 1) return null;
|
|
@@ -5779,9 +6021,9 @@ function removeFocusedRowOrColumn(editor, index, direction) {
|
|
|
5779
6021
|
const rowStart = state.doc.resolve(tableInside.posAtIndex(index) + 1);
|
|
5780
6022
|
const cellPos = state.doc.resolve(rowStart.posAtIndex(0));
|
|
5781
6023
|
const selState = state.apply(
|
|
5782
|
-
state.tr.setSelection(new
|
|
6024
|
+
state.tr.setSelection(new import_prosemirror_tables4.CellSelection(cellPos))
|
|
5783
6025
|
);
|
|
5784
|
-
return (0,
|
|
6026
|
+
return (0, import_prosemirror_tables4.deleteRow)(selState, (tr) => tiptap.view.dispatch(tr));
|
|
5785
6027
|
} catch {
|
|
5786
6028
|
return false;
|
|
5787
6029
|
}
|
|
@@ -5931,6 +6173,20 @@ function normalizeAlign(ta) {
|
|
|
5931
6173
|
if (v === "justify") return "justify";
|
|
5932
6174
|
return "";
|
|
5933
6175
|
}
|
|
6176
|
+
function mapVerticalAlign(v) {
|
|
6177
|
+
const s = (v || "").trim().toLowerCase();
|
|
6178
|
+
if (s === "middle" || s === "center") return "middle";
|
|
6179
|
+
if (s === "bottom") return "bottom";
|
|
6180
|
+
return null;
|
|
6181
|
+
}
|
|
6182
|
+
function fontSizeToPx(raw) {
|
|
6183
|
+
if (!raw) return null;
|
|
6184
|
+
const m = String(raw).trim().match(/^([\d.]+)\s*(px|pt)?$/i);
|
|
6185
|
+
if (!m) return null;
|
|
6186
|
+
const v = parseFloat(m[1]);
|
|
6187
|
+
if (!Number.isFinite(v) || v <= 0) return null;
|
|
6188
|
+
return (m[2] || "px").toLowerCase() === "pt" ? v * (96 / 72) : v;
|
|
6189
|
+
}
|
|
5934
6190
|
function applyCellFormatting(el, fmt) {
|
|
5935
6191
|
if (fmt.bgRgb && !fmt.bgTransparent) {
|
|
5936
6192
|
const v = nearestBackgroundColorValue(fmt.bgRgb);
|
|
@@ -5950,6 +6206,13 @@ function applyCellFormatting(el, fmt) {
|
|
|
5950
6206
|
if (fmt.bold) inner = `<strong>${inner}</strong>`;
|
|
5951
6207
|
el.innerHTML = inner;
|
|
5952
6208
|
}
|
|
6209
|
+
if (fmt.verticalAlign) {
|
|
6210
|
+
el.setAttribute("data-vertical-alignment", fmt.verticalAlign);
|
|
6211
|
+
}
|
|
6212
|
+
if (fmt.fontSizePx && Math.abs(fmt.fontSizePx - 14) > 1 && el.innerHTML.trim()) {
|
|
6213
|
+
const v = `${Math.round(fmt.fontSizePx)}px`;
|
|
6214
|
+
el.innerHTML = `<span data-style-type="fontSize" data-value="${v}" style="font-size:${v}">` + el.innerHTML + `</span>`;
|
|
6215
|
+
}
|
|
5953
6216
|
}
|
|
5954
6217
|
function readComputedFormat(el) {
|
|
5955
6218
|
const cs = getComputedStyle(el);
|
|
@@ -5963,7 +6226,13 @@ function readComputedFormat(el) {
|
|
|
5963
6226
|
align: normalizeAlign(cs.textAlign),
|
|
5964
6227
|
bold: fw === "bold" || fw === "bolder" || !isNaN(fwNum) && fwNum >= 600,
|
|
5965
6228
|
italic: (cs.fontStyle || "").toLowerCase().includes("italic"),
|
|
5966
|
-
underline: decoration.toLowerCase().includes("underline")
|
|
6229
|
+
underline: decoration.toLowerCase().includes("underline"),
|
|
6230
|
+
fontSizePx: fontSizeToPx(cs.fontSize),
|
|
6231
|
+
// ⚠️ computed vertical-align은 td 기본값이 "middle"이라 셀마다 잘못 붙는다.
|
|
6232
|
+
// 명시적 inline style / valign 속성만 읽는다(기본값 노이즈 방지).
|
|
6233
|
+
verticalAlign: mapVerticalAlign(
|
|
6234
|
+
el.style?.verticalAlign || el.getAttribute("valign")
|
|
6235
|
+
)
|
|
5967
6236
|
};
|
|
5968
6237
|
}
|
|
5969
6238
|
function readInlineFormat(el) {
|
|
@@ -5979,7 +6248,11 @@ function readInlineFormat(el) {
|
|
|
5979
6248
|
align: normalizeAlign(sm["text-align"] || el.getAttribute("align")),
|
|
5980
6249
|
bold: fw === "bold" || fw === "bolder" || parseInt(fw, 10) >= 600,
|
|
5981
6250
|
italic: (sm["font-style"] || "").toLowerCase().includes("italic"),
|
|
5982
|
-
underline: decoration.toLowerCase().includes("underline")
|
|
6251
|
+
underline: decoration.toLowerCase().includes("underline"),
|
|
6252
|
+
fontSizePx: fontSizeToPx(sm["font-size"]),
|
|
6253
|
+
verticalAlign: mapVerticalAlign(
|
|
6254
|
+
sm["vertical-align"] || el.getAttribute("valign")
|
|
6255
|
+
)
|
|
5983
6256
|
};
|
|
5984
6257
|
}
|
|
5985
6258
|
function normalizeExcelTableHtml(html) {
|
|
@@ -5993,7 +6266,7 @@ function normalizeExcelTableHtml(html) {
|
|
|
5993
6266
|
try {
|
|
5994
6267
|
host = document.createElement("div");
|
|
5995
6268
|
host.setAttribute("aria-hidden", "true");
|
|
5996
|
-
host.style.cssText = "position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none";
|
|
6269
|
+
host.style.cssText = "position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;opacity:0;pointer-events:none;font-size:14px";
|
|
5997
6270
|
const shadow = host.attachShadow({ mode: "open" });
|
|
5998
6271
|
const styles = Array.from(doc.querySelectorAll("style")).map((s) => s.outerHTML).join("");
|
|
5999
6272
|
shadow.innerHTML = styles + doc.body.innerHTML;
|
|
@@ -6016,8 +6289,102 @@ function normalizeExcelTableHtml(html) {
|
|
|
6016
6289
|
}
|
|
6017
6290
|
}
|
|
6018
6291
|
|
|
6292
|
+
// src/utils/table-paste-fit.ts
|
|
6293
|
+
var MIN_COL_PX = 24;
|
|
6294
|
+
function toPx(raw, maxWidth) {
|
|
6295
|
+
if (!raw) return null;
|
|
6296
|
+
const m = String(raw).trim().match(/^([\d.]+)\s*(pt|px|%)?$/i);
|
|
6297
|
+
if (!m) return null;
|
|
6298
|
+
const v = parseFloat(m[1]);
|
|
6299
|
+
if (!Number.isFinite(v) || v <= 0) return null;
|
|
6300
|
+
const unit = (m[2] || "px").toLowerCase();
|
|
6301
|
+
if (unit === "pt") return v * (96 / 72);
|
|
6302
|
+
if (unit === "%") return v / 100 * maxWidth;
|
|
6303
|
+
return v;
|
|
6304
|
+
}
|
|
6305
|
+
function elWidthPx(el, maxWidth) {
|
|
6306
|
+
const styleW = el.style?.width;
|
|
6307
|
+
return toPx(styleW, maxWidth) ?? toPx(el.getAttribute("width"), maxWidth);
|
|
6308
|
+
}
|
|
6309
|
+
function readColumnWidths(table, maxWidth) {
|
|
6310
|
+
const colEls = table.querySelector("colgroup")?.querySelectorAll("col");
|
|
6311
|
+
if (colEls && colEls.length > 0) {
|
|
6312
|
+
const widths2 = [];
|
|
6313
|
+
let ok2 = true;
|
|
6314
|
+
colEls.forEach((c) => {
|
|
6315
|
+
const span = parseInt(c.getAttribute("span") || "1", 10) || 1;
|
|
6316
|
+
const w = elWidthPx(c, maxWidth);
|
|
6317
|
+
if (w == null) ok2 = false;
|
|
6318
|
+
for (let i = 0; i < span; i++) widths2.push(w ?? 0);
|
|
6319
|
+
});
|
|
6320
|
+
if (ok2 && widths2.length > 0) return widths2;
|
|
6321
|
+
}
|
|
6322
|
+
const firstRow = table.querySelector("tr");
|
|
6323
|
+
if (!firstRow) return null;
|
|
6324
|
+
const widths = [];
|
|
6325
|
+
let ok = true;
|
|
6326
|
+
Array.from(firstRow.children).forEach((cell) => {
|
|
6327
|
+
if (cell.tagName !== "TD" && cell.tagName !== "TH") return;
|
|
6328
|
+
const span = parseInt(cell.getAttribute("colspan") || "1", 10) || 1;
|
|
6329
|
+
const w = elWidthPx(cell, maxWidth);
|
|
6330
|
+
if (w == null) ok = false;
|
|
6331
|
+
const per = (w ?? 0) / span;
|
|
6332
|
+
for (let i = 0; i < span; i++) widths.push(per);
|
|
6333
|
+
});
|
|
6334
|
+
return ok && widths.length > 0 ? widths : null;
|
|
6335
|
+
}
|
|
6336
|
+
function fitWidths(widths, maxWidth) {
|
|
6337
|
+
const total = widths.reduce((a, b) => a + b, 0);
|
|
6338
|
+
if (total <= 0) return widths;
|
|
6339
|
+
const scale = total > maxWidth ? maxWidth / total : 1;
|
|
6340
|
+
return widths.map((w) => Math.max(MIN_COL_PX, Math.round(w * scale)));
|
|
6341
|
+
}
|
|
6342
|
+
function computeFittedColumnWidthsPerTable(html, maxWidth) {
|
|
6343
|
+
if (!html || typeof DOMParser === "undefined" || !(maxWidth > 0)) return [];
|
|
6344
|
+
let doc;
|
|
6345
|
+
try {
|
|
6346
|
+
doc = new DOMParser().parseFromString(html, "text/html");
|
|
6347
|
+
} catch {
|
|
6348
|
+
return [];
|
|
6349
|
+
}
|
|
6350
|
+
return Array.from(doc.querySelectorAll("table")).map((t) => {
|
|
6351
|
+
const widths = readColumnWidths(t, maxWidth);
|
|
6352
|
+
return widths ? fitWidths(widths, maxWidth) : null;
|
|
6353
|
+
});
|
|
6354
|
+
}
|
|
6355
|
+
function collectTableBlocks(blocks) {
|
|
6356
|
+
const out = [];
|
|
6357
|
+
const walk = (bs) => {
|
|
6358
|
+
for (const b of bs) {
|
|
6359
|
+
if (b?.type === "table") out.push(b);
|
|
6360
|
+
if (b?.children?.length) walk(b.children);
|
|
6361
|
+
}
|
|
6362
|
+
};
|
|
6363
|
+
walk(blocks || []);
|
|
6364
|
+
return out;
|
|
6365
|
+
}
|
|
6366
|
+
function applyFittedWidthsToNewTables(editor, beforeIds, perTable) {
|
|
6367
|
+
if (!editor || perTable.length === 0) return;
|
|
6368
|
+
const newTables = collectTableBlocks(editor.document).filter(
|
|
6369
|
+
(b) => !beforeIds.has(b.id)
|
|
6370
|
+
);
|
|
6371
|
+
newTables.forEach((tb, i) => {
|
|
6372
|
+
const widths = perTable[i];
|
|
6373
|
+
const current = tb?.content?.columnWidths;
|
|
6374
|
+
if (widths && Array.isArray(current) && current.length === widths.length) {
|
|
6375
|
+
try {
|
|
6376
|
+
editor.updateBlock(tb, {
|
|
6377
|
+
type: "table",
|
|
6378
|
+
content: { ...tb.content, columnWidths: widths }
|
|
6379
|
+
});
|
|
6380
|
+
} catch {
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
});
|
|
6384
|
+
}
|
|
6385
|
+
|
|
6019
6386
|
// src/components/LumirEditor.tsx
|
|
6020
|
-
var
|
|
6387
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
6021
6388
|
var DEBUG_LOG = (loc, msg, data) => {
|
|
6022
6389
|
const p = fetch("http://127.0.0.1:7686/ingest/1f8ee1c5-0cf0-4ae7-91ed-5ea7ed17130a", {
|
|
6023
6390
|
method: "POST",
|
|
@@ -6248,9 +6615,9 @@ var findBlockWithLink = (blocks, targetUrl) => {
|
|
|
6248
6615
|
return null;
|
|
6249
6616
|
};
|
|
6250
6617
|
var ConvertToPreviewButton = ({ url }) => {
|
|
6251
|
-
const editor = (0,
|
|
6252
|
-
const Components = (0,
|
|
6253
|
-
return /* @__PURE__ */ (0,
|
|
6618
|
+
const editor = (0, import_react37.useBlockNoteEditor)();
|
|
6619
|
+
const Components = (0, import_react37.useComponentsContext)();
|
|
6620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6254
6621
|
Components.LinkToolbar.Button,
|
|
6255
6622
|
{
|
|
6256
6623
|
className: "bn-button",
|
|
@@ -6269,29 +6636,29 @@ var ConvertToPreviewButton = ({ url }) => {
|
|
|
6269
6636
|
console.error("Convert to link preview failed:", err);
|
|
6270
6637
|
}
|
|
6271
6638
|
},
|
|
6272
|
-
icon: /* @__PURE__ */ (0,
|
|
6273
|
-
/* @__PURE__ */ (0,
|
|
6274
|
-
/* @__PURE__ */ (0,
|
|
6275
|
-
/* @__PURE__ */ (0,
|
|
6639
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6640
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "1", y: "3", width: "14", height: "10", rx: "2", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }),
|
|
6641
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("line", { x1: "1", y1: "9", x2: "15", y2: "9", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
6642
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { cx: "5", cy: "6.5", r: "1.5", stroke: "currentColor", strokeWidth: "1", fill: "none" })
|
|
6276
6643
|
] })
|
|
6277
6644
|
}
|
|
6278
6645
|
);
|
|
6279
6646
|
};
|
|
6280
6647
|
var CustomLinkToolbar = (props) => {
|
|
6281
|
-
const editor = (0,
|
|
6282
|
-
const Components = (0,
|
|
6648
|
+
const editor = (0, import_react37.useBlockNoteEditor)();
|
|
6649
|
+
const Components = (0, import_react37.useComponentsContext)();
|
|
6283
6650
|
const hasLinkPreview = !!editor?._linkPreviewApiEndpoint;
|
|
6284
|
-
return /* @__PURE__ */ (0,
|
|
6651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
6285
6652
|
Components.LinkToolbar.Root,
|
|
6286
6653
|
{
|
|
6287
6654
|
className: "bn-toolbar bn-link-toolbar",
|
|
6288
6655
|
onMouseEnter: props.stopHideTimer,
|
|
6289
6656
|
onMouseLeave: props.startHideTimer,
|
|
6290
6657
|
children: [
|
|
6291
|
-
/* @__PURE__ */ (0,
|
|
6292
|
-
/* @__PURE__ */ (0,
|
|
6293
|
-
/* @__PURE__ */ (0,
|
|
6294
|
-
hasLinkPreview && /* @__PURE__ */ (0,
|
|
6658
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.EditLinkButton, { url: props.url, text: props.text, editLink: props.editLink }),
|
|
6659
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.OpenLinkButton, { url: props.url }),
|
|
6660
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.DeleteLinkButton, { deleteLink: props.deleteLink }),
|
|
6661
|
+
hasLinkPreview && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ConvertToPreviewButton, { url: props.url })
|
|
6295
6662
|
]
|
|
6296
6663
|
}
|
|
6297
6664
|
);
|
|
@@ -6336,13 +6703,13 @@ function LumirEditor({
|
|
|
6336
6703
|
onError,
|
|
6337
6704
|
onImageDelete
|
|
6338
6705
|
}) {
|
|
6339
|
-
const [isUploading, setIsUploading] = (0,
|
|
6340
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
6341
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
6342
|
-
const floatingMenuFileInputRef = (0,
|
|
6343
|
-
const floatingMenuBlockRef = (0,
|
|
6344
|
-
const floatingMenuUploadStartTimeRef = (0,
|
|
6345
|
-
const handleError = (0,
|
|
6706
|
+
const [isUploading, setIsUploading] = (0, import_react36.useState)(false);
|
|
6707
|
+
const [uploadProgress, setUploadProgress] = (0, import_react36.useState)(null);
|
|
6708
|
+
const [errorMessage, setErrorMessage] = (0, import_react36.useState)(null);
|
|
6709
|
+
const floatingMenuFileInputRef = (0, import_react36.useRef)(null);
|
|
6710
|
+
const floatingMenuBlockRef = (0, import_react36.useRef)(null);
|
|
6711
|
+
const floatingMenuUploadStartTimeRef = (0, import_react36.useRef)(0);
|
|
6712
|
+
const handleError = (0, import_react36.useCallback)(
|
|
6346
6713
|
(error) => {
|
|
6347
6714
|
onError?.(error);
|
|
6348
6715
|
setErrorMessage(error.getUserMessage());
|
|
@@ -6350,12 +6717,12 @@ function LumirEditor({
|
|
|
6350
6717
|
},
|
|
6351
6718
|
[onError]
|
|
6352
6719
|
);
|
|
6353
|
-
const validatedContent = (0,
|
|
6720
|
+
const validatedContent = (0, import_react36.useMemo)(() => {
|
|
6354
6721
|
return liftFontSize(
|
|
6355
6722
|
ContentUtils.validateContent(initialContent, initialEmptyBlocks)
|
|
6356
6723
|
);
|
|
6357
6724
|
}, [initialContent, initialEmptyBlocks]);
|
|
6358
|
-
const tableConfig = (0,
|
|
6725
|
+
const tableConfig = (0, import_react36.useMemo)(() => {
|
|
6359
6726
|
return EditorConfig.getDefaultTableConfig(tables);
|
|
6360
6727
|
}, [
|
|
6361
6728
|
tables?.splitCells,
|
|
@@ -6363,10 +6730,10 @@ function LumirEditor({
|
|
|
6363
6730
|
tables?.cellTextColor,
|
|
6364
6731
|
tables?.headers
|
|
6365
6732
|
]);
|
|
6366
|
-
const headingConfig = (0,
|
|
6733
|
+
const headingConfig = (0, import_react36.useMemo)(() => {
|
|
6367
6734
|
return EditorConfig.getDefaultHeadingConfig(heading);
|
|
6368
6735
|
}, [heading?.levels?.join(",") ?? ""]);
|
|
6369
|
-
const disabledExtensions = (0,
|
|
6736
|
+
const disabledExtensions = (0, import_react36.useMemo)(() => {
|
|
6370
6737
|
return EditorConfig.getDisabledExtensions(
|
|
6371
6738
|
disableExtensions,
|
|
6372
6739
|
allowVideoUpload,
|
|
@@ -6374,18 +6741,18 @@ function LumirEditor({
|
|
|
6374
6741
|
allowFileUpload
|
|
6375
6742
|
);
|
|
6376
6743
|
}, [disableExtensions, allowVideoUpload, allowAudioUpload, allowFileUpload]);
|
|
6377
|
-
(0,
|
|
6744
|
+
(0, import_react36.useEffect)(() => {
|
|
6378
6745
|
DEBUG_LOG("LumirEditor:init:disabledExtensions", "snapshot", {
|
|
6379
6746
|
allowVideoUpload,
|
|
6380
6747
|
hasVideoInDisabled: disabledExtensions.includes("video"),
|
|
6381
6748
|
disabledList: disabledExtensions.slice(0, 15)
|
|
6382
6749
|
});
|
|
6383
6750
|
}, [allowVideoUpload, disabledExtensions]);
|
|
6384
|
-
const fileNameTransformRef = (0,
|
|
6385
|
-
(0,
|
|
6751
|
+
const fileNameTransformRef = (0, import_react36.useRef)(s3Upload?.fileNameTransform);
|
|
6752
|
+
(0, import_react36.useEffect)(() => {
|
|
6386
6753
|
fileNameTransformRef.current = s3Upload?.fileNameTransform;
|
|
6387
6754
|
}, [s3Upload?.fileNameTransform]);
|
|
6388
|
-
const memoizedS3Upload = (0,
|
|
6755
|
+
const memoizedS3Upload = (0, import_react36.useMemo)(() => {
|
|
6389
6756
|
if (!s3Upload) return void 0;
|
|
6390
6757
|
return {
|
|
6391
6758
|
apiEndpoint: s3Upload.apiEndpoint,
|
|
@@ -6414,7 +6781,7 @@ function LumirEditor({
|
|
|
6414
6781
|
s3Upload?.maxRetries,
|
|
6415
6782
|
s3Upload?.onProgress
|
|
6416
6783
|
]);
|
|
6417
|
-
const editor = (0,
|
|
6784
|
+
const editor = (0, import_react37.useCreateBlockNote)(
|
|
6418
6785
|
{
|
|
6419
6786
|
// HTML 미리보기 블록이 포함된 커스텀 스키마 사용
|
|
6420
6787
|
schema,
|
|
@@ -6442,7 +6809,9 @@ function LumirEditor({
|
|
|
6442
6809
|
// tableHandles prop으로 게이트(기존 grip 컨트롤러와 동일 게이트).
|
|
6443
6810
|
RowHeightExtension.configure({ resizable: tableHandles }),
|
|
6444
6811
|
// 표 블록 정렬(좌/가운데/우) attr.
|
|
6445
|
-
TableAlignmentExtension
|
|
6812
|
+
TableAlignmentExtension,
|
|
6813
|
+
// 셀 포커스 시 Ctrl/Cmd+A → 표 전체 선택.
|
|
6814
|
+
TableSelectAllExtension
|
|
6446
6815
|
]
|
|
6447
6816
|
},
|
|
6448
6817
|
placeholders: placeholder ? { default: placeholder, emptyDocument: placeholder } : void 0,
|
|
@@ -6548,7 +6917,14 @@ function LumirEditor({
|
|
|
6548
6917
|
hasFiles: !!event?.clipboardData?.files?.length
|
|
6549
6918
|
});
|
|
6550
6919
|
event.preventDefault();
|
|
6920
|
+
const pmDom = editor2.prosemirrorView?.dom;
|
|
6921
|
+
const maxWidth = pmDom?.clientWidth ? pmDom.clientWidth - 8 : 0;
|
|
6922
|
+
const fittedWidths = computeFittedColumnWidthsPerTable(pastedHtml, maxWidth);
|
|
6923
|
+
const beforeTableIds = new Set(
|
|
6924
|
+
collectTableBlocks(editor2.document).map((b) => b.id)
|
|
6925
|
+
);
|
|
6551
6926
|
editor2.pasteHTML(normalizeExcelTableHtml(pastedHtml));
|
|
6927
|
+
applyFittedWidthsToNewTables(editor2, beforeTableIds, fittedWidths);
|
|
6552
6928
|
return true;
|
|
6553
6929
|
}
|
|
6554
6930
|
const fileList = event?.clipboardData?.files ?? null;
|
|
@@ -6636,12 +7012,12 @@ function LumirEditor({
|
|
|
6636
7012
|
} catch {
|
|
6637
7013
|
}
|
|
6638
7014
|
}
|
|
6639
|
-
(0,
|
|
7015
|
+
(0, import_react36.useEffect)(() => {
|
|
6640
7016
|
if (editor) {
|
|
6641
7017
|
editor.isEditable = editable;
|
|
6642
7018
|
}
|
|
6643
7019
|
}, [editor, editable]);
|
|
6644
|
-
(0,
|
|
7020
|
+
(0, import_react36.useEffect)(() => {
|
|
6645
7021
|
if (!editor) return;
|
|
6646
7022
|
const th = editor.tableHandles;
|
|
6647
7023
|
if (!th || th.__lumirColDelPatched || typeof th.removeRowOrColumn !== "function")
|
|
@@ -6653,7 +7029,7 @@ function LumirEditor({
|
|
|
6653
7029
|
};
|
|
6654
7030
|
th.__lumirColDelPatched = true;
|
|
6655
7031
|
}, [editor]);
|
|
6656
|
-
(0,
|
|
7032
|
+
(0, import_react36.useEffect)(() => {
|
|
6657
7033
|
if (!editor || !floatingMenu) return;
|
|
6658
7034
|
const ft = editor.formattingToolbar;
|
|
6659
7035
|
if (!ft?.onUpdate) return;
|
|
@@ -6666,7 +7042,7 @@ function LumirEditor({
|
|
|
6666
7042
|
});
|
|
6667
7043
|
return unsubscribe;
|
|
6668
7044
|
}, [editor, floatingMenu]);
|
|
6669
|
-
(0,
|
|
7045
|
+
(0, import_react36.useEffect)(() => {
|
|
6670
7046
|
if (!editor || !onContentChange) return;
|
|
6671
7047
|
const handleContentChange = () => {
|
|
6672
7048
|
const blocks = editor.topLevelBlocks;
|
|
@@ -6683,13 +7059,13 @@ function LumirEditor({
|
|
|
6683
7059
|
};
|
|
6684
7060
|
return editor.onEditorContentChange(handleContentChange);
|
|
6685
7061
|
}, [editor, onContentChange]);
|
|
6686
|
-
const previousMediaUrlsRef = (0,
|
|
6687
|
-
(0,
|
|
7062
|
+
const previousMediaUrlsRef = (0, import_react36.useRef)(/* @__PURE__ */ new Set());
|
|
7063
|
+
(0, import_react36.useEffect)(() => {
|
|
6688
7064
|
if (!editor) return;
|
|
6689
7065
|
const initialBlocks = editor.topLevelBlocks;
|
|
6690
7066
|
previousMediaUrlsRef.current = extractMediaUrls(initialBlocks);
|
|
6691
7067
|
}, [editor]);
|
|
6692
|
-
(0,
|
|
7068
|
+
(0, import_react36.useEffect)(() => {
|
|
6693
7069
|
if (!editor || !onImageDelete) return;
|
|
6694
7070
|
const handleMediaDeleteCheck = () => {
|
|
6695
7071
|
const currentBlocks = editor.topLevelBlocks;
|
|
@@ -6703,7 +7079,7 @@ function LumirEditor({
|
|
|
6703
7079
|
};
|
|
6704
7080
|
return editor.onEditorContentChange(handleMediaDeleteCheck);
|
|
6705
7081
|
}, [editor, onImageDelete]);
|
|
6706
|
-
(0,
|
|
7082
|
+
(0, import_react36.useEffect)(() => {
|
|
6707
7083
|
const el = editor?.domElement;
|
|
6708
7084
|
if (!el) return;
|
|
6709
7085
|
const handleDragOver = (e) => {
|
|
@@ -6834,13 +7210,13 @@ function LumirEditor({
|
|
|
6834
7210
|
el.removeEventListener("drop", handleDrop, { capture: true });
|
|
6835
7211
|
};
|
|
6836
7212
|
}, [editor, allowVideoUpload]);
|
|
6837
|
-
const computedSideMenu = (0,
|
|
7213
|
+
const computedSideMenu = (0, import_react36.useMemo)(() => {
|
|
6838
7214
|
return sideMenuAddButton ? sideMenu : false;
|
|
6839
7215
|
}, [sideMenuAddButton, sideMenu]);
|
|
6840
|
-
const DragHandleOnlySideMenu = (0,
|
|
6841
|
-
return (props) => /* @__PURE__ */ (0,
|
|
7216
|
+
const DragHandleOnlySideMenu = (0, import_react36.useMemo)(() => {
|
|
7217
|
+
return (props) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.SideMenu, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.DragHandleButton, { ...props, dragHandleMenu: LumirDragHandleMenu }) });
|
|
6842
7218
|
}, []);
|
|
6843
|
-
return /* @__PURE__ */ (0,
|
|
7219
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
6844
7220
|
"div",
|
|
6845
7221
|
{
|
|
6846
7222
|
className: cn(
|
|
@@ -6850,8 +7226,8 @@ function LumirEditor({
|
|
|
6850
7226
|
),
|
|
6851
7227
|
style: { position: "relative", display: "flex", flexDirection: "column" },
|
|
6852
7228
|
children: [
|
|
6853
|
-
floatingMenu && editor && /* @__PURE__ */ (0,
|
|
6854
|
-
/* @__PURE__ */ (0,
|
|
7229
|
+
floatingMenu && editor && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
7230
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6855
7231
|
"input",
|
|
6856
7232
|
{
|
|
6857
7233
|
ref: floatingMenuFileInputRef,
|
|
@@ -6922,7 +7298,7 @@ function LumirEditor({
|
|
|
6922
7298
|
}
|
|
6923
7299
|
}
|
|
6924
7300
|
),
|
|
6925
|
-
/* @__PURE__ */ (0,
|
|
7301
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
6926
7302
|
FloatingMenu,
|
|
6927
7303
|
{
|
|
6928
7304
|
editor,
|
|
@@ -6954,7 +7330,7 @@ function LumirEditor({
|
|
|
6954
7330
|
}
|
|
6955
7331
|
)
|
|
6956
7332
|
] }),
|
|
6957
|
-
/* @__PURE__ */ (0,
|
|
7333
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
6958
7334
|
import_mantine.BlockNoteView,
|
|
6959
7335
|
{
|
|
6960
7336
|
editor,
|
|
@@ -6969,21 +7345,21 @@ function LumirEditor({
|
|
|
6969
7345
|
tableHandles: false,
|
|
6970
7346
|
onSelectionChange,
|
|
6971
7347
|
children: [
|
|
6972
|
-
tableHandles && /* @__PURE__ */ (0,
|
|
6973
|
-
formattingToolbar && /* @__PURE__ */ (0,
|
|
6974
|
-
|
|
7348
|
+
tableHandles && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(LumirTableHandlesController, {}),
|
|
7349
|
+
formattingToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7350
|
+
import_react37.FormattingToolbarController,
|
|
6975
7351
|
{
|
|
6976
7352
|
formattingToolbar: CustomFormattingToolbar
|
|
6977
7353
|
}
|
|
6978
7354
|
),
|
|
6979
|
-
linkToolbar && (linkPreview?.apiEndpoint ? /* @__PURE__ */ (0,
|
|
6980
|
-
/* @__PURE__ */ (0,
|
|
6981
|
-
|
|
7355
|
+
linkToolbar && (linkPreview?.apiEndpoint ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.LinkToolbarController, { linkToolbar: CustomLinkToolbar }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.LinkToolbarController, {})),
|
|
7356
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7357
|
+
import_react37.SuggestionMenuController,
|
|
6982
7358
|
{
|
|
6983
7359
|
triggerCharacter: "/",
|
|
6984
|
-
getItems: (0,
|
|
7360
|
+
getItems: (0, import_react36.useCallback)(
|
|
6985
7361
|
async (query) => {
|
|
6986
|
-
const items = (0,
|
|
7362
|
+
const items = (0, import_react37.getDefaultReactSlashMenuItems)(editor);
|
|
6987
7363
|
const filtered = items.filter((item) => {
|
|
6988
7364
|
const key = (item?.key || "").toString().toLowerCase();
|
|
6989
7365
|
const title = (item?.title || "").toString().toLowerCase();
|
|
@@ -7025,7 +7401,7 @@ function LumirEditor({
|
|
|
7025
7401
|
},
|
|
7026
7402
|
aliases: ["html", "preview", "\uC6F9", "\uC6F9\uD398\uC774\uC9C0"],
|
|
7027
7403
|
group: "Embeds",
|
|
7028
|
-
icon: /* @__PURE__ */ (0,
|
|
7404
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7029
7405
|
"svg",
|
|
7030
7406
|
{
|
|
7031
7407
|
width: "18",
|
|
@@ -7037,45 +7413,64 @@ function LumirEditor({
|
|
|
7037
7413
|
strokeLinecap: "round",
|
|
7038
7414
|
strokeLinejoin: "round",
|
|
7039
7415
|
children: [
|
|
7040
|
-
/* @__PURE__ */ (0,
|
|
7041
|
-
/* @__PURE__ */ (0,
|
|
7416
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
7417
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
7042
7418
|
]
|
|
7043
7419
|
}
|
|
7044
7420
|
),
|
|
7045
7421
|
subtext: "HTML \uD30C\uC77C\uC744 \uBBF8\uB9AC\uBCF4\uAE30\uB85C \uC0BD\uC785"
|
|
7046
7422
|
};
|
|
7423
|
+
const columnIcon = (withDivider) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7424
|
+
"svg",
|
|
7425
|
+
{
|
|
7426
|
+
width: "18",
|
|
7427
|
+
height: "18",
|
|
7428
|
+
viewBox: "0 0 24 24",
|
|
7429
|
+
fill: "none",
|
|
7430
|
+
stroke: "currentColor",
|
|
7431
|
+
strokeWidth: "2",
|
|
7432
|
+
strokeLinecap: "round",
|
|
7433
|
+
strokeLinejoin: "round",
|
|
7434
|
+
children: [
|
|
7435
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "3", y: "4", width: "7", height: "16", rx: "1" }),
|
|
7436
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "14", y: "4", width: "7", height: "16", rx: "1" }),
|
|
7437
|
+
withDivider && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("line", { x1: "12", y1: "3", x2: "12", y2: "21", strokeDasharray: "2 2" })
|
|
7438
|
+
]
|
|
7439
|
+
}
|
|
7440
|
+
);
|
|
7047
7441
|
const columnItem = {
|
|
7048
7442
|
title: "2\uB2E8 \uCEEC\uB7FC",
|
|
7049
|
-
onItemClick: () =>
|
|
7050
|
-
insertTwoColumns(editor);
|
|
7051
|
-
},
|
|
7443
|
+
onItemClick: () => insertTwoColumns(editor, false),
|
|
7052
7444
|
aliases: ["columns", "column", "2col", "\uB2E8", "\uCEEC\uB7FC", "\uB2E4\uB2E8", "\uBD84\uD560"],
|
|
7053
7445
|
group: "Basic blocks",
|
|
7054
|
-
icon:
|
|
7055
|
-
"svg",
|
|
7056
|
-
{
|
|
7057
|
-
width: "18",
|
|
7058
|
-
height: "18",
|
|
7059
|
-
viewBox: "0 0 24 24",
|
|
7060
|
-
fill: "none",
|
|
7061
|
-
stroke: "currentColor",
|
|
7062
|
-
strokeWidth: "2",
|
|
7063
|
-
strokeLinecap: "round",
|
|
7064
|
-
strokeLinejoin: "round",
|
|
7065
|
-
children: [
|
|
7066
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { x: "3", y: "4", width: "7", height: "16", rx: "1" }),
|
|
7067
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("rect", { x: "14", y: "4", width: "7", height: "16", rx: "1" })
|
|
7068
|
-
]
|
|
7069
|
-
}
|
|
7070
|
-
),
|
|
7446
|
+
icon: columnIcon(false),
|
|
7071
7447
|
subtext: "\uBE14\uB85D\uC744 \uC88C\uC6B0 2\uB2E8\uC73C\uB85C \uBC30\uCE58"
|
|
7072
7448
|
};
|
|
7073
|
-
const
|
|
7449
|
+
const columnDividerItem = {
|
|
7450
|
+
title: "2\uB2E8 \uCEEC\uB7FC (\uAD6C\uBD84\uC120)",
|
|
7451
|
+
onItemClick: () => insertTwoColumns(editor, true),
|
|
7452
|
+
aliases: [
|
|
7453
|
+
"columns divider",
|
|
7454
|
+
"\uAD6C\uBD84\uC120",
|
|
7455
|
+
"\uCEEC\uB7FC \uAD6C\uBD84\uC120",
|
|
7456
|
+
"2\uB2E8 \uAD6C\uBD84\uC120",
|
|
7457
|
+
"divider"
|
|
7458
|
+
],
|
|
7459
|
+
group: "Basic blocks",
|
|
7460
|
+
icon: columnIcon(true),
|
|
7461
|
+
subtext: "\uAC00\uC6B4\uB370 \uC138\uB85C \uAD6C\uBD84\uC120\uC774 \uC788\uB294 2\uB2E8 \uCEEC\uB7FC"
|
|
7462
|
+
};
|
|
7463
|
+
const allItems = [
|
|
7464
|
+
...filtered,
|
|
7465
|
+
htmlPreviewItem,
|
|
7466
|
+
columnItem,
|
|
7467
|
+
columnDividerItem
|
|
7468
|
+
];
|
|
7074
7469
|
if (linkPreview?.apiEndpoint) {
|
|
7075
7470
|
allItems.push({
|
|
7076
7471
|
title: "Link Preview",
|
|
7077
7472
|
onItemClick: () => {
|
|
7078
|
-
(0,
|
|
7473
|
+
(0, import_core11.insertOrUpdateBlock)(editor, {
|
|
7079
7474
|
type: "linkPreview",
|
|
7080
7475
|
props: { url: "" }
|
|
7081
7476
|
});
|
|
@@ -7089,7 +7484,7 @@ function LumirEditor({
|
|
|
7089
7484
|
"\uD504\uB9AC\uBDF0"
|
|
7090
7485
|
],
|
|
7091
7486
|
group: "Embeds",
|
|
7092
|
-
icon: /* @__PURE__ */ (0,
|
|
7487
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
7093
7488
|
"svg",
|
|
7094
7489
|
{
|
|
7095
7490
|
width: "18",
|
|
@@ -7101,8 +7496,8 @@ function LumirEditor({
|
|
|
7101
7496
|
strokeLinecap: "round",
|
|
7102
7497
|
strokeLinejoin: "round",
|
|
7103
7498
|
children: [
|
|
7104
|
-
/* @__PURE__ */ (0,
|
|
7105
|
-
/* @__PURE__ */ (0,
|
|
7499
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
|
|
7500
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
|
|
7106
7501
|
]
|
|
7107
7502
|
}
|
|
7108
7503
|
),
|
|
@@ -7138,21 +7533,21 @@ function LumirEditor({
|
|
|
7138
7533
|
)
|
|
7139
7534
|
}
|
|
7140
7535
|
),
|
|
7141
|
-
!sideMenuAddButton && /* @__PURE__ */ (0,
|
|
7536
|
+
!sideMenuAddButton && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react37.SideMenuController, { sideMenu: DragHandleOnlySideMenu })
|
|
7142
7537
|
]
|
|
7143
7538
|
}
|
|
7144
7539
|
),
|
|
7145
|
-
isUploading && /* @__PURE__ */ (0,
|
|
7146
|
-
/* @__PURE__ */ (0,
|
|
7147
|
-
uploadProgress !== null && /* @__PURE__ */ (0,
|
|
7540
|
+
isUploading && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lumirEditor-upload-overlay", children: [
|
|
7541
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "lumirEditor-spinner" }),
|
|
7542
|
+
uploadProgress !== null && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "lumirEditor-upload-progress", children: [
|
|
7148
7543
|
uploadProgress,
|
|
7149
7544
|
"%"
|
|
7150
7545
|
] })
|
|
7151
7546
|
] }),
|
|
7152
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
7153
|
-
/* @__PURE__ */ (0,
|
|
7154
|
-
/* @__PURE__ */ (0,
|
|
7155
|
-
/* @__PURE__ */ (0,
|
|
7547
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "lumirEditor-error-toast", children: [
|
|
7548
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lumirEditor-error-icon", children: "\u26A0\uFE0F" }),
|
|
7549
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "lumirEditor-error-message", children: errorMessage }),
|
|
7550
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
7156
7551
|
"button",
|
|
7157
7552
|
{
|
|
7158
7553
|
className: "lumirEditor-error-close",
|
|
@@ -7171,7 +7566,11 @@ function LumirEditor({
|
|
|
7171
7566
|
BACKGROUND_COLORS,
|
|
7172
7567
|
ContentUtils,
|
|
7173
7568
|
EditorConfig,
|
|
7569
|
+
FONT_SIZE_DEFAULT_PX,
|
|
7570
|
+
FONT_SIZE_MAX,
|
|
7571
|
+
FONT_SIZE_MIN,
|
|
7174
7572
|
FONT_SIZE_PRESETS,
|
|
7573
|
+
FONT_SIZE_STEP,
|
|
7175
7574
|
FloatingMenu,
|
|
7176
7575
|
FontSize,
|
|
7177
7576
|
FontSizeButton,
|
|
@@ -7181,12 +7580,15 @@ function LumirEditor({
|
|
|
7181
7580
|
LumirEditor,
|
|
7182
7581
|
LumirEditorError,
|
|
7183
7582
|
TEXT_COLORS,
|
|
7583
|
+
clampFontSizePx,
|
|
7184
7584
|
clearMetadataCache,
|
|
7185
7585
|
cn,
|
|
7186
7586
|
createS3Uploader,
|
|
7187
7587
|
fetchLinkMetadata,
|
|
7188
7588
|
getHexFromColorValue,
|
|
7189
7589
|
liftFontSize,
|
|
7190
|
-
lowerFontSize
|
|
7590
|
+
lowerFontSize,
|
|
7591
|
+
parseFontSizePx,
|
|
7592
|
+
toFontSizeValue
|
|
7191
7593
|
});
|
|
7192
7594
|
//# sourceMappingURL=index.js.map
|