@gantfdt/semiword 1.1.0 → 1.1.2

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,5 +1,5 @@
1
- import { useEditorRefApi, isTemplateTableEl, useTableActions, useTableRowColActions } from './chunk-DRZQC4T6.mjs';
2
- import { glassSurfaceCss, createCssScope, templateCss, typographyCss, codeBlockCss, tableCss, fixedTableCss, getDefaultPlaceholder, PluginRegistry, BUILTIN_PLUGINS, MINIMAL_PLUGINS, isSafeCssColor, sanitizeJsonContent, findAncestor } from './chunk-6XGJMUU3.mjs';
1
+ import { useEditorRefApi, isTemplateTableEl, useTableActions, useTableRowColActions } from './chunk-IQZHLLFT.mjs';
2
+ import { glassSurfaceCss, createCssScope, templateCss, typographyCss, codeBlockCss, tableCss, fixedTableCss, getDefaultPlaceholder, PluginRegistry, BUILTIN_PLUGINS, MINIMAL_PLUGINS, isSafeCssColor, sanitizeJsonContent, findAncestor } from './chunk-YE3O5CVM.mjs';
3
3
  import { createStyles, Button, IconChevronDown, Tooltip, Tag, Dropdown, Divider, Input, InputNumber } from './chunk-WT7ZJINB.mjs';
4
4
  import { sanitizeHtml } from './chunk-7D6NMYFG.mjs';
5
5
  import { tr } from './chunk-W627LLF4.mjs';
@@ -1554,6 +1554,26 @@ var useToolbarStyles = createStyles(({ css, token, sizeToken, glassEffect, getAl
1554
1554
  align-items: center;
1555
1555
  gap: 4px;
1556
1556
  font-size: ${token.fontSizeLG}px;
1557
+ `,
1558
+ /* 触发器文字列固定宽度:正文 / H1-H6 切换时按钮宽度保持一致,不随文案伸缩 */
1559
+ dropdownTriggerLabel: css`
1560
+ display: inline-block;
1561
+ width: 2em;
1562
+ text-align: left;
1563
+ white-space: nowrap;
1564
+ `,
1565
+ /* ---- 弹出面板表面 ---- */
1566
+ /* 浮层统一使用不透明容器色:毛玻璃主题下也不透出页面背景 */
1567
+ popupSurface: css`
1568
+ background: ${token.colorBgElevated};
1569
+ border-radius: ${borderRadius + 2}px;
1570
+ box-shadow: ${token.boxShadowSecondary};
1571
+ `,
1572
+ /* 菜单型下拉:覆盖宿主主题可能挂上的半透明菜单底色 */
1573
+ dropdownPopup: css`
1574
+ .ant-dropdown-menu {
1575
+ background: ${token.colorBgElevated};
1576
+ }
1557
1577
  `
1558
1578
  };
1559
1579
  });
@@ -2086,7 +2106,7 @@ function ColorPickerButton({ item, editor }) {
2086
2106
  const isDefaultActive = !checkedValue;
2087
2107
  const solidInitialColor = lastUsedColor && !isGradientColor(lastUsedColor) ? lastUsedColor : recentColors[0];
2088
2108
  const barStyle = displayValue ? isGradientColor(displayValue) ? { backgroundImage: displayValue } : { backgroundColor: displayValue } : void 0;
2089
- const palette = /* @__PURE__ */ jsxs("div", { className: styles.colorPanel, "data-color-picker-owner": item.id, children: [
2109
+ const palette = /* @__PURE__ */ jsxs("div", { className: cx(styles.colorPanel, styles.popupSurface), "data-color-picker-owner": item.id, children: [
2090
2110
  /* @__PURE__ */ jsxs("div", { className: styles.colorPaletteWrapper, children: [
2091
2111
  /* @__PURE__ */ jsxs("button", { type: "button", className: styles.colorDefaultRow, onClick: handleClear, children: [
2092
2112
  /* @__PURE__ */ jsx("span", { className: styles.colorDefaultSwatch, style: { backgroundColor: defaultSwatch ?? "transparent" }, children: isDefaultActive && /* @__PURE__ */ jsx(CheckIcon, { color: defaultSwatch ? getReadableCheckColor(defaultSwatch) : "#262626" }) }),
@@ -2216,7 +2236,7 @@ ToolbarDropdownTrigger.displayName = "ToolbarDropdownTrigger";
2216
2236
  var MAX_ROWS = 5;
2217
2237
  var MAX_COLS = 5;
2218
2238
  function TableInsertMenu({ item, editor }) {
2219
- const { styles } = useToolbarStyles();
2239
+ const { styles, cx } = useToolbarStyles();
2220
2240
  const [open, setOpen] = useState(false);
2221
2241
  const [hover, setHover] = useState({ row: 0, col: 0 });
2222
2242
  const gridRef = useRef(null);
@@ -2235,7 +2255,7 @@ function TableInsertMenu({ item, editor }) {
2235
2255
  onNavigate: (index) => setHover({ row: Math.floor(index / MAX_COLS) + 1, col: index % MAX_COLS + 1 })
2236
2256
  });
2237
2257
  const handleCellKeyDown = (event, row, col) => handleKeyDown(event, (row - 1) * MAX_COLS + (col - 1));
2238
- const grid = /* @__PURE__ */ jsxs("div", { ref: gridRef, className: styles.tableGrid, children: [
2258
+ const grid = /* @__PURE__ */ jsxs("div", { ref: gridRef, className: cx(styles.tableGrid, styles.popupSurface), children: [
2239
2259
  /* @__PURE__ */ jsx("table", { className: styles.tableGridTable, role: "grid", "aria-label": item.label ?? tr("\u63D2\u5165\u8868\u683C"), children: /* @__PURE__ */ jsx("tbody", { children: Array.from({ length: MAX_ROWS }, (_, i) => /* @__PURE__ */ jsx("tr", { role: "row", children: Array.from({ length: MAX_COLS }, (_2, j) => {
2240
2260
  const row = i + 1;
2241
2261
  const col = j + 1;
@@ -2298,6 +2318,7 @@ function ToolbarDivider() {
2298
2318
  return /* @__PURE__ */ jsx(Divider, { type: "vertical" });
2299
2319
  }
2300
2320
  function ToolbarDropdown({ item, editor }) {
2321
+ const { styles } = useToolbarStyles();
2301
2322
  const options = item.options ?? [];
2302
2323
  if (options.length === 0) return null;
2303
2324
  const activeIndex = options.findIndex((opt) => opt.isActive?.(editor) ?? false);
@@ -2312,6 +2333,7 @@ function ToolbarDropdown({ item, editor }) {
2312
2333
  Dropdown,
2313
2334
  {
2314
2335
  trigger: ["click"],
2336
+ rootClassName: styles.dropdownPopup,
2315
2337
  menu: {
2316
2338
  items: menuItems,
2317
2339
  // 高亮当前激活的选项
@@ -2324,7 +2346,7 @@ function ToolbarDropdown({ item, editor }) {
2324
2346
  },
2325
2347
  children: /* @__PURE__ */ jsxs(ToolbarDropdownTrigger, { children: [
2326
2348
  item.icon,
2327
- triggerLabel
2349
+ /* @__PURE__ */ jsx("span", { className: styles.dropdownTriggerLabel, children: triggerLabel })
2328
2350
  ] })
2329
2351
  }
2330
2352
  );
@@ -3341,5 +3363,5 @@ var RichEditor = forwardRef(function RichEditor2(props, ref) {
3341
3363
  });
3342
3364
 
3343
3365
  export { CollaborationProvider, EditorContext, RichEditor, useCollaboration, useEditorContext, usePluginRegistry };
3344
- //# sourceMappingURL=chunk-3K44CBQF.mjs.map
3345
- //# sourceMappingURL=chunk-3K44CBQF.mjs.map
3366
+ //# sourceMappingURL=chunk-V4AKDECS.mjs.map
3367
+ //# sourceMappingURL=chunk-V4AKDECS.mjs.map