@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/api-reference.json
CHANGED
|
@@ -522,7 +522,7 @@ async function prepareUEditorContentForSave({
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
// src/components/UEditor/UEditor.tsx
|
|
525
|
-
import
|
|
525
|
+
import React16, { useEffect as useEffect10, useImperativeHandle as useImperativeHandle4, useMemo as useMemo2, useRef as useRef10 } from "react";
|
|
526
526
|
import { useEditor, EditorContent } from "@tiptap/react";
|
|
527
527
|
|
|
528
528
|
// src/components/UEditor/extensions.ts
|
|
@@ -12057,7 +12057,9 @@ function TableAddRails({
|
|
|
12057
12057
|
),
|
|
12058
12058
|
style: {
|
|
12059
12059
|
top: columnRailTop,
|
|
12060
|
-
|
|
12060
|
+
// An invisible rail must not sit outside the table: even at
|
|
12061
|
+
// opacity 0 its box would otherwise create a horizontal scrollbar.
|
|
12062
|
+
left: showColumnRail ? columnRailLeft : Math.max(visibleBounds.left, visibleBounds.right - BUTTON_SHORT_SIZE),
|
|
12061
12063
|
width: BUTTON_SHORT_SIZE,
|
|
12062
12064
|
height: BUTTON_LONG_SIZE,
|
|
12063
12065
|
opacity: showColumnRail ? 1 : 0,
|
|
@@ -12335,18 +12337,16 @@ function TableColumnHandles({
|
|
|
12335
12337
|
// src/components/UEditor/table-resize-handles.tsx
|
|
12336
12338
|
import { MoveDiagonal2 } from "lucide-react";
|
|
12337
12339
|
import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
12338
|
-
var HANDLE_BASE_CLASS = cn(
|
|
12339
|
-
"pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center rounded-md",
|
|
12340
|
-
"bg-background/95 text-primary shadow-sm backdrop-blur-sm",
|
|
12341
|
-
"transition-[color,background-color,box-shadow,transform] duration-150",
|
|
12342
|
-
"hover:bg-primary hover:text-primary-foreground hover:shadow-md active:scale-95",
|
|
12343
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
12344
|
-
);
|
|
12345
12340
|
var EDGE_HANDLE_CLASS = cn(
|
|
12346
12341
|
"pointer-events-auto absolute top-0 z-10 h-full w-2 touch-none cursor-col-resize bg-transparent p-0",
|
|
12347
12342
|
"border-transparent transition-colors duration-150 hover:border-primary",
|
|
12348
12343
|
"focus-visible:border-primary focus-visible:outline-none"
|
|
12349
12344
|
);
|
|
12345
|
+
var CORNER_HANDLE_CLASS = cn(
|
|
12346
|
+
"pointer-events-auto absolute z-10 inline-flex touch-none items-center justify-center p-0",
|
|
12347
|
+
"text-primary/70 transition-[color,transform] duration-150 hover:text-primary active:scale-95",
|
|
12348
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"
|
|
12349
|
+
);
|
|
12350
12350
|
function formatTableResizeDimensionLabel({
|
|
12351
12351
|
width,
|
|
12352
12352
|
height,
|
|
@@ -12426,9 +12426,9 @@ function TableResizeHandles({
|
|
|
12426
12426
|
title: `${resizeBothLabel}. ${ctrlHint}`,
|
|
12427
12427
|
"data-table-resize-handle": "both",
|
|
12428
12428
|
className: cn(
|
|
12429
|
-
|
|
12430
|
-
"bottom-[-28px] right-
|
|
12431
|
-
active && "
|
|
12429
|
+
CORNER_HANDLE_CLASS,
|
|
12430
|
+
"bottom-[-28px] right-0 h-6 w-6 cursor-nwse-resize",
|
|
12431
|
+
active && "text-primary"
|
|
12432
12432
|
),
|
|
12433
12433
|
onDoubleClick: onFitWidth,
|
|
12434
12434
|
onClick: (event) => {
|
|
@@ -14885,78 +14885,13 @@ function useUEditorOutput({
|
|
|
14885
14885
|
};
|
|
14886
14886
|
}
|
|
14887
14887
|
|
|
14888
|
-
// src/components/UEditor/use-wide-table-layout.ts
|
|
14889
|
-
import React16 from "react";
|
|
14890
|
-
function useWideTableLayout(editor, enabled, widthBoundaryRef, editorShellRef, editorSurfaceRef) {
|
|
14891
|
-
React16.useLayoutEffect(() => {
|
|
14892
|
-
const boundary = widthBoundaryRef.current;
|
|
14893
|
-
const shell = editorShellRef.current;
|
|
14894
|
-
const surface = editorSurfaceRef.current;
|
|
14895
|
-
if (!editor || !boundary || !shell || !surface) return;
|
|
14896
|
-
const editorDocument = editor.view.dom.ownerDocument;
|
|
14897
|
-
const editorWindow = editorDocument.defaultView;
|
|
14898
|
-
if (!editorWindow) return;
|
|
14899
|
-
const editorDom = editor.view.dom;
|
|
14900
|
-
let frame = 0;
|
|
14901
|
-
const resetWidths = () => {
|
|
14902
|
-
shell.style.removeProperty("width");
|
|
14903
|
-
editorDom.style.removeProperty("width");
|
|
14904
|
-
};
|
|
14905
|
-
const sync = () => {
|
|
14906
|
-
frame = 0;
|
|
14907
|
-
resetWidths();
|
|
14908
|
-
if (!enabled || editor.isDestroyed) return;
|
|
14909
|
-
const boundaryWidth = boundary.getBoundingClientRect().width || boundary.clientWidth;
|
|
14910
|
-
const surfaceWidth = surface.getBoundingClientRect().width || surface.clientWidth;
|
|
14911
|
-
if (boundaryWidth <= 0 || surfaceWidth <= 0) return;
|
|
14912
|
-
editorDom.style.width = `${surfaceWidth}px`;
|
|
14913
|
-
const shellRect = shell.getBoundingClientRect();
|
|
14914
|
-
let requiredWidth = boundaryWidth;
|
|
14915
|
-
editorDom.querySelectorAll("table").forEach((table) => {
|
|
14916
|
-
const tableRect = table.getBoundingClientRect();
|
|
14917
|
-
if (tableRect.width > 0) {
|
|
14918
|
-
requiredWidth = Math.max(requiredWidth, tableRect.right - shellRect.left + 32);
|
|
14919
|
-
return;
|
|
14920
|
-
}
|
|
14921
|
-
const widthBp = Number(table.getAttribute("data-table-width-bp"));
|
|
14922
|
-
if (Number.isFinite(widthBp) && widthBp > 1e4) {
|
|
14923
|
-
requiredWidth = Math.max(requiredWidth, surfaceWidth * widthBp / 1e4 + 32);
|
|
14924
|
-
}
|
|
14925
|
-
});
|
|
14926
|
-
if (requiredWidth <= boundaryWidth + 1) {
|
|
14927
|
-
editorDom.style.removeProperty("width");
|
|
14928
|
-
return;
|
|
14929
|
-
}
|
|
14930
|
-
shell.style.width = `${Math.ceil(requiredWidth)}px`;
|
|
14931
|
-
};
|
|
14932
|
-
const schedule = () => {
|
|
14933
|
-
if (frame) editorWindow.cancelAnimationFrame(frame);
|
|
14934
|
-
frame = editorWindow.requestAnimationFrame(sync);
|
|
14935
|
-
};
|
|
14936
|
-
const resizeObserver = typeof editorWindow.ResizeObserver === "function" ? new editorWindow.ResizeObserver(schedule) : null;
|
|
14937
|
-
resizeObserver?.observe(boundary);
|
|
14938
|
-
editor.on("transaction", schedule);
|
|
14939
|
-
surface.addEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
|
|
14940
|
-
editorWindow.addEventListener("resize", schedule);
|
|
14941
|
-
schedule();
|
|
14942
|
-
return () => {
|
|
14943
|
-
if (frame) editorWindow.cancelAnimationFrame(frame);
|
|
14944
|
-
resizeObserver?.disconnect();
|
|
14945
|
-
editor.off("transaction", schedule);
|
|
14946
|
-
surface.removeEventListener(UEDITOR_TABLE_LAYOUT_CHANGE_EVENT, schedule);
|
|
14947
|
-
editorWindow.removeEventListener("resize", schedule);
|
|
14948
|
-
resetWidths();
|
|
14949
|
-
};
|
|
14950
|
-
}, [editor, editorShellRef, editorSurfaceRef, enabled, widthBoundaryRef]);
|
|
14951
|
-
}
|
|
14952
|
-
|
|
14953
14888
|
// src/components/UEditor/UEditor.tsx
|
|
14954
14889
|
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
14955
|
-
var LazyMenuBar =
|
|
14890
|
+
var LazyMenuBar = React16.lazy(async () => {
|
|
14956
14891
|
const { MenuBar } = await import("./menu-bar-HZBBRX42.js");
|
|
14957
14892
|
return { default: MenuBar };
|
|
14958
14893
|
});
|
|
14959
|
-
var UEditor =
|
|
14894
|
+
var UEditor = React16.forwardRef(({
|
|
14960
14895
|
getPortalContainer,
|
|
14961
14896
|
content = "",
|
|
14962
14897
|
onChange,
|
|
@@ -15015,10 +14950,8 @@ var UEditor = React17.forwardRef(({
|
|
|
15015
14950
|
const editorInstanceRef = useRef10(null);
|
|
15016
14951
|
const formulaRangePickRef = useRef10(null);
|
|
15017
14952
|
const formulaRangeSurfaceRef = useRef10(null);
|
|
15018
|
-
const [formulaRangeHighlight, setFormulaRangeHighlight] =
|
|
15019
|
-
const [isMenuBarVisible, setIsMenuBarVisible] =
|
|
15020
|
-
const widthBoundaryRef = useRef10(null);
|
|
15021
|
-
const editorShellRef = useRef10(null);
|
|
14953
|
+
const [formulaRangeHighlight, setFormulaRangeHighlight] = React16.useState(null);
|
|
14954
|
+
const [isMenuBarVisible, setIsMenuBarVisible] = React16.useState(showMenuBar);
|
|
15022
14955
|
useEffect10(() => {
|
|
15023
14956
|
setIsMenuBarVisible(showMenuBar);
|
|
15024
14957
|
}, [showMenuBar]);
|
|
@@ -15028,7 +14961,7 @@ var UEditor = React17.forwardRef(({
|
|
|
15028
14961
|
onJsonChange,
|
|
15029
14962
|
outputDebounceMs
|
|
15030
14963
|
});
|
|
15031
|
-
const scheduleFormulaRecalculate =
|
|
14964
|
+
const scheduleFormulaRecalculate = React16.useCallback((editor2, options) => {
|
|
15032
14965
|
if (editor2.isDestroyed || scheduledFormulaRecalculateRef.current) return;
|
|
15033
14966
|
if (!options?.force && isEditingTableFormulaText(editor2)) return;
|
|
15034
14967
|
scheduledFormulaRecalculateRef.current = true;
|
|
@@ -15070,7 +15003,7 @@ var UEditor = React17.forwardRef(({
|
|
|
15070
15003
|
],
|
|
15071
15004
|
[getPortalContainer, effectivePlaceholder, t, maxCharacters, uploadImage, resolvedUploadFile, imageInsertMode, maxImageFileSize, allowedImageMimeTypes, fallbackToDataUrl, onImageUploadError, editable, fetchMetadata, extraExtensions]
|
|
15072
15005
|
);
|
|
15073
|
-
const syncFormulaRangeHighlight =
|
|
15006
|
+
const syncFormulaRangeHighlight = React16.useCallback((pickState) => {
|
|
15074
15007
|
const container = formulaRangeSurfaceRef.current;
|
|
15075
15008
|
setFormulaRangeHighlight(container && pickState ? getFormulaRangePickHighlight(container, pickState) : null);
|
|
15076
15009
|
}, []);
|
|
@@ -15211,7 +15144,6 @@ var UEditor = React17.forwardRef(({
|
|
|
15211
15144
|
apply: t("tableMenu.apply"),
|
|
15212
15145
|
cancel: t("imageInput.cancelBtn")
|
|
15213
15146
|
});
|
|
15214
|
-
useWideTableLayout(editor, expandWideTables, widthBoundaryRef, editorShellRef, editorContentRef);
|
|
15215
15147
|
useImperativeHandle4(
|
|
15216
15148
|
ref,
|
|
15217
15149
|
() => ({
|
|
@@ -15279,10 +15211,9 @@ var UEditor = React17.forwardRef(({
|
|
|
15279
15211
|
}
|
|
15280
15212
|
) });
|
|
15281
15213
|
}
|
|
15282
|
-
return /* @__PURE__ */ jsx20(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ jsx20("div", {
|
|
15214
|
+
return /* @__PURE__ */ jsx20(UEditorPortalProvider, { getPortalContainer, children: /* @__PURE__ */ jsx20("div", { "data-ueditor-width-boundary": "", className: "w-full", children: /* @__PURE__ */ jsxs17(
|
|
15283
15215
|
"div",
|
|
15284
15216
|
{
|
|
15285
|
-
ref: editorShellRef,
|
|
15286
15217
|
className: cn(
|
|
15287
15218
|
"group relative flex flex-col text-card-foreground",
|
|
15288
15219
|
editable ? [
|
|
@@ -15297,7 +15228,7 @@ var UEditor = React17.forwardRef(({
|
|
|
15297
15228
|
),
|
|
15298
15229
|
children: [
|
|
15299
15230
|
editable && (showMenuBar || showToolbar || showBubbleMenu) ? /* @__PURE__ */ jsxs17(EditorUiRenderStateProvider, { editor, children: [
|
|
15300
|
-
isMenuBarVisible && /* @__PURE__ */ jsx20(
|
|
15231
|
+
isMenuBarVisible && /* @__PURE__ */ jsx20(React16.Suspense, { fallback: null, children: /* @__PURE__ */ jsx20(
|
|
15301
15232
|
LazyMenuBar,
|
|
15302
15233
|
{
|
|
15303
15234
|
editor,
|
|
@@ -15355,7 +15286,7 @@ var UEditor = React17.forwardRef(({
|
|
|
15355
15286
|
formulaRangeSurfaceRef.current = node;
|
|
15356
15287
|
},
|
|
15357
15288
|
className: cn(
|
|
15358
|
-
"relative flex-1 overflow-y-auto",
|
|
15289
|
+
"relative flex-1 overflow-x-auto overflow-y-auto [scrollbar-width:thin] [scrollbar-color:hsl(var(--border))_transparent]",
|
|
15359
15290
|
expandWideTables && "[&_.tableWrapper]:!overflow-visible [&_.tableWrapper]:!pb-0"
|
|
15360
15291
|
),
|
|
15361
15292
|
style: {
|
|
@@ -15448,4 +15379,4 @@ export {
|
|
|
15448
15379
|
prepareUEditorContentForSave,
|
|
15449
15380
|
UEditor_default
|
|
15450
15381
|
};
|
|
15451
|
-
//# sourceMappingURL=chunk-
|
|
15382
|
+
//# sourceMappingURL=chunk-JYAEYUGM.js.map
|