@underverse-ui/underverse 2.0.33 → 2.0.34
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-FQVWYDKP.js → chunk-JYAEYUGM.js} +22 -91
- package/dist/chunk-JYAEYUGM.js.map +1 -0
- package/dist/index.cjs +56 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/ueditor.cjs +71 -143
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +1 -1
- package/dist/ueditor.d.ts +1 -1
- package/dist/ueditor.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-FQVWYDKP.js.map +0 -1
package/dist/index.js
CHANGED
package/dist/ueditor.cjs
CHANGED
|
@@ -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,
|
|
@@ -25664,18 +25596,16 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25664
25596
|
}, ref) => {
|
|
25665
25597
|
const t = useSmartTranslations("UEditor");
|
|
25666
25598
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
25667
|
-
const inFlightPrepareRef = (0,
|
|
25668
|
-
const lastAppliedContentRef = (0,
|
|
25669
|
-
const scheduledFormulaRecalculateRef = (0,
|
|
25670
|
-
const pendingFormulaTextRecalculateRef = (0,
|
|
25671
|
-
const editorInstanceRef = (0,
|
|
25672
|
-
const formulaRangePickRef = (0,
|
|
25673
|
-
const formulaRangeSurfaceRef = (0,
|
|
25674
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
25675
|
-
const [isMenuBarVisible, setIsMenuBarVisible] =
|
|
25676
|
-
|
|
25677
|
-
const editorShellRef = (0, import_react46.useRef)(null);
|
|
25678
|
-
(0, import_react46.useEffect)(() => {
|
|
25599
|
+
const inFlightPrepareRef = (0, import_react45.useRef)(null);
|
|
25600
|
+
const lastAppliedContentRef = (0, import_react45.useRef)(content ?? "");
|
|
25601
|
+
const scheduledFormulaRecalculateRef = (0, import_react45.useRef)(false);
|
|
25602
|
+
const pendingFormulaTextRecalculateRef = (0, import_react45.useRef)(false);
|
|
25603
|
+
const editorInstanceRef = (0, import_react45.useRef)(null);
|
|
25604
|
+
const formulaRangePickRef = (0, import_react45.useRef)(null);
|
|
25605
|
+
const formulaRangeSurfaceRef = (0, import_react45.useRef)(null);
|
|
25606
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = import_react45.default.useState(null);
|
|
25607
|
+
const [isMenuBarVisible, setIsMenuBarVisible] = import_react45.default.useState(showMenuBar);
|
|
25608
|
+
(0, import_react45.useEffect)(() => {
|
|
25679
25609
|
setIsMenuBarVisible(showMenuBar);
|
|
25680
25610
|
}, [showMenuBar]);
|
|
25681
25611
|
const { flushOutputUpdates, scheduleOutputUpdate } = useUEditorOutput({
|
|
@@ -25684,7 +25614,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25684
25614
|
onJsonChange,
|
|
25685
25615
|
outputDebounceMs
|
|
25686
25616
|
});
|
|
25687
|
-
const scheduleFormulaRecalculate =
|
|
25617
|
+
const scheduleFormulaRecalculate = import_react45.default.useCallback((editor2, options) => {
|
|
25688
25618
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
25689
25619
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
25690
25620
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -25695,7 +25625,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25695
25625
|
}
|
|
25696
25626
|
});
|
|
25697
25627
|
}, []);
|
|
25698
|
-
const resolvedUploadFile = (0,
|
|
25628
|
+
const resolvedUploadFile = (0, import_react45.useMemo)(() => {
|
|
25699
25629
|
if (uploadFile) return uploadFile;
|
|
25700
25630
|
if (uploadFileForSave) {
|
|
25701
25631
|
return async (file) => {
|
|
@@ -25705,7 +25635,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25705
25635
|
}
|
|
25706
25636
|
return uploadImage;
|
|
25707
25637
|
}, [uploadFile, uploadFileForSave, uploadImage]);
|
|
25708
|
-
const extensions = (0,
|
|
25638
|
+
const extensions = (0, import_react45.useMemo)(
|
|
25709
25639
|
() => [
|
|
25710
25640
|
...buildUEditorExtensions({
|
|
25711
25641
|
getPortalContainer,
|
|
@@ -25726,11 +25656,11 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25726
25656
|
],
|
|
25727
25657
|
[getPortalContainer, effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, onImageUploadError, editable, fetchMetadata, extraExtensions]
|
|
25728
25658
|
);
|
|
25729
|
-
const syncFormulaRangeHighlight =
|
|
25659
|
+
const syncFormulaRangeHighlight = import_react45.default.useCallback((pickState) => {
|
|
25730
25660
|
const container = formulaRangeSurfaceRef.current;
|
|
25731
25661
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
25732
25662
|
}, []);
|
|
25733
|
-
const editor = (0,
|
|
25663
|
+
const editor = (0, import_react46.useEditor)({
|
|
25734
25664
|
immediatelyRender: false,
|
|
25735
25665
|
extensions,
|
|
25736
25666
|
content,
|
|
@@ -25851,7 +25781,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25851
25781
|
queueMicrotask(flushOutputUpdates);
|
|
25852
25782
|
}
|
|
25853
25783
|
});
|
|
25854
|
-
(0,
|
|
25784
|
+
(0, import_react45.useEffect)(() => {
|
|
25855
25785
|
editorInstanceRef.current = editor;
|
|
25856
25786
|
return () => {
|
|
25857
25787
|
if (editorInstanceRef.current === editor) editorInstanceRef.current = null;
|
|
@@ -25867,8 +25797,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25867
25797
|
apply: t("tableMenu.apply"),
|
|
25868
25798
|
cancel: t("imageInput.cancelBtn")
|
|
25869
25799
|
});
|
|
25870
|
-
|
|
25871
|
-
(0, import_react46.useImperativeHandle)(
|
|
25800
|
+
(0, import_react45.useImperativeHandle)(
|
|
25872
25801
|
ref,
|
|
25873
25802
|
() => ({
|
|
25874
25803
|
editor,
|
|
@@ -25897,7 +25826,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25897
25826
|
}),
|
|
25898
25827
|
[content, editor, uploadImageForSave, uploadFileForSave, uploadImageConcurrency]
|
|
25899
25828
|
);
|
|
25900
|
-
(0,
|
|
25829
|
+
(0, import_react45.useEffect)(() => {
|
|
25901
25830
|
if (!editor) return;
|
|
25902
25831
|
queueMicrotask(() => {
|
|
25903
25832
|
if (!editor.isDestroyed) {
|
|
@@ -25905,7 +25834,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25905
25834
|
}
|
|
25906
25835
|
});
|
|
25907
25836
|
}, [editor]);
|
|
25908
|
-
(0,
|
|
25837
|
+
(0, import_react45.useEffect)(() => {
|
|
25909
25838
|
if (!editor) return;
|
|
25910
25839
|
const nextContent = content ?? "";
|
|
25911
25840
|
if (lastAppliedContentRef.current === nextContent) return;
|
|
@@ -25935,10 +25864,9 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25935
25864
|
}
|
|
25936
25865
|
) });
|
|
25937
25866
|
}
|
|
25938
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", {
|
|
25867
|
+
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
25868
|
"div",
|
|
25940
25869
|
{
|
|
25941
|
-
ref: editorShellRef,
|
|
25942
25870
|
className: cn(
|
|
25943
25871
|
"group relative flex flex-col text-card-foreground",
|
|
25944
25872
|
editable ? [
|
|
@@ -25953,7 +25881,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
25953
25881
|
),
|
|
25954
25882
|
children: [
|
|
25955
25883
|
editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(EditorUiRenderStateProvider, { editor, children: [
|
|
25956
|
-
isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
25884
|
+
isMenuBarVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_react45.default.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
25957
25885
|
LazyMenuBar,
|
|
25958
25886
|
{
|
|
25959
25887
|
editor,
|
|
@@ -26011,7 +25939,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
26011
25939
|
formulaRangeSurfaceRef.current = node;
|
|
26012
25940
|
},
|
|
26013
25941
|
className: cn(
|
|
26014
|
-
"relative flex-1 overflow-y-auto",
|
|
25942
|
+
"relative flex-1 overflow-x-auto overflow-y-auto [scrollbar-width:thin] [scrollbar-color:hsl(var(--border))_transparent]",
|
|
26015
25943
|
expandWideTables && "[&_.tableWrapper]:!overflow-visible [&_.tableWrapper]:!pb-0"
|
|
26016
25944
|
),
|
|
26017
25945
|
style: {
|
|
@@ -26080,7 +26008,7 @@ var UEditor = import_react46.default.forwardRef(({
|
|
|
26080
26008
|
}
|
|
26081
26009
|
),
|
|
26082
26010
|
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
26083
|
-
|
|
26011
|
+
import_react46.EditorContent,
|
|
26084
26012
|
{
|
|
26085
26013
|
editor,
|
|
26086
26014
|
className: "min-h-full"
|