rme 0.3.0-beta.30 → 0.3.0-beta.31

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/dist/index.mjs CHANGED
@@ -2253,7 +2253,7 @@ function computeChange(oldVal, newVal) {
2253
2253
 
2254
2254
  // src/editor/components/Editor.tsx
2255
2255
  import { prosemirrorNodeToHtml } from "@rme-sdk/main";
2256
- import { forwardRef as forwardRef2, memo as memo9, useImperativeHandle as useImperativeHandle2, useMemo as useMemo7, useState as useState9 } from "react";
2256
+ import { forwardRef as forwardRef2, memo as memo9, useImperativeHandle as useImperativeHandle2, useMemo as useMemo7, useState as useState8 } from "react";
2257
2257
 
2258
2258
  // src/editor/components/SourceEditor/index.tsx
2259
2259
  import { ProsemirrorDevTools } from "@rme-sdk/dev";
@@ -12557,123 +12557,69 @@ import { PositionerPortal, useCommands as useCommands3, useMultiPositioner } fro
12557
12557
  import { useEffect as useEffect9 } from "react";
12558
12558
 
12559
12559
  // src/editor/toolbar/TableToolbar/ActiveCellMenu.tsx
12560
- import {
12561
- ClickAwayListener,
12562
- Grow,
12563
- ListItemText,
12564
- MenuItem as MenuItem2,
12565
- MenuList,
12566
- Paper,
12567
- Popper
12568
- } from "@mui/material";
12569
12560
  import { useCommands } from "@rme-sdk/react";
12570
- import { useRef as useRef9, useState as useState8 } from "react";
12561
+ import { Dropdown } from "antd";
12571
12562
  import { useTranslation as useTranslation2 } from "react-i18next";
12572
- import styled12 from "styled-components";
12573
- import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
12574
- var Container5 = styled12.div`
12575
- position: absolute;
12576
-
12577
- .MuiList-padding {
12578
- padding: 0;
12579
- }
12580
- `;
12563
+ import { jsx as jsx20 } from "react/jsx-runtime";
12581
12564
  var ActiveCellMenu = (props) => {
12582
12565
  const { positioner } = props;
12583
12566
  const commands = useCommands();
12584
- const [open, setOpen] = useState8(false);
12585
- const anchorRef = useRef9(null);
12586
12567
  const { t: t19 } = useTranslation2();
12587
- const options = [
12568
+ const menuItems = [
12588
12569
  {
12589
- label: "insert column before",
12590
- i18nKey: "table.insertColumnBefore",
12591
- handler: commands.addTableColumnBefore
12570
+ key: "insertColumnBefore",
12571
+ label: t19("table.insertColumnBefore"),
12572
+ onClick: commands.addTableColumnBefore
12592
12573
  },
12593
12574
  {
12594
- label: "insert column after",
12595
- i18nKey: "table.insertColumnAfter",
12596
- handler: commands.addTableColumnAfter
12575
+ key: "insertColumnAfter",
12576
+ label: t19("table.insertColumnAfter"),
12577
+ onClick: commands.addTableColumnAfter
12597
12578
  },
12598
12579
  {
12599
- label: "insert row before",
12600
- i18nKey: "table.insertRowBefore",
12601
- handler: commands.addTableRowBefore
12580
+ key: "insertRowBefore",
12581
+ label: t19("table.insertRowBefore"),
12582
+ onClick: commands.addTableRowBefore
12602
12583
  },
12603
12584
  {
12604
- label: "insert row after",
12605
- i18nKey: "table.insertRowAfter",
12606
- handler: commands.addTableRowAfter
12585
+ key: "insertRowAfter",
12586
+ label: t19("table.insertRowAfter"),
12587
+ onClick: commands.addTableRowAfter
12607
12588
  },
12608
12589
  {
12609
- label: "delete column",
12610
- i18nKey: "table.deleteColumn",
12611
- handler: commands.deleteTableColumn
12590
+ key: "deleteColumn",
12591
+ label: t19("table.deleteColumn"),
12592
+ onClick: commands.deleteTableColumn
12612
12593
  },
12613
12594
  {
12614
- label: "delete row",
12615
- i18nKey: "table.deleteRow",
12616
- handler: commands.deleteTableRow
12595
+ key: "deleteRow",
12596
+ label: t19("table.deleteRow"),
12597
+ onClick: commands.deleteTableRow
12617
12598
  }
12618
12599
  ];
12619
- const handleClose = (event) => {
12620
- if (anchorRef.current && anchorRef.current.contains(event.target)) {
12621
- return;
12622
- }
12623
- setOpen(false);
12624
- };
12625
12600
  const { ref, key: key2, x, y } = positioner;
12626
- return /* @__PURE__ */ jsxs9(
12627
- Container5,
12601
+ return /* @__PURE__ */ jsx20(
12602
+ "div",
12628
12603
  {
12629
12604
  ref,
12630
12605
  style: {
12606
+ position: "absolute",
12631
12607
  left: x,
12632
12608
  top: y,
12633
12609
  width: 20,
12634
12610
  height: 20,
12635
12611
  zIndex: 1
12636
12612
  },
12637
- onMouseDown: (e) => {
12638
- e.preventDefault();
12639
- setOpen(true);
12640
- },
12641
- children: [
12642
- /* @__PURE__ */ jsx20("div", { ref: anchorRef, children: /* @__PURE__ */ jsx20("i", { className: "ri-equalizer-line" }) }),
12643
- /* @__PURE__ */ jsx20(
12644
- Popper,
12645
- {
12646
- sx: {
12647
- zIndex: 1
12648
- },
12649
- open,
12650
- anchorEl: anchorRef.current,
12651
- role: void 0,
12652
- transition: true,
12653
- disablePortal: true,
12654
- children: ({ TransitionProps, placement }) => /* @__PURE__ */ jsx20(
12655
- Grow,
12656
- {
12657
- ...TransitionProps,
12658
- style: {
12659
- transformOrigin: placement === "bottom" ? "center top" : "center bottom"
12660
- },
12661
- children: /* @__PURE__ */ jsx20(Paper, { children: /* @__PURE__ */ jsx20(ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsx20(MenuList, { dense: true, autoFocusItem: true, children: options.map((option) => /* @__PURE__ */ jsx20(
12662
- MenuItem2,
12663
- {
12664
- onClick: () => {
12665
- option.handler();
12666
- setOpen(false);
12667
- },
12668
- children: /* @__PURE__ */ jsx20(ListItemText, { children: t19(option.i18nKey) })
12669
- },
12670
- option.label
12671
- )) }) }) })
12672
- }
12673
- )
12674
- }
12675
- )
12676
- ]
12613
+ children: /* @__PURE__ */ jsx20(Dropdown, { menu: { items: menuItems }, trigger: ["click"], children: /* @__PURE__ */ jsx20(
12614
+ "div",
12615
+ {
12616
+ onMouseDown: (e) => {
12617
+ e.preventDefault();
12618
+ },
12619
+ style: { cursor: "pointer" },
12620
+ children: /* @__PURE__ */ jsx20("i", { className: "ri-equalizer-line" })
12621
+ }
12622
+ ) })
12677
12623
  },
12678
12624
  key2
12679
12625
  );
@@ -12682,10 +12628,10 @@ var ActiveCellMenu_default = ActiveCellMenu;
12682
12628
 
12683
12629
  // src/editor/toolbar/TableToolbar/TableBar.tsx
12684
12630
  import { useCommands as useCommands2 } from "@rme-sdk/react";
12685
- import styled13 from "styled-components";
12631
+ import styled12 from "styled-components";
12686
12632
  import { Tooltip } from "zens";
12687
12633
  import { jsx as jsx21 } from "react/jsx-runtime";
12688
- var Container6 = styled13.div`
12634
+ var Container5 = styled12.div`
12689
12635
  position: absolute;
12690
12636
  color: ${(props) => props.theme.dangerColor};
12691
12637
  `;
@@ -12694,7 +12640,7 @@ function TableBar(props) {
12694
12640
  const commands = useCommands2();
12695
12641
  const { ref, key: key2, x, y } = positioner;
12696
12642
  return /* @__PURE__ */ jsx21(
12697
- Container6,
12643
+ Container5,
12698
12644
  {
12699
12645
  ref,
12700
12646
  style: {
@@ -12820,7 +12766,7 @@ var TableToolbar_default = TableToolbar;
12820
12766
  // src/editor/toolbar/toolbar/command-btns/command-button.tsx
12821
12767
  import { isString as isString4 } from "@rme-sdk/core";
12822
12768
  import { useCallback as useCallback6 } from "react";
12823
- import styled14 from "styled-components";
12769
+ import styled13 from "styled-components";
12824
12770
  import { Ariakit, Tooltip as Tooltip2 } from "zens";
12825
12771
 
12826
12772
  // src/editor/toolbar/toolbar/use-command-option-values.ts
@@ -12906,7 +12852,7 @@ var CommandButton = ({
12906
12852
  const tooltipText = label ?? labelText;
12907
12853
  const shortcutText = displayShortcut && commandOptions.shortcut ? ` (${commandOptions.shortcut})` : "";
12908
12854
  return /* @__PURE__ */ jsx24(Tooltip2, { title: `${tooltipText}${shortcutText}`, children: /* @__PURE__ */ jsx24(
12909
- Container7,
12855
+ Container6,
12910
12856
  {
12911
12857
  "aria-label": labelText,
12912
12858
  disabled: !enabled,
@@ -12917,7 +12863,7 @@ var CommandButton = ({
12917
12863
  }
12918
12864
  ) });
12919
12865
  };
12920
- var Container7 = styled14(Ariakit.ToolbarItem)`
12866
+ var Container6 = styled13(Ariakit.ToolbarItem)`
12921
12867
  display: flex;
12922
12868
  flex-direction: column;
12923
12869
  align-items: center;
@@ -12935,7 +12881,7 @@ var Container7 = styled14(Ariakit.ToolbarItem)`
12935
12881
  `;
12936
12882
 
12937
12883
  // src/editor/toolbar/toolbar/wysiwyg-toolbar.tsx
12938
- import styled15 from "styled-components";
12884
+ import styled14 from "styled-components";
12939
12885
  import { Ariakit as Ariakit2 } from "zens";
12940
12886
 
12941
12887
  // src/editor/toolbar/toolbar/command-btns/insert-separator-button.tsx
@@ -13282,10 +13228,10 @@ var UndoButton = (props) => {
13282
13228
  };
13283
13229
 
13284
13230
  // src/editor/toolbar/toolbar/wysiwyg-toolbar.tsx
13285
- import { jsx as jsx37, jsxs as jsxs10 } from "react/jsx-runtime";
13231
+ import { jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
13286
13232
  var WysiwygToolbar = (props) => {
13287
13233
  const { prevActions = null, nextActions = null } = props;
13288
- return /* @__PURE__ */ jsxs10(ToolBar, { className: props.className, style: props.style, children: [
13234
+ return /* @__PURE__ */ jsxs9(ToolBar, { className: props.className, style: props.style, children: [
13289
13235
  prevActions,
13290
13236
  /* @__PURE__ */ jsx37(UndoButton, {}),
13291
13237
  /* @__PURE__ */ jsx37(RedoButton, {}),
@@ -13304,7 +13250,7 @@ var WysiwygToolbar = (props) => {
13304
13250
  nextActions
13305
13251
  ] });
13306
13252
  };
13307
- var ToolBar = styled15(Ariakit2.Toolbar)`
13253
+ var ToolBar = styled14(Ariakit2.Toolbar)`
13308
13254
  display: flex;
13309
13255
  flex-wrap: wrap;
13310
13256
  max-width: 100%;
@@ -13315,7 +13261,7 @@ var ToolBar = styled15(Ariakit2.Toolbar)`
13315
13261
  color: ${(props) => props.theme.primaryFontColor};
13316
13262
  background-color: ${(props) => props.theme.editorToolbarBgColor};
13317
13263
  `;
13318
- var ToolbarSeparator = styled15(Ariakit2.ToolbarSeparator)`
13264
+ var ToolbarSeparator = styled14(Ariakit2.ToolbarSeparator)`
13319
13265
  height: 0.5em;
13320
13266
  margin: 0 0.25em;
13321
13267
  border-right-width: 1px;
@@ -13417,7 +13363,7 @@ var createWysiwygDelegate = (options = {}) => {
13417
13363
  };
13418
13364
 
13419
13365
  // src/editor/components/WysiwygEditor/index.tsx
13420
- import { jsx as jsx39, jsxs as jsxs11 } from "react/jsx-runtime";
13366
+ import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
13421
13367
  var WysiwygEditor = (props) => {
13422
13368
  const {
13423
13369
  content,
@@ -13458,7 +13404,7 @@ var WysiwygEditor = (props) => {
13458
13404
  } catch (error) {
13459
13405
  return /* @__PURE__ */ jsx39(ErrorBoundary_default, { hasError: true, error, ...props.errorHandler || {} });
13460
13406
  }
13461
- return /* @__PURE__ */ jsx39(ErrorBoundary_default, { ...props.errorHandler || {}, children: /* @__PURE__ */ jsx39(WysiwygThemeWrapper, { ...styleToken, children: /* @__PURE__ */ jsxs11(
13407
+ return /* @__PURE__ */ jsx39(ErrorBoundary_default, { ...props.errorHandler || {}, children: /* @__PURE__ */ jsx39(WysiwygThemeWrapper, { ...styleToken, children: /* @__PURE__ */ jsxs10(
13462
13408
  Remirror2,
13463
13409
  {
13464
13410
  manager: editorDelegate.manager,
@@ -13492,7 +13438,7 @@ var Editor = memo9(
13492
13438
  onContextMounted,
13493
13439
  ...otherProps
13494
13440
  } = props;
13495
- const [type, setType] = useState9(initialType);
13441
+ const [type, setType] = useState8(initialType);
13496
13442
  useImperativeHandle2(ref, () => ({
13497
13443
  getType: () => type,
13498
13444
  toggleType: (targetType) => {
@@ -13659,7 +13605,7 @@ var ThemeProvider = memo10(({ theme, i18n, children }) => {
13659
13605
  });
13660
13606
 
13661
13607
  // src/editor/components/Preview/preview.tsx
13662
- import { useEffect as useEffect12, useState as useState10 } from "react";
13608
+ import { useEffect as useEffect12, useState as useState9 } from "react";
13663
13609
  import { Icon } from "zens";
13664
13610
 
13665
13611
  // src/editor/utils/prosemirrorNodeToHtml.ts
@@ -13784,7 +13730,7 @@ var rmeProsemirrorNodeToHtml = async (doc, delegateOptions) => {
13784
13730
  import { jsx as jsx42 } from "react/jsx-runtime";
13785
13731
  var Preview = (props) => {
13786
13732
  const { doc, delegateOptions } = props;
13787
- const [processedHtml, setProcessedHtml] = useState10("");
13733
+ const [processedHtml, setProcessedHtml] = useState9("");
13788
13734
  let targetDoc = doc;
13789
13735
  if (typeof targetDoc === "string") {
13790
13736
  targetDoc = createWysiwygDelegate(delegateOptions).stringToDoc(targetDoc);