@lumir-company/editor 0.4.5 → 0.4.7
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 +1299 -1299
- package/dist/index.d.mts +32 -64
- package/dist/index.d.ts +32 -64
- package/dist/index.js +609 -353
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +595 -339
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +977 -977
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/components/LumirEditor.tsx
|
|
4
|
-
import { useEffect as
|
|
4
|
+
import { useEffect as useEffect8, useMemo, useCallback as useCallback14, useState as useState8, useRef as useRef9 } from "react";
|
|
5
5
|
import {
|
|
6
6
|
useCreateBlockNote,
|
|
7
7
|
SideMenu as BlockSideMenu,
|
|
@@ -218,7 +218,7 @@ var createS3Uploader = (config) => {
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
// src/blocks/HtmlPreview.tsx
|
|
221
|
-
import { createReactBlockSpec as
|
|
221
|
+
import { createReactBlockSpec as createReactBlockSpec3 } from "@blocknote/react";
|
|
222
222
|
import {
|
|
223
223
|
defaultBlockSpecs,
|
|
224
224
|
BlockNoteSchema,
|
|
@@ -929,9 +929,264 @@ var LinkPreviewBlock = createReactBlockSpec(
|
|
|
929
929
|
}
|
|
930
930
|
);
|
|
931
931
|
|
|
932
|
+
// src/blocks/VideoBlock.tsx
|
|
933
|
+
import { createReactBlockSpec as createReactBlockSpec2 } from "@blocknote/react";
|
|
934
|
+
import { useState as useState2, useCallback as useCallback2, useRef as useRef2, useEffect as useEffect2 } from "react";
|
|
935
|
+
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
936
|
+
var MIN_VIDEO_WIDTH = 200;
|
|
937
|
+
var MAX_VIDEO_WIDTH = 1200;
|
|
938
|
+
var MIN_VIDEO_HEIGHT = 120;
|
|
939
|
+
var MAX_VIDEO_HEIGHT = 600;
|
|
940
|
+
var DEFAULT_VIDEO_WIDTH = 640;
|
|
941
|
+
var DEFAULT_VIDEO_HEIGHT = 360;
|
|
942
|
+
var VideoBlockCard = ({
|
|
943
|
+
url,
|
|
944
|
+
editable,
|
|
945
|
+
width,
|
|
946
|
+
onWidthChange,
|
|
947
|
+
height,
|
|
948
|
+
onHeightChange,
|
|
949
|
+
onContextMenuBlock
|
|
950
|
+
}) => {
|
|
951
|
+
const [resizeParams, setResizeParams] = useState2(
|
|
952
|
+
void 0
|
|
953
|
+
);
|
|
954
|
+
const [localWidth, setLocalWidth] = useState2(width);
|
|
955
|
+
const [localHeight, setLocalHeight] = useState2(height);
|
|
956
|
+
const wrapperRef = useRef2(null);
|
|
957
|
+
useEffect2(() => {
|
|
958
|
+
setLocalWidth(width);
|
|
959
|
+
}, [width]);
|
|
960
|
+
useEffect2(() => {
|
|
961
|
+
setLocalHeight(height);
|
|
962
|
+
}, [height]);
|
|
963
|
+
useEffect2(() => {
|
|
964
|
+
if (!resizeParams) return;
|
|
965
|
+
const onMouseMove = (e) => {
|
|
966
|
+
if (resizeParams.handleUsed === "bottom") {
|
|
967
|
+
const delta = e.clientY - resizeParams.initialClientY;
|
|
968
|
+
setLocalHeight(
|
|
969
|
+
Math.min(
|
|
970
|
+
Math.max(resizeParams.initialHeight + delta, MIN_VIDEO_HEIGHT),
|
|
971
|
+
MAX_VIDEO_HEIGHT
|
|
972
|
+
)
|
|
973
|
+
);
|
|
974
|
+
} else {
|
|
975
|
+
const delta = resizeParams.handleUsed === "left" ? resizeParams.initialClientX - e.clientX : e.clientX - resizeParams.initialClientX;
|
|
976
|
+
setLocalWidth(
|
|
977
|
+
Math.min(
|
|
978
|
+
Math.max(resizeParams.initialWidth + delta, MIN_VIDEO_WIDTH),
|
|
979
|
+
wrapperRef.current?.parentElement?.clientWidth || MAX_VIDEO_WIDTH
|
|
980
|
+
)
|
|
981
|
+
);
|
|
982
|
+
}
|
|
983
|
+
};
|
|
984
|
+
const onMouseUp = () => {
|
|
985
|
+
const handle = resizeParams.handleUsed;
|
|
986
|
+
setResizeParams(void 0);
|
|
987
|
+
if (handle === "bottom") {
|
|
988
|
+
if (localHeight != null && onHeightChange) onHeightChange(localHeight);
|
|
989
|
+
} else {
|
|
990
|
+
if (localWidth != null && onWidthChange) onWidthChange(localWidth);
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
994
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
995
|
+
return () => {
|
|
996
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
997
|
+
window.removeEventListener("mouseup", onMouseUp);
|
|
998
|
+
};
|
|
999
|
+
}, [resizeParams, localWidth, localHeight, onWidthChange, onHeightChange]);
|
|
1000
|
+
const handleLeftDown = useCallback2(
|
|
1001
|
+
(e) => {
|
|
1002
|
+
e.preventDefault();
|
|
1003
|
+
e.stopPropagation();
|
|
1004
|
+
setResizeParams({
|
|
1005
|
+
handleUsed: "left",
|
|
1006
|
+
initialWidth: wrapperRef.current?.clientWidth ?? DEFAULT_VIDEO_WIDTH,
|
|
1007
|
+
initialHeight: localHeight ?? DEFAULT_VIDEO_HEIGHT,
|
|
1008
|
+
initialClientX: e.clientX,
|
|
1009
|
+
initialClientY: e.clientY
|
|
1010
|
+
});
|
|
1011
|
+
},
|
|
1012
|
+
[localHeight]
|
|
1013
|
+
);
|
|
1014
|
+
const handleRightDown = useCallback2(
|
|
1015
|
+
(e) => {
|
|
1016
|
+
e.preventDefault();
|
|
1017
|
+
e.stopPropagation();
|
|
1018
|
+
setResizeParams({
|
|
1019
|
+
handleUsed: "right",
|
|
1020
|
+
initialWidth: wrapperRef.current?.clientWidth ?? DEFAULT_VIDEO_WIDTH,
|
|
1021
|
+
initialHeight: localHeight ?? DEFAULT_VIDEO_HEIGHT,
|
|
1022
|
+
initialClientX: e.clientX,
|
|
1023
|
+
initialClientY: e.clientY
|
|
1024
|
+
});
|
|
1025
|
+
},
|
|
1026
|
+
[localHeight]
|
|
1027
|
+
);
|
|
1028
|
+
const handleBottomDown = useCallback2(
|
|
1029
|
+
(e) => {
|
|
1030
|
+
e.preventDefault();
|
|
1031
|
+
e.stopPropagation();
|
|
1032
|
+
setResizeParams({
|
|
1033
|
+
handleUsed: "bottom",
|
|
1034
|
+
initialWidth: wrapperRef.current?.clientWidth ?? DEFAULT_VIDEO_WIDTH,
|
|
1035
|
+
initialHeight: localHeight ?? DEFAULT_VIDEO_HEIGHT,
|
|
1036
|
+
initialClientX: e.clientX,
|
|
1037
|
+
initialClientY: e.clientY
|
|
1038
|
+
});
|
|
1039
|
+
},
|
|
1040
|
+
[localHeight]
|
|
1041
|
+
);
|
|
1042
|
+
const resizeCursor = resizeParams ? resizeParams.handleUsed === "bottom" ? "ns-resize" : "ew-resize" : "default";
|
|
1043
|
+
const [hovered, setHovered] = useState2(false);
|
|
1044
|
+
return /* @__PURE__ */ jsxs2(
|
|
1045
|
+
"div",
|
|
1046
|
+
{
|
|
1047
|
+
ref: wrapperRef,
|
|
1048
|
+
className: "lumir-video-block-wrapper",
|
|
1049
|
+
onContextMenu: onContextMenuBlock,
|
|
1050
|
+
style: {
|
|
1051
|
+
position: "relative",
|
|
1052
|
+
width: localWidth != null ? `${localWidth}px` : void 0,
|
|
1053
|
+
maxWidth: "100%",
|
|
1054
|
+
cursor: resizeCursor,
|
|
1055
|
+
transition: resizeParams ? "none" : "box-shadow 0.2s"
|
|
1056
|
+
},
|
|
1057
|
+
onMouseEnter: () => {
|
|
1058
|
+
if (!resizeParams) setHovered(true);
|
|
1059
|
+
},
|
|
1060
|
+
onMouseLeave: () => {
|
|
1061
|
+
if (!resizeParams) setHovered(false);
|
|
1062
|
+
},
|
|
1063
|
+
children: [
|
|
1064
|
+
editable && (hovered || resizeParams) && /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
1065
|
+
/* @__PURE__ */ jsx2(
|
|
1066
|
+
"div",
|
|
1067
|
+
{
|
|
1068
|
+
className: "lumir-resize-handle",
|
|
1069
|
+
style: { left: "4px" },
|
|
1070
|
+
onMouseDown: handleLeftDown
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
/* @__PURE__ */ jsx2(
|
|
1074
|
+
"div",
|
|
1075
|
+
{
|
|
1076
|
+
className: "lumir-resize-handle",
|
|
1077
|
+
style: { right: "4px" },
|
|
1078
|
+
onMouseDown: handleRightDown
|
|
1079
|
+
}
|
|
1080
|
+
)
|
|
1081
|
+
] }),
|
|
1082
|
+
/* @__PURE__ */ jsxs2(
|
|
1083
|
+
"div",
|
|
1084
|
+
{
|
|
1085
|
+
style: {
|
|
1086
|
+
width: "100%",
|
|
1087
|
+
height: `${localHeight ?? DEFAULT_VIDEO_HEIGHT}px`,
|
|
1088
|
+
overflow: "hidden",
|
|
1089
|
+
backgroundColor: "#000",
|
|
1090
|
+
borderRadius: "6px"
|
|
1091
|
+
},
|
|
1092
|
+
children: [
|
|
1093
|
+
/* @__PURE__ */ jsx2(
|
|
1094
|
+
"video",
|
|
1095
|
+
{
|
|
1096
|
+
src: url,
|
|
1097
|
+
controls: true,
|
|
1098
|
+
controlsList: "nodownload",
|
|
1099
|
+
playsInline: true,
|
|
1100
|
+
style: {
|
|
1101
|
+
width: "100%",
|
|
1102
|
+
height: "100%",
|
|
1103
|
+
objectFit: "contain",
|
|
1104
|
+
display: "block"
|
|
1105
|
+
},
|
|
1106
|
+
onContextMenu: (e) => e.preventDefault()
|
|
1107
|
+
}
|
|
1108
|
+
),
|
|
1109
|
+
editable && (hovered || resizeParams) && /* @__PURE__ */ jsx2(
|
|
1110
|
+
"div",
|
|
1111
|
+
{
|
|
1112
|
+
className: "lumir-resize-handle-bottom",
|
|
1113
|
+
onMouseDown: handleBottomDown
|
|
1114
|
+
}
|
|
1115
|
+
)
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
)
|
|
1119
|
+
]
|
|
1120
|
+
}
|
|
1121
|
+
);
|
|
1122
|
+
};
|
|
1123
|
+
var VideoBlock = createReactBlockSpec2(
|
|
1124
|
+
{
|
|
1125
|
+
type: "video",
|
|
1126
|
+
propSchema: {
|
|
1127
|
+
url: { default: "" },
|
|
1128
|
+
previewWidth: { default: 640 },
|
|
1129
|
+
previewHeight: { default: 360 }
|
|
1130
|
+
},
|
|
1131
|
+
content: "none"
|
|
1132
|
+
},
|
|
1133
|
+
{
|
|
1134
|
+
render: (props) => {
|
|
1135
|
+
const url = props.block.props.url ?? "";
|
|
1136
|
+
const editable = props.editor.isEditable;
|
|
1137
|
+
const handleContextMenu = useCallback2((e) => {
|
|
1138
|
+
e.preventDefault();
|
|
1139
|
+
e.stopPropagation();
|
|
1140
|
+
}, []);
|
|
1141
|
+
if (!url) {
|
|
1142
|
+
return /* @__PURE__ */ jsx2(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
className: "lumir-video-block-placeholder",
|
|
1146
|
+
onContextMenu: handleContextMenu,
|
|
1147
|
+
style: {
|
|
1148
|
+
width: "100%",
|
|
1149
|
+
maxWidth: `${DEFAULT_VIDEO_WIDTH}px`,
|
|
1150
|
+
height: `${DEFAULT_VIDEO_HEIGHT}px`,
|
|
1151
|
+
backgroundColor: "#1a1a1a",
|
|
1152
|
+
borderRadius: "6px",
|
|
1153
|
+
display: "flex",
|
|
1154
|
+
alignItems: "center",
|
|
1155
|
+
justifyContent: "center",
|
|
1156
|
+
color: "rgba(255,255,255,0.5)",
|
|
1157
|
+
fontSize: "14px"
|
|
1158
|
+
},
|
|
1159
|
+
children: "\uBE44\uB514\uC624 URL \uC5C6\uC74C"
|
|
1160
|
+
}
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
return /* @__PURE__ */ jsx2(
|
|
1164
|
+
VideoBlockCard,
|
|
1165
|
+
{
|
|
1166
|
+
url,
|
|
1167
|
+
editable,
|
|
1168
|
+
width: props.block.props.previewWidth,
|
|
1169
|
+
onWidthChange: (newWidth) => {
|
|
1170
|
+
props.editor.updateBlock(props.block, {
|
|
1171
|
+
props: { previewWidth: newWidth }
|
|
1172
|
+
});
|
|
1173
|
+
},
|
|
1174
|
+
height: props.block.props.previewHeight,
|
|
1175
|
+
onHeightChange: (newHeight) => {
|
|
1176
|
+
props.editor.updateBlock(props.block, {
|
|
1177
|
+
props: { previewHeight: newHeight }
|
|
1178
|
+
});
|
|
1179
|
+
},
|
|
1180
|
+
onContextMenuBlock: handleContextMenu
|
|
1181
|
+
}
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
);
|
|
1186
|
+
|
|
932
1187
|
// src/blocks/HtmlPreview.tsx
|
|
933
|
-
import { useState as
|
|
934
|
-
import { jsx as
|
|
1188
|
+
import { useState as useState3, useRef as useRef3, useCallback as useCallback3, useEffect as useEffect3 } from "react";
|
|
1189
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
935
1190
|
var MIN_HEIGHT = 100;
|
|
936
1191
|
var MAX_HEIGHT = 1200;
|
|
937
1192
|
var ensureCharset = (html) => {
|
|
@@ -969,7 +1224,7 @@ var createSecureBlobUrl = (htmlContent) => {
|
|
|
969
1224
|
});
|
|
970
1225
|
return URL.createObjectURL(blob);
|
|
971
1226
|
};
|
|
972
|
-
var HtmlPreviewBlock =
|
|
1227
|
+
var HtmlPreviewBlock = createReactBlockSpec3(
|
|
973
1228
|
{
|
|
974
1229
|
type: "htmlPreview",
|
|
975
1230
|
propSchema: {
|
|
@@ -987,15 +1242,15 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
987
1242
|
},
|
|
988
1243
|
{
|
|
989
1244
|
render: (props) => {
|
|
990
|
-
const [isExpanded, setIsExpanded] =
|
|
991
|
-
const [isResizing, setIsResizing] =
|
|
992
|
-
const [blobUrl, setBlobUrl] =
|
|
993
|
-
const containerRef =
|
|
1245
|
+
const [isExpanded, setIsExpanded] = useState3(true);
|
|
1246
|
+
const [isResizing, setIsResizing] = useState3(false);
|
|
1247
|
+
const [blobUrl, setBlobUrl] = useState3("");
|
|
1248
|
+
const containerRef = useRef3(null);
|
|
994
1249
|
const htmlContent = props.block.props.htmlContent || "";
|
|
995
1250
|
const fileName = props.block.props.fileName || "HTML Document";
|
|
996
1251
|
const savedHeight = props.block.props.height || "400px";
|
|
997
1252
|
const currentHeight = parseInt(savedHeight, 10) || 400;
|
|
998
|
-
|
|
1253
|
+
useEffect3(() => {
|
|
999
1254
|
if (htmlContent) {
|
|
1000
1255
|
const url = createSecureBlobUrl(htmlContent);
|
|
1001
1256
|
setBlobUrl(url);
|
|
@@ -1004,7 +1259,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1004
1259
|
};
|
|
1005
1260
|
}
|
|
1006
1261
|
}, [htmlContent]);
|
|
1007
|
-
const handleResizeStart =
|
|
1262
|
+
const handleResizeStart = useCallback3(
|
|
1008
1263
|
(e) => {
|
|
1009
1264
|
e.preventDefault();
|
|
1010
1265
|
e.stopPropagation();
|
|
@@ -1031,7 +1286,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1031
1286
|
},
|
|
1032
1287
|
[currentHeight, props.editor, props.block]
|
|
1033
1288
|
);
|
|
1034
|
-
const handleExport =
|
|
1289
|
+
const handleExport = useCallback3(
|
|
1035
1290
|
(e) => {
|
|
1036
1291
|
e.stopPropagation();
|
|
1037
1292
|
const safeFileName = sanitizeFileName(fileName);
|
|
@@ -1052,7 +1307,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1052
1307
|
},
|
|
1053
1308
|
[htmlContent, fileName]
|
|
1054
1309
|
);
|
|
1055
|
-
const handleOpenNewWindow =
|
|
1310
|
+
const handleOpenNewWindow = useCallback3(
|
|
1056
1311
|
(e) => {
|
|
1057
1312
|
e.stopPropagation();
|
|
1058
1313
|
if (typeof window === "undefined") return;
|
|
@@ -1066,7 +1321,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1066
1321
|
},
|
|
1067
1322
|
[htmlContent]
|
|
1068
1323
|
);
|
|
1069
|
-
return /* @__PURE__ */
|
|
1324
|
+
return /* @__PURE__ */ jsxs3(
|
|
1070
1325
|
"div",
|
|
1071
1326
|
{
|
|
1072
1327
|
ref: containerRef,
|
|
@@ -1082,7 +1337,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1082
1337
|
boxShadow: "none"
|
|
1083
1338
|
},
|
|
1084
1339
|
children: [
|
|
1085
|
-
/* @__PURE__ */
|
|
1340
|
+
/* @__PURE__ */ jsxs3(
|
|
1086
1341
|
"div",
|
|
1087
1342
|
{
|
|
1088
1343
|
style: {
|
|
@@ -1094,7 +1349,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1094
1349
|
borderBottom: isExpanded ? "1px solid #e0e0e0" : "none"
|
|
1095
1350
|
},
|
|
1096
1351
|
children: [
|
|
1097
|
-
/* @__PURE__ */
|
|
1352
|
+
/* @__PURE__ */ jsxs3(
|
|
1098
1353
|
"div",
|
|
1099
1354
|
{
|
|
1100
1355
|
style: {
|
|
@@ -1106,7 +1361,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1106
1361
|
},
|
|
1107
1362
|
onClick: () => setIsExpanded(!isExpanded),
|
|
1108
1363
|
children: [
|
|
1109
|
-
/* @__PURE__ */
|
|
1364
|
+
/* @__PURE__ */ jsx3(
|
|
1110
1365
|
"svg",
|
|
1111
1366
|
{
|
|
1112
1367
|
width: "16",
|
|
@@ -1121,15 +1376,15 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1121
1376
|
transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
1122
1377
|
transition: "transform 0.2s"
|
|
1123
1378
|
},
|
|
1124
|
-
children: /* @__PURE__ */
|
|
1379
|
+
children: /* @__PURE__ */ jsx3("polyline", { points: "6 9 12 15 18 9" })
|
|
1125
1380
|
}
|
|
1126
1381
|
),
|
|
1127
|
-
/* @__PURE__ */
|
|
1382
|
+
/* @__PURE__ */ jsx3("span", { style: { fontWeight: 500, fontSize: "14px" }, children: fileName })
|
|
1128
1383
|
]
|
|
1129
1384
|
}
|
|
1130
1385
|
),
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
/* @__PURE__ */
|
|
1386
|
+
/* @__PURE__ */ jsxs3("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1387
|
+
/* @__PURE__ */ jsx3(
|
|
1133
1388
|
"button",
|
|
1134
1389
|
{
|
|
1135
1390
|
onClick: handleOpenNewWindow,
|
|
@@ -1152,7 +1407,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1152
1407
|
onMouseLeave: (e) => {
|
|
1153
1408
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1154
1409
|
},
|
|
1155
|
-
children: /* @__PURE__ */
|
|
1410
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1156
1411
|
"svg",
|
|
1157
1412
|
{
|
|
1158
1413
|
width: "16",
|
|
@@ -1164,15 +1419,15 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1164
1419
|
strokeLinecap: "round",
|
|
1165
1420
|
strokeLinejoin: "round",
|
|
1166
1421
|
children: [
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1422
|
+
/* @__PURE__ */ jsx3("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
1423
|
+
/* @__PURE__ */ jsx3("polyline", { points: "15 3 21 3 21 9" }),
|
|
1424
|
+
/* @__PURE__ */ jsx3("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1170
1425
|
]
|
|
1171
1426
|
}
|
|
1172
1427
|
)
|
|
1173
1428
|
}
|
|
1174
1429
|
),
|
|
1175
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ jsx3(
|
|
1176
1431
|
"button",
|
|
1177
1432
|
{
|
|
1178
1433
|
onClick: handleExport,
|
|
@@ -1195,7 +1450,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1195
1450
|
onMouseLeave: (e) => {
|
|
1196
1451
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1197
1452
|
},
|
|
1198
|
-
children: /* @__PURE__ */
|
|
1453
|
+
children: /* @__PURE__ */ jsxs3(
|
|
1199
1454
|
"svg",
|
|
1200
1455
|
{
|
|
1201
1456
|
width: "16",
|
|
@@ -1207,9 +1462,9 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1207
1462
|
strokeLinecap: "round",
|
|
1208
1463
|
strokeLinejoin: "round",
|
|
1209
1464
|
children: [
|
|
1210
|
-
/* @__PURE__ */
|
|
1211
|
-
/* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1465
|
+
/* @__PURE__ */ jsx3("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1466
|
+
/* @__PURE__ */ jsx3("polyline", { points: "7 10 12 15 17 10" }),
|
|
1467
|
+
/* @__PURE__ */ jsx3("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
1213
1468
|
]
|
|
1214
1469
|
}
|
|
1215
1470
|
)
|
|
@@ -1219,7 +1474,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1219
1474
|
]
|
|
1220
1475
|
}
|
|
1221
1476
|
),
|
|
1222
|
-
isExpanded && /* @__PURE__ */
|
|
1477
|
+
isExpanded && /* @__PURE__ */ jsxs3(
|
|
1223
1478
|
"div",
|
|
1224
1479
|
{
|
|
1225
1480
|
style: {
|
|
@@ -1228,7 +1483,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1228
1483
|
position: "relative"
|
|
1229
1484
|
},
|
|
1230
1485
|
children: [
|
|
1231
|
-
/* @__PURE__ */
|
|
1486
|
+
/* @__PURE__ */ jsx3(
|
|
1232
1487
|
"iframe",
|
|
1233
1488
|
{
|
|
1234
1489
|
src: blobUrl || "about:blank",
|
|
@@ -1245,7 +1500,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1245
1500
|
loading: "lazy"
|
|
1246
1501
|
}
|
|
1247
1502
|
),
|
|
1248
|
-
/* @__PURE__ */
|
|
1503
|
+
/* @__PURE__ */ jsx3(
|
|
1249
1504
|
"div",
|
|
1250
1505
|
{
|
|
1251
1506
|
onMouseDown: handleResizeStart,
|
|
@@ -1270,7 +1525,7 @@ var HtmlPreviewBlock = createReactBlockSpec2(
|
|
|
1270
1525
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1271
1526
|
}
|
|
1272
1527
|
},
|
|
1273
|
-
children: /* @__PURE__ */
|
|
1528
|
+
children: /* @__PURE__ */ jsx3(
|
|
1274
1529
|
"div",
|
|
1275
1530
|
{
|
|
1276
1531
|
style: {
|
|
@@ -1296,67 +1551,68 @@ var schema = BlockNoteSchema.create({
|
|
|
1296
1551
|
blockSpecs: {
|
|
1297
1552
|
...defaultBlockSpecs,
|
|
1298
1553
|
htmlPreview: HtmlPreviewBlock,
|
|
1299
|
-
linkPreview: LinkPreviewBlock
|
|
1554
|
+
linkPreview: LinkPreviewBlock,
|
|
1555
|
+
video: VideoBlock
|
|
1300
1556
|
},
|
|
1301
1557
|
inlineContentSpecs: defaultInlineContentSpecs,
|
|
1302
1558
|
styleSpecs: defaultStyleSpecs
|
|
1303
1559
|
});
|
|
1304
1560
|
|
|
1305
1561
|
// src/components/FloatingMenu/index.tsx
|
|
1306
|
-
import { useState as
|
|
1562
|
+
import { useState as useState7, useEffect as useEffect7, useRef as useRef8 } from "react";
|
|
1307
1563
|
|
|
1308
1564
|
// src/components/FloatingMenu/Icons.tsx
|
|
1309
|
-
import { jsx as
|
|
1565
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1310
1566
|
var Icons = {
|
|
1311
|
-
undo: /* @__PURE__ */
|
|
1312
|
-
redo: /* @__PURE__ */
|
|
1313
|
-
bold: /* @__PURE__ */
|
|
1314
|
-
italic: /* @__PURE__ */
|
|
1315
|
-
underline: /* @__PURE__ */
|
|
1316
|
-
strikethrough: /* @__PURE__ */
|
|
1317
|
-
alignLeft: /* @__PURE__ */
|
|
1318
|
-
alignCenter: /* @__PURE__ */
|
|
1319
|
-
alignRight: /* @__PURE__ */
|
|
1320
|
-
bulletList: /* @__PURE__ */
|
|
1321
|
-
numberedList: /* @__PURE__ */
|
|
1322
|
-
image: /* @__PURE__ */
|
|
1323
|
-
expandMore: /* @__PURE__ */
|
|
1324
|
-
textColor: /* @__PURE__ */
|
|
1325
|
-
bgColor: /* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1567
|
+
undo: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1568
|
+
redo: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1569
|
+
bold: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1570
|
+
italic: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z" }) }),
|
|
1571
|
+
underline: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1572
|
+
strikethrough: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z" }) }),
|
|
1573
|
+
alignLeft: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z" }) }),
|
|
1574
|
+
alignCenter: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z" }) }),
|
|
1575
|
+
alignRight: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z" }) }),
|
|
1576
|
+
bulletList: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1577
|
+
numberedList: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" }) }),
|
|
1578
|
+
image: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1579
|
+
expandMore: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "18", height: "18", children: /* @__PURE__ */ jsx4("path", { d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" }) }),
|
|
1580
|
+
textColor: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z" }) }),
|
|
1581
|
+
bgColor: /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1582
|
+
/* @__PURE__ */ jsx4("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" }),
|
|
1583
|
+
/* @__PURE__ */ jsx4("path", { fillOpacity: ".36", d: "M0 20h24v4H0z" })
|
|
1328
1584
|
] }),
|
|
1329
|
-
link: /* @__PURE__ */
|
|
1330
|
-
chevronRight: /* @__PURE__ */
|
|
1331
|
-
chevronLeft: /* @__PURE__ */
|
|
1332
|
-
table: /* @__PURE__ */
|
|
1333
|
-
htmlFile: /* @__PURE__ */
|
|
1585
|
+
link: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1586
|
+
chevronRight: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) }),
|
|
1587
|
+
chevronLeft: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) }),
|
|
1588
|
+
table: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1589
|
+
htmlFile: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) })
|
|
1334
1590
|
};
|
|
1335
1591
|
var BlockTypeIcons = {
|
|
1336
|
-
paragraph: /* @__PURE__ */
|
|
1337
|
-
h1: /* @__PURE__ */
|
|
1338
|
-
h2: /* @__PURE__ */
|
|
1339
|
-
h3: /* @__PURE__ */
|
|
1340
|
-
h4: /* @__PURE__ */
|
|
1341
|
-
h5: /* @__PURE__ */
|
|
1342
|
-
h6: /* @__PURE__ */
|
|
1343
|
-
toggleH1: /* @__PURE__ */
|
|
1344
|
-
/* @__PURE__ */
|
|
1345
|
-
/* @__PURE__ */
|
|
1592
|
+
paragraph: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M5 5h14v2H5zM5 11h14v2H5zM5 17h10v2H5z" }) }),
|
|
1593
|
+
h1: /* @__PURE__ */ jsx4("span", { className: "lumir-block-icon-text", children: "H1" }),
|
|
1594
|
+
h2: /* @__PURE__ */ jsx4("span", { className: "lumir-block-icon-text", children: "H2" }),
|
|
1595
|
+
h3: /* @__PURE__ */ jsx4("span", { className: "lumir-block-icon-text", children: "H3" }),
|
|
1596
|
+
h4: /* @__PURE__ */ jsx4("span", { className: "lumir-block-icon-text", children: "H4" }),
|
|
1597
|
+
h5: /* @__PURE__ */ jsx4("span", { className: "lumir-block-icon-text", children: "H5" }),
|
|
1598
|
+
h6: /* @__PURE__ */ jsx4("span", { className: "lumir-block-icon-text", children: "H6" }),
|
|
1599
|
+
toggleH1: /* @__PURE__ */ jsxs4("span", { className: "lumir-block-icon-toggle", children: [
|
|
1600
|
+
/* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", children: /* @__PURE__ */ jsx4("path", { d: "M8 5v14l11-7z" }) }),
|
|
1601
|
+
/* @__PURE__ */ jsx4("span", { children: "H1" })
|
|
1346
1602
|
] }),
|
|
1347
|
-
toggleH2: /* @__PURE__ */
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
/* @__PURE__ */
|
|
1603
|
+
toggleH2: /* @__PURE__ */ jsxs4("span", { className: "lumir-block-icon-toggle", children: [
|
|
1604
|
+
/* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", children: /* @__PURE__ */ jsx4("path", { d: "M8 5v14l11-7z" }) }),
|
|
1605
|
+
/* @__PURE__ */ jsx4("span", { children: "H2" })
|
|
1350
1606
|
] }),
|
|
1351
|
-
toggleH3: /* @__PURE__ */
|
|
1352
|
-
/* @__PURE__ */
|
|
1353
|
-
/* @__PURE__ */
|
|
1607
|
+
toggleH3: /* @__PURE__ */ jsxs4("span", { className: "lumir-block-icon-toggle", children: [
|
|
1608
|
+
/* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "8", height: "8", children: /* @__PURE__ */ jsx4("path", { d: "M8 5v14l11-7z" }) }),
|
|
1609
|
+
/* @__PURE__ */ jsx4("span", { children: "H3" })
|
|
1354
1610
|
] }),
|
|
1355
|
-
quote: /* @__PURE__ */
|
|
1356
|
-
codeBlock: /* @__PURE__ */
|
|
1357
|
-
toggleList: /* @__PURE__ */
|
|
1358
|
-
/* @__PURE__ */
|
|
1359
|
-
/* @__PURE__ */
|
|
1611
|
+
quote: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z" }) }),
|
|
1612
|
+
codeBlock: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("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" }) }),
|
|
1613
|
+
toggleList: /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1614
|
+
/* @__PURE__ */ jsx4("path", { d: "M10 6h10v2H10zM10 11h10v2H10zM10 16h10v2H10z" }),
|
|
1615
|
+
/* @__PURE__ */ jsx4(
|
|
1360
1616
|
"path",
|
|
1361
1617
|
{
|
|
1362
1618
|
d: "M4 8l4 4-4 4",
|
|
@@ -1368,15 +1624,15 @@ var BlockTypeIcons = {
|
|
|
1368
1624
|
}
|
|
1369
1625
|
)
|
|
1370
1626
|
] }),
|
|
1371
|
-
bulletList: /* @__PURE__ */
|
|
1372
|
-
/* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1627
|
+
bulletList: /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1628
|
+
/* @__PURE__ */ jsx4("circle", { cx: "4", cy: "6", r: "1.5" }),
|
|
1629
|
+
/* @__PURE__ */ jsx4("circle", { cx: "4", cy: "12", r: "1.5" }),
|
|
1630
|
+
/* @__PURE__ */ jsx4("circle", { cx: "4", cy: "18", r: "1.5" }),
|
|
1631
|
+
/* @__PURE__ */ jsx4("path", { d: "M8 5h12v2H8zM8 11h12v2H8zM8 17h12v2H8z" })
|
|
1376
1632
|
] }),
|
|
1377
|
-
numberedList: /* @__PURE__ */
|
|
1378
|
-
checkList: /* @__PURE__ */
|
|
1379
|
-
/* @__PURE__ */
|
|
1633
|
+
numberedList: /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: /* @__PURE__ */ jsx4("path", { d: "M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z" }) }),
|
|
1634
|
+
checkList: /* @__PURE__ */ jsxs4("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1635
|
+
/* @__PURE__ */ jsx4(
|
|
1380
1636
|
"rect",
|
|
1381
1637
|
{
|
|
1382
1638
|
x: "3",
|
|
@@ -1389,7 +1645,7 @@ var BlockTypeIcons = {
|
|
|
1389
1645
|
strokeWidth: "1.5"
|
|
1390
1646
|
}
|
|
1391
1647
|
),
|
|
1392
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ jsx4(
|
|
1393
1649
|
"path",
|
|
1394
1650
|
{
|
|
1395
1651
|
d: "M4.5 7l1.5 1.5 3-3",
|
|
@@ -1400,8 +1656,8 @@ var BlockTypeIcons = {
|
|
|
1400
1656
|
strokeLinejoin: "round"
|
|
1401
1657
|
}
|
|
1402
1658
|
),
|
|
1403
|
-
/* @__PURE__ */
|
|
1404
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 6h8v2h-8z" }),
|
|
1660
|
+
/* @__PURE__ */ jsx4(
|
|
1405
1661
|
"rect",
|
|
1406
1662
|
{
|
|
1407
1663
|
x: "3",
|
|
@@ -1414,37 +1670,37 @@ var BlockTypeIcons = {
|
|
|
1414
1670
|
strokeWidth: "1.5"
|
|
1415
1671
|
}
|
|
1416
1672
|
),
|
|
1417
|
-
/* @__PURE__ */
|
|
1673
|
+
/* @__PURE__ */ jsx4("path", { d: "M12 16h8v2h-8z" })
|
|
1418
1674
|
] })
|
|
1419
1675
|
};
|
|
1420
1676
|
|
|
1421
1677
|
// src/components/FloatingMenu/components/ToolbarDivider.tsx
|
|
1422
|
-
import { jsx as
|
|
1423
|
-
var ToolbarDivider = () => /* @__PURE__ */
|
|
1678
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1679
|
+
var ToolbarDivider = () => /* @__PURE__ */ jsx5("div", { className: "lumir-toolbar-divider" });
|
|
1424
1680
|
|
|
1425
1681
|
// src/components/FloatingMenu/components/UndoRedoButtons.tsx
|
|
1426
|
-
import { useCallback as
|
|
1427
|
-
import { jsx as
|
|
1682
|
+
import { useCallback as useCallback4 } from "react";
|
|
1683
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1428
1684
|
var UndoRedoButtons = ({ editor }) => {
|
|
1429
|
-
const handleUndo =
|
|
1685
|
+
const handleUndo = useCallback4(() => {
|
|
1430
1686
|
try {
|
|
1431
1687
|
editor?.undo?.();
|
|
1432
1688
|
} catch (err) {
|
|
1433
1689
|
console.error("Undo failed:", err);
|
|
1434
1690
|
}
|
|
1435
1691
|
}, [editor]);
|
|
1436
|
-
const handleRedo =
|
|
1692
|
+
const handleRedo = useCallback4(() => {
|
|
1437
1693
|
try {
|
|
1438
1694
|
editor?.redo?.();
|
|
1439
1695
|
} catch (err) {
|
|
1440
1696
|
console.error("Redo failed:", err);
|
|
1441
1697
|
}
|
|
1442
1698
|
}, [editor]);
|
|
1443
|
-
const handleMouseDown =
|
|
1699
|
+
const handleMouseDown = useCallback4((e) => {
|
|
1444
1700
|
e.preventDefault();
|
|
1445
1701
|
}, []);
|
|
1446
|
-
return /* @__PURE__ */
|
|
1447
|
-
/* @__PURE__ */
|
|
1702
|
+
return /* @__PURE__ */ jsxs5("div", { className: "lumir-toolbar-group", children: [
|
|
1703
|
+
/* @__PURE__ */ jsx6(
|
|
1448
1704
|
"button",
|
|
1449
1705
|
{
|
|
1450
1706
|
className: "lumir-toolbar-btn",
|
|
@@ -1455,7 +1711,7 @@ var UndoRedoButtons = ({ editor }) => {
|
|
|
1455
1711
|
children: Icons.undo
|
|
1456
1712
|
}
|
|
1457
1713
|
),
|
|
1458
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ jsx6(
|
|
1459
1715
|
"button",
|
|
1460
1716
|
{
|
|
1461
1717
|
className: "lumir-toolbar-btn",
|
|
@@ -1470,8 +1726,8 @@ var UndoRedoButtons = ({ editor }) => {
|
|
|
1470
1726
|
};
|
|
1471
1727
|
|
|
1472
1728
|
// src/components/FloatingMenu/components/TextStyleButton.tsx
|
|
1473
|
-
import { useCallback as
|
|
1474
|
-
import { jsx as
|
|
1729
|
+
import { useCallback as useCallback5 } from "react";
|
|
1730
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1475
1731
|
var iconMap = {
|
|
1476
1732
|
bold: Icons.bold,
|
|
1477
1733
|
italic: Icons.italic,
|
|
@@ -1497,17 +1753,17 @@ var TextStyleButton = ({
|
|
|
1497
1753
|
}
|
|
1498
1754
|
};
|
|
1499
1755
|
const isActive = getIsActive();
|
|
1500
|
-
const handleClick =
|
|
1756
|
+
const handleClick = useCallback5(() => {
|
|
1501
1757
|
try {
|
|
1502
1758
|
editor?.toggleStyles?.({ [style]: true });
|
|
1503
1759
|
} catch (err) {
|
|
1504
1760
|
console.error(`Toggle ${style} failed:`, err);
|
|
1505
1761
|
}
|
|
1506
1762
|
}, [editor, style]);
|
|
1507
|
-
const handleMouseDown =
|
|
1763
|
+
const handleMouseDown = useCallback5((e) => {
|
|
1508
1764
|
e.preventDefault();
|
|
1509
1765
|
}, []);
|
|
1510
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ jsx7(
|
|
1511
1767
|
"button",
|
|
1512
1768
|
{
|
|
1513
1769
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -1521,8 +1777,8 @@ var TextStyleButton = ({
|
|
|
1521
1777
|
};
|
|
1522
1778
|
|
|
1523
1779
|
// src/components/FloatingMenu/components/AlignButton.tsx
|
|
1524
|
-
import { useCallback as
|
|
1525
|
-
import { jsx as
|
|
1780
|
+
import { useCallback as useCallback6 } from "react";
|
|
1781
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1526
1782
|
var iconMap2 = {
|
|
1527
1783
|
left: Icons.alignLeft,
|
|
1528
1784
|
center: Icons.alignCenter,
|
|
@@ -1546,7 +1802,7 @@ var AlignButton = ({
|
|
|
1546
1802
|
}
|
|
1547
1803
|
};
|
|
1548
1804
|
const isActive = getCurrentAlignment() === alignment;
|
|
1549
|
-
const handleClick =
|
|
1805
|
+
const handleClick = useCallback6(() => {
|
|
1550
1806
|
try {
|
|
1551
1807
|
const block = editor?.getTextCursorPosition()?.block;
|
|
1552
1808
|
if (block && editor?.updateBlock) {
|
|
@@ -1556,10 +1812,10 @@ var AlignButton = ({
|
|
|
1556
1812
|
console.error(`Set alignment ${alignment} failed:`, err);
|
|
1557
1813
|
}
|
|
1558
1814
|
}, [editor, alignment]);
|
|
1559
|
-
const handleMouseDown =
|
|
1815
|
+
const handleMouseDown = useCallback6((e) => {
|
|
1560
1816
|
e.preventDefault();
|
|
1561
1817
|
}, []);
|
|
1562
|
-
return /* @__PURE__ */
|
|
1818
|
+
return /* @__PURE__ */ jsx8(
|
|
1563
1819
|
"button",
|
|
1564
1820
|
{
|
|
1565
1821
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -1573,8 +1829,8 @@ var AlignButton = ({
|
|
|
1573
1829
|
};
|
|
1574
1830
|
|
|
1575
1831
|
// src/components/FloatingMenu/components/ListButton.tsx
|
|
1576
|
-
import { useCallback as
|
|
1577
|
-
import { jsx as
|
|
1832
|
+
import { useCallback as useCallback7 } from "react";
|
|
1833
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1578
1834
|
var iconMap3 = {
|
|
1579
1835
|
bullet: Icons.bulletList,
|
|
1580
1836
|
numbered: Icons.numberedList
|
|
@@ -1594,7 +1850,7 @@ var ListButton = ({ editor, type }) => {
|
|
|
1594
1850
|
}
|
|
1595
1851
|
};
|
|
1596
1852
|
const isActive = getIsActive();
|
|
1597
|
-
const handleClick =
|
|
1853
|
+
const handleClick = useCallback7(() => {
|
|
1598
1854
|
try {
|
|
1599
1855
|
const block = editor?.getTextCursorPosition()?.block;
|
|
1600
1856
|
if (block && editor?.updateBlock) {
|
|
@@ -1606,10 +1862,10 @@ var ListButton = ({ editor, type }) => {
|
|
|
1606
1862
|
console.error(`List toggle failed:`, err);
|
|
1607
1863
|
}
|
|
1608
1864
|
}, [editor, type]);
|
|
1609
|
-
const handleMouseDown =
|
|
1865
|
+
const handleMouseDown = useCallback7((e) => {
|
|
1610
1866
|
e.preventDefault();
|
|
1611
1867
|
}, []);
|
|
1612
|
-
return /* @__PURE__ */
|
|
1868
|
+
return /* @__PURE__ */ jsx9(
|
|
1613
1869
|
"button",
|
|
1614
1870
|
{
|
|
1615
1871
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -1623,13 +1879,13 @@ var ListButton = ({ editor, type }) => {
|
|
|
1623
1879
|
};
|
|
1624
1880
|
|
|
1625
1881
|
// src/components/FloatingMenu/components/ImageButton.tsx
|
|
1626
|
-
import { useCallback as
|
|
1627
|
-
import { jsx as
|
|
1882
|
+
import { useCallback as useCallback8 } from "react";
|
|
1883
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
1628
1884
|
var ImageButton = ({
|
|
1629
1885
|
editor,
|
|
1630
1886
|
onImageUpload
|
|
1631
1887
|
}) => {
|
|
1632
|
-
const handleClick =
|
|
1888
|
+
const handleClick = useCallback8(() => {
|
|
1633
1889
|
if (onImageUpload) {
|
|
1634
1890
|
onImageUpload();
|
|
1635
1891
|
} else {
|
|
@@ -1654,10 +1910,10 @@ var ImageButton = ({
|
|
|
1654
1910
|
input.click();
|
|
1655
1911
|
}
|
|
1656
1912
|
}, [editor, onImageUpload]);
|
|
1657
|
-
const handleMouseDown =
|
|
1913
|
+
const handleMouseDown = useCallback8((e) => {
|
|
1658
1914
|
e.preventDefault();
|
|
1659
1915
|
}, []);
|
|
1660
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsx10(
|
|
1661
1917
|
"button",
|
|
1662
1918
|
{
|
|
1663
1919
|
className: "lumir-toolbar-btn",
|
|
@@ -1671,7 +1927,7 @@ var ImageButton = ({
|
|
|
1671
1927
|
};
|
|
1672
1928
|
|
|
1673
1929
|
// src/components/FloatingMenu/components/ColorButton.tsx
|
|
1674
|
-
import { useState as
|
|
1930
|
+
import { useState as useState4, useEffect as useEffect4, useRef as useRef4, useCallback as useCallback9 } from "react";
|
|
1675
1931
|
|
|
1676
1932
|
// src/constants/colors.ts
|
|
1677
1933
|
var TEXT_COLORS = [
|
|
@@ -1705,13 +1961,13 @@ var getHexFromColorValue = (value, type) => {
|
|
|
1705
1961
|
};
|
|
1706
1962
|
|
|
1707
1963
|
// src/components/FloatingMenu/components/ColorButton.tsx
|
|
1708
|
-
import { jsx as
|
|
1964
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1709
1965
|
var ColorButton = ({ editor, type }) => {
|
|
1710
|
-
const [isOpen, setIsOpen] =
|
|
1711
|
-
const [currentColor, setCurrentColor] =
|
|
1712
|
-
const dropdownRef =
|
|
1966
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
1967
|
+
const [currentColor, setCurrentColor] = useState4("default");
|
|
1968
|
+
const dropdownRef = useRef4(null);
|
|
1713
1969
|
const colors = type === "text" ? TEXT_COLORS : BACKGROUND_COLORS;
|
|
1714
|
-
const getCurrentColor =
|
|
1970
|
+
const getCurrentColor = useCallback9(() => {
|
|
1715
1971
|
try {
|
|
1716
1972
|
const activeStyles = editor?.getActiveStyles?.() || {};
|
|
1717
1973
|
if (type === "text" && activeStyles.textColor) {
|
|
@@ -1723,13 +1979,13 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1723
1979
|
}
|
|
1724
1980
|
return "default";
|
|
1725
1981
|
}, [editor, type]);
|
|
1726
|
-
|
|
1982
|
+
useEffect4(() => {
|
|
1727
1983
|
if (isOpen) {
|
|
1728
1984
|
const color = getCurrentColor();
|
|
1729
1985
|
setCurrentColor(color);
|
|
1730
1986
|
}
|
|
1731
1987
|
}, [isOpen, getCurrentColor]);
|
|
1732
|
-
|
|
1988
|
+
useEffect4(() => {
|
|
1733
1989
|
const handleClickOutside = (e) => {
|
|
1734
1990
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
1735
1991
|
setIsOpen(false);
|
|
@@ -1738,7 +1994,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1738
1994
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1739
1995
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1740
1996
|
}, []);
|
|
1741
|
-
const handleColorSelect =
|
|
1997
|
+
const handleColorSelect = useCallback9(
|
|
1742
1998
|
(color) => {
|
|
1743
1999
|
try {
|
|
1744
2000
|
if (!editor) return;
|
|
@@ -1755,11 +2011,11 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1755
2011
|
},
|
|
1756
2012
|
[editor, type]
|
|
1757
2013
|
);
|
|
1758
|
-
const handleMouseDown =
|
|
2014
|
+
const handleMouseDown = useCallback9((e) => {
|
|
1759
2015
|
e.preventDefault();
|
|
1760
2016
|
}, []);
|
|
1761
|
-
return /* @__PURE__ */
|
|
1762
|
-
/* @__PURE__ */
|
|
2017
|
+
return /* @__PURE__ */ jsxs6("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2018
|
+
/* @__PURE__ */ jsxs6(
|
|
1763
2019
|
"button",
|
|
1764
2020
|
{
|
|
1765
2021
|
className: "lumir-toolbar-btn lumir-color-btn",
|
|
@@ -1769,7 +2025,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1769
2025
|
type: "button",
|
|
1770
2026
|
children: [
|
|
1771
2027
|
type === "text" ? Icons.textColor : Icons.bgColor,
|
|
1772
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ jsx11(
|
|
1773
2029
|
"span",
|
|
1774
2030
|
{
|
|
1775
2031
|
className: "lumir-color-indicator",
|
|
@@ -1781,7 +2037,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1781
2037
|
]
|
|
1782
2038
|
}
|
|
1783
2039
|
),
|
|
1784
|
-
isOpen && /* @__PURE__ */
|
|
2040
|
+
isOpen && /* @__PURE__ */ jsx11("div", { className: "lumir-dropdown-menu lumir-color-menu", children: /* @__PURE__ */ jsx11("div", { className: "lumir-color-grid", children: colors.map((color) => /* @__PURE__ */ jsx11(
|
|
1785
2041
|
"button",
|
|
1786
2042
|
{
|
|
1787
2043
|
className: cn(
|
|
@@ -1800,8 +2056,8 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1800
2056
|
};
|
|
1801
2057
|
|
|
1802
2058
|
// src/components/FloatingMenu/components/LinkButton.tsx
|
|
1803
|
-
import { useState as
|
|
1804
|
-
import { jsx as
|
|
2059
|
+
import { useState as useState5, useEffect as useEffect5, useRef as useRef5, useCallback as useCallback10 } from "react";
|
|
2060
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1805
2061
|
var isDangerousProtocol = (url) => {
|
|
1806
2062
|
const trimmedUrl = url.trim().toLowerCase();
|
|
1807
2063
|
const dangerousPatterns = [
|
|
@@ -1827,13 +2083,13 @@ var normalizeUrl = (url) => {
|
|
|
1827
2083
|
return `https://${trimmedUrl}`;
|
|
1828
2084
|
};
|
|
1829
2085
|
var LinkButton = ({ editor }) => {
|
|
1830
|
-
const [isOpen, setIsOpen] =
|
|
1831
|
-
const [linkUrl, setLinkUrl] =
|
|
1832
|
-
const [errorMsg, setErrorMsg] =
|
|
1833
|
-
const dropdownRef =
|
|
1834
|
-
const inputRef =
|
|
1835
|
-
const hasSelectionRef =
|
|
1836
|
-
|
|
2086
|
+
const [isOpen, setIsOpen] = useState5(false);
|
|
2087
|
+
const [linkUrl, setLinkUrl] = useState5("");
|
|
2088
|
+
const [errorMsg, setErrorMsg] = useState5(null);
|
|
2089
|
+
const dropdownRef = useRef5(null);
|
|
2090
|
+
const inputRef = useRef5(null);
|
|
2091
|
+
const hasSelectionRef = useRef5(false);
|
|
2092
|
+
useEffect5(() => {
|
|
1837
2093
|
const handleClickOutside = (e) => {
|
|
1838
2094
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
1839
2095
|
setIsOpen(false);
|
|
@@ -1844,7 +2100,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1844
2100
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1845
2101
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1846
2102
|
}, []);
|
|
1847
|
-
|
|
2103
|
+
useEffect5(() => {
|
|
1848
2104
|
if (isOpen && inputRef.current) {
|
|
1849
2105
|
try {
|
|
1850
2106
|
const selectedText = editor?.getSelectedText?.() || "";
|
|
@@ -1855,7 +2111,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1855
2111
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
1856
2112
|
}
|
|
1857
2113
|
}, [isOpen, editor]);
|
|
1858
|
-
const handleSubmit =
|
|
2114
|
+
const handleSubmit = useCallback10(
|
|
1859
2115
|
(e) => {
|
|
1860
2116
|
e?.preventDefault();
|
|
1861
2117
|
setErrorMsg(null);
|
|
@@ -1882,15 +2138,15 @@ var LinkButton = ({ editor }) => {
|
|
|
1882
2138
|
},
|
|
1883
2139
|
[editor, linkUrl]
|
|
1884
2140
|
);
|
|
1885
|
-
const handleCancel =
|
|
2141
|
+
const handleCancel = useCallback10(() => {
|
|
1886
2142
|
setIsOpen(false);
|
|
1887
2143
|
setLinkUrl("");
|
|
1888
2144
|
setErrorMsg(null);
|
|
1889
2145
|
}, []);
|
|
1890
|
-
const handleMouseDown =
|
|
2146
|
+
const handleMouseDown = useCallback10((e) => {
|
|
1891
2147
|
e.preventDefault();
|
|
1892
2148
|
}, []);
|
|
1893
|
-
const handleKeyDown =
|
|
2149
|
+
const handleKeyDown = useCallback10(
|
|
1894
2150
|
(e) => {
|
|
1895
2151
|
if (e.key === "Enter") {
|
|
1896
2152
|
handleSubmit();
|
|
@@ -1900,8 +2156,8 @@ var LinkButton = ({ editor }) => {
|
|
|
1900
2156
|
},
|
|
1901
2157
|
[handleSubmit, handleCancel]
|
|
1902
2158
|
);
|
|
1903
|
-
return /* @__PURE__ */
|
|
1904
|
-
/* @__PURE__ */
|
|
2159
|
+
return /* @__PURE__ */ jsxs7("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2160
|
+
/* @__PURE__ */ jsx12(
|
|
1905
2161
|
"button",
|
|
1906
2162
|
{
|
|
1907
2163
|
className: "lumir-toolbar-btn",
|
|
@@ -1912,8 +2168,8 @@ var LinkButton = ({ editor }) => {
|
|
|
1912
2168
|
children: Icons.link
|
|
1913
2169
|
}
|
|
1914
2170
|
),
|
|
1915
|
-
isOpen && /* @__PURE__ */
|
|
1916
|
-
/* @__PURE__ */
|
|
2171
|
+
isOpen && /* @__PURE__ */ jsx12("div", { className: "lumir-dropdown-menu lumir-link-menu", children: /* @__PURE__ */ jsxs7("form", { onSubmit: handleSubmit, className: "lumir-link-form", children: [
|
|
2172
|
+
/* @__PURE__ */ jsx12(
|
|
1917
2173
|
"input",
|
|
1918
2174
|
{
|
|
1919
2175
|
ref: inputRef,
|
|
@@ -1929,7 +2185,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1929
2185
|
onMouseDown: handleMouseDown
|
|
1930
2186
|
}
|
|
1931
2187
|
),
|
|
1932
|
-
errorMsg && /* @__PURE__ */
|
|
2188
|
+
errorMsg && /* @__PURE__ */ jsx12(
|
|
1933
2189
|
"div",
|
|
1934
2190
|
{
|
|
1935
2191
|
style: {
|
|
@@ -1941,8 +2197,8 @@ var LinkButton = ({ editor }) => {
|
|
|
1941
2197
|
children: errorMsg
|
|
1942
2198
|
}
|
|
1943
2199
|
),
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */
|
|
2200
|
+
/* @__PURE__ */ jsxs7("div", { className: "lumir-link-actions", children: [
|
|
2201
|
+
/* @__PURE__ */ jsx12(
|
|
1946
2202
|
"button",
|
|
1947
2203
|
{
|
|
1948
2204
|
type: "button",
|
|
@@ -1952,7 +2208,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1952
2208
|
children: "\uCDE8\uC18C"
|
|
1953
2209
|
}
|
|
1954
2210
|
),
|
|
1955
|
-
/* @__PURE__ */
|
|
2211
|
+
/* @__PURE__ */ jsx12(
|
|
1956
2212
|
"button",
|
|
1957
2213
|
{
|
|
1958
2214
|
type: "submit",
|
|
@@ -1968,10 +2224,10 @@ var LinkButton = ({ editor }) => {
|
|
|
1968
2224
|
};
|
|
1969
2225
|
|
|
1970
2226
|
// src/components/FloatingMenu/components/TableButton.tsx
|
|
1971
|
-
import { useCallback as
|
|
1972
|
-
import { jsx as
|
|
2227
|
+
import { useCallback as useCallback11 } from "react";
|
|
2228
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
1973
2229
|
var TableButton = ({ editor }) => {
|
|
1974
|
-
const handleClick =
|
|
2230
|
+
const handleClick = useCallback11(() => {
|
|
1975
2231
|
try {
|
|
1976
2232
|
const block = editor?.getTextCursorPosition()?.block;
|
|
1977
2233
|
if (!block || !editor?.insertBlocks) return;
|
|
@@ -1993,10 +2249,10 @@ var TableButton = ({ editor }) => {
|
|
|
1993
2249
|
console.error("Table insert failed:", err);
|
|
1994
2250
|
}
|
|
1995
2251
|
}, [editor]);
|
|
1996
|
-
const handleMouseDown =
|
|
2252
|
+
const handleMouseDown = useCallback11((e) => {
|
|
1997
2253
|
e.preventDefault();
|
|
1998
2254
|
}, []);
|
|
1999
|
-
return /* @__PURE__ */
|
|
2255
|
+
return /* @__PURE__ */ jsx13(
|
|
2000
2256
|
"button",
|
|
2001
2257
|
{
|
|
2002
2258
|
className: "lumir-toolbar-btn",
|
|
@@ -2010,13 +2266,13 @@ var TableButton = ({ editor }) => {
|
|
|
2010
2266
|
};
|
|
2011
2267
|
|
|
2012
2268
|
// src/components/FloatingMenu/components/HTMLImportButton.tsx
|
|
2013
|
-
import { useCallback as
|
|
2014
|
-
import { Fragment as
|
|
2269
|
+
import { useCallback as useCallback12, useRef as useRef6 } from "react";
|
|
2270
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2015
2271
|
var HTMLImportButton = ({
|
|
2016
2272
|
editor
|
|
2017
2273
|
}) => {
|
|
2018
|
-
const fileInputRef =
|
|
2019
|
-
const handleFileUpload =
|
|
2274
|
+
const fileInputRef = useRef6(null);
|
|
2275
|
+
const handleFileUpload = useCallback12(
|
|
2020
2276
|
(e) => {
|
|
2021
2277
|
const file = e.target.files?.[0];
|
|
2022
2278
|
if (!file) return;
|
|
@@ -2052,14 +2308,14 @@ var HTMLImportButton = ({
|
|
|
2052
2308
|
},
|
|
2053
2309
|
[editor]
|
|
2054
2310
|
);
|
|
2055
|
-
const handleClick =
|
|
2311
|
+
const handleClick = useCallback12(() => {
|
|
2056
2312
|
fileInputRef.current?.click();
|
|
2057
2313
|
}, []);
|
|
2058
|
-
const handleMouseDown =
|
|
2314
|
+
const handleMouseDown = useCallback12((e) => {
|
|
2059
2315
|
e.preventDefault();
|
|
2060
2316
|
}, []);
|
|
2061
|
-
return /* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2317
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
2318
|
+
/* @__PURE__ */ jsx14(
|
|
2063
2319
|
"input",
|
|
2064
2320
|
{
|
|
2065
2321
|
ref: fileInputRef,
|
|
@@ -2069,7 +2325,7 @@ var HTMLImportButton = ({
|
|
|
2069
2325
|
style: { display: "none" }
|
|
2070
2326
|
}
|
|
2071
2327
|
),
|
|
2072
|
-
/* @__PURE__ */
|
|
2328
|
+
/* @__PURE__ */ jsx14(
|
|
2073
2329
|
"button",
|
|
2074
2330
|
{
|
|
2075
2331
|
className: "lumir-toolbar-btn",
|
|
@@ -2084,8 +2340,8 @@ var HTMLImportButton = ({
|
|
|
2084
2340
|
};
|
|
2085
2341
|
|
|
2086
2342
|
// src/components/FloatingMenu/components/BlockTypeSelect.tsx
|
|
2087
|
-
import { useState as
|
|
2088
|
-
import { jsx as
|
|
2343
|
+
import { useState as useState6, useEffect as useEffect6, useRef as useRef7, useCallback as useCallback13 } from "react";
|
|
2344
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2089
2345
|
var blockTypeCategories = [
|
|
2090
2346
|
{
|
|
2091
2347
|
category: "Headings",
|
|
@@ -2115,8 +2371,8 @@ var blockTypes = blockTypeCategories.flatMap(
|
|
|
2115
2371
|
(cat) => cat.items
|
|
2116
2372
|
);
|
|
2117
2373
|
var BlockTypeSelect = ({ editor }) => {
|
|
2118
|
-
const [isOpen, setIsOpen] =
|
|
2119
|
-
const dropdownRef =
|
|
2374
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
2375
|
+
const dropdownRef = useRef7(null);
|
|
2120
2376
|
const getCurrentBlock = () => {
|
|
2121
2377
|
try {
|
|
2122
2378
|
return editor?.getTextCursorPosition()?.block;
|
|
@@ -2128,7 +2384,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2128
2384
|
const currentType = currentBlock?.type || "paragraph";
|
|
2129
2385
|
const currentLevel = currentBlock?.props?.level;
|
|
2130
2386
|
const isCurrentToggle = currentType === "heading" && currentBlock?.props?.isToggleable === true;
|
|
2131
|
-
|
|
2387
|
+
useEffect6(() => {
|
|
2132
2388
|
const handleClickOutside = (e) => {
|
|
2133
2389
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2134
2390
|
setIsOpen(false);
|
|
@@ -2157,7 +2413,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2157
2413
|
console.error("Block type change failed:", err);
|
|
2158
2414
|
}
|
|
2159
2415
|
};
|
|
2160
|
-
const handleMouseDown =
|
|
2416
|
+
const handleMouseDown = useCallback13((e) => {
|
|
2161
2417
|
e.preventDefault();
|
|
2162
2418
|
}, []);
|
|
2163
2419
|
const getCurrentLabel = () => {
|
|
@@ -2188,8 +2444,8 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2188
2444
|
}
|
|
2189
2445
|
return currentType === bt.type;
|
|
2190
2446
|
};
|
|
2191
|
-
return /* @__PURE__ */
|
|
2192
|
-
/* @__PURE__ */
|
|
2447
|
+
return /* @__PURE__ */ jsxs9("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2448
|
+
/* @__PURE__ */ jsxs9(
|
|
2193
2449
|
"button",
|
|
2194
2450
|
{
|
|
2195
2451
|
className: "lumir-dropdown-btn lumir-block-type-btn",
|
|
@@ -2197,15 +2453,15 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2197
2453
|
onMouseDown: handleMouseDown,
|
|
2198
2454
|
type: "button",
|
|
2199
2455
|
children: [
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2456
|
+
/* @__PURE__ */ jsx15("span", { className: "lumir-block-icon", children: BlockTypeIcons[getCurrentIcon()] }),
|
|
2457
|
+
/* @__PURE__ */ jsx15("span", { className: "lumir-block-label", children: getCurrentLabel() }),
|
|
2202
2458
|
Icons.expandMore
|
|
2203
2459
|
]
|
|
2204
2460
|
}
|
|
2205
2461
|
),
|
|
2206
|
-
isOpen && /* @__PURE__ */
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
category.items.map((bt) => /* @__PURE__ */
|
|
2462
|
+
isOpen && /* @__PURE__ */ jsx15("div", { className: "lumir-dropdown-menu lumir-block-menu", children: blockTypeCategories.map((category) => /* @__PURE__ */ jsxs9("div", { className: "lumir-block-category", children: [
|
|
2463
|
+
/* @__PURE__ */ jsx15("div", { className: "lumir-block-category-title", children: category.category }),
|
|
2464
|
+
category.items.map((bt) => /* @__PURE__ */ jsxs9(
|
|
2209
2465
|
"button",
|
|
2210
2466
|
{
|
|
2211
2467
|
className: cn(
|
|
@@ -2215,8 +2471,8 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2215
2471
|
onClick: () => handleTypeChange(bt.type, bt.level, bt.isToggle),
|
|
2216
2472
|
onMouseDown: handleMouseDown,
|
|
2217
2473
|
children: [
|
|
2218
|
-
/* @__PURE__ */
|
|
2219
|
-
/* @__PURE__ */
|
|
2474
|
+
/* @__PURE__ */ jsx15("span", { className: "lumir-block-icon", children: BlockTypeIcons[bt.icon] }),
|
|
2475
|
+
/* @__PURE__ */ jsx15("span", { className: "lumir-block-item-title", children: bt.label })
|
|
2220
2476
|
]
|
|
2221
2477
|
},
|
|
2222
2478
|
bt.icon
|
|
@@ -2226,7 +2482,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2226
2482
|
};
|
|
2227
2483
|
|
|
2228
2484
|
// src/components/FloatingMenu/index.tsx
|
|
2229
|
-
import { Fragment as
|
|
2485
|
+
import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2230
2486
|
var COMPACT_BREAKPOINT = 700;
|
|
2231
2487
|
var MINIMIZED_BREAKPOINT = 400;
|
|
2232
2488
|
var FloatingMenu = ({
|
|
@@ -2235,12 +2491,12 @@ var FloatingMenu = ({
|
|
|
2235
2491
|
className,
|
|
2236
2492
|
onImageUpload
|
|
2237
2493
|
}) => {
|
|
2238
|
-
const wrapperRef =
|
|
2239
|
-
const [isCompact, setIsCompact] =
|
|
2240
|
-
const [isMinimizable, setIsMinimizable] =
|
|
2241
|
-
const [isMinimized, setIsMinimized] =
|
|
2242
|
-
const [, setSelectionTick] =
|
|
2243
|
-
|
|
2494
|
+
const wrapperRef = useRef8(null);
|
|
2495
|
+
const [isCompact, setIsCompact] = useState7(false);
|
|
2496
|
+
const [isMinimizable, setIsMinimizable] = useState7(false);
|
|
2497
|
+
const [isMinimized, setIsMinimized] = useState7(false);
|
|
2498
|
+
const [, setSelectionTick] = useState7(0);
|
|
2499
|
+
useEffect7(() => {
|
|
2244
2500
|
if (!editor) return;
|
|
2245
2501
|
let debounceTimer = null;
|
|
2246
2502
|
const DEBOUNCE_DELAY = 150;
|
|
@@ -2264,7 +2520,7 @@ var FloatingMenu = ({
|
|
|
2264
2520
|
unsubscribeContent?.();
|
|
2265
2521
|
};
|
|
2266
2522
|
}, [editor]);
|
|
2267
|
-
|
|
2523
|
+
useEffect7(() => {
|
|
2268
2524
|
const checkWidth = () => {
|
|
2269
2525
|
if (wrapperRef.current) {
|
|
2270
2526
|
const width = wrapperRef.current.offsetWidth;
|
|
@@ -2279,8 +2535,8 @@ var FloatingMenu = ({
|
|
|
2279
2535
|
}
|
|
2280
2536
|
return () => resizeObserver.disconnect();
|
|
2281
2537
|
}, []);
|
|
2282
|
-
const MinimizedLayout = () => /* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2538
|
+
const MinimizedLayout = () => /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
2539
|
+
/* @__PURE__ */ jsx16(
|
|
2284
2540
|
"button",
|
|
2285
2541
|
{
|
|
2286
2542
|
className: "lumir-toolbar-button lumir-toggle-button",
|
|
@@ -2291,117 +2547,117 @@ var FloatingMenu = ({
|
|
|
2291
2547
|
children: isMinimized ? Icons.chevronRight : Icons.chevronLeft
|
|
2292
2548
|
}
|
|
2293
2549
|
),
|
|
2294
|
-
!isMinimized && /* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */
|
|
2296
|
-
/* @__PURE__ */
|
|
2297
|
-
/* @__PURE__ */
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2301
|
-
/* @__PURE__ */
|
|
2302
|
-
/* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2550
|
+
!isMinimized && /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
2551
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2552
|
+
/* @__PURE__ */ jsx16(UndoRedoButtons, { editor }),
|
|
2553
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2554
|
+
/* @__PURE__ */ jsx16("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ jsx16(BlockTypeSelect, { editor }) }),
|
|
2555
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2556
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2557
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "bold" }),
|
|
2558
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "italic" }),
|
|
2559
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "underline" }),
|
|
2560
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "strike" })
|
|
2305
2561
|
] }),
|
|
2306
|
-
/* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
2309
|
-
/* @__PURE__ */
|
|
2310
|
-
/* @__PURE__ */
|
|
2562
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2563
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2564
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "left" }),
|
|
2565
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "center" }),
|
|
2566
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "right" })
|
|
2311
2567
|
] }),
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */
|
|
2314
|
-
/* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2568
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2569
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2570
|
+
/* @__PURE__ */ jsx16(ListButton, { editor, type: "bullet" }),
|
|
2571
|
+
/* @__PURE__ */ jsx16(ListButton, { editor, type: "numbered" })
|
|
2316
2572
|
] }),
|
|
2317
|
-
/* @__PURE__ */
|
|
2318
|
-
/* @__PURE__ */
|
|
2319
|
-
/* @__PURE__ */
|
|
2320
|
-
/* @__PURE__ */
|
|
2573
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2574
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2575
|
+
/* @__PURE__ */ jsx16(ColorButton, { editor, type: "text" }),
|
|
2576
|
+
/* @__PURE__ */ jsx16(ColorButton, { editor, type: "background" })
|
|
2321
2577
|
] }),
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
/* @__PURE__ */
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
2327
|
-
/* @__PURE__ */
|
|
2578
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2579
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2580
|
+
/* @__PURE__ */ jsx16(ImageButton, { editor, onImageUpload }),
|
|
2581
|
+
/* @__PURE__ */ jsx16(LinkButton, { editor }),
|
|
2582
|
+
/* @__PURE__ */ jsx16(TableButton, { editor }),
|
|
2583
|
+
/* @__PURE__ */ jsx16(HTMLImportButton, { editor })
|
|
2328
2584
|
] })
|
|
2329
2585
|
] })
|
|
2330
2586
|
] });
|
|
2331
|
-
const SingleRowLayout = () => /* @__PURE__ */
|
|
2332
|
-
/* @__PURE__ */
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */
|
|
2337
|
-
/* @__PURE__ */
|
|
2338
|
-
/* @__PURE__ */
|
|
2339
|
-
/* @__PURE__ */
|
|
2340
|
-
/* @__PURE__ */
|
|
2587
|
+
const SingleRowLayout = () => /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
2588
|
+
/* @__PURE__ */ jsx16(UndoRedoButtons, { editor }),
|
|
2589
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2590
|
+
/* @__PURE__ */ jsx16("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ jsx16(BlockTypeSelect, { editor }) }),
|
|
2591
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2592
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2593
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "bold" }),
|
|
2594
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "italic" }),
|
|
2595
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "underline" }),
|
|
2596
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "strike" })
|
|
2341
2597
|
] }),
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */
|
|
2344
|
-
/* @__PURE__ */
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */
|
|
2598
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2599
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2600
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "left" }),
|
|
2601
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "center" }),
|
|
2602
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "right" })
|
|
2347
2603
|
] }),
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2350
|
-
/* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */
|
|
2604
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2605
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2606
|
+
/* @__PURE__ */ jsx16(ListButton, { editor, type: "bullet" }),
|
|
2607
|
+
/* @__PURE__ */ jsx16(ListButton, { editor, type: "numbered" })
|
|
2352
2608
|
] }),
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2609
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2610
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2611
|
+
/* @__PURE__ */ jsx16(ColorButton, { editor, type: "text" }),
|
|
2612
|
+
/* @__PURE__ */ jsx16(ColorButton, { editor, type: "background" })
|
|
2357
2613
|
] }),
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2360
|
-
/* @__PURE__ */
|
|
2361
|
-
/* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
/* @__PURE__ */
|
|
2614
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2615
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2616
|
+
/* @__PURE__ */ jsx16(ImageButton, { editor, onImageUpload }),
|
|
2617
|
+
/* @__PURE__ */ jsx16(LinkButton, { editor }),
|
|
2618
|
+
/* @__PURE__ */ jsx16(TableButton, { editor }),
|
|
2619
|
+
/* @__PURE__ */ jsx16(HTMLImportButton, { editor })
|
|
2364
2620
|
] })
|
|
2365
2621
|
] });
|
|
2366
|
-
const TwoRowLayout = () => /* @__PURE__ */
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
2622
|
+
const TwoRowLayout = () => /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
2623
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-row", children: [
|
|
2624
|
+
/* @__PURE__ */ jsx16(UndoRedoButtons, { editor }),
|
|
2625
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2626
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2627
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "bold" }),
|
|
2628
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "italic" }),
|
|
2629
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "underline" }),
|
|
2630
|
+
/* @__PURE__ */ jsx16(TextStyleButton, { editor, style: "strike" })
|
|
2375
2631
|
] }),
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2379
|
-
/* @__PURE__ */
|
|
2380
|
-
/* @__PURE__ */
|
|
2632
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2633
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2634
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "left" }),
|
|
2635
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "center" }),
|
|
2636
|
+
/* @__PURE__ */ jsx16(AlignButton, { editor, alignment: "right" })
|
|
2381
2637
|
] }),
|
|
2382
|
-
/* @__PURE__ */
|
|
2383
|
-
/* @__PURE__ */
|
|
2384
|
-
/* @__PURE__ */
|
|
2385
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2639
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2640
|
+
/* @__PURE__ */ jsx16(ListButton, { editor, type: "bullet" }),
|
|
2641
|
+
/* @__PURE__ */ jsx16(ListButton, { editor, type: "numbered" })
|
|
2386
2642
|
] })
|
|
2387
2643
|
] }),
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
/* @__PURE__ */
|
|
2390
|
-
/* @__PURE__ */
|
|
2391
|
-
/* @__PURE__ */
|
|
2392
|
-
/* @__PURE__ */
|
|
2393
|
-
/* @__PURE__ */
|
|
2644
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-row", children: [
|
|
2645
|
+
/* @__PURE__ */ jsx16("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ jsx16(BlockTypeSelect, { editor }) }),
|
|
2646
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2647
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2648
|
+
/* @__PURE__ */ jsx16(ColorButton, { editor, type: "text" }),
|
|
2649
|
+
/* @__PURE__ */ jsx16(ColorButton, { editor, type: "background" })
|
|
2394
2650
|
] }),
|
|
2395
|
-
/* @__PURE__ */
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */
|
|
2399
|
-
/* @__PURE__ */
|
|
2400
|
-
/* @__PURE__ */
|
|
2651
|
+
/* @__PURE__ */ jsx16(ToolbarDivider, {}),
|
|
2652
|
+
/* @__PURE__ */ jsxs10("div", { className: "lumir-toolbar-group", children: [
|
|
2653
|
+
/* @__PURE__ */ jsx16(ImageButton, { editor, onImageUpload }),
|
|
2654
|
+
/* @__PURE__ */ jsx16(LinkButton, { editor }),
|
|
2655
|
+
/* @__PURE__ */ jsx16(TableButton, { editor }),
|
|
2656
|
+
/* @__PURE__ */ jsx16(HTMLImportButton, { editor })
|
|
2401
2657
|
] })
|
|
2402
2658
|
] })
|
|
2403
2659
|
] });
|
|
2404
|
-
return /* @__PURE__ */
|
|
2660
|
+
return /* @__PURE__ */ jsx16(
|
|
2405
2661
|
"div",
|
|
2406
2662
|
{
|
|
2407
2663
|
ref: wrapperRef,
|
|
@@ -2411,7 +2667,7 @@ var FloatingMenu = ({
|
|
|
2411
2667
|
className
|
|
2412
2668
|
),
|
|
2413
2669
|
"data-position": position,
|
|
2414
|
-
children: /* @__PURE__ */
|
|
2670
|
+
children: /* @__PURE__ */ jsx16(
|
|
2415
2671
|
"div",
|
|
2416
2672
|
{
|
|
2417
2673
|
className: cn(
|
|
@@ -2420,7 +2676,7 @@ var FloatingMenu = ({
|
|
|
2420
2676
|
isMinimizable && "is-minimizable",
|
|
2421
2677
|
isMinimized && "is-minimized"
|
|
2422
2678
|
),
|
|
2423
|
-
children: isMinimizable ? /* @__PURE__ */
|
|
2679
|
+
children: isMinimizable ? /* @__PURE__ */ jsx16(MinimizedLayout, {}) : isCompact ? /* @__PURE__ */ jsx16(TwoRowLayout, {}) : /* @__PURE__ */ jsx16(SingleRowLayout, {})
|
|
2424
2680
|
}
|
|
2425
2681
|
)
|
|
2426
2682
|
}
|
|
@@ -2538,7 +2794,7 @@ var ALLOWED_VIDEO_EXTENSIONS = [
|
|
|
2538
2794
|
];
|
|
2539
2795
|
|
|
2540
2796
|
// src/components/LumirEditor.tsx
|
|
2541
|
-
import { Fragment as
|
|
2797
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2542
2798
|
var DEBUG_LOG = (loc, msg, data) => {
|
|
2543
2799
|
fetch("http://127.0.0.1:7686/ingest/1f8ee1c5-0cf0-4ae7-91ed-5ea7ed17130a", {
|
|
2544
2800
|
method: "POST",
|
|
@@ -2762,7 +3018,7 @@ var findBlockWithLink = (blocks, targetUrl) => {
|
|
|
2762
3018
|
var ConvertToPreviewButton = ({ url }) => {
|
|
2763
3019
|
const editor = useBlockNoteEditor();
|
|
2764
3020
|
const Components = useComponentsContext();
|
|
2765
|
-
return /* @__PURE__ */
|
|
3021
|
+
return /* @__PURE__ */ jsx17(
|
|
2766
3022
|
Components.LinkToolbar.Button,
|
|
2767
3023
|
{
|
|
2768
3024
|
className: "bn-button",
|
|
@@ -2781,10 +3037,10 @@ var ConvertToPreviewButton = ({ url }) => {
|
|
|
2781
3037
|
console.error("Convert to link preview failed:", err);
|
|
2782
3038
|
}
|
|
2783
3039
|
},
|
|
2784
|
-
icon: /* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2787
|
-
/* @__PURE__ */
|
|
3040
|
+
icon: /* @__PURE__ */ jsxs11("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3041
|
+
/* @__PURE__ */ jsx17("rect", { x: "1", y: "3", width: "14", height: "10", rx: "2", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }),
|
|
3042
|
+
/* @__PURE__ */ jsx17("line", { x1: "1", y1: "9", x2: "15", y2: "9", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
3043
|
+
/* @__PURE__ */ jsx17("circle", { cx: "5", cy: "6.5", r: "1.5", stroke: "currentColor", strokeWidth: "1", fill: "none" })
|
|
2788
3044
|
] })
|
|
2789
3045
|
}
|
|
2790
3046
|
);
|
|
@@ -2793,17 +3049,17 @@ var CustomLinkToolbar = (props) => {
|
|
|
2793
3049
|
const editor = useBlockNoteEditor();
|
|
2794
3050
|
const Components = useComponentsContext();
|
|
2795
3051
|
const hasLinkPreview = !!editor?._linkPreviewApiEndpoint;
|
|
2796
|
-
return /* @__PURE__ */
|
|
3052
|
+
return /* @__PURE__ */ jsxs11(
|
|
2797
3053
|
Components.LinkToolbar.Root,
|
|
2798
3054
|
{
|
|
2799
3055
|
className: "bn-toolbar bn-link-toolbar",
|
|
2800
3056
|
onMouseEnter: props.stopHideTimer,
|
|
2801
3057
|
onMouseLeave: props.startHideTimer,
|
|
2802
3058
|
children: [
|
|
2803
|
-
/* @__PURE__ */
|
|
2804
|
-
/* @__PURE__ */
|
|
2805
|
-
/* @__PURE__ */
|
|
2806
|
-
hasLinkPreview && /* @__PURE__ */
|
|
3059
|
+
/* @__PURE__ */ jsx17(EditLinkButton, { url: props.url, text: props.text, editLink: props.editLink }),
|
|
3060
|
+
/* @__PURE__ */ jsx17(OpenLinkButton, { url: props.url }),
|
|
3061
|
+
/* @__PURE__ */ jsx17(DeleteLinkButton, { deleteLink: props.deleteLink }),
|
|
3062
|
+
hasLinkPreview && /* @__PURE__ */ jsx17(ConvertToPreviewButton, { url: props.url })
|
|
2807
3063
|
]
|
|
2808
3064
|
}
|
|
2809
3065
|
);
|
|
@@ -2845,13 +3101,13 @@ function LumirEditor({
|
|
|
2845
3101
|
onError,
|
|
2846
3102
|
onImageDelete
|
|
2847
3103
|
}) {
|
|
2848
|
-
const [isUploading, setIsUploading] =
|
|
2849
|
-
const [uploadProgress, setUploadProgress] =
|
|
2850
|
-
const [errorMessage, setErrorMessage] =
|
|
2851
|
-
const floatingMenuFileInputRef =
|
|
2852
|
-
const floatingMenuBlockRef =
|
|
2853
|
-
const floatingMenuUploadStartTimeRef =
|
|
2854
|
-
const handleError =
|
|
3104
|
+
const [isUploading, setIsUploading] = useState8(false);
|
|
3105
|
+
const [uploadProgress, setUploadProgress] = useState8(null);
|
|
3106
|
+
const [errorMessage, setErrorMessage] = useState8(null);
|
|
3107
|
+
const floatingMenuFileInputRef = useRef9(null);
|
|
3108
|
+
const floatingMenuBlockRef = useRef9(null);
|
|
3109
|
+
const floatingMenuUploadStartTimeRef = useRef9(0);
|
|
3110
|
+
const handleError = useCallback14(
|
|
2855
3111
|
(error) => {
|
|
2856
3112
|
onError?.(error);
|
|
2857
3113
|
setErrorMessage(error.getUserMessage());
|
|
@@ -2881,15 +3137,15 @@ function LumirEditor({
|
|
|
2881
3137
|
allowFileUpload
|
|
2882
3138
|
);
|
|
2883
3139
|
}, [disableExtensions, allowVideoUpload, allowAudioUpload, allowFileUpload]);
|
|
2884
|
-
|
|
3140
|
+
useEffect8(() => {
|
|
2885
3141
|
DEBUG_LOG("LumirEditor:init:disabledExtensions", "snapshot", {
|
|
2886
3142
|
allowVideoUpload,
|
|
2887
3143
|
hasVideoInDisabled: disabledExtensions.includes("video"),
|
|
2888
3144
|
disabledList: disabledExtensions.slice(0, 15)
|
|
2889
3145
|
});
|
|
2890
3146
|
}, [allowVideoUpload, disabledExtensions]);
|
|
2891
|
-
const fileNameTransformRef =
|
|
2892
|
-
|
|
3147
|
+
const fileNameTransformRef = useRef9(s3Upload?.fileNameTransform);
|
|
3148
|
+
useEffect8(() => {
|
|
2893
3149
|
fileNameTransformRef.current = s3Upload?.fileNameTransform;
|
|
2894
3150
|
}, [s3Upload?.fileNameTransform]);
|
|
2895
3151
|
const memoizedS3Upload = useMemo(() => {
|
|
@@ -3103,12 +3359,12 @@ function LumirEditor({
|
|
|
3103
3359
|
if (editor && linkPreview?.apiEndpoint) {
|
|
3104
3360
|
editor._linkPreviewApiEndpoint = linkPreview.apiEndpoint;
|
|
3105
3361
|
}
|
|
3106
|
-
|
|
3362
|
+
useEffect8(() => {
|
|
3107
3363
|
if (editor) {
|
|
3108
3364
|
editor.isEditable = editable;
|
|
3109
3365
|
}
|
|
3110
3366
|
}, [editor, editable]);
|
|
3111
|
-
|
|
3367
|
+
useEffect8(() => {
|
|
3112
3368
|
if (!editor || !onContentChange) return;
|
|
3113
3369
|
const handleContentChange = () => {
|
|
3114
3370
|
const blocks = editor.topLevelBlocks;
|
|
@@ -3116,13 +3372,13 @@ function LumirEditor({
|
|
|
3116
3372
|
};
|
|
3117
3373
|
return editor.onEditorContentChange(handleContentChange);
|
|
3118
3374
|
}, [editor, onContentChange]);
|
|
3119
|
-
const previousMediaUrlsRef =
|
|
3120
|
-
|
|
3375
|
+
const previousMediaUrlsRef = useRef9(/* @__PURE__ */ new Set());
|
|
3376
|
+
useEffect8(() => {
|
|
3121
3377
|
if (!editor) return;
|
|
3122
3378
|
const initialBlocks = editor.topLevelBlocks;
|
|
3123
3379
|
previousMediaUrlsRef.current = extractMediaUrls(initialBlocks);
|
|
3124
3380
|
}, [editor]);
|
|
3125
|
-
|
|
3381
|
+
useEffect8(() => {
|
|
3126
3382
|
if (!editor || !onImageDelete) return;
|
|
3127
3383
|
const handleMediaDeleteCheck = () => {
|
|
3128
3384
|
const currentBlocks = editor.topLevelBlocks;
|
|
@@ -3136,7 +3392,7 @@ function LumirEditor({
|
|
|
3136
3392
|
};
|
|
3137
3393
|
return editor.onEditorContentChange(handleMediaDeleteCheck);
|
|
3138
3394
|
}, [editor, onImageDelete]);
|
|
3139
|
-
|
|
3395
|
+
useEffect8(() => {
|
|
3140
3396
|
const el = editor?.domElement;
|
|
3141
3397
|
if (!el) return;
|
|
3142
3398
|
const handleDragOver = (e) => {
|
|
@@ -3271,16 +3527,16 @@ function LumirEditor({
|
|
|
3271
3527
|
return sideMenuAddButton ? sideMenu : false;
|
|
3272
3528
|
}, [sideMenuAddButton, sideMenu]);
|
|
3273
3529
|
const DragHandleOnlySideMenu = useMemo(() => {
|
|
3274
|
-
return (props) => /* @__PURE__ */
|
|
3530
|
+
return (props) => /* @__PURE__ */ jsx17(BlockSideMenu, { ...props, children: /* @__PURE__ */ jsx17(DragHandleButton, { ...props }) });
|
|
3275
3531
|
}, []);
|
|
3276
|
-
return /* @__PURE__ */
|
|
3532
|
+
return /* @__PURE__ */ jsxs11(
|
|
3277
3533
|
"div",
|
|
3278
3534
|
{
|
|
3279
3535
|
className: cn("lumirEditor", className),
|
|
3280
3536
|
style: { position: "relative", display: "flex", flexDirection: "column" },
|
|
3281
3537
|
children: [
|
|
3282
|
-
floatingMenu && editor && /* @__PURE__ */
|
|
3283
|
-
/* @__PURE__ */
|
|
3538
|
+
floatingMenu && editor && /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
3539
|
+
/* @__PURE__ */ jsx17(
|
|
3284
3540
|
"input",
|
|
3285
3541
|
{
|
|
3286
3542
|
ref: floatingMenuFileInputRef,
|
|
@@ -3351,7 +3607,7 @@ function LumirEditor({
|
|
|
3351
3607
|
}
|
|
3352
3608
|
}
|
|
3353
3609
|
),
|
|
3354
|
-
/* @__PURE__ */
|
|
3610
|
+
/* @__PURE__ */ jsx17(
|
|
3355
3611
|
FloatingMenu,
|
|
3356
3612
|
{
|
|
3357
3613
|
editor,
|
|
@@ -3383,7 +3639,7 @@ function LumirEditor({
|
|
|
3383
3639
|
}
|
|
3384
3640
|
)
|
|
3385
3641
|
] }),
|
|
3386
|
-
/* @__PURE__ */
|
|
3642
|
+
/* @__PURE__ */ jsxs11(
|
|
3387
3643
|
BlockNoteView,
|
|
3388
3644
|
{
|
|
3389
3645
|
editor,
|
|
@@ -3398,12 +3654,12 @@ function LumirEditor({
|
|
|
3398
3654
|
tableHandles,
|
|
3399
3655
|
onSelectionChange,
|
|
3400
3656
|
children: [
|
|
3401
|
-
linkToolbar && (linkPreview?.apiEndpoint ? /* @__PURE__ */
|
|
3402
|
-
/* @__PURE__ */
|
|
3657
|
+
linkToolbar && (linkPreview?.apiEndpoint ? /* @__PURE__ */ jsx17(LinkToolbarController, { linkToolbar: CustomLinkToolbar }) : /* @__PURE__ */ jsx17(LinkToolbarController, {})),
|
|
3658
|
+
/* @__PURE__ */ jsx17(
|
|
3403
3659
|
SuggestionMenuController,
|
|
3404
3660
|
{
|
|
3405
3661
|
triggerCharacter: "/",
|
|
3406
|
-
getItems:
|
|
3662
|
+
getItems: useCallback14(
|
|
3407
3663
|
async (query) => {
|
|
3408
3664
|
const items = getDefaultReactSlashMenuItems(editor);
|
|
3409
3665
|
const filtered = items.filter((item) => {
|
|
@@ -3447,7 +3703,7 @@ function LumirEditor({
|
|
|
3447
3703
|
},
|
|
3448
3704
|
aliases: ["html", "preview", "\uC6F9", "\uC6F9\uD398\uC774\uC9C0"],
|
|
3449
3705
|
group: "Embeds",
|
|
3450
|
-
icon: /* @__PURE__ */
|
|
3706
|
+
icon: /* @__PURE__ */ jsxs11(
|
|
3451
3707
|
"svg",
|
|
3452
3708
|
{
|
|
3453
3709
|
width: "18",
|
|
@@ -3459,8 +3715,8 @@ function LumirEditor({
|
|
|
3459
3715
|
strokeLinecap: "round",
|
|
3460
3716
|
strokeLinejoin: "round",
|
|
3461
3717
|
children: [
|
|
3462
|
-
/* @__PURE__ */
|
|
3463
|
-
/* @__PURE__ */
|
|
3718
|
+
/* @__PURE__ */ jsx17("polyline", { points: "16 18 22 12 16 6" }),
|
|
3719
|
+
/* @__PURE__ */ jsx17("polyline", { points: "8 6 2 12 8 18" })
|
|
3464
3720
|
]
|
|
3465
3721
|
}
|
|
3466
3722
|
),
|
|
@@ -3485,7 +3741,7 @@ function LumirEditor({
|
|
|
3485
3741
|
"\uD504\uB9AC\uBDF0"
|
|
3486
3742
|
],
|
|
3487
3743
|
group: "Embeds",
|
|
3488
|
-
icon: /* @__PURE__ */
|
|
3744
|
+
icon: /* @__PURE__ */ jsxs11(
|
|
3489
3745
|
"svg",
|
|
3490
3746
|
{
|
|
3491
3747
|
width: "18",
|
|
@@ -3497,8 +3753,8 @@ function LumirEditor({
|
|
|
3497
3753
|
strokeLinecap: "round",
|
|
3498
3754
|
strokeLinejoin: "round",
|
|
3499
3755
|
children: [
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
/* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ jsx17("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
|
|
3757
|
+
/* @__PURE__ */ jsx17("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
|
|
3502
3758
|
]
|
|
3503
3759
|
}
|
|
3504
3760
|
),
|
|
@@ -3517,21 +3773,21 @@ function LumirEditor({
|
|
|
3517
3773
|
)
|
|
3518
3774
|
}
|
|
3519
3775
|
),
|
|
3520
|
-
!sideMenuAddButton && /* @__PURE__ */
|
|
3776
|
+
!sideMenuAddButton && /* @__PURE__ */ jsx17(SideMenuController, { sideMenu: DragHandleOnlySideMenu })
|
|
3521
3777
|
]
|
|
3522
3778
|
}
|
|
3523
3779
|
),
|
|
3524
|
-
isUploading && /* @__PURE__ */
|
|
3525
|
-
/* @__PURE__ */
|
|
3526
|
-
uploadProgress !== null && /* @__PURE__ */
|
|
3780
|
+
isUploading && /* @__PURE__ */ jsxs11("div", { className: "lumirEditor-upload-overlay", children: [
|
|
3781
|
+
/* @__PURE__ */ jsx17("div", { className: "lumirEditor-spinner" }),
|
|
3782
|
+
uploadProgress !== null && /* @__PURE__ */ jsxs11("span", { className: "lumirEditor-upload-progress", children: [
|
|
3527
3783
|
uploadProgress,
|
|
3528
3784
|
"%"
|
|
3529
3785
|
] })
|
|
3530
3786
|
] }),
|
|
3531
|
-
errorMessage && /* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3534
|
-
/* @__PURE__ */
|
|
3787
|
+
errorMessage && /* @__PURE__ */ jsxs11("div", { className: "lumirEditor-error-toast", children: [
|
|
3788
|
+
/* @__PURE__ */ jsx17("span", { className: "lumirEditor-error-icon", children: "\u26A0\uFE0F" }),
|
|
3789
|
+
/* @__PURE__ */ jsx17("span", { className: "lumirEditor-error-message", children: errorMessage }),
|
|
3790
|
+
/* @__PURE__ */ jsx17(
|
|
3535
3791
|
"button",
|
|
3536
3792
|
{
|
|
3537
3793
|
className: "lumirEditor-error-close",
|