@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.js
CHANGED
|
@@ -40,8 +40,8 @@ __export(index_exports, {
|
|
|
40
40
|
module.exports = __toCommonJS(index_exports);
|
|
41
41
|
|
|
42
42
|
// src/components/LumirEditor.tsx
|
|
43
|
-
var
|
|
44
|
-
var
|
|
43
|
+
var import_react18 = require("react");
|
|
44
|
+
var import_react19 = require("@blocknote/react");
|
|
45
45
|
var import_mantine = require("@blocknote/mantine");
|
|
46
46
|
var import_core2 = require("@blocknote/core");
|
|
47
47
|
|
|
@@ -244,7 +244,7 @@ var createS3Uploader = (config) => {
|
|
|
244
244
|
};
|
|
245
245
|
|
|
246
246
|
// src/blocks/HtmlPreview.tsx
|
|
247
|
-
var
|
|
247
|
+
var import_react5 = require("@blocknote/react");
|
|
248
248
|
var import_core = require("@blocknote/core");
|
|
249
249
|
|
|
250
250
|
// src/blocks/LinkPreview.tsx
|
|
@@ -950,9 +950,264 @@ var LinkPreviewBlock = (0, import_react.createReactBlockSpec)(
|
|
|
950
950
|
}
|
|
951
951
|
);
|
|
952
952
|
|
|
953
|
-
// src/blocks/
|
|
953
|
+
// src/blocks/VideoBlock.tsx
|
|
954
|
+
var import_react3 = require("@blocknote/react");
|
|
954
955
|
var import_react4 = require("react");
|
|
955
956
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
957
|
+
var MIN_VIDEO_WIDTH = 200;
|
|
958
|
+
var MAX_VIDEO_WIDTH = 1200;
|
|
959
|
+
var MIN_VIDEO_HEIGHT = 120;
|
|
960
|
+
var MAX_VIDEO_HEIGHT = 600;
|
|
961
|
+
var DEFAULT_VIDEO_WIDTH = 640;
|
|
962
|
+
var DEFAULT_VIDEO_HEIGHT = 360;
|
|
963
|
+
var VideoBlockCard = ({
|
|
964
|
+
url,
|
|
965
|
+
editable,
|
|
966
|
+
width,
|
|
967
|
+
onWidthChange,
|
|
968
|
+
height,
|
|
969
|
+
onHeightChange,
|
|
970
|
+
onContextMenuBlock
|
|
971
|
+
}) => {
|
|
972
|
+
const [resizeParams, setResizeParams] = (0, import_react4.useState)(
|
|
973
|
+
void 0
|
|
974
|
+
);
|
|
975
|
+
const [localWidth, setLocalWidth] = (0, import_react4.useState)(width);
|
|
976
|
+
const [localHeight, setLocalHeight] = (0, import_react4.useState)(height);
|
|
977
|
+
const wrapperRef = (0, import_react4.useRef)(null);
|
|
978
|
+
(0, import_react4.useEffect)(() => {
|
|
979
|
+
setLocalWidth(width);
|
|
980
|
+
}, [width]);
|
|
981
|
+
(0, import_react4.useEffect)(() => {
|
|
982
|
+
setLocalHeight(height);
|
|
983
|
+
}, [height]);
|
|
984
|
+
(0, import_react4.useEffect)(() => {
|
|
985
|
+
if (!resizeParams) return;
|
|
986
|
+
const onMouseMove = (e) => {
|
|
987
|
+
if (resizeParams.handleUsed === "bottom") {
|
|
988
|
+
const delta = e.clientY - resizeParams.initialClientY;
|
|
989
|
+
setLocalHeight(
|
|
990
|
+
Math.min(
|
|
991
|
+
Math.max(resizeParams.initialHeight + delta, MIN_VIDEO_HEIGHT),
|
|
992
|
+
MAX_VIDEO_HEIGHT
|
|
993
|
+
)
|
|
994
|
+
);
|
|
995
|
+
} else {
|
|
996
|
+
const delta = resizeParams.handleUsed === "left" ? resizeParams.initialClientX - e.clientX : e.clientX - resizeParams.initialClientX;
|
|
997
|
+
setLocalWidth(
|
|
998
|
+
Math.min(
|
|
999
|
+
Math.max(resizeParams.initialWidth + delta, MIN_VIDEO_WIDTH),
|
|
1000
|
+
wrapperRef.current?.parentElement?.clientWidth || MAX_VIDEO_WIDTH
|
|
1001
|
+
)
|
|
1002
|
+
);
|
|
1003
|
+
}
|
|
1004
|
+
};
|
|
1005
|
+
const onMouseUp = () => {
|
|
1006
|
+
const handle = resizeParams.handleUsed;
|
|
1007
|
+
setResizeParams(void 0);
|
|
1008
|
+
if (handle === "bottom") {
|
|
1009
|
+
if (localHeight != null && onHeightChange) onHeightChange(localHeight);
|
|
1010
|
+
} else {
|
|
1011
|
+
if (localWidth != null && onWidthChange) onWidthChange(localWidth);
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
1015
|
+
window.addEventListener("mouseup", onMouseUp);
|
|
1016
|
+
return () => {
|
|
1017
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
1018
|
+
window.removeEventListener("mouseup", onMouseUp);
|
|
1019
|
+
};
|
|
1020
|
+
}, [resizeParams, localWidth, localHeight, onWidthChange, onHeightChange]);
|
|
1021
|
+
const handleLeftDown = (0, import_react4.useCallback)(
|
|
1022
|
+
(e) => {
|
|
1023
|
+
e.preventDefault();
|
|
1024
|
+
e.stopPropagation();
|
|
1025
|
+
setResizeParams({
|
|
1026
|
+
handleUsed: "left",
|
|
1027
|
+
initialWidth: wrapperRef.current?.clientWidth ?? DEFAULT_VIDEO_WIDTH,
|
|
1028
|
+
initialHeight: localHeight ?? DEFAULT_VIDEO_HEIGHT,
|
|
1029
|
+
initialClientX: e.clientX,
|
|
1030
|
+
initialClientY: e.clientY
|
|
1031
|
+
});
|
|
1032
|
+
},
|
|
1033
|
+
[localHeight]
|
|
1034
|
+
);
|
|
1035
|
+
const handleRightDown = (0, import_react4.useCallback)(
|
|
1036
|
+
(e) => {
|
|
1037
|
+
e.preventDefault();
|
|
1038
|
+
e.stopPropagation();
|
|
1039
|
+
setResizeParams({
|
|
1040
|
+
handleUsed: "right",
|
|
1041
|
+
initialWidth: wrapperRef.current?.clientWidth ?? DEFAULT_VIDEO_WIDTH,
|
|
1042
|
+
initialHeight: localHeight ?? DEFAULT_VIDEO_HEIGHT,
|
|
1043
|
+
initialClientX: e.clientX,
|
|
1044
|
+
initialClientY: e.clientY
|
|
1045
|
+
});
|
|
1046
|
+
},
|
|
1047
|
+
[localHeight]
|
|
1048
|
+
);
|
|
1049
|
+
const handleBottomDown = (0, import_react4.useCallback)(
|
|
1050
|
+
(e) => {
|
|
1051
|
+
e.preventDefault();
|
|
1052
|
+
e.stopPropagation();
|
|
1053
|
+
setResizeParams({
|
|
1054
|
+
handleUsed: "bottom",
|
|
1055
|
+
initialWidth: wrapperRef.current?.clientWidth ?? DEFAULT_VIDEO_WIDTH,
|
|
1056
|
+
initialHeight: localHeight ?? DEFAULT_VIDEO_HEIGHT,
|
|
1057
|
+
initialClientX: e.clientX,
|
|
1058
|
+
initialClientY: e.clientY
|
|
1059
|
+
});
|
|
1060
|
+
},
|
|
1061
|
+
[localHeight]
|
|
1062
|
+
);
|
|
1063
|
+
const resizeCursor = resizeParams ? resizeParams.handleUsed === "bottom" ? "ns-resize" : "ew-resize" : "default";
|
|
1064
|
+
const [hovered, setHovered] = (0, import_react4.useState)(false);
|
|
1065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1066
|
+
"div",
|
|
1067
|
+
{
|
|
1068
|
+
ref: wrapperRef,
|
|
1069
|
+
className: "lumir-video-block-wrapper",
|
|
1070
|
+
onContextMenu: onContextMenuBlock,
|
|
1071
|
+
style: {
|
|
1072
|
+
position: "relative",
|
|
1073
|
+
width: localWidth != null ? `${localWidth}px` : void 0,
|
|
1074
|
+
maxWidth: "100%",
|
|
1075
|
+
cursor: resizeCursor,
|
|
1076
|
+
transition: resizeParams ? "none" : "box-shadow 0.2s"
|
|
1077
|
+
},
|
|
1078
|
+
onMouseEnter: () => {
|
|
1079
|
+
if (!resizeParams) setHovered(true);
|
|
1080
|
+
},
|
|
1081
|
+
onMouseLeave: () => {
|
|
1082
|
+
if (!resizeParams) setHovered(false);
|
|
1083
|
+
},
|
|
1084
|
+
children: [
|
|
1085
|
+
editable && (hovered || resizeParams) && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1087
|
+
"div",
|
|
1088
|
+
{
|
|
1089
|
+
className: "lumir-resize-handle",
|
|
1090
|
+
style: { left: "4px" },
|
|
1091
|
+
onMouseDown: handleLeftDown
|
|
1092
|
+
}
|
|
1093
|
+
),
|
|
1094
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1095
|
+
"div",
|
|
1096
|
+
{
|
|
1097
|
+
className: "lumir-resize-handle",
|
|
1098
|
+
style: { right: "4px" },
|
|
1099
|
+
onMouseDown: handleRightDown
|
|
1100
|
+
}
|
|
1101
|
+
)
|
|
1102
|
+
] }),
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
1104
|
+
"div",
|
|
1105
|
+
{
|
|
1106
|
+
style: {
|
|
1107
|
+
width: "100%",
|
|
1108
|
+
height: `${localHeight ?? DEFAULT_VIDEO_HEIGHT}px`,
|
|
1109
|
+
overflow: "hidden",
|
|
1110
|
+
backgroundColor: "#000",
|
|
1111
|
+
borderRadius: "6px"
|
|
1112
|
+
},
|
|
1113
|
+
children: [
|
|
1114
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1115
|
+
"video",
|
|
1116
|
+
{
|
|
1117
|
+
src: url,
|
|
1118
|
+
controls: true,
|
|
1119
|
+
controlsList: "nodownload",
|
|
1120
|
+
playsInline: true,
|
|
1121
|
+
style: {
|
|
1122
|
+
width: "100%",
|
|
1123
|
+
height: "100%",
|
|
1124
|
+
objectFit: "contain",
|
|
1125
|
+
display: "block"
|
|
1126
|
+
},
|
|
1127
|
+
onContextMenu: (e) => e.preventDefault()
|
|
1128
|
+
}
|
|
1129
|
+
),
|
|
1130
|
+
editable && (hovered || resizeParams) && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1131
|
+
"div",
|
|
1132
|
+
{
|
|
1133
|
+
className: "lumir-resize-handle-bottom",
|
|
1134
|
+
onMouseDown: handleBottomDown
|
|
1135
|
+
}
|
|
1136
|
+
)
|
|
1137
|
+
]
|
|
1138
|
+
}
|
|
1139
|
+
)
|
|
1140
|
+
]
|
|
1141
|
+
}
|
|
1142
|
+
);
|
|
1143
|
+
};
|
|
1144
|
+
var VideoBlock = (0, import_react3.createReactBlockSpec)(
|
|
1145
|
+
{
|
|
1146
|
+
type: "video",
|
|
1147
|
+
propSchema: {
|
|
1148
|
+
url: { default: "" },
|
|
1149
|
+
previewWidth: { default: 640 },
|
|
1150
|
+
previewHeight: { default: 360 }
|
|
1151
|
+
},
|
|
1152
|
+
content: "none"
|
|
1153
|
+
},
|
|
1154
|
+
{
|
|
1155
|
+
render: (props) => {
|
|
1156
|
+
const url = props.block.props.url ?? "";
|
|
1157
|
+
const editable = props.editor.isEditable;
|
|
1158
|
+
const handleContextMenu = (0, import_react4.useCallback)((e) => {
|
|
1159
|
+
e.preventDefault();
|
|
1160
|
+
e.stopPropagation();
|
|
1161
|
+
}, []);
|
|
1162
|
+
if (!url) {
|
|
1163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1164
|
+
"div",
|
|
1165
|
+
{
|
|
1166
|
+
className: "lumir-video-block-placeholder",
|
|
1167
|
+
onContextMenu: handleContextMenu,
|
|
1168
|
+
style: {
|
|
1169
|
+
width: "100%",
|
|
1170
|
+
maxWidth: `${DEFAULT_VIDEO_WIDTH}px`,
|
|
1171
|
+
height: `${DEFAULT_VIDEO_HEIGHT}px`,
|
|
1172
|
+
backgroundColor: "#1a1a1a",
|
|
1173
|
+
borderRadius: "6px",
|
|
1174
|
+
display: "flex",
|
|
1175
|
+
alignItems: "center",
|
|
1176
|
+
justifyContent: "center",
|
|
1177
|
+
color: "rgba(255,255,255,0.5)",
|
|
1178
|
+
fontSize: "14px"
|
|
1179
|
+
},
|
|
1180
|
+
children: "\uBE44\uB514\uC624 URL \uC5C6\uC74C"
|
|
1181
|
+
}
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
1185
|
+
VideoBlockCard,
|
|
1186
|
+
{
|
|
1187
|
+
url,
|
|
1188
|
+
editable,
|
|
1189
|
+
width: props.block.props.previewWidth,
|
|
1190
|
+
onWidthChange: (newWidth) => {
|
|
1191
|
+
props.editor.updateBlock(props.block, {
|
|
1192
|
+
props: { previewWidth: newWidth }
|
|
1193
|
+
});
|
|
1194
|
+
},
|
|
1195
|
+
height: props.block.props.previewHeight,
|
|
1196
|
+
onHeightChange: (newHeight) => {
|
|
1197
|
+
props.editor.updateBlock(props.block, {
|
|
1198
|
+
props: { previewHeight: newHeight }
|
|
1199
|
+
});
|
|
1200
|
+
},
|
|
1201
|
+
onContextMenuBlock: handleContextMenu
|
|
1202
|
+
}
|
|
1203
|
+
);
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
);
|
|
1207
|
+
|
|
1208
|
+
// src/blocks/HtmlPreview.tsx
|
|
1209
|
+
var import_react6 = require("react");
|
|
1210
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
956
1211
|
var MIN_HEIGHT = 100;
|
|
957
1212
|
var MAX_HEIGHT = 1200;
|
|
958
1213
|
var ensureCharset = (html) => {
|
|
@@ -990,7 +1245,7 @@ var createSecureBlobUrl = (htmlContent) => {
|
|
|
990
1245
|
});
|
|
991
1246
|
return URL.createObjectURL(blob);
|
|
992
1247
|
};
|
|
993
|
-
var HtmlPreviewBlock = (0,
|
|
1248
|
+
var HtmlPreviewBlock = (0, import_react5.createReactBlockSpec)(
|
|
994
1249
|
{
|
|
995
1250
|
type: "htmlPreview",
|
|
996
1251
|
propSchema: {
|
|
@@ -1008,15 +1263,15 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1008
1263
|
},
|
|
1009
1264
|
{
|
|
1010
1265
|
render: (props) => {
|
|
1011
|
-
const [isExpanded, setIsExpanded] = (0,
|
|
1012
|
-
const [isResizing, setIsResizing] = (0,
|
|
1013
|
-
const [blobUrl, setBlobUrl] = (0,
|
|
1014
|
-
const containerRef = (0,
|
|
1266
|
+
const [isExpanded, setIsExpanded] = (0, import_react6.useState)(true);
|
|
1267
|
+
const [isResizing, setIsResizing] = (0, import_react6.useState)(false);
|
|
1268
|
+
const [blobUrl, setBlobUrl] = (0, import_react6.useState)("");
|
|
1269
|
+
const containerRef = (0, import_react6.useRef)(null);
|
|
1015
1270
|
const htmlContent = props.block.props.htmlContent || "";
|
|
1016
1271
|
const fileName = props.block.props.fileName || "HTML Document";
|
|
1017
1272
|
const savedHeight = props.block.props.height || "400px";
|
|
1018
1273
|
const currentHeight = parseInt(savedHeight, 10) || 400;
|
|
1019
|
-
(0,
|
|
1274
|
+
(0, import_react6.useEffect)(() => {
|
|
1020
1275
|
if (htmlContent) {
|
|
1021
1276
|
const url = createSecureBlobUrl(htmlContent);
|
|
1022
1277
|
setBlobUrl(url);
|
|
@@ -1025,7 +1280,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1025
1280
|
};
|
|
1026
1281
|
}
|
|
1027
1282
|
}, [htmlContent]);
|
|
1028
|
-
const handleResizeStart = (0,
|
|
1283
|
+
const handleResizeStart = (0, import_react6.useCallback)(
|
|
1029
1284
|
(e) => {
|
|
1030
1285
|
e.preventDefault();
|
|
1031
1286
|
e.stopPropagation();
|
|
@@ -1052,7 +1307,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1052
1307
|
},
|
|
1053
1308
|
[currentHeight, props.editor, props.block]
|
|
1054
1309
|
);
|
|
1055
|
-
const handleExport = (0,
|
|
1310
|
+
const handleExport = (0, import_react6.useCallback)(
|
|
1056
1311
|
(e) => {
|
|
1057
1312
|
e.stopPropagation();
|
|
1058
1313
|
const safeFileName = sanitizeFileName(fileName);
|
|
@@ -1073,7 +1328,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1073
1328
|
},
|
|
1074
1329
|
[htmlContent, fileName]
|
|
1075
1330
|
);
|
|
1076
|
-
const handleOpenNewWindow = (0,
|
|
1331
|
+
const handleOpenNewWindow = (0, import_react6.useCallback)(
|
|
1077
1332
|
(e) => {
|
|
1078
1333
|
e.stopPropagation();
|
|
1079
1334
|
if (typeof window === "undefined") return;
|
|
@@ -1087,7 +1342,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1087
1342
|
},
|
|
1088
1343
|
[htmlContent]
|
|
1089
1344
|
);
|
|
1090
|
-
return /* @__PURE__ */ (0,
|
|
1345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1091
1346
|
"div",
|
|
1092
1347
|
{
|
|
1093
1348
|
ref: containerRef,
|
|
@@ -1103,7 +1358,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1103
1358
|
boxShadow: "none"
|
|
1104
1359
|
},
|
|
1105
1360
|
children: [
|
|
1106
|
-
/* @__PURE__ */ (0,
|
|
1361
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1107
1362
|
"div",
|
|
1108
1363
|
{
|
|
1109
1364
|
style: {
|
|
@@ -1115,7 +1370,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1115
1370
|
borderBottom: isExpanded ? "1px solid #e0e0e0" : "none"
|
|
1116
1371
|
},
|
|
1117
1372
|
children: [
|
|
1118
|
-
/* @__PURE__ */ (0,
|
|
1373
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1119
1374
|
"div",
|
|
1120
1375
|
{
|
|
1121
1376
|
style: {
|
|
@@ -1127,7 +1382,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1127
1382
|
},
|
|
1128
1383
|
onClick: () => setIsExpanded(!isExpanded),
|
|
1129
1384
|
children: [
|
|
1130
|
-
/* @__PURE__ */ (0,
|
|
1385
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1131
1386
|
"svg",
|
|
1132
1387
|
{
|
|
1133
1388
|
width: "16",
|
|
@@ -1142,15 +1397,15 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1142
1397
|
transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)",
|
|
1143
1398
|
transition: "transform 0.2s"
|
|
1144
1399
|
},
|
|
1145
|
-
children: /* @__PURE__ */ (0,
|
|
1400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "6 9 12 15 18 9" })
|
|
1146
1401
|
}
|
|
1147
1402
|
),
|
|
1148
|
-
/* @__PURE__ */ (0,
|
|
1403
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: { fontWeight: 500, fontSize: "14px" }, children: fileName })
|
|
1149
1404
|
]
|
|
1150
1405
|
}
|
|
1151
1406
|
),
|
|
1152
|
-
/* @__PURE__ */ (0,
|
|
1153
|
-
/* @__PURE__ */ (0,
|
|
1407
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1408
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1154
1409
|
"button",
|
|
1155
1410
|
{
|
|
1156
1411
|
onClick: handleOpenNewWindow,
|
|
@@ -1173,7 +1428,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1173
1428
|
onMouseLeave: (e) => {
|
|
1174
1429
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1175
1430
|
},
|
|
1176
|
-
children: /* @__PURE__ */ (0,
|
|
1431
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1177
1432
|
"svg",
|
|
1178
1433
|
{
|
|
1179
1434
|
width: "16",
|
|
@@ -1185,15 +1440,15 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1185
1440
|
strokeLinecap: "round",
|
|
1186
1441
|
strokeLinejoin: "round",
|
|
1187
1442
|
children: [
|
|
1188
|
-
/* @__PURE__ */ (0,
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1190
|
-
/* @__PURE__ */ (0,
|
|
1443
|
+
/* @__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" }),
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "15 3 21 3 21 9" }),
|
|
1445
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
1191
1446
|
]
|
|
1192
1447
|
}
|
|
1193
1448
|
)
|
|
1194
1449
|
}
|
|
1195
1450
|
),
|
|
1196
|
-
/* @__PURE__ */ (0,
|
|
1451
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1197
1452
|
"button",
|
|
1198
1453
|
{
|
|
1199
1454
|
onClick: handleExport,
|
|
@@ -1216,7 +1471,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1216
1471
|
onMouseLeave: (e) => {
|
|
1217
1472
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1218
1473
|
},
|
|
1219
|
-
children: /* @__PURE__ */ (0,
|
|
1474
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1220
1475
|
"svg",
|
|
1221
1476
|
{
|
|
1222
1477
|
width: "16",
|
|
@@ -1228,9 +1483,9 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1228
1483
|
strokeLinecap: "round",
|
|
1229
1484
|
strokeLinejoin: "round",
|
|
1230
1485
|
children: [
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1232
|
-
/* @__PURE__ */ (0,
|
|
1233
|
-
/* @__PURE__ */ (0,
|
|
1486
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("polyline", { points: "7 10 12 15 17 10" }),
|
|
1488
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
1234
1489
|
]
|
|
1235
1490
|
}
|
|
1236
1491
|
)
|
|
@@ -1240,7 +1495,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1240
1495
|
]
|
|
1241
1496
|
}
|
|
1242
1497
|
),
|
|
1243
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
1498
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1244
1499
|
"div",
|
|
1245
1500
|
{
|
|
1246
1501
|
style: {
|
|
@@ -1249,7 +1504,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1249
1504
|
position: "relative"
|
|
1250
1505
|
},
|
|
1251
1506
|
children: [
|
|
1252
|
-
/* @__PURE__ */ (0,
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1253
1508
|
"iframe",
|
|
1254
1509
|
{
|
|
1255
1510
|
src: blobUrl || "about:blank",
|
|
@@ -1266,7 +1521,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1266
1521
|
loading: "lazy"
|
|
1267
1522
|
}
|
|
1268
1523
|
),
|
|
1269
|
-
/* @__PURE__ */ (0,
|
|
1524
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1270
1525
|
"div",
|
|
1271
1526
|
{
|
|
1272
1527
|
onMouseDown: handleResizeStart,
|
|
@@ -1291,7 +1546,7 @@ var HtmlPreviewBlock = (0, import_react3.createReactBlockSpec)(
|
|
|
1291
1546
|
e.currentTarget.style.backgroundColor = "transparent";
|
|
1292
1547
|
}
|
|
1293
1548
|
},
|
|
1294
|
-
children: /* @__PURE__ */ (0,
|
|
1549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1295
1550
|
"div",
|
|
1296
1551
|
{
|
|
1297
1552
|
style: {
|
|
@@ -1317,67 +1572,68 @@ var schema = import_core.BlockNoteSchema.create({
|
|
|
1317
1572
|
blockSpecs: {
|
|
1318
1573
|
...import_core.defaultBlockSpecs,
|
|
1319
1574
|
htmlPreview: HtmlPreviewBlock,
|
|
1320
|
-
linkPreview: LinkPreviewBlock
|
|
1575
|
+
linkPreview: LinkPreviewBlock,
|
|
1576
|
+
video: VideoBlock
|
|
1321
1577
|
},
|
|
1322
1578
|
inlineContentSpecs: import_core.defaultInlineContentSpecs,
|
|
1323
1579
|
styleSpecs: import_core.defaultStyleSpecs
|
|
1324
1580
|
});
|
|
1325
1581
|
|
|
1326
1582
|
// src/components/FloatingMenu/index.tsx
|
|
1327
|
-
var
|
|
1583
|
+
var import_react17 = require("react");
|
|
1328
1584
|
|
|
1329
1585
|
// src/components/FloatingMenu/Icons.tsx
|
|
1330
|
-
var
|
|
1586
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1331
1587
|
var Icons = {
|
|
1332
|
-
undo: /* @__PURE__ */ (0,
|
|
1333
|
-
redo: /* @__PURE__ */ (0,
|
|
1334
|
-
bold: /* @__PURE__ */ (0,
|
|
1335
|
-
italic: /* @__PURE__ */ (0,
|
|
1336
|
-
underline: /* @__PURE__ */ (0,
|
|
1337
|
-
strikethrough: /* @__PURE__ */ (0,
|
|
1338
|
-
alignLeft: /* @__PURE__ */ (0,
|
|
1339
|
-
alignCenter: /* @__PURE__ */ (0,
|
|
1340
|
-
alignRight: /* @__PURE__ */ (0,
|
|
1341
|
-
bulletList: /* @__PURE__ */ (0,
|
|
1342
|
-
numberedList: /* @__PURE__ */ (0,
|
|
1343
|
-
image: /* @__PURE__ */ (0,
|
|
1344
|
-
expandMore: /* @__PURE__ */ (0,
|
|
1345
|
-
textColor: /* @__PURE__ */ (0,
|
|
1346
|
-
bgColor: /* @__PURE__ */ (0,
|
|
1347
|
-
/* @__PURE__ */ (0,
|
|
1348
|
-
/* @__PURE__ */ (0,
|
|
1588
|
+
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" }) }),
|
|
1589
|
+
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" }) }),
|
|
1590
|
+
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" }) }),
|
|
1591
|
+
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" }) }),
|
|
1592
|
+
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" }) }),
|
|
1593
|
+
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" }) }),
|
|
1594
|
+
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" }) }),
|
|
1595
|
+
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" }) }),
|
|
1596
|
+
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" }) }),
|
|
1597
|
+
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" }) }),
|
|
1598
|
+
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" }) }),
|
|
1599
|
+
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" }) }),
|
|
1600
|
+
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" }) }),
|
|
1601
|
+
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" }) }),
|
|
1602
|
+
bgColor: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1603
|
+
/* @__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" }),
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { fillOpacity: ".36", d: "M0 20h24v4H0z" })
|
|
1349
1605
|
] }),
|
|
1350
|
-
link: /* @__PURE__ */ (0,
|
|
1351
|
-
chevronRight: /* @__PURE__ */ (0,
|
|
1352
|
-
chevronLeft: /* @__PURE__ */ (0,
|
|
1353
|
-
table: /* @__PURE__ */ (0,
|
|
1354
|
-
htmlFile: /* @__PURE__ */ (0,
|
|
1606
|
+
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" }) }),
|
|
1607
|
+
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" }) }),
|
|
1608
|
+
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" }) }),
|
|
1609
|
+
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" }) }),
|
|
1610
|
+
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" }) })
|
|
1355
1611
|
};
|
|
1356
1612
|
var BlockTypeIcons = {
|
|
1357
|
-
paragraph: /* @__PURE__ */ (0,
|
|
1358
|
-
h1: /* @__PURE__ */ (0,
|
|
1359
|
-
h2: /* @__PURE__ */ (0,
|
|
1360
|
-
h3: /* @__PURE__ */ (0,
|
|
1361
|
-
h4: /* @__PURE__ */ (0,
|
|
1362
|
-
h5: /* @__PURE__ */ (0,
|
|
1363
|
-
h6: /* @__PURE__ */ (0,
|
|
1364
|
-
toggleH1: /* @__PURE__ */ (0,
|
|
1365
|
-
/* @__PURE__ */ (0,
|
|
1366
|
-
/* @__PURE__ */ (0,
|
|
1613
|
+
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" }) }),
|
|
1614
|
+
h1: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H1" }),
|
|
1615
|
+
h2: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H2" }),
|
|
1616
|
+
h3: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H3" }),
|
|
1617
|
+
h4: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H4" }),
|
|
1618
|
+
h5: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H5" }),
|
|
1619
|
+
h6: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "lumir-block-icon-text", children: "H6" }),
|
|
1620
|
+
toggleH1: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "lumir-block-icon-toggle", children: [
|
|
1621
|
+
/* @__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" }) }),
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H1" })
|
|
1367
1623
|
] }),
|
|
1368
|
-
toggleH2: /* @__PURE__ */ (0,
|
|
1369
|
-
/* @__PURE__ */ (0,
|
|
1370
|
-
/* @__PURE__ */ (0,
|
|
1624
|
+
toggleH2: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "lumir-block-icon-toggle", children: [
|
|
1625
|
+
/* @__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" }) }),
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H2" })
|
|
1371
1627
|
] }),
|
|
1372
|
-
toggleH3: /* @__PURE__ */ (0,
|
|
1373
|
-
/* @__PURE__ */ (0,
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1628
|
+
toggleH3: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "lumir-block-icon-toggle", children: [
|
|
1629
|
+
/* @__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" }) }),
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H3" })
|
|
1375
1631
|
] }),
|
|
1376
|
-
quote: /* @__PURE__ */ (0,
|
|
1377
|
-
codeBlock: /* @__PURE__ */ (0,
|
|
1378
|
-
toggleList: /* @__PURE__ */ (0,
|
|
1379
|
-
/* @__PURE__ */ (0,
|
|
1380
|
-
/* @__PURE__ */ (0,
|
|
1632
|
+
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" }) }),
|
|
1633
|
+
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" }) }),
|
|
1634
|
+
toggleList: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M10 6h10v2H10zM10 11h10v2H10zM10 16h10v2H10z" }),
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1381
1637
|
"path",
|
|
1382
1638
|
{
|
|
1383
1639
|
d: "M4 8l4 4-4 4",
|
|
@@ -1389,15 +1645,15 @@ var BlockTypeIcons = {
|
|
|
1389
1645
|
}
|
|
1390
1646
|
)
|
|
1391
1647
|
] }),
|
|
1392
|
-
bulletList: /* @__PURE__ */ (0,
|
|
1393
|
-
/* @__PURE__ */ (0,
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
1395
|
-
/* @__PURE__ */ (0,
|
|
1396
|
-
/* @__PURE__ */ (0,
|
|
1648
|
+
bulletList: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "4", cy: "6", r: "1.5" }),
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "4", cy: "12", r: "1.5" }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("circle", { cx: "4", cy: "18", r: "1.5" }),
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 5h12v2H8zM8 11h12v2H8zM8 17h12v2H8z" })
|
|
1397
1653
|
] }),
|
|
1398
|
-
numberedList: /* @__PURE__ */ (0,
|
|
1399
|
-
checkList: /* @__PURE__ */ (0,
|
|
1400
|
-
/* @__PURE__ */ (0,
|
|
1654
|
+
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" }) }),
|
|
1655
|
+
checkList: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { viewBox: "0 0 24 24", fill: "currentColor", width: "20", height: "20", children: [
|
|
1656
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1401
1657
|
"rect",
|
|
1402
1658
|
{
|
|
1403
1659
|
x: "3",
|
|
@@ -1410,7 +1666,7 @@ var BlockTypeIcons = {
|
|
|
1410
1666
|
strokeWidth: "1.5"
|
|
1411
1667
|
}
|
|
1412
1668
|
),
|
|
1413
|
-
/* @__PURE__ */ (0,
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1414
1670
|
"path",
|
|
1415
1671
|
{
|
|
1416
1672
|
d: "M4.5 7l1.5 1.5 3-3",
|
|
@@ -1421,8 +1677,8 @@ var BlockTypeIcons = {
|
|
|
1421
1677
|
strokeLinejoin: "round"
|
|
1422
1678
|
}
|
|
1423
1679
|
),
|
|
1424
|
-
/* @__PURE__ */ (0,
|
|
1425
|
-
/* @__PURE__ */ (0,
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 6h8v2h-8z" }),
|
|
1681
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1426
1682
|
"rect",
|
|
1427
1683
|
{
|
|
1428
1684
|
x: "3",
|
|
@@ -1435,37 +1691,37 @@ var BlockTypeIcons = {
|
|
|
1435
1691
|
strokeWidth: "1.5"
|
|
1436
1692
|
}
|
|
1437
1693
|
),
|
|
1438
|
-
/* @__PURE__ */ (0,
|
|
1694
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M12 16h8v2h-8z" })
|
|
1439
1695
|
] })
|
|
1440
1696
|
};
|
|
1441
1697
|
|
|
1442
1698
|
// src/components/FloatingMenu/components/ToolbarDivider.tsx
|
|
1443
|
-
var
|
|
1444
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0,
|
|
1699
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1700
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "lumir-toolbar-divider" });
|
|
1445
1701
|
|
|
1446
1702
|
// src/components/FloatingMenu/components/UndoRedoButtons.tsx
|
|
1447
|
-
var
|
|
1448
|
-
var
|
|
1703
|
+
var import_react7 = require("react");
|
|
1704
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1449
1705
|
var UndoRedoButtons = ({ editor }) => {
|
|
1450
|
-
const handleUndo = (0,
|
|
1706
|
+
const handleUndo = (0, import_react7.useCallback)(() => {
|
|
1451
1707
|
try {
|
|
1452
1708
|
editor?.undo?.();
|
|
1453
1709
|
} catch (err) {
|
|
1454
1710
|
console.error("Undo failed:", err);
|
|
1455
1711
|
}
|
|
1456
1712
|
}, [editor]);
|
|
1457
|
-
const handleRedo = (0,
|
|
1713
|
+
const handleRedo = (0, import_react7.useCallback)(() => {
|
|
1458
1714
|
try {
|
|
1459
1715
|
editor?.redo?.();
|
|
1460
1716
|
} catch (err) {
|
|
1461
1717
|
console.error("Redo failed:", err);
|
|
1462
1718
|
}
|
|
1463
1719
|
}, [editor]);
|
|
1464
|
-
const handleMouseDown = (0,
|
|
1720
|
+
const handleMouseDown = (0, import_react7.useCallback)((e) => {
|
|
1465
1721
|
e.preventDefault();
|
|
1466
1722
|
}, []);
|
|
1467
|
-
return /* @__PURE__ */ (0,
|
|
1468
|
-
/* @__PURE__ */ (0,
|
|
1723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
1724
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1469
1725
|
"button",
|
|
1470
1726
|
{
|
|
1471
1727
|
className: "lumir-toolbar-btn",
|
|
@@ -1476,7 +1732,7 @@ var UndoRedoButtons = ({ editor }) => {
|
|
|
1476
1732
|
children: Icons.undo
|
|
1477
1733
|
}
|
|
1478
1734
|
),
|
|
1479
|
-
/* @__PURE__ */ (0,
|
|
1735
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1480
1736
|
"button",
|
|
1481
1737
|
{
|
|
1482
1738
|
className: "lumir-toolbar-btn",
|
|
@@ -1491,8 +1747,8 @@ var UndoRedoButtons = ({ editor }) => {
|
|
|
1491
1747
|
};
|
|
1492
1748
|
|
|
1493
1749
|
// src/components/FloatingMenu/components/TextStyleButton.tsx
|
|
1494
|
-
var
|
|
1495
|
-
var
|
|
1750
|
+
var import_react8 = require("react");
|
|
1751
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1496
1752
|
var iconMap = {
|
|
1497
1753
|
bold: Icons.bold,
|
|
1498
1754
|
italic: Icons.italic,
|
|
@@ -1518,17 +1774,17 @@ var TextStyleButton = ({
|
|
|
1518
1774
|
}
|
|
1519
1775
|
};
|
|
1520
1776
|
const isActive = getIsActive();
|
|
1521
|
-
const handleClick = (0,
|
|
1777
|
+
const handleClick = (0, import_react8.useCallback)(() => {
|
|
1522
1778
|
try {
|
|
1523
1779
|
editor?.toggleStyles?.({ [style]: true });
|
|
1524
1780
|
} catch (err) {
|
|
1525
1781
|
console.error(`Toggle ${style} failed:`, err);
|
|
1526
1782
|
}
|
|
1527
1783
|
}, [editor, style]);
|
|
1528
|
-
const handleMouseDown = (0,
|
|
1784
|
+
const handleMouseDown = (0, import_react8.useCallback)((e) => {
|
|
1529
1785
|
e.preventDefault();
|
|
1530
1786
|
}, []);
|
|
1531
|
-
return /* @__PURE__ */ (0,
|
|
1787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1532
1788
|
"button",
|
|
1533
1789
|
{
|
|
1534
1790
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -1542,8 +1798,8 @@ var TextStyleButton = ({
|
|
|
1542
1798
|
};
|
|
1543
1799
|
|
|
1544
1800
|
// src/components/FloatingMenu/components/AlignButton.tsx
|
|
1545
|
-
var
|
|
1546
|
-
var
|
|
1801
|
+
var import_react9 = require("react");
|
|
1802
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1547
1803
|
var iconMap2 = {
|
|
1548
1804
|
left: Icons.alignLeft,
|
|
1549
1805
|
center: Icons.alignCenter,
|
|
@@ -1567,7 +1823,7 @@ var AlignButton = ({
|
|
|
1567
1823
|
}
|
|
1568
1824
|
};
|
|
1569
1825
|
const isActive = getCurrentAlignment() === alignment;
|
|
1570
|
-
const handleClick = (0,
|
|
1826
|
+
const handleClick = (0, import_react9.useCallback)(() => {
|
|
1571
1827
|
try {
|
|
1572
1828
|
const block = editor?.getTextCursorPosition()?.block;
|
|
1573
1829
|
if (block && editor?.updateBlock) {
|
|
@@ -1577,10 +1833,10 @@ var AlignButton = ({
|
|
|
1577
1833
|
console.error(`Set alignment ${alignment} failed:`, err);
|
|
1578
1834
|
}
|
|
1579
1835
|
}, [editor, alignment]);
|
|
1580
|
-
const handleMouseDown = (0,
|
|
1836
|
+
const handleMouseDown = (0, import_react9.useCallback)((e) => {
|
|
1581
1837
|
e.preventDefault();
|
|
1582
1838
|
}, []);
|
|
1583
|
-
return /* @__PURE__ */ (0,
|
|
1839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1584
1840
|
"button",
|
|
1585
1841
|
{
|
|
1586
1842
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -1594,8 +1850,8 @@ var AlignButton = ({
|
|
|
1594
1850
|
};
|
|
1595
1851
|
|
|
1596
1852
|
// src/components/FloatingMenu/components/ListButton.tsx
|
|
1597
|
-
var
|
|
1598
|
-
var
|
|
1853
|
+
var import_react10 = require("react");
|
|
1854
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1599
1855
|
var iconMap3 = {
|
|
1600
1856
|
bullet: Icons.bulletList,
|
|
1601
1857
|
numbered: Icons.numberedList
|
|
@@ -1615,7 +1871,7 @@ var ListButton = ({ editor, type }) => {
|
|
|
1615
1871
|
}
|
|
1616
1872
|
};
|
|
1617
1873
|
const isActive = getIsActive();
|
|
1618
|
-
const handleClick = (0,
|
|
1874
|
+
const handleClick = (0, import_react10.useCallback)(() => {
|
|
1619
1875
|
try {
|
|
1620
1876
|
const block = editor?.getTextCursorPosition()?.block;
|
|
1621
1877
|
if (block && editor?.updateBlock) {
|
|
@@ -1627,10 +1883,10 @@ var ListButton = ({ editor, type }) => {
|
|
|
1627
1883
|
console.error(`List toggle failed:`, err);
|
|
1628
1884
|
}
|
|
1629
1885
|
}, [editor, type]);
|
|
1630
|
-
const handleMouseDown = (0,
|
|
1886
|
+
const handleMouseDown = (0, import_react10.useCallback)((e) => {
|
|
1631
1887
|
e.preventDefault();
|
|
1632
1888
|
}, []);
|
|
1633
|
-
return /* @__PURE__ */ (0,
|
|
1889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1634
1890
|
"button",
|
|
1635
1891
|
{
|
|
1636
1892
|
className: cn("lumir-toolbar-btn", isActive && "is-active"),
|
|
@@ -1644,13 +1900,13 @@ var ListButton = ({ editor, type }) => {
|
|
|
1644
1900
|
};
|
|
1645
1901
|
|
|
1646
1902
|
// src/components/FloatingMenu/components/ImageButton.tsx
|
|
1647
|
-
var
|
|
1648
|
-
var
|
|
1903
|
+
var import_react11 = require("react");
|
|
1904
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1649
1905
|
var ImageButton = ({
|
|
1650
1906
|
editor,
|
|
1651
1907
|
onImageUpload
|
|
1652
1908
|
}) => {
|
|
1653
|
-
const handleClick = (0,
|
|
1909
|
+
const handleClick = (0, import_react11.useCallback)(() => {
|
|
1654
1910
|
if (onImageUpload) {
|
|
1655
1911
|
onImageUpload();
|
|
1656
1912
|
} else {
|
|
@@ -1675,10 +1931,10 @@ var ImageButton = ({
|
|
|
1675
1931
|
input.click();
|
|
1676
1932
|
}
|
|
1677
1933
|
}, [editor, onImageUpload]);
|
|
1678
|
-
const handleMouseDown = (0,
|
|
1934
|
+
const handleMouseDown = (0, import_react11.useCallback)((e) => {
|
|
1679
1935
|
e.preventDefault();
|
|
1680
1936
|
}, []);
|
|
1681
|
-
return /* @__PURE__ */ (0,
|
|
1937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1682
1938
|
"button",
|
|
1683
1939
|
{
|
|
1684
1940
|
className: "lumir-toolbar-btn",
|
|
@@ -1692,7 +1948,7 @@ var ImageButton = ({
|
|
|
1692
1948
|
};
|
|
1693
1949
|
|
|
1694
1950
|
// src/components/FloatingMenu/components/ColorButton.tsx
|
|
1695
|
-
var
|
|
1951
|
+
var import_react12 = require("react");
|
|
1696
1952
|
|
|
1697
1953
|
// src/constants/colors.ts
|
|
1698
1954
|
var TEXT_COLORS = [
|
|
@@ -1726,13 +1982,13 @@ var getHexFromColorValue = (value, type) => {
|
|
|
1726
1982
|
};
|
|
1727
1983
|
|
|
1728
1984
|
// src/components/FloatingMenu/components/ColorButton.tsx
|
|
1729
|
-
var
|
|
1985
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1730
1986
|
var ColorButton = ({ editor, type }) => {
|
|
1731
|
-
const [isOpen, setIsOpen] = (0,
|
|
1732
|
-
const [currentColor, setCurrentColor] = (0,
|
|
1733
|
-
const dropdownRef = (0,
|
|
1987
|
+
const [isOpen, setIsOpen] = (0, import_react12.useState)(false);
|
|
1988
|
+
const [currentColor, setCurrentColor] = (0, import_react12.useState)("default");
|
|
1989
|
+
const dropdownRef = (0, import_react12.useRef)(null);
|
|
1734
1990
|
const colors = type === "text" ? TEXT_COLORS : BACKGROUND_COLORS;
|
|
1735
|
-
const getCurrentColor = (0,
|
|
1991
|
+
const getCurrentColor = (0, import_react12.useCallback)(() => {
|
|
1736
1992
|
try {
|
|
1737
1993
|
const activeStyles = editor?.getActiveStyles?.() || {};
|
|
1738
1994
|
if (type === "text" && activeStyles.textColor) {
|
|
@@ -1744,13 +2000,13 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1744
2000
|
}
|
|
1745
2001
|
return "default";
|
|
1746
2002
|
}, [editor, type]);
|
|
1747
|
-
(0,
|
|
2003
|
+
(0, import_react12.useEffect)(() => {
|
|
1748
2004
|
if (isOpen) {
|
|
1749
2005
|
const color = getCurrentColor();
|
|
1750
2006
|
setCurrentColor(color);
|
|
1751
2007
|
}
|
|
1752
2008
|
}, [isOpen, getCurrentColor]);
|
|
1753
|
-
(0,
|
|
2009
|
+
(0, import_react12.useEffect)(() => {
|
|
1754
2010
|
const handleClickOutside = (e) => {
|
|
1755
2011
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
1756
2012
|
setIsOpen(false);
|
|
@@ -1759,7 +2015,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1759
2015
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1760
2016
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1761
2017
|
}, []);
|
|
1762
|
-
const handleColorSelect = (0,
|
|
2018
|
+
const handleColorSelect = (0, import_react12.useCallback)(
|
|
1763
2019
|
(color) => {
|
|
1764
2020
|
try {
|
|
1765
2021
|
if (!editor) return;
|
|
@@ -1776,11 +2032,11 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1776
2032
|
},
|
|
1777
2033
|
[editor, type]
|
|
1778
2034
|
);
|
|
1779
|
-
const handleMouseDown = (0,
|
|
2035
|
+
const handleMouseDown = (0, import_react12.useCallback)((e) => {
|
|
1780
2036
|
e.preventDefault();
|
|
1781
2037
|
}, []);
|
|
1782
|
-
return /* @__PURE__ */ (0,
|
|
1783
|
-
/* @__PURE__ */ (0,
|
|
2038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2039
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1784
2040
|
"button",
|
|
1785
2041
|
{
|
|
1786
2042
|
className: "lumir-toolbar-btn lumir-color-btn",
|
|
@@ -1790,7 +2046,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1790
2046
|
type: "button",
|
|
1791
2047
|
children: [
|
|
1792
2048
|
type === "text" ? Icons.textColor : Icons.bgColor,
|
|
1793
|
-
/* @__PURE__ */ (0,
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1794
2050
|
"span",
|
|
1795
2051
|
{
|
|
1796
2052
|
className: "lumir-color-indicator",
|
|
@@ -1802,7 +2058,7 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1802
2058
|
]
|
|
1803
2059
|
}
|
|
1804
2060
|
),
|
|
1805
|
-
isOpen && /* @__PURE__ */ (0,
|
|
2061
|
+
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)(
|
|
1806
2062
|
"button",
|
|
1807
2063
|
{
|
|
1808
2064
|
className: cn(
|
|
@@ -1821,8 +2077,8 @@ var ColorButton = ({ editor, type }) => {
|
|
|
1821
2077
|
};
|
|
1822
2078
|
|
|
1823
2079
|
// src/components/FloatingMenu/components/LinkButton.tsx
|
|
1824
|
-
var
|
|
1825
|
-
var
|
|
2080
|
+
var import_react13 = require("react");
|
|
2081
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1826
2082
|
var isDangerousProtocol = (url) => {
|
|
1827
2083
|
const trimmedUrl = url.trim().toLowerCase();
|
|
1828
2084
|
const dangerousPatterns = [
|
|
@@ -1848,13 +2104,13 @@ var normalizeUrl = (url) => {
|
|
|
1848
2104
|
return `https://${trimmedUrl}`;
|
|
1849
2105
|
};
|
|
1850
2106
|
var LinkButton = ({ editor }) => {
|
|
1851
|
-
const [isOpen, setIsOpen] = (0,
|
|
1852
|
-
const [linkUrl, setLinkUrl] = (0,
|
|
1853
|
-
const [errorMsg, setErrorMsg] = (0,
|
|
1854
|
-
const dropdownRef = (0,
|
|
1855
|
-
const inputRef = (0,
|
|
1856
|
-
const hasSelectionRef = (0,
|
|
1857
|
-
(0,
|
|
2107
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
2108
|
+
const [linkUrl, setLinkUrl] = (0, import_react13.useState)("");
|
|
2109
|
+
const [errorMsg, setErrorMsg] = (0, import_react13.useState)(null);
|
|
2110
|
+
const dropdownRef = (0, import_react13.useRef)(null);
|
|
2111
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
2112
|
+
const hasSelectionRef = (0, import_react13.useRef)(false);
|
|
2113
|
+
(0, import_react13.useEffect)(() => {
|
|
1858
2114
|
const handleClickOutside = (e) => {
|
|
1859
2115
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
1860
2116
|
setIsOpen(false);
|
|
@@ -1865,7 +2121,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1865
2121
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1866
2122
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1867
2123
|
}, []);
|
|
1868
|
-
(0,
|
|
2124
|
+
(0, import_react13.useEffect)(() => {
|
|
1869
2125
|
if (isOpen && inputRef.current) {
|
|
1870
2126
|
try {
|
|
1871
2127
|
const selectedText = editor?.getSelectedText?.() || "";
|
|
@@ -1876,7 +2132,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1876
2132
|
setTimeout(() => inputRef.current?.focus(), 0);
|
|
1877
2133
|
}
|
|
1878
2134
|
}, [isOpen, editor]);
|
|
1879
|
-
const handleSubmit = (0,
|
|
2135
|
+
const handleSubmit = (0, import_react13.useCallback)(
|
|
1880
2136
|
(e) => {
|
|
1881
2137
|
e?.preventDefault();
|
|
1882
2138
|
setErrorMsg(null);
|
|
@@ -1903,15 +2159,15 @@ var LinkButton = ({ editor }) => {
|
|
|
1903
2159
|
},
|
|
1904
2160
|
[editor, linkUrl]
|
|
1905
2161
|
);
|
|
1906
|
-
const handleCancel = (0,
|
|
2162
|
+
const handleCancel = (0, import_react13.useCallback)(() => {
|
|
1907
2163
|
setIsOpen(false);
|
|
1908
2164
|
setLinkUrl("");
|
|
1909
2165
|
setErrorMsg(null);
|
|
1910
2166
|
}, []);
|
|
1911
|
-
const handleMouseDown = (0,
|
|
2167
|
+
const handleMouseDown = (0, import_react13.useCallback)((e) => {
|
|
1912
2168
|
e.preventDefault();
|
|
1913
2169
|
}, []);
|
|
1914
|
-
const handleKeyDown = (0,
|
|
2170
|
+
const handleKeyDown = (0, import_react13.useCallback)(
|
|
1915
2171
|
(e) => {
|
|
1916
2172
|
if (e.key === "Enter") {
|
|
1917
2173
|
handleSubmit();
|
|
@@ -1921,8 +2177,8 @@ var LinkButton = ({ editor }) => {
|
|
|
1921
2177
|
},
|
|
1922
2178
|
[handleSubmit, handleCancel]
|
|
1923
2179
|
);
|
|
1924
|
-
return /* @__PURE__ */ (0,
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
2180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2181
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1926
2182
|
"button",
|
|
1927
2183
|
{
|
|
1928
2184
|
className: "lumir-toolbar-btn",
|
|
@@ -1933,8 +2189,8 @@ var LinkButton = ({ editor }) => {
|
|
|
1933
2189
|
children: Icons.link
|
|
1934
2190
|
}
|
|
1935
2191
|
),
|
|
1936
|
-
isOpen && /* @__PURE__ */ (0,
|
|
1937
|
-
/* @__PURE__ */ (0,
|
|
2192
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "lumir-dropdown-menu lumir-link-menu", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: handleSubmit, className: "lumir-link-form", children: [
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1938
2194
|
"input",
|
|
1939
2195
|
{
|
|
1940
2196
|
ref: inputRef,
|
|
@@ -1950,7 +2206,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1950
2206
|
onMouseDown: handleMouseDown
|
|
1951
2207
|
}
|
|
1952
2208
|
),
|
|
1953
|
-
errorMsg && /* @__PURE__ */ (0,
|
|
2209
|
+
errorMsg && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1954
2210
|
"div",
|
|
1955
2211
|
{
|
|
1956
2212
|
style: {
|
|
@@ -1962,8 +2218,8 @@ var LinkButton = ({ editor }) => {
|
|
|
1962
2218
|
children: errorMsg
|
|
1963
2219
|
}
|
|
1964
2220
|
),
|
|
1965
|
-
/* @__PURE__ */ (0,
|
|
1966
|
-
/* @__PURE__ */ (0,
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "lumir-link-actions", children: [
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1967
2223
|
"button",
|
|
1968
2224
|
{
|
|
1969
2225
|
type: "button",
|
|
@@ -1973,7 +2229,7 @@ var LinkButton = ({ editor }) => {
|
|
|
1973
2229
|
children: "\uCDE8\uC18C"
|
|
1974
2230
|
}
|
|
1975
2231
|
),
|
|
1976
|
-
/* @__PURE__ */ (0,
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1977
2233
|
"button",
|
|
1978
2234
|
{
|
|
1979
2235
|
type: "submit",
|
|
@@ -1989,10 +2245,10 @@ var LinkButton = ({ editor }) => {
|
|
|
1989
2245
|
};
|
|
1990
2246
|
|
|
1991
2247
|
// src/components/FloatingMenu/components/TableButton.tsx
|
|
1992
|
-
var
|
|
1993
|
-
var
|
|
2248
|
+
var import_react14 = require("react");
|
|
2249
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1994
2250
|
var TableButton = ({ editor }) => {
|
|
1995
|
-
const handleClick = (0,
|
|
2251
|
+
const handleClick = (0, import_react14.useCallback)(() => {
|
|
1996
2252
|
try {
|
|
1997
2253
|
const block = editor?.getTextCursorPosition()?.block;
|
|
1998
2254
|
if (!block || !editor?.insertBlocks) return;
|
|
@@ -2014,10 +2270,10 @@ var TableButton = ({ editor }) => {
|
|
|
2014
2270
|
console.error("Table insert failed:", err);
|
|
2015
2271
|
}
|
|
2016
2272
|
}, [editor]);
|
|
2017
|
-
const handleMouseDown = (0,
|
|
2273
|
+
const handleMouseDown = (0, import_react14.useCallback)((e) => {
|
|
2018
2274
|
e.preventDefault();
|
|
2019
2275
|
}, []);
|
|
2020
|
-
return /* @__PURE__ */ (0,
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2021
2277
|
"button",
|
|
2022
2278
|
{
|
|
2023
2279
|
className: "lumir-toolbar-btn",
|
|
@@ -2031,13 +2287,13 @@ var TableButton = ({ editor }) => {
|
|
|
2031
2287
|
};
|
|
2032
2288
|
|
|
2033
2289
|
// src/components/FloatingMenu/components/HTMLImportButton.tsx
|
|
2034
|
-
var
|
|
2035
|
-
var
|
|
2290
|
+
var import_react15 = require("react");
|
|
2291
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2036
2292
|
var HTMLImportButton = ({
|
|
2037
2293
|
editor
|
|
2038
2294
|
}) => {
|
|
2039
|
-
const fileInputRef = (0,
|
|
2040
|
-
const handleFileUpload = (0,
|
|
2295
|
+
const fileInputRef = (0, import_react15.useRef)(null);
|
|
2296
|
+
const handleFileUpload = (0, import_react15.useCallback)(
|
|
2041
2297
|
(e) => {
|
|
2042
2298
|
const file = e.target.files?.[0];
|
|
2043
2299
|
if (!file) return;
|
|
@@ -2073,14 +2329,14 @@ var HTMLImportButton = ({
|
|
|
2073
2329
|
},
|
|
2074
2330
|
[editor]
|
|
2075
2331
|
);
|
|
2076
|
-
const handleClick = (0,
|
|
2332
|
+
const handleClick = (0, import_react15.useCallback)(() => {
|
|
2077
2333
|
fileInputRef.current?.click();
|
|
2078
2334
|
}, []);
|
|
2079
|
-
const handleMouseDown = (0,
|
|
2335
|
+
const handleMouseDown = (0, import_react15.useCallback)((e) => {
|
|
2080
2336
|
e.preventDefault();
|
|
2081
2337
|
}, []);
|
|
2082
|
-
return /* @__PURE__ */ (0,
|
|
2083
|
-
/* @__PURE__ */ (0,
|
|
2338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
2339
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2084
2340
|
"input",
|
|
2085
2341
|
{
|
|
2086
2342
|
ref: fileInputRef,
|
|
@@ -2090,7 +2346,7 @@ var HTMLImportButton = ({
|
|
|
2090
2346
|
style: { display: "none" }
|
|
2091
2347
|
}
|
|
2092
2348
|
),
|
|
2093
|
-
/* @__PURE__ */ (0,
|
|
2349
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2094
2350
|
"button",
|
|
2095
2351
|
{
|
|
2096
2352
|
className: "lumir-toolbar-btn",
|
|
@@ -2105,8 +2361,8 @@ var HTMLImportButton = ({
|
|
|
2105
2361
|
};
|
|
2106
2362
|
|
|
2107
2363
|
// src/components/FloatingMenu/components/BlockTypeSelect.tsx
|
|
2108
|
-
var
|
|
2109
|
-
var
|
|
2364
|
+
var import_react16 = require("react");
|
|
2365
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2110
2366
|
var blockTypeCategories = [
|
|
2111
2367
|
{
|
|
2112
2368
|
category: "Headings",
|
|
@@ -2136,8 +2392,8 @@ var blockTypes = blockTypeCategories.flatMap(
|
|
|
2136
2392
|
(cat) => cat.items
|
|
2137
2393
|
);
|
|
2138
2394
|
var BlockTypeSelect = ({ editor }) => {
|
|
2139
|
-
const [isOpen, setIsOpen] = (0,
|
|
2140
|
-
const dropdownRef = (0,
|
|
2395
|
+
const [isOpen, setIsOpen] = (0, import_react16.useState)(false);
|
|
2396
|
+
const dropdownRef = (0, import_react16.useRef)(null);
|
|
2141
2397
|
const getCurrentBlock = () => {
|
|
2142
2398
|
try {
|
|
2143
2399
|
return editor?.getTextCursorPosition()?.block;
|
|
@@ -2149,7 +2405,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2149
2405
|
const currentType = currentBlock?.type || "paragraph";
|
|
2150
2406
|
const currentLevel = currentBlock?.props?.level;
|
|
2151
2407
|
const isCurrentToggle = currentType === "heading" && currentBlock?.props?.isToggleable === true;
|
|
2152
|
-
(0,
|
|
2408
|
+
(0, import_react16.useEffect)(() => {
|
|
2153
2409
|
const handleClickOutside = (e) => {
|
|
2154
2410
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
2155
2411
|
setIsOpen(false);
|
|
@@ -2178,7 +2434,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2178
2434
|
console.error("Block type change failed:", err);
|
|
2179
2435
|
}
|
|
2180
2436
|
};
|
|
2181
|
-
const handleMouseDown = (0,
|
|
2437
|
+
const handleMouseDown = (0, import_react16.useCallback)((e) => {
|
|
2182
2438
|
e.preventDefault();
|
|
2183
2439
|
}, []);
|
|
2184
2440
|
const getCurrentLabel = () => {
|
|
@@ -2209,8 +2465,8 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2209
2465
|
}
|
|
2210
2466
|
return currentType === bt.type;
|
|
2211
2467
|
};
|
|
2212
|
-
return /* @__PURE__ */ (0,
|
|
2213
|
-
/* @__PURE__ */ (0,
|
|
2468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lumir-dropdown-wrapper", ref: dropdownRef, children: [
|
|
2469
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2214
2470
|
"button",
|
|
2215
2471
|
{
|
|
2216
2472
|
className: "lumir-dropdown-btn lumir-block-type-btn",
|
|
@@ -2218,15 +2474,15 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2218
2474
|
onMouseDown: handleMouseDown,
|
|
2219
2475
|
type: "button",
|
|
2220
2476
|
children: [
|
|
2221
|
-
/* @__PURE__ */ (0,
|
|
2222
|
-
/* @__PURE__ */ (0,
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "lumir-block-icon", children: BlockTypeIcons[getCurrentIcon()] }),
|
|
2478
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "lumir-block-label", children: getCurrentLabel() }),
|
|
2223
2479
|
Icons.expandMore
|
|
2224
2480
|
]
|
|
2225
2481
|
}
|
|
2226
2482
|
),
|
|
2227
|
-
isOpen && /* @__PURE__ */ (0,
|
|
2228
|
-
/* @__PURE__ */ (0,
|
|
2229
|
-
category.items.map((bt) => /* @__PURE__ */ (0,
|
|
2483
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lumir-dropdown-menu lumir-block-menu", children: blockTypeCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "lumir-block-category", children: [
|
|
2484
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lumir-block-category-title", children: category.category }),
|
|
2485
|
+
category.items.map((bt) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
2230
2486
|
"button",
|
|
2231
2487
|
{
|
|
2232
2488
|
className: cn(
|
|
@@ -2236,8 +2492,8 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2236
2492
|
onClick: () => handleTypeChange(bt.type, bt.level, bt.isToggle),
|
|
2237
2493
|
onMouseDown: handleMouseDown,
|
|
2238
2494
|
children: [
|
|
2239
|
-
/* @__PURE__ */ (0,
|
|
2240
|
-
/* @__PURE__ */ (0,
|
|
2495
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "lumir-block-icon", children: BlockTypeIcons[bt.icon] }),
|
|
2496
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "lumir-block-item-title", children: bt.label })
|
|
2241
2497
|
]
|
|
2242
2498
|
},
|
|
2243
2499
|
bt.icon
|
|
@@ -2247,7 +2503,7 @@ var BlockTypeSelect = ({ editor }) => {
|
|
|
2247
2503
|
};
|
|
2248
2504
|
|
|
2249
2505
|
// src/components/FloatingMenu/index.tsx
|
|
2250
|
-
var
|
|
2506
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2251
2507
|
var COMPACT_BREAKPOINT = 700;
|
|
2252
2508
|
var MINIMIZED_BREAKPOINT = 400;
|
|
2253
2509
|
var FloatingMenu = ({
|
|
@@ -2256,12 +2512,12 @@ var FloatingMenu = ({
|
|
|
2256
2512
|
className,
|
|
2257
2513
|
onImageUpload
|
|
2258
2514
|
}) => {
|
|
2259
|
-
const wrapperRef = (0,
|
|
2260
|
-
const [isCompact, setIsCompact] = (0,
|
|
2261
|
-
const [isMinimizable, setIsMinimizable] = (0,
|
|
2262
|
-
const [isMinimized, setIsMinimized] = (0,
|
|
2263
|
-
const [, setSelectionTick] = (0,
|
|
2264
|
-
(0,
|
|
2515
|
+
const wrapperRef = (0, import_react17.useRef)(null);
|
|
2516
|
+
const [isCompact, setIsCompact] = (0, import_react17.useState)(false);
|
|
2517
|
+
const [isMinimizable, setIsMinimizable] = (0, import_react17.useState)(false);
|
|
2518
|
+
const [isMinimized, setIsMinimized] = (0, import_react17.useState)(false);
|
|
2519
|
+
const [, setSelectionTick] = (0, import_react17.useState)(0);
|
|
2520
|
+
(0, import_react17.useEffect)(() => {
|
|
2265
2521
|
if (!editor) return;
|
|
2266
2522
|
let debounceTimer = null;
|
|
2267
2523
|
const DEBOUNCE_DELAY = 150;
|
|
@@ -2285,7 +2541,7 @@ var FloatingMenu = ({
|
|
|
2285
2541
|
unsubscribeContent?.();
|
|
2286
2542
|
};
|
|
2287
2543
|
}, [editor]);
|
|
2288
|
-
(0,
|
|
2544
|
+
(0, import_react17.useEffect)(() => {
|
|
2289
2545
|
const checkWidth = () => {
|
|
2290
2546
|
if (wrapperRef.current) {
|
|
2291
2547
|
const width = wrapperRef.current.offsetWidth;
|
|
@@ -2300,8 +2556,8 @@ var FloatingMenu = ({
|
|
|
2300
2556
|
}
|
|
2301
2557
|
return () => resizeObserver.disconnect();
|
|
2302
2558
|
}, []);
|
|
2303
|
-
const MinimizedLayout = () => /* @__PURE__ */ (0,
|
|
2304
|
-
/* @__PURE__ */ (0,
|
|
2559
|
+
const MinimizedLayout = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2560
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2305
2561
|
"button",
|
|
2306
2562
|
{
|
|
2307
2563
|
className: "lumir-toolbar-button lumir-toggle-button",
|
|
@@ -2312,117 +2568,117 @@ var FloatingMenu = ({
|
|
|
2312
2568
|
children: isMinimized ? Icons.chevronRight : Icons.chevronLeft
|
|
2313
2569
|
}
|
|
2314
2570
|
),
|
|
2315
|
-
!isMinimized && /* @__PURE__ */ (0,
|
|
2316
|
-
/* @__PURE__ */ (0,
|
|
2317
|
-
/* @__PURE__ */ (0,
|
|
2318
|
-
/* @__PURE__ */ (0,
|
|
2319
|
-
/* @__PURE__ */ (0,
|
|
2320
|
-
/* @__PURE__ */ (0,
|
|
2321
|
-
/* @__PURE__ */ (0,
|
|
2322
|
-
/* @__PURE__ */ (0,
|
|
2323
|
-
/* @__PURE__ */ (0,
|
|
2324
|
-
/* @__PURE__ */ (0,
|
|
2325
|
-
/* @__PURE__ */ (0,
|
|
2571
|
+
!isMinimized && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2572
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2573
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UndoRedoButtons, { editor }),
|
|
2574
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2575
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BlockTypeSelect, { editor }) }),
|
|
2576
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2577
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2578
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "bold" }),
|
|
2579
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "italic" }),
|
|
2580
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "underline" }),
|
|
2581
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "strike" })
|
|
2326
2582
|
] }),
|
|
2327
|
-
/* @__PURE__ */ (0,
|
|
2328
|
-
/* @__PURE__ */ (0,
|
|
2329
|
-
/* @__PURE__ */ (0,
|
|
2330
|
-
/* @__PURE__ */ (0,
|
|
2331
|
-
/* @__PURE__ */ (0,
|
|
2583
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2584
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2585
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "left" }),
|
|
2586
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "center" }),
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "right" })
|
|
2332
2588
|
] }),
|
|
2333
|
-
/* @__PURE__ */ (0,
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2336
|
-
/* @__PURE__ */ (0,
|
|
2589
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2590
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2591
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListButton, { editor, type: "bullet" }),
|
|
2592
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListButton, { editor, type: "numbered" })
|
|
2337
2593
|
] }),
|
|
2338
|
-
/* @__PURE__ */ (0,
|
|
2339
|
-
/* @__PURE__ */ (0,
|
|
2340
|
-
/* @__PURE__ */ (0,
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2594
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2595
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2596
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorButton, { editor, type: "text" }),
|
|
2597
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorButton, { editor, type: "background" })
|
|
2342
2598
|
] }),
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2344
|
-
/* @__PURE__ */ (0,
|
|
2345
|
-
/* @__PURE__ */ (0,
|
|
2346
|
-
/* @__PURE__ */ (0,
|
|
2347
|
-
/* @__PURE__ */ (0,
|
|
2348
|
-
/* @__PURE__ */ (0,
|
|
2599
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2600
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2601
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageButton, { editor, onImageUpload }),
|
|
2602
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LinkButton, { editor }),
|
|
2603
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableButton, { editor }),
|
|
2604
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HTMLImportButton, { editor })
|
|
2349
2605
|
] })
|
|
2350
2606
|
] })
|
|
2351
2607
|
] });
|
|
2352
|
-
const SingleRowLayout = () => /* @__PURE__ */ (0,
|
|
2353
|
-
/* @__PURE__ */ (0,
|
|
2354
|
-
/* @__PURE__ */ (0,
|
|
2355
|
-
/* @__PURE__ */ (0,
|
|
2356
|
-
/* @__PURE__ */ (0,
|
|
2357
|
-
/* @__PURE__ */ (0,
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2359
|
-
/* @__PURE__ */ (0,
|
|
2360
|
-
/* @__PURE__ */ (0,
|
|
2361
|
-
/* @__PURE__ */ (0,
|
|
2608
|
+
const SingleRowLayout = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UndoRedoButtons, { editor }),
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BlockTypeSelect, { editor }) }),
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "bold" }),
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "italic" }),
|
|
2616
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "underline" }),
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "strike" })
|
|
2362
2618
|
] }),
|
|
2363
|
-
/* @__PURE__ */ (0,
|
|
2364
|
-
/* @__PURE__ */ (0,
|
|
2365
|
-
/* @__PURE__ */ (0,
|
|
2366
|
-
/* @__PURE__ */ (0,
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "left" }),
|
|
2622
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "center" }),
|
|
2623
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "right" })
|
|
2368
2624
|
] }),
|
|
2369
|
-
/* @__PURE__ */ (0,
|
|
2370
|
-
/* @__PURE__ */ (0,
|
|
2371
|
-
/* @__PURE__ */ (0,
|
|
2372
|
-
/* @__PURE__ */ (0,
|
|
2625
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2626
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListButton, { editor, type: "bullet" }),
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListButton, { editor, type: "numbered" })
|
|
2373
2629
|
] }),
|
|
2374
|
-
/* @__PURE__ */ (0,
|
|
2375
|
-
/* @__PURE__ */ (0,
|
|
2376
|
-
/* @__PURE__ */ (0,
|
|
2377
|
-
/* @__PURE__ */ (0,
|
|
2630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorButton, { editor, type: "text" }),
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorButton, { editor, type: "background" })
|
|
2378
2634
|
] }),
|
|
2379
|
-
/* @__PURE__ */ (0,
|
|
2380
|
-
/* @__PURE__ */ (0,
|
|
2381
|
-
/* @__PURE__ */ (0,
|
|
2382
|
-
/* @__PURE__ */ (0,
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2635
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2636
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageButton, { editor, onImageUpload }),
|
|
2638
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LinkButton, { editor }),
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableButton, { editor }),
|
|
2640
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HTMLImportButton, { editor })
|
|
2385
2641
|
] })
|
|
2386
2642
|
] });
|
|
2387
|
-
const TwoRowLayout = () => /* @__PURE__ */ (0,
|
|
2388
|
-
/* @__PURE__ */ (0,
|
|
2389
|
-
/* @__PURE__ */ (0,
|
|
2390
|
-
/* @__PURE__ */ (0,
|
|
2391
|
-
/* @__PURE__ */ (0,
|
|
2392
|
-
/* @__PURE__ */ (0,
|
|
2393
|
-
/* @__PURE__ */ (0,
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2395
|
-
/* @__PURE__ */ (0,
|
|
2643
|
+
const TwoRowLayout = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-row", children: [
|
|
2645
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UndoRedoButtons, { editor }),
|
|
2646
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "bold" }),
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "italic" }),
|
|
2650
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "underline" }),
|
|
2651
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TextStyleButton, { editor, style: "strike" })
|
|
2396
2652
|
] }),
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2398
|
-
/* @__PURE__ */ (0,
|
|
2399
|
-
/* @__PURE__ */ (0,
|
|
2400
|
-
/* @__PURE__ */ (0,
|
|
2401
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2654
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "left" }),
|
|
2656
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "center" }),
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlignButton, { editor, alignment: "right" })
|
|
2402
2658
|
] }),
|
|
2403
|
-
/* @__PURE__ */ (0,
|
|
2404
|
-
/* @__PURE__ */ (0,
|
|
2405
|
-
/* @__PURE__ */ (0,
|
|
2406
|
-
/* @__PURE__ */ (0,
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2660
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2661
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListButton, { editor, type: "bullet" }),
|
|
2662
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListButton, { editor, type: "numbered" })
|
|
2407
2663
|
] })
|
|
2408
2664
|
] }),
|
|
2409
|
-
/* @__PURE__ */ (0,
|
|
2410
|
-
/* @__PURE__ */ (0,
|
|
2411
|
-
/* @__PURE__ */ (0,
|
|
2412
|
-
/* @__PURE__ */ (0,
|
|
2413
|
-
/* @__PURE__ */ (0,
|
|
2414
|
-
/* @__PURE__ */ (0,
|
|
2665
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-row", children: [
|
|
2666
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "lumir-toolbar-group", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BlockTypeSelect, { editor }) }),
|
|
2667
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2668
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2669
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorButton, { editor, type: "text" }),
|
|
2670
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ColorButton, { editor, type: "background" })
|
|
2415
2671
|
] }),
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2417
|
-
/* @__PURE__ */ (0,
|
|
2418
|
-
/* @__PURE__ */ (0,
|
|
2419
|
-
/* @__PURE__ */ (0,
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
2421
|
-
/* @__PURE__ */ (0,
|
|
2672
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolbarDivider, {}),
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "lumir-toolbar-group", children: [
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ImageButton, { editor, onImageUpload }),
|
|
2675
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LinkButton, { editor }),
|
|
2676
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TableButton, { editor }),
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HTMLImportButton, { editor })
|
|
2422
2678
|
] })
|
|
2423
2679
|
] })
|
|
2424
2680
|
] });
|
|
2425
|
-
return /* @__PURE__ */ (0,
|
|
2681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2426
2682
|
"div",
|
|
2427
2683
|
{
|
|
2428
2684
|
ref: wrapperRef,
|
|
@@ -2432,7 +2688,7 @@ var FloatingMenu = ({
|
|
|
2432
2688
|
className
|
|
2433
2689
|
),
|
|
2434
2690
|
"data-position": position,
|
|
2435
|
-
children: /* @__PURE__ */ (0,
|
|
2691
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2436
2692
|
"div",
|
|
2437
2693
|
{
|
|
2438
2694
|
className: cn(
|
|
@@ -2441,7 +2697,7 @@ var FloatingMenu = ({
|
|
|
2441
2697
|
isMinimizable && "is-minimizable",
|
|
2442
2698
|
isMinimized && "is-minimized"
|
|
2443
2699
|
),
|
|
2444
|
-
children: isMinimizable ? /* @__PURE__ */ (0,
|
|
2700
|
+
children: isMinimizable ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MinimizedLayout, {}) : isCompact ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(TwoRowLayout, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SingleRowLayout, {})
|
|
2445
2701
|
}
|
|
2446
2702
|
)
|
|
2447
2703
|
}
|
|
@@ -2559,7 +2815,7 @@ var ALLOWED_VIDEO_EXTENSIONS = [
|
|
|
2559
2815
|
];
|
|
2560
2816
|
|
|
2561
2817
|
// src/components/LumirEditor.tsx
|
|
2562
|
-
var
|
|
2818
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2563
2819
|
var DEBUG_LOG = (loc, msg, data) => {
|
|
2564
2820
|
fetch("http://127.0.0.1:7686/ingest/1f8ee1c5-0cf0-4ae7-91ed-5ea7ed17130a", {
|
|
2565
2821
|
method: "POST",
|
|
@@ -2781,9 +3037,9 @@ var findBlockWithLink = (blocks, targetUrl) => {
|
|
|
2781
3037
|
return null;
|
|
2782
3038
|
};
|
|
2783
3039
|
var ConvertToPreviewButton = ({ url }) => {
|
|
2784
|
-
const editor = (0,
|
|
2785
|
-
const Components = (0,
|
|
2786
|
-
return /* @__PURE__ */ (0,
|
|
3040
|
+
const editor = (0, import_react19.useBlockNoteEditor)();
|
|
3041
|
+
const Components = (0, import_react19.useComponentsContext)();
|
|
3042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2787
3043
|
Components.LinkToolbar.Button,
|
|
2788
3044
|
{
|
|
2789
3045
|
className: "bn-button",
|
|
@@ -2802,29 +3058,29 @@ var ConvertToPreviewButton = ({ url }) => {
|
|
|
2802
3058
|
console.error("Convert to link preview failed:", err);
|
|
2803
3059
|
}
|
|
2804
3060
|
},
|
|
2805
|
-
icon: /* @__PURE__ */ (0,
|
|
2806
|
-
/* @__PURE__ */ (0,
|
|
2807
|
-
/* @__PURE__ */ (0,
|
|
2808
|
-
/* @__PURE__ */ (0,
|
|
3061
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
|
|
3062
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("rect", { x: "1", y: "3", width: "14", height: "10", rx: "2", stroke: "currentColor", strokeWidth: "1.5", fill: "none" }),
|
|
3063
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("line", { x1: "1", y1: "9", x2: "15", y2: "9", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("circle", { cx: "5", cy: "6.5", r: "1.5", stroke: "currentColor", strokeWidth: "1", fill: "none" })
|
|
2809
3065
|
] })
|
|
2810
3066
|
}
|
|
2811
3067
|
);
|
|
2812
3068
|
};
|
|
2813
3069
|
var CustomLinkToolbar = (props) => {
|
|
2814
|
-
const editor = (0,
|
|
2815
|
-
const Components = (0,
|
|
3070
|
+
const editor = (0, import_react19.useBlockNoteEditor)();
|
|
3071
|
+
const Components = (0, import_react19.useComponentsContext)();
|
|
2816
3072
|
const hasLinkPreview = !!editor?._linkPreviewApiEndpoint;
|
|
2817
|
-
return /* @__PURE__ */ (0,
|
|
3073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2818
3074
|
Components.LinkToolbar.Root,
|
|
2819
3075
|
{
|
|
2820
3076
|
className: "bn-toolbar bn-link-toolbar",
|
|
2821
3077
|
onMouseEnter: props.stopHideTimer,
|
|
2822
3078
|
onMouseLeave: props.startHideTimer,
|
|
2823
3079
|
children: [
|
|
2824
|
-
/* @__PURE__ */ (0,
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
2826
|
-
/* @__PURE__ */ (0,
|
|
2827
|
-
hasLinkPreview && /* @__PURE__ */ (0,
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.EditLinkButton, { url: props.url, text: props.text, editLink: props.editLink }),
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.OpenLinkButton, { url: props.url }),
|
|
3082
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.DeleteLinkButton, { deleteLink: props.deleteLink }),
|
|
3083
|
+
hasLinkPreview && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ConvertToPreviewButton, { url: props.url })
|
|
2828
3084
|
]
|
|
2829
3085
|
}
|
|
2830
3086
|
);
|
|
@@ -2866,13 +3122,13 @@ function LumirEditor({
|
|
|
2866
3122
|
onError,
|
|
2867
3123
|
onImageDelete
|
|
2868
3124
|
}) {
|
|
2869
|
-
const [isUploading, setIsUploading] = (0,
|
|
2870
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
2871
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
2872
|
-
const floatingMenuFileInputRef = (0,
|
|
2873
|
-
const floatingMenuBlockRef = (0,
|
|
2874
|
-
const floatingMenuUploadStartTimeRef = (0,
|
|
2875
|
-
const handleError = (0,
|
|
3125
|
+
const [isUploading, setIsUploading] = (0, import_react18.useState)(false);
|
|
3126
|
+
const [uploadProgress, setUploadProgress] = (0, import_react18.useState)(null);
|
|
3127
|
+
const [errorMessage, setErrorMessage] = (0, import_react18.useState)(null);
|
|
3128
|
+
const floatingMenuFileInputRef = (0, import_react18.useRef)(null);
|
|
3129
|
+
const floatingMenuBlockRef = (0, import_react18.useRef)(null);
|
|
3130
|
+
const floatingMenuUploadStartTimeRef = (0, import_react18.useRef)(0);
|
|
3131
|
+
const handleError = (0, import_react18.useCallback)(
|
|
2876
3132
|
(error) => {
|
|
2877
3133
|
onError?.(error);
|
|
2878
3134
|
setErrorMessage(error.getUserMessage());
|
|
@@ -2880,10 +3136,10 @@ function LumirEditor({
|
|
|
2880
3136
|
},
|
|
2881
3137
|
[onError]
|
|
2882
3138
|
);
|
|
2883
|
-
const validatedContent = (0,
|
|
3139
|
+
const validatedContent = (0, import_react18.useMemo)(() => {
|
|
2884
3140
|
return ContentUtils.validateContent(initialContent, initialEmptyBlocks);
|
|
2885
3141
|
}, [initialContent, initialEmptyBlocks]);
|
|
2886
|
-
const tableConfig = (0,
|
|
3142
|
+
const tableConfig = (0, import_react18.useMemo)(() => {
|
|
2887
3143
|
return EditorConfig.getDefaultTableConfig(tables);
|
|
2888
3144
|
}, [
|
|
2889
3145
|
tables?.splitCells,
|
|
@@ -2891,10 +3147,10 @@ function LumirEditor({
|
|
|
2891
3147
|
tables?.cellTextColor,
|
|
2892
3148
|
tables?.headers
|
|
2893
3149
|
]);
|
|
2894
|
-
const headingConfig = (0,
|
|
3150
|
+
const headingConfig = (0, import_react18.useMemo)(() => {
|
|
2895
3151
|
return EditorConfig.getDefaultHeadingConfig(heading);
|
|
2896
3152
|
}, [heading?.levels?.join(",") ?? ""]);
|
|
2897
|
-
const disabledExtensions = (0,
|
|
3153
|
+
const disabledExtensions = (0, import_react18.useMemo)(() => {
|
|
2898
3154
|
return EditorConfig.getDisabledExtensions(
|
|
2899
3155
|
disableExtensions,
|
|
2900
3156
|
allowVideoUpload,
|
|
@@ -2902,18 +3158,18 @@ function LumirEditor({
|
|
|
2902
3158
|
allowFileUpload
|
|
2903
3159
|
);
|
|
2904
3160
|
}, [disableExtensions, allowVideoUpload, allowAudioUpload, allowFileUpload]);
|
|
2905
|
-
(0,
|
|
3161
|
+
(0, import_react18.useEffect)(() => {
|
|
2906
3162
|
DEBUG_LOG("LumirEditor:init:disabledExtensions", "snapshot", {
|
|
2907
3163
|
allowVideoUpload,
|
|
2908
3164
|
hasVideoInDisabled: disabledExtensions.includes("video"),
|
|
2909
3165
|
disabledList: disabledExtensions.slice(0, 15)
|
|
2910
3166
|
});
|
|
2911
3167
|
}, [allowVideoUpload, disabledExtensions]);
|
|
2912
|
-
const fileNameTransformRef = (0,
|
|
2913
|
-
(0,
|
|
3168
|
+
const fileNameTransformRef = (0, import_react18.useRef)(s3Upload?.fileNameTransform);
|
|
3169
|
+
(0, import_react18.useEffect)(() => {
|
|
2914
3170
|
fileNameTransformRef.current = s3Upload?.fileNameTransform;
|
|
2915
3171
|
}, [s3Upload?.fileNameTransform]);
|
|
2916
|
-
const memoizedS3Upload = (0,
|
|
3172
|
+
const memoizedS3Upload = (0, import_react18.useMemo)(() => {
|
|
2917
3173
|
if (!s3Upload) return void 0;
|
|
2918
3174
|
return {
|
|
2919
3175
|
apiEndpoint: s3Upload.apiEndpoint,
|
|
@@ -2942,7 +3198,7 @@ function LumirEditor({
|
|
|
2942
3198
|
s3Upload?.maxRetries,
|
|
2943
3199
|
s3Upload?.onProgress
|
|
2944
3200
|
]);
|
|
2945
|
-
const editor = (0,
|
|
3201
|
+
const editor = (0, import_react19.useCreateBlockNote)(
|
|
2946
3202
|
{
|
|
2947
3203
|
// HTML 미리보기 블록이 포함된 커스텀 스키마 사용
|
|
2948
3204
|
schema,
|
|
@@ -3124,12 +3380,12 @@ function LumirEditor({
|
|
|
3124
3380
|
if (editor && linkPreview?.apiEndpoint) {
|
|
3125
3381
|
editor._linkPreviewApiEndpoint = linkPreview.apiEndpoint;
|
|
3126
3382
|
}
|
|
3127
|
-
(0,
|
|
3383
|
+
(0, import_react18.useEffect)(() => {
|
|
3128
3384
|
if (editor) {
|
|
3129
3385
|
editor.isEditable = editable;
|
|
3130
3386
|
}
|
|
3131
3387
|
}, [editor, editable]);
|
|
3132
|
-
(0,
|
|
3388
|
+
(0, import_react18.useEffect)(() => {
|
|
3133
3389
|
if (!editor || !onContentChange) return;
|
|
3134
3390
|
const handleContentChange = () => {
|
|
3135
3391
|
const blocks = editor.topLevelBlocks;
|
|
@@ -3137,13 +3393,13 @@ function LumirEditor({
|
|
|
3137
3393
|
};
|
|
3138
3394
|
return editor.onEditorContentChange(handleContentChange);
|
|
3139
3395
|
}, [editor, onContentChange]);
|
|
3140
|
-
const previousMediaUrlsRef = (0,
|
|
3141
|
-
(0,
|
|
3396
|
+
const previousMediaUrlsRef = (0, import_react18.useRef)(/* @__PURE__ */ new Set());
|
|
3397
|
+
(0, import_react18.useEffect)(() => {
|
|
3142
3398
|
if (!editor) return;
|
|
3143
3399
|
const initialBlocks = editor.topLevelBlocks;
|
|
3144
3400
|
previousMediaUrlsRef.current = extractMediaUrls(initialBlocks);
|
|
3145
3401
|
}, [editor]);
|
|
3146
|
-
(0,
|
|
3402
|
+
(0, import_react18.useEffect)(() => {
|
|
3147
3403
|
if (!editor || !onImageDelete) return;
|
|
3148
3404
|
const handleMediaDeleteCheck = () => {
|
|
3149
3405
|
const currentBlocks = editor.topLevelBlocks;
|
|
@@ -3157,7 +3413,7 @@ function LumirEditor({
|
|
|
3157
3413
|
};
|
|
3158
3414
|
return editor.onEditorContentChange(handleMediaDeleteCheck);
|
|
3159
3415
|
}, [editor, onImageDelete]);
|
|
3160
|
-
(0,
|
|
3416
|
+
(0, import_react18.useEffect)(() => {
|
|
3161
3417
|
const el = editor?.domElement;
|
|
3162
3418
|
if (!el) return;
|
|
3163
3419
|
const handleDragOver = (e) => {
|
|
@@ -3288,20 +3544,20 @@ function LumirEditor({
|
|
|
3288
3544
|
el.removeEventListener("drop", handleDrop, { capture: true });
|
|
3289
3545
|
};
|
|
3290
3546
|
}, [editor, allowVideoUpload]);
|
|
3291
|
-
const computedSideMenu = (0,
|
|
3547
|
+
const computedSideMenu = (0, import_react18.useMemo)(() => {
|
|
3292
3548
|
return sideMenuAddButton ? sideMenu : false;
|
|
3293
3549
|
}, [sideMenuAddButton, sideMenu]);
|
|
3294
|
-
const DragHandleOnlySideMenu = (0,
|
|
3295
|
-
return (props) => /* @__PURE__ */ (0,
|
|
3550
|
+
const DragHandleOnlySideMenu = (0, import_react18.useMemo)(() => {
|
|
3551
|
+
return (props) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.SideMenu, { ...props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.DragHandleButton, { ...props }) });
|
|
3296
3552
|
}, []);
|
|
3297
|
-
return /* @__PURE__ */ (0,
|
|
3553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3298
3554
|
"div",
|
|
3299
3555
|
{
|
|
3300
3556
|
className: cn("lumirEditor", className),
|
|
3301
3557
|
style: { position: "relative", display: "flex", flexDirection: "column" },
|
|
3302
3558
|
children: [
|
|
3303
|
-
floatingMenu && editor && /* @__PURE__ */ (0,
|
|
3304
|
-
/* @__PURE__ */ (0,
|
|
3559
|
+
floatingMenu && editor && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
3560
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3305
3561
|
"input",
|
|
3306
3562
|
{
|
|
3307
3563
|
ref: floatingMenuFileInputRef,
|
|
@@ -3372,7 +3628,7 @@ function LumirEditor({
|
|
|
3372
3628
|
}
|
|
3373
3629
|
}
|
|
3374
3630
|
),
|
|
3375
|
-
/* @__PURE__ */ (0,
|
|
3631
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3376
3632
|
FloatingMenu,
|
|
3377
3633
|
{
|
|
3378
3634
|
editor,
|
|
@@ -3404,7 +3660,7 @@ function LumirEditor({
|
|
|
3404
3660
|
}
|
|
3405
3661
|
)
|
|
3406
3662
|
] }),
|
|
3407
|
-
/* @__PURE__ */ (0,
|
|
3663
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3408
3664
|
import_mantine.BlockNoteView,
|
|
3409
3665
|
{
|
|
3410
3666
|
editor,
|
|
@@ -3419,14 +3675,14 @@ function LumirEditor({
|
|
|
3419
3675
|
tableHandles,
|
|
3420
3676
|
onSelectionChange,
|
|
3421
3677
|
children: [
|
|
3422
|
-
linkToolbar && (linkPreview?.apiEndpoint ? /* @__PURE__ */ (0,
|
|
3423
|
-
/* @__PURE__ */ (0,
|
|
3424
|
-
|
|
3678
|
+
linkToolbar && (linkPreview?.apiEndpoint ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.LinkToolbarController, { linkToolbar: CustomLinkToolbar }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.LinkToolbarController, {})),
|
|
3679
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3680
|
+
import_react19.SuggestionMenuController,
|
|
3425
3681
|
{
|
|
3426
3682
|
triggerCharacter: "/",
|
|
3427
|
-
getItems: (0,
|
|
3683
|
+
getItems: (0, import_react18.useCallback)(
|
|
3428
3684
|
async (query) => {
|
|
3429
|
-
const items = (0,
|
|
3685
|
+
const items = (0, import_react19.getDefaultReactSlashMenuItems)(editor);
|
|
3430
3686
|
const filtered = items.filter((item) => {
|
|
3431
3687
|
const key = (item?.key || "").toString().toLowerCase();
|
|
3432
3688
|
const title = (item?.title || "").toString().toLowerCase();
|
|
@@ -3468,7 +3724,7 @@ function LumirEditor({
|
|
|
3468
3724
|
},
|
|
3469
3725
|
aliases: ["html", "preview", "\uC6F9", "\uC6F9\uD398\uC774\uC9C0"],
|
|
3470
3726
|
group: "Embeds",
|
|
3471
|
-
icon: /* @__PURE__ */ (0,
|
|
3727
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3472
3728
|
"svg",
|
|
3473
3729
|
{
|
|
3474
3730
|
width: "18",
|
|
@@ -3480,8 +3736,8 @@ function LumirEditor({
|
|
|
3480
3736
|
strokeLinecap: "round",
|
|
3481
3737
|
strokeLinejoin: "round",
|
|
3482
3738
|
children: [
|
|
3483
|
-
/* @__PURE__ */ (0,
|
|
3484
|
-
/* @__PURE__ */ (0,
|
|
3739
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("polyline", { points: "16 18 22 12 16 6" }),
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("polyline", { points: "8 6 2 12 8 18" })
|
|
3485
3741
|
]
|
|
3486
3742
|
}
|
|
3487
3743
|
),
|
|
@@ -3506,7 +3762,7 @@ function LumirEditor({
|
|
|
3506
3762
|
"\uD504\uB9AC\uBDF0"
|
|
3507
3763
|
],
|
|
3508
3764
|
group: "Embeds",
|
|
3509
|
-
icon: /* @__PURE__ */ (0,
|
|
3765
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
3510
3766
|
"svg",
|
|
3511
3767
|
{
|
|
3512
3768
|
width: "18",
|
|
@@ -3518,8 +3774,8 @@ function LumirEditor({
|
|
|
3518
3774
|
strokeLinecap: "round",
|
|
3519
3775
|
strokeLinejoin: "round",
|
|
3520
3776
|
children: [
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3522
|
-
/* @__PURE__ */ (0,
|
|
3777
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.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" }),
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.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" })
|
|
3523
3779
|
]
|
|
3524
3780
|
}
|
|
3525
3781
|
),
|
|
@@ -3538,21 +3794,21 @@ function LumirEditor({
|
|
|
3538
3794
|
)
|
|
3539
3795
|
}
|
|
3540
3796
|
),
|
|
3541
|
-
!sideMenuAddButton && /* @__PURE__ */ (0,
|
|
3797
|
+
!sideMenuAddButton && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react19.SideMenuController, { sideMenu: DragHandleOnlySideMenu })
|
|
3542
3798
|
]
|
|
3543
3799
|
}
|
|
3544
3800
|
),
|
|
3545
|
-
isUploading && /* @__PURE__ */ (0,
|
|
3546
|
-
/* @__PURE__ */ (0,
|
|
3547
|
-
uploadProgress !== null && /* @__PURE__ */ (0,
|
|
3801
|
+
isUploading && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumirEditor-upload-overlay", children: [
|
|
3802
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "lumirEditor-spinner" }),
|
|
3803
|
+
uploadProgress !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "lumirEditor-upload-progress", children: [
|
|
3548
3804
|
uploadProgress,
|
|
3549
3805
|
"%"
|
|
3550
3806
|
] })
|
|
3551
3807
|
] }),
|
|
3552
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
3553
|
-
/* @__PURE__ */ (0,
|
|
3554
|
-
/* @__PURE__ */ (0,
|
|
3555
|
-
/* @__PURE__ */ (0,
|
|
3808
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "lumirEditor-error-toast", children: [
|
|
3809
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "lumirEditor-error-icon", children: "\u26A0\uFE0F" }),
|
|
3810
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "lumirEditor-error-message", children: errorMessage }),
|
|
3811
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3556
3812
|
"button",
|
|
3557
3813
|
{
|
|
3558
3814
|
className: "lumirEditor-error-close",
|