@underverse-ui/underverse 2.0.23 → 2.0.25

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.
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Modal_default
4
- } from "./chunk-ZQWVWDGS.js";
4
+ } from "./chunk-FFVBGTHU.js";
5
5
  import {
6
6
  DEFAULT_TABLE_ROW_HEIGHT,
7
7
  DEFAULT_UEDITOR_IMAGE_MAX_FILE_SIZE,
@@ -21,7 +21,7 @@ import {
21
21
  sanitizeUEditorUrl,
22
22
  useDropdownMenuClose,
23
23
  useSharedEditorUiRenderState
24
- } from "./chunk-O7AAN6W6.js";
24
+ } from "./chunk-OJF3XRN7.js";
25
25
  import {
26
26
  cn,
27
27
  useSmartTranslations
@@ -945,4 +945,4 @@ var MenuBar = ({
945
945
  export {
946
946
  MenuBar
947
947
  };
948
- //# sourceMappingURL=menu-bar-E7MNW6UC.js.map
948
+ //# sourceMappingURL=menu-bar-4FM4Y273.js.map
package/dist/ueditor.cjs CHANGED
@@ -5787,7 +5787,8 @@ var init_DropdownMenu = __esm({
5787
5787
  openOnHover = false,
5788
5788
  hoverCloseDelay = 120,
5789
5789
  items,
5790
- borderMode
5790
+ borderMode,
5791
+ getPortalContainer
5791
5792
  }) => {
5792
5793
  const [internalOpen, setInternalOpen] = (0, import_react29.useState)(false);
5793
5794
  const open = isOpen !== void 0 ? isOpen : internalOpen;
@@ -6020,6 +6021,7 @@ var init_DropdownMenu = __esm({
6020
6021
  placement,
6021
6022
  disabled,
6022
6023
  borderMode: resolvedBorderMode,
6024
+ getPortalContainer,
6023
6025
  contentClassName: cn("p-1", contentClassName),
6024
6026
  children: menuBody
6025
6027
  }
@@ -6080,7 +6082,7 @@ var init_DropdownMenu = __esm({
6080
6082
  );
6081
6083
  };
6082
6084
  DropdownMenuSeparator = ({ className }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("h-px bg-border my-1", className) });
6083
- DropdownMenuSub = ({ label, icon: Icon, disabled, borderMode, children }) => {
6085
+ DropdownMenuSub = ({ label, icon: Icon, disabled, borderMode, getPortalContainer, children }) => {
6084
6086
  const globalConfig = useUnderverseUIConfig();
6085
6087
  const resolvedBorderMode = borderMode ?? globalConfig.dropdownMenu?.borderMode ?? globalConfig.borderMode;
6086
6088
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -6108,6 +6110,7 @@ var init_DropdownMenu = __esm({
6108
6110
  ),
6109
6111
  placement: "right",
6110
6112
  openOnHover: true,
6113
+ getPortalContainer,
6111
6114
  children
6112
6115
  }
6113
6116
  );
@@ -20918,6 +20921,22 @@ init_table_dom_utils();
20918
20921
  init_table_dom_utils();
20919
20922
  var FALLBACK_TABLE_ROW_HEIGHT = DEFAULT_TABLE_ROW_HEIGHT;
20920
20923
  var FALLBACK_TABLE_COLUMN_WIDTH = 160;
20924
+ function isTableCellElement(element) {
20925
+ const realm = element?.ownerDocument?.defaultView;
20926
+ return Boolean(realm && element instanceof realm.HTMLTableCellElement);
20927
+ }
20928
+ function isTableRowElement(element) {
20929
+ const realm = element?.ownerDocument?.defaultView;
20930
+ return Boolean(realm && element instanceof realm.HTMLTableRowElement);
20931
+ }
20932
+ function isTableElement(element) {
20933
+ const realm = element?.ownerDocument?.defaultView;
20934
+ return Boolean(realm && element instanceof realm.HTMLTableElement);
20935
+ }
20936
+ function isHTMLElement(element) {
20937
+ const realm = element?.ownerDocument?.defaultView;
20938
+ return Boolean(realm && element instanceof realm.HTMLElement);
20939
+ }
20921
20940
  function getVisibleTableBounds(layout) {
20922
20941
  const left = Math.max(layout.tableLeft, layout.wrapperLeft);
20923
20942
  const top = Math.max(layout.tableTop, layout.wrapperTop);
@@ -20942,23 +20961,23 @@ function parsePixelMetric(value) {
20942
20961
  }
20943
20962
  function getPrimaryCell(table) {
20944
20963
  const cell = table.querySelector("th,td");
20945
- return cell instanceof HTMLTableCellElement ? cell : null;
20964
+ return isTableCellElement(cell) ? cell : null;
20946
20965
  }
20947
20966
  function getLastCell(table) {
20948
20967
  const lastRow = table.rows.item(table.rows.length - 1);
20949
- if (!(lastRow instanceof HTMLTableRowElement)) return null;
20968
+ if (!isTableRowElement(lastRow)) return null;
20950
20969
  const cell = lastRow.cells.item(lastRow.cells.length - 1);
20951
- return cell instanceof HTMLTableCellElement ? cell : null;
20970
+ return isTableCellElement(cell) ? cell : null;
20952
20971
  }
20953
20972
  function getCellFromTarget(target) {
20954
20973
  const element = resolveEventElement(target);
20955
20974
  if (!element) return null;
20956
20975
  const directCell = element.closest("th,td");
20957
- if (directCell instanceof HTMLTableCellElement) {
20976
+ if (isTableCellElement(directCell)) {
20958
20977
  return directCell;
20959
20978
  }
20960
20979
  const table = element.closest("table");
20961
- if (table instanceof HTMLTableElement) {
20980
+ if (isTableElement(table)) {
20962
20981
  return getPrimaryCell(table);
20963
20982
  }
20964
20983
  return null;
@@ -21004,7 +21023,7 @@ function buildLogicalColumnMetrics({
21004
21023
  const visualColumns = [];
21005
21024
  if (firstRow) {
21006
21025
  for (const tableCell of Array.from(firstRow.cells)) {
21007
- if (!(tableCell instanceof HTMLTableCellElement)) continue;
21026
+ if (!isTableCellElement(tableCell)) continue;
21008
21027
  const cellPos = editor.view.posAtDOM(tableCell, 0);
21009
21028
  const relativeCellPos = getCellRelativePosFromDomPos(map, tableInfo.start, cellPos);
21010
21029
  if (relativeCellPos == null) continue;
@@ -21061,7 +21080,8 @@ function buildLogicalRowMetrics({
21061
21080
  seenCellPositions.add(relativeCellPos);
21062
21081
  const cellMapRect = map.findCell(relativeCellPos);
21063
21082
  const cellDom = editor.view.nodeDOM(tableInfo.start + relativeCellPos);
21064
- const tableCell = cellDom instanceof HTMLTableCellElement ? cellDom : null;
21083
+ const cellCandidate = cellDom;
21084
+ const tableCell = isTableCellElement(cellCandidate) ? cellCandidate : null;
21065
21085
  if (tableCell) {
21066
21086
  const cellRect = tableCell.getBoundingClientRect();
21067
21087
  const start = cellRect.height > 0 ? cellRect.top - surfaceRect.top + surface.scrollTop : tableTop + cellMapRect.top * fallbackHeight;
@@ -21111,14 +21131,14 @@ function getTableCellTextSelectionRange(editor, cellPos) {
21111
21131
  function buildTableControlLayout(editor, surface, cell) {
21112
21132
  const row = cell.closest("tr");
21113
21133
  const table = cell.closest("table");
21114
- if (!(row instanceof HTMLTableRowElement) || !(table instanceof HTMLTableElement)) {
21134
+ if (!isTableRowElement(row) || !isTableElement(table)) {
21115
21135
  return null;
21116
21136
  }
21117
- const rows = Array.from(table.rows).filter((item) => item instanceof HTMLTableRowElement);
21137
+ const rows = Array.from(table.rows).filter(isTableRowElement);
21118
21138
  const cornerCell = getLastCell(table);
21119
21139
  const cellPos = editor.view.posAtDOM(cell, 0);
21120
21140
  const tableInfo = findTableInfo(editor, cellPos);
21121
- if (rows.length === 0 || !tableInfo || !(cornerCell instanceof HTMLTableCellElement)) {
21141
+ if (rows.length === 0 || !tableInfo || !isTableCellElement(cornerCell)) {
21122
21142
  return null;
21123
21143
  }
21124
21144
  const map = TableMap4.get(tableInfo.node);
@@ -21129,7 +21149,7 @@ function buildTableControlLayout(editor, surface, cell) {
21129
21149
  const explicitRowHeights = rows.map((tableRow) => parsePixelMetric(tableRow.getAttribute("data-row-height")) ?? parsePixelMetric(tableRow.style.height));
21130
21150
  const explicitTableHeight = explicitRowHeights.every((height) => height !== null) ? explicitRowHeights.reduce((sum, height) => sum + height, 0) : null;
21131
21151
  const wrapperElement = table.closest(".tableWrapper");
21132
- const wrapper = wrapperElement instanceof HTMLElement ? wrapperElement : null;
21152
+ const wrapper = isHTMLElement(wrapperElement) ? wrapperElement : null;
21133
21153
  const wrapperRect = wrapper?.getBoundingClientRect() ?? tableRect;
21134
21154
  const tableLeft = tableRect.left - surfaceRect.left + surface.scrollLeft;
21135
21155
  const tableTop = tableRect.top - surfaceRect.top + surface.scrollTop;
@@ -21198,6 +21218,10 @@ var COLUMN_HANDLE_HOVER_HEIGHT = 28;
21198
21218
  var ADD_COLUMN_HOVER_WIDTH = 24;
21199
21219
  var ADD_ROW_HOVER_HEIGHT = 24;
21200
21220
  var HANDLE_HOVER_RADIUS = 14;
21221
+ function isHTMLElement2(element) {
21222
+ const realm = element?.ownerDocument?.defaultView;
21223
+ return Boolean(realm && element instanceof realm.HTMLElement);
21224
+ }
21201
21225
  var DEFAULT_TABLE_HOVER_STATE = {
21202
21226
  menuVisible: false,
21203
21227
  addColumnVisible: false,
@@ -21225,8 +21249,8 @@ function buildTableHoverState({
21225
21249
  const directTableMenu = targetElement?.closest?.("[data-table-control='table-menu']");
21226
21250
  const directAddColumn = targetElement?.closest?.("[data-table-control='add-column']");
21227
21251
  const directAddRow = targetElement?.closest?.("[data-table-control='add-row']");
21228
- const directRowHandleIndex = directRowHandle instanceof HTMLElement && relativeX <= layout.tableLeft ? Number.parseInt(directRowHandle.dataset.rowHandleIndex ?? "", 10) : Number.NaN;
21229
- const directColumnHandleIndex = directColumnHandle instanceof HTMLElement && relativeY <= layout.tableTop ? Number.parseInt(directColumnHandle.dataset.columnHandleIndex ?? "", 10) : Number.NaN;
21252
+ const directRowHandleIndex = isHTMLElement2(directRowHandle) && relativeX <= layout.tableLeft ? Number.parseInt(directRowHandle.dataset.rowHandleIndex ?? "", 10) : Number.NaN;
21253
+ const directColumnHandleIndex = isHTMLElement2(directColumnHandle) && relativeY <= layout.tableTop ? Number.parseInt(directColumnHandle.dataset.columnHandleIndex ?? "", 10) : Number.NaN;
21230
21254
  const visibleBounds = getVisibleTableBounds(layout);
21231
21255
  const rowRailTop = layout.wrapperTop + layout.wrapperHeight;
21232
21256
  const isMouseInTable = relativeX >= layout.tableLeft && relativeX <= layout.tableLeft + layout.tableWidth && relativeY >= layout.tableTop && relativeY <= layout.tableTop + layout.tableHeight;