@underverse-ui/underverse 2.0.33 → 2.0.35
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/api-reference.json +1 -1
- package/dist/{chunk-OTPC2OTQ.js → chunk-F2P3DJSC.js} +3 -3
- package/dist/{chunk-OTPC2OTQ.js.map → chunk-F2P3DJSC.js.map} +1 -1
- package/dist/{chunk-FQVWYDKP.js → chunk-H4AVZA4K.js} +28 -94
- package/dist/chunk-H4AVZA4K.js.map +1 -0
- package/dist/{chunk-UHUKUI5S.js → chunk-WFQV7XFC.js} +2 -2
- package/dist/index.cjs +62 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-HZBBRX42.js → menu-bar-MUISXLMR.js} +3 -3
- package/dist/ueditor.cjs +77 -146
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +3 -1
- package/dist/ueditor.d.ts +3 -1
- package/dist/ueditor.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-FQVWYDKP.js.map +0 -1
- /package/dist/{chunk-UHUKUI5S.js.map → chunk-WFQV7XFC.js.map} +0 -0
- /package/dist/{menu-bar-HZBBRX42.js.map → menu-bar-MUISXLMR.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
Modal_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WFQV7XFC.js";
|
|
5
5
|
import {
|
|
6
6
|
DEFAULT_TABLE_ROW_HEIGHT,
|
|
7
7
|
DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
trackEditorInsertionPosition,
|
|
30
30
|
useDropdownMenuClose,
|
|
31
31
|
useSharedEditorUiRenderState
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-F2P3DJSC.js";
|
|
33
33
|
import {
|
|
34
34
|
cn,
|
|
35
35
|
resolveUEditorPortalContainer,
|
|
@@ -1118,4 +1118,4 @@ var MenuBar = ({
|
|
|
1118
1118
|
export {
|
|
1119
1119
|
MenuBar
|
|
1120
1120
|
};
|
|
1121
|
-
//# sourceMappingURL=menu-bar-
|
|
1121
|
+
//# sourceMappingURL=menu-bar-MUISXLMR.js.map
|
package/dist/ueditor.cjs
CHANGED
|
@@ -9245,7 +9245,7 @@ var init_editor_styles = __esm({
|
|
|
9245
9245
|
"[&_td]:align-top",
|
|
9246
9246
|
"[&_td]:box-border",
|
|
9247
9247
|
"[&_td]:select-text",
|
|
9248
|
-
"[&_td]:px-
|
|
9248
|
+
"[&_td]:px-[var(--ueditor-table-cell-padding-x,0.5rem)]",
|
|
9249
9249
|
"[&_td]:py-0",
|
|
9250
9250
|
"[&_td]:whitespace-normal",
|
|
9251
9251
|
"[&_td]:wrap-anywhere",
|
|
@@ -9257,7 +9257,7 @@ var init_editor_styles = __esm({
|
|
|
9257
9257
|
"[&_th]:align-top",
|
|
9258
9258
|
"[&_th]:box-border",
|
|
9259
9259
|
"[&_th]:select-text",
|
|
9260
|
-
"[&_th]:px-
|
|
9260
|
+
"[&_th]:px-[var(--ueditor-table-cell-padding-x,0.5rem)]",
|
|
9261
9261
|
"[&_th]:py-0",
|
|
9262
9262
|
"[&_th]:whitespace-normal",
|
|
9263
9263
|
"[&_th]:wrap-anywhere",
|
|
@@ -9407,12 +9407,12 @@ function unlockBodyScroll(body) {
|
|
|
9407
9407
|
body.style.overflow = current.overflow;
|
|
9408
9408
|
bodyScrollLocks.delete(body);
|
|
9409
9409
|
}
|
|
9410
|
-
var
|
|
9410
|
+
var React31, import_react_dom4, import_lucide_react20, import_jsx_runtime36, bodyScrollLocks, sizeStyles, Modal, Modal_default;
|
|
9411
9411
|
var init_Modal = __esm({
|
|
9412
9412
|
"src/components/Modal.tsx"() {
|
|
9413
9413
|
"use strict";
|
|
9414
9414
|
"use client";
|
|
9415
|
-
|
|
9415
|
+
React31 = __toESM(require("react"), 1);
|
|
9416
9416
|
import_react_dom4 = require("react-dom");
|
|
9417
9417
|
init_cn();
|
|
9418
9418
|
import_lucide_react20 = require("lucide-react");
|
|
@@ -9452,22 +9452,22 @@ var init_Modal = __esm({
|
|
|
9452
9452
|
const gi18n = useGlobalI18n();
|
|
9453
9453
|
const globalConfig = useUnderverseUIConfig();
|
|
9454
9454
|
const resolvedBorderMode = borderMode ?? globalConfig.borderMode;
|
|
9455
|
-
const [isMounted, setIsMounted] =
|
|
9456
|
-
const [isVisible, setIsVisible] =
|
|
9457
|
-
const [isAnimating, setIsAnimating] =
|
|
9458
|
-
const mouseDownTarget =
|
|
9459
|
-
const modalContentRef =
|
|
9460
|
-
const titleId =
|
|
9461
|
-
const descriptionId =
|
|
9455
|
+
const [isMounted, setIsMounted] = React31.useState(false);
|
|
9456
|
+
const [isVisible, setIsVisible] = React31.useState(false);
|
|
9457
|
+
const [isAnimating, setIsAnimating] = React31.useState(true);
|
|
9458
|
+
const mouseDownTarget = React31.useRef(null);
|
|
9459
|
+
const modalContentRef = React31.useRef(null);
|
|
9460
|
+
const titleId = React31.useId();
|
|
9461
|
+
const descriptionId = React31.useId();
|
|
9462
9462
|
const resolvedPortalContainer = portalContainer ?? (typeof document !== "undefined" ? document.body : null);
|
|
9463
9463
|
const portalDocument = resolvedPortalContainer?.ownerDocument ?? null;
|
|
9464
9464
|
const portalWindow = portalDocument?.defaultView ?? null;
|
|
9465
|
-
|
|
9465
|
+
React31.useEffect(() => {
|
|
9466
9466
|
setIsMounted(true);
|
|
9467
9467
|
return () => setIsMounted(false);
|
|
9468
9468
|
}, []);
|
|
9469
|
-
const animationRef =
|
|
9470
|
-
|
|
9469
|
+
const animationRef = React31.useRef(false);
|
|
9470
|
+
React31.useEffect(() => {
|
|
9471
9471
|
if (isOpen) {
|
|
9472
9472
|
if (animationRef.current) return;
|
|
9473
9473
|
animationRef.current = true;
|
|
@@ -9487,7 +9487,7 @@ var init_Modal = __esm({
|
|
|
9487
9487
|
}
|
|
9488
9488
|
}
|
|
9489
9489
|
}, [isOpen, isVisible, portalWindow]);
|
|
9490
|
-
|
|
9490
|
+
React31.useEffect(() => {
|
|
9491
9491
|
if (!isOpen) return;
|
|
9492
9492
|
const handleKeyDown2 = (event) => {
|
|
9493
9493
|
if (event.key === "Escape" && closeOnEsc) {
|
|
@@ -9519,7 +9519,7 @@ var init_Modal = __esm({
|
|
|
9519
9519
|
portalDocument?.addEventListener("keydown", handleKeyDown2);
|
|
9520
9520
|
return () => portalDocument?.removeEventListener("keydown", handleKeyDown2);
|
|
9521
9521
|
}, [isOpen, closeOnEsc, onClose, portalDocument]);
|
|
9522
|
-
|
|
9522
|
+
React31.useEffect(() => {
|
|
9523
9523
|
if (!isOpen || !portalDocument) return;
|
|
9524
9524
|
const previousFocus = portalDocument.activeElement;
|
|
9525
9525
|
const frameId = portalWindow?.requestAnimationFrame(() => modalContentRef.current?.focus());
|
|
@@ -9528,7 +9528,7 @@ var init_Modal = __esm({
|
|
|
9528
9528
|
if (previousFocus?.isConnected) previousFocus.focus();
|
|
9529
9529
|
};
|
|
9530
9530
|
}, [isOpen, portalDocument, portalWindow]);
|
|
9531
|
-
|
|
9531
|
+
React31.useEffect(() => {
|
|
9532
9532
|
const body = portalDocument?.body;
|
|
9533
9533
|
if (!isOpen || !body) return;
|
|
9534
9534
|
lockBodyScroll(body);
|
|
@@ -9917,7 +9917,7 @@ function renderMenuItems(items) {
|
|
|
9917
9917
|
case "sub":
|
|
9918
9918
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DropdownMenuSub, { label: item.label, icon: item.icon, disabled: item.disabled, children: renderMenuItems(item.items) }, i);
|
|
9919
9919
|
case "custom":
|
|
9920
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react44.default.Fragment, { children: item.render() }, item.key);
|
|
9921
9921
|
}
|
|
9922
9922
|
});
|
|
9923
9923
|
}
|
|
@@ -10300,12 +10300,12 @@ function buildTableMenuItems(t, editor, onInsertTable) {
|
|
|
10300
10300
|
}
|
|
10301
10301
|
];
|
|
10302
10302
|
}
|
|
10303
|
-
var
|
|
10303
|
+
var import_react44, import_lucide_react21, import_jsx_runtime37, MenuBarTrigger, MenuBar;
|
|
10304
10304
|
var init_menu_bar = __esm({
|
|
10305
10305
|
"src/components/UEditor/menu-bar.tsx"() {
|
|
10306
10306
|
"use strict";
|
|
10307
10307
|
"use client";
|
|
10308
|
-
|
|
10308
|
+
import_react44 = __toESM(require("react"), 1);
|
|
10309
10309
|
import_lucide_react21 = require("lucide-react");
|
|
10310
10310
|
init_useSmartTranslations();
|
|
10311
10311
|
init_cn();
|
|
@@ -10322,7 +10322,7 @@ var init_menu_bar = __esm({
|
|
|
10322
10322
|
init_async_insertion_position();
|
|
10323
10323
|
init_image_file_upload();
|
|
10324
10324
|
import_jsx_runtime37 = require("react/jsx-runtime");
|
|
10325
|
-
MenuBarTrigger =
|
|
10325
|
+
MenuBarTrigger = import_react44.default.forwardRef(
|
|
10326
10326
|
({ children, className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
10327
10327
|
"button",
|
|
10328
10328
|
{
|
|
@@ -10359,25 +10359,25 @@ var init_menu_bar = __esm({
|
|
|
10359
10359
|
const t = useSmartTranslations("UEditor");
|
|
10360
10360
|
useSharedEditorUiRenderState(editor);
|
|
10361
10361
|
const getPortalContainer = useUEditorPortalContainerGetter();
|
|
10362
|
-
const fileInputRef = (0,
|
|
10363
|
-
const sourceTextareaRef = (0,
|
|
10364
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
10365
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
10366
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
10367
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
10368
|
-
const [openMenuKey, setOpenMenuKey] = (0,
|
|
10369
|
-
const [showSourceDialog, setShowSourceDialog] = (0,
|
|
10370
|
-
const [sourceHtml, setSourceHtml] = (0,
|
|
10371
|
-
const [sourceError, setSourceError] = (0,
|
|
10372
|
-
const sourceErrorId =
|
|
10373
|
-
const [showPreviewDialog, setShowPreviewDialog] = (0,
|
|
10374
|
-
const [previewHtml, setPreviewHtml] = (0,
|
|
10362
|
+
const fileInputRef = (0, import_react44.useRef)(null);
|
|
10363
|
+
const sourceTextareaRef = (0, import_react44.useRef)(null);
|
|
10364
|
+
const [showImageInput, setShowImageInput] = (0, import_react44.useState)(false);
|
|
10365
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react44.useState)(false);
|
|
10366
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react44.useState)(false);
|
|
10367
|
+
const [imageUploadError, setImageUploadError] = (0, import_react44.useState)(null);
|
|
10368
|
+
const [openMenuKey, setOpenMenuKey] = (0, import_react44.useState)(null);
|
|
10369
|
+
const [showSourceDialog, setShowSourceDialog] = (0, import_react44.useState)(false);
|
|
10370
|
+
const [sourceHtml, setSourceHtml] = (0, import_react44.useState)("");
|
|
10371
|
+
const [sourceError, setSourceError] = (0, import_react44.useState)("");
|
|
10372
|
+
const sourceErrorId = import_react44.default.useId();
|
|
10373
|
+
const [showPreviewDialog, setShowPreviewDialog] = (0, import_react44.useState)(false);
|
|
10374
|
+
const [previewHtml, setPreviewHtml] = (0, import_react44.useState)("");
|
|
10375
10375
|
const modalPortalContainer = resolveUEditorPortalContainer(
|
|
10376
10376
|
getPortalContainer,
|
|
10377
10377
|
void 0,
|
|
10378
10378
|
editor.view.dom.ownerDocument
|
|
10379
10379
|
);
|
|
10380
|
-
(0,
|
|
10380
|
+
(0, import_react44.useEffect)(() => {
|
|
10381
10381
|
if (!showPreviewDialog) return;
|
|
10382
10382
|
const updatePreview = () => {
|
|
10383
10383
|
if (!editor.isDestroyed) {
|
|
@@ -10734,9 +10734,9 @@ __export(UEditor_exports, {
|
|
|
10734
10734
|
module.exports = __toCommonJS(UEditor_exports);
|
|
10735
10735
|
|
|
10736
10736
|
// src/components/UEditor/UEditor.tsx
|
|
10737
|
-
var
|
|
10737
|
+
var import_react45 = __toESM(require("react"), 1);
|
|
10738
10738
|
init_useSmartTranslations();
|
|
10739
|
-
var
|
|
10739
|
+
var import_react46 = require("@tiptap/react");
|
|
10740
10740
|
init_cn();
|
|
10741
10741
|
|
|
10742
10742
|
// src/components/UEditor/extensions.ts
|
|
@@ -22680,7 +22680,9 @@ function TableAddRails({
|
|
|
22680
22680
|
),
|
|
22681
22681
|
style: {
|
|
22682
22682
|
top: columnRailTop,
|
|
22683
|
-
|
|
22683
|
+
// An invisible rail must not sit outside the table: even at
|
|
22684
|
+
// opacity 0 its box would otherwise create a horizontal scrollbar.
|
|
22685
|
+
left: showColumnRail ? columnRailLeft : Math.max(visibleBounds.left, visibleBounds.right - BUTTON_SHORT_SIZE),
|
|
22684
22686
|
width: BUTTON_SHORT_SIZE,
|
|
22685
22687
|
height: BUTTON_LONG_SIZE,
|
|
22686
22688
|
opacity: showColumnRail ? 1 : 0,
|
|
@@ -22966,18 +22968,16 @@ var import_lucide_react17 = require("lucide-react");
|
|
|
22966
22968
|
init_cn();
|
|
22967
22969
|
init_table_width_model();
|
|
22968
22970
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
22969
|
-
var HANDLE_BASE_CLASS = cn(
|
|
22970
|
-
"pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center rounded-md",
|
|
22971
|
-
"bg-background/95 text-primary shadow-sm backdrop-blur-sm",
|
|
22972
|
-
"transition-[color,background-color,box-shadow,transform] duration-150",
|
|
22973
|
-
"hover:bg-primary hover:text-primary-foreground hover:shadow-md active:scale-95",
|
|
22974
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
22975
|
-
);
|
|
22976
22971
|
var EDGE_HANDLE_CLASS = cn(
|
|
22977
22972
|
"pointer-events-auto absolute top-0 z-10 h-full w-2 touch-none cursor-col-resize bg-transparent p-0",
|
|
22978
22973
|
"border-transparent transition-colors duration-150 hover:border-primary",
|
|
22979
22974
|
"focus-visible:border-primary focus-visible:outline-none"
|
|
22980
22975
|
);
|
|
22976
|
+
var CORNER_HANDLE_CLASS = cn(
|
|
22977
|
+
"pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center p-0",
|
|
22978
|
+
"text-primary/70 transition-[color,transform] duration-150 hover:text-primary active:scale-95",
|
|
22979
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
22980
|
+
);
|
|
22981
22981
|
function formatTableResizeDimensionLabel({
|
|
22982
22982
|
width,
|
|
22983
22983
|
height,
|
|
@@ -23057,9 +23057,9 @@ function TableResizeHandles({
|
|
|
23057
23057
|
title: `${resizeBothLabel}. ${ctrlHint}`,
|
|
23058
23058
|
"data-table-resize-handle": "both",
|
|
23059
23059
|
className: cn(
|
|
23060
|
-
|
|
23061
|
-
"bottom-[-28px] right-
|
|
23062
|
-
active && "
|
|
23060
|
+
CORNER_HANDLE_CLASS,
|
|
23061
|
+
"bottom-[-28px] right-0 h-6 w-6 cursor-nwse-resize",
|
|
23062
|
+
active && "text-primary"
|
|
23063
23063
|
),
|
|
23064
23064
|
onDoubleClick: onFitWidth,
|
|
23065
23065
|
onClick: (event) => {
|
|
@@ -25539,80 +25539,12 @@ function useUEditorOutput({
|
|
|
25539
25539
|
|
|
25540
25540
|
// src/components/UEditor/UEditor.tsx
|
|
25541
25541
|
init_portal_context();
|
|
25542
|
-
|
|
25543
|
-
// src/components/UEditor/use-wide-table-layout.ts
|
|
25544
|
-
var import_react44 = __toESM(require("react"), 1);
|
|
25545
|
-
init_table_dom_utils();
|
|
25546
|
-
function useWideTableLayout(editor, enabled, widthBoundaryRef, editorShellRef, editorSurfaceRef) {
|
|
25547
|
-
import_react44.default.useLayoutEffect(() => {
|
|
25548
|
-
const boundary = widthBoundaryRef.current;
|
|
25549
|
-
const shell = editorShellRef.current;
|
|
25550
|
-
const surface = editorSurfaceRef.current;
|
|
25551
|
-
if (!editor || !boundary || !shell || !surface) return;
|
|
25552
|
-
const editorDocument = editor.view.dom.ownerDocument;
|
|
25553
|
-
const editorWindow = editorDocument.defaultView;
|
|
25554
|
-
if (!editorWindow) return;
|
|
25555
|
-
const editorDom = editor.view.dom;
|
|
25556
|
-
let frame = 0;
|
|
25557
|
-
const resetWidths = () => {
|
|
25558
|
-
shell.style.removeProperty("width");
|
|
25559
|
-
editorDom.style.removeProperty("width");
|
|
25560
|
-
};
|
|
25561
|
-
const sync = () => {
|
|
25562
|
-
frame = 0;
|
|
25563
|
-
resetWidths();
|
|
25564
|
-
if (!enabled || editor.isDestroyed) return;
|
|
25565
|
-
const boundaryWidth = boundary.getBoundingClientRect().width || boundary.clientWidth;
|
|
25566
|
-
const surfaceWidth = surface.getBoundingClientRect().width || surface.clientWidth;
|
|
25567
|
-
if (boundaryWidth <= 0 || surfaceWidth <= 0) return;
|
|
25568
|
-
editorDom.style.width = `${surfaceWidth}px`;
|
|
25569
|
-
const shellRect = shell.getBoundingClientRect();
|
|
25570
|
-
let requiredWidth = boundaryWidth;
|
|
25571
|
-
editorDom.querySelectorAll("table").forEach((table) => {
|
|
25572
|
-
const tableRect = table.getBoundingClientRect();
|
|
25573
|
-
if (tableRect.width > 0) {
|
|
25574
|
-
requiredWidth = Math.max(requiredWidth, tableRect.right - shellRect.left + 32);
|
|
25575
|
-
return;
|
|
25576
|
-
}
|
|
25577
|
-
const widthBp = Number(table.getAttribute("data-table-width-bp"));
|
|
25578
|
-
if (Number.isFinite(widthBp) && widthBp > 1e4) {
|
|
25579
|
-
requiredWidth = Math.max(requiredWidth, surfaceWidth * widthBp / 1e4 + 32);
|
|
25580
|
-
}
|
|
25581
|
-
});
|
|
25582
|
-
if (requiredWidth <= boundaryWidth + 1) {
|
|
25583
|
-
editorDom.style.removeProperty("width");
|
|
25584
|
-
return;
|
|
25585
|
-
}
|
|
25586
|
-
shell.style.width = `${Math.ceil(requiredWidth)}px`;
|
|
25587
|
-
};
|
|
25588
|
-
const schedule = () => {
|
|
25589
|
-
if (frame) editorWindow.cancelAnimationFrame(frame);
|
|
25590
|
-
frame = editorWindow.requestAnimationFrame(sync);
|
|
25591
|
-
};
|
|
25592
|
-
const resizeObserver = typeof editorWindow.ResizeObserver === "function" ? new editorWindow.ResizeObserver(schedule) : null;
|
|
25593
|
-
resizeObserver?.observe(boundary);
|
|
25594
|
-
editor.on("transaction", schedule);
|
|
25595
|
-
surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
|
|
25596
|
-
editorWindow.addEventListener("resize", schedule);
|
|
25597
|
-
schedule();
|
|
25598
|
-
return () => {
|
|
25599
|
-
if (frame) editorWindow.cancelAnimationFrame(frame);
|
|
25600
|
-
resizeObserver?.disconnect();
|
|
25601
|
-
editor.off("transaction", schedule);
|
|
25602
|
-
surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
|
|
25603
|
-
editorWindow.removeEventListener("resize", schedule);
|
|
25604
|
-
resetWidths();
|
|
25605
|
-
};
|
|
25606
|
-
}, [editor, editorShellRef, editorSurfaceRef, enabled, widthBoundaryRef]);
|
|
25607
|
-
}
|
|
25608
|
-
|
|
25609
|
-
// src/components/UEditor/UEditor.tsx
|
|
25610
25542
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
25611
|
-
var LazyMenuBar =
|
|
25543
|
+
var LazyMenuBar = import_react45.default.lazy(async () => {
|
|
25612
25544
|
const { MenuBar: MenuBar2 } = await Promise.resolve().then(() => (init_menu_bar(), menu_bar_exports));
|
|
25613
25545
|
return { default: MenuBar2 };
|
|
25614
25546
|
});
|
|
25615
|
-
var UEditor =
|
|
25547
|
+
var UEditor = import_react45.default.forwardRef(({
|
|
25616
25548
|
getPortalContainer,
|
|
25617
25549
|
content = "",
|
|
25618
25550
|
onChange,
|
|
@@ -25643,6 +25575,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25643
25575
|
maxCharacters,
|
|
25644
25576
|
minHeight = "200px",
|
|
25645
25577
|
maxHeight = "auto",
|
|
25578
|
+
tableCellHorizontalPadding = 8,
|
|
25646
25579
|
expandWideTables = true,
|
|
25647
25580
|
variant = "default",
|
|
25648
25581
|
rounded = true,
|
|
@@ -25664,18 +25597,17 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25664
25597
|
}, ref) => {
|
|
25665
25598
|
const t = useSmartTranslations("UEditor");
|
|
25666
25599
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
25667
|
-
const
|
|
25668
|
-
const
|
|
25669
|
-
const
|
|
25670
|
-
const
|
|
25671
|
-
const
|
|
25672
|
-
const
|
|
25673
|
-
const
|
|
25674
|
-
const
|
|
25675
|
-
const [
|
|
25676
|
-
const
|
|
25677
|
-
|
|
25678
|
-
(0, import_react46.useEffect)(() => {
|
|
25600
|
+
const resolvedTableCellHorizontalPadding = Number.isFinite(tableCellHorizontalPadding) ? Math.max(0, tableCellHorizontalPadding) : 8;
|
|
25601
|
+
const inFlightPrepareRef = (0, import_react45.useRef)(null);
|
|
25602
|
+
const lastAppliedContentRef = (0, import_react45.useRef)(content ?? "");
|
|
25603
|
+
const scheduledFormulaRecalculateRef = (0, import_react45.useRef)(false);
|
|
25604
|
+
const pendingFormulaTextRecalculateRef = (0, import_react45.useRef)(false);
|
|
25605
|
+
const editorInstanceRef = (0, import_react45.useRef)(null);
|
|
25606
|
+
const formulaRangePickRef = (0, import_react45.useRef)(null);
|
|
25607
|
+
const formulaRangeSurfaceRef = (0, import_react45.useRef)(null);
|
|
25608
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react45.default.useState(null);
|
|
25609
|
+
const [isMenuBarVisible, setIsMenuBarVisible] = import_react45.default.useState(showMenuBar);
|
|
25610
|
+
(0, import_react45.useEffect)(() => {
|
|
25679
25611
|
setIsMenuBarVisible(showMenuBar);
|
|
25680
25612
|
}, [showMenuBar]);
|
|
25681
25613
|
const { flushOutputUpdates, scheduleOutputUpdate } = useUEditorOutput({
|
|
@@ -25684,7 +25616,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25684
25616
|
onJsonChange,
|
|
25685
25617
|
outputDebounceMs
|
|
25686
25618
|
});
|
|
25687
|
-
const scheduleFormulaRecalculate =
|
|
25619
|
+
const scheduleFormulaRecalculate = import_react45.default.useCallback((editor2, options) => {
|
|
25688
25620
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
25689
25621
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
25690
25622
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -25695,7 +25627,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25695
25627
|
}
|
|
25696
25628
|
});
|
|
25697
25629
|
}, []);
|
|
25698
|
-
const resolvedUploadFile = (0,
|
|
25630
|
+
const resolvedUploadFile = (0, import_react45.useMemo)(() => {
|
|
25699
25631
|
if (uploadFile) return uploadFile;
|
|
25700
25632
|
if (uploadFileForSave) {
|
|
25701
25633
|
return async (file) => {
|
|
@@ -25705,7 +25637,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25705
25637
|
}
|
|
25706
25638
|
return uploadImage;
|
|
25707
25639
|
}, [uploadFile, uploadFileForSave, uploadImage]);
|
|
25708
|
-
const extensions = (0,
|
|
25640
|
+
const extensions = (0, import_react45.useMemo)(
|
|
25709
25641
|
() => [
|
|
25710
25642
|
...buildUEditorExtensions({
|
|
25711
25643
|
getPortalContainer,
|
|
@@ -25726,11 +25658,11 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25726
25658
|
],
|
|
25727
25659
|
[getPortalContainer, effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, onImageUploadError, editable, fetchMetadata, extraExtensions]
|
|
25728
25660
|
);
|
|
25729
|
-
const syncFormulaRangeHighlight =
|
|
25661
|
+
const syncFormulaRangeHighlight = import_react45.default.useCallback((pickState) => {
|
|
25730
25662
|
const container = formulaRangeSurfaceRef.current;
|
|
25731
25663
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
25732
25664
|
}, []);
|
|
25733
|
-
const editor = (0,
|
|
25665
|
+
const editor = (0, import_react46.useEditor)({
|
|
25734
25666
|
immediatelyRender: false,
|
|
25735
25667
|
extensions,
|
|
25736
25668
|
content,
|
|
@@ -25851,7 +25783,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25851
25783
|
queueMicrotask(flushOutputUpdates);
|
|
25852
25784
|
}
|
|
25853
25785
|
});
|
|
25854
|
-
(0,
|
|
25786
|
+
(0, import_react45.useEffect)(() => {
|
|
25855
25787
|
editorInstanceRef.current = editor;
|
|
25856
25788
|
return () => {
|
|
25857
25789
|
if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
|
|
@@ -25867,8 +25799,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25867
25799
|
apply: t("tableMenu.apply"),
|
|
25868
25800
|
cancel: t("imageInput.cancelBtn")
|
|
25869
25801
|
});
|
|
25870
|
-
|
|
25871
|
-
(0, import_react46.useImperativeHandle)(
|
|
25802
|
+
(0, import_react45.useImperativeHandle)(
|
|
25872
25803
|
ref,
|
|
25873
25804
|
() => ({
|
|
25874
25805
|
editor,
|
|
@@ -25897,7 +25828,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25897
25828
|
}),
|
|
25898
25829
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
25899
25830
|
);
|
|
25900
|
-
(0,
|
|
25831
|
+
(0, import_react45.useEffect)(() => {
|
|
25901
25832
|
if (!editor) return;
|
|
25902
25833
|
queueMicrotask(() => {
|
|
25903
25834
|
if (!editor.isDestroyed) {
|
|
@@ -25905,7 +25836,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25905
25836
|
}
|
|
25906
25837
|
});
|
|
25907
25838
|
}, [editor]);
|
|
25908
|
-
(0,
|
|
25839
|
+
(0, import_react45.useEffect)(() => {
|
|
25909
25840
|
if (!editor) return;
|
|
25910
25841
|
const nextContent = content ?? "";
|
|
25911
25842
|
if (lastAppliedContentRef.current === nextContent) return;
|
|
@@ -25935,10 +25866,9 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25935
25866
|
}
|
|
25936
25867
|
) });
|
|
25937
25868
|
}
|
|
25938
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", {
|
|
25869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
25939
25870
|
"div",
|
|
25940
25871
|
{
|
|
25941
|
-
ref: editorShellRef,
|
|
25942
25872
|
className: cn(
|
|
25943
25873
|
"group relative flex flex-col text-card-foreground",
|
|
25944
25874
|
editable ? [
|
|
@@ -25953,7 +25883,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25953
25883
|
),
|
|
25954
25884
|
children: [
|
|
25955
25885
|
editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(EditorUiRenderStateProvider, { editor, children: [
|
|
25956
|
-
isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
25886
|
+
isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react45.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
25957
25887
|
LazyMenuBar,
|
|
25958
25888
|
{
|
|
25959
25889
|
editor,
|
|
@@ -26011,13 +25941,14 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
26011
25941
|
formulaRangeSurfaceRef.current = node;
|
|
26012
25942
|
},
|
|
26013
25943
|
className: cn(
|
|
26014
|
-
"relative flex-1 overflow-y-auto",
|
|
25944
|
+
"relative flex-1 overflow-x-auto overflow-y-auto [scrollbar-width:thin] [scrollbar-color:hsl(var(--border))_transparent]",
|
|
26015
25945
|
expandWideTables && "[&_.tableWrapper]:!overflow-visible [&_.tableWrapper]:!pb-0"
|
|
26016
25946
|
),
|
|
26017
25947
|
style: {
|
|
26018
25948
|
fontFamily: defaultFontFamily,
|
|
26019
25949
|
minHeight: editable ? minHeight : void 0,
|
|
26020
|
-
maxHeight
|
|
25950
|
+
maxHeight,
|
|
25951
|
+
"--ueditor-table-cell-padding-x": `${resolvedTableCellHorizontalPadding}px`
|
|
26021
25952
|
},
|
|
26022
25953
|
children: [
|
|
26023
25954
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
@@ -26080,7 +26011,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
26080
26011
|
}
|
|
26081
26012
|
),
|
|
26082
26013
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
26083
|
-
|
|
26014
|
+
import_react46.EditorContent,
|
|
26084
26015
|
{
|
|
26085
26016
|
editor,
|
|
26086
26017
|
className: "min-h-full"
|