@oliasoft-open-source/react-ui-library 5.13.6-beta-2 → 5.13.7-beta-1

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.js CHANGED
@@ -22,11 +22,10 @@ import { useVirtualizer } from "@tanstack/react-virtual";
22
22
  import { SimplifyAP } from "simplify-ts";
23
23
  import Papa from "papaparse";
24
24
  import { Slide, ToastContainer as Toaster, toast as toast$1 } from "react-toastify";
25
- import { isNil as isNil$1 } from "es-toolkit";
26
- import { EditorContent, useEditor } from "@tiptap/react";
27
- import StarterKit from "@tiptap/starter-kit";
28
- import Placeholder from "@tiptap/extension-placeholder";
29
- import { Markdown } from "@tiptap/markdown";
25
+ import { isNullOrUndefined } from "remirror";
26
+ import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, MarkdownExtension, OrderedListExtension, PlaceholderExtension } from "remirror/extensions";
27
+ import { EditorComponent, Remirror, useActive, useCommands, useRemirror } from "@remirror/react";
28
+ import "remirror/styles/all.css";
30
29
  import { DndProvider } from "react-dnd";
31
30
  import { MultiBackend, Tree as Tree$1, getBackendOptions } from "@minoru/react-dnd-treeview";
32
31
  import ReactDiffViewer, { DiffMethod } from "react-diff-viewer-continued";
@@ -5055,7 +5054,7 @@ const normalizeParsedResult = (e) => {
5055
5054
  onClickCopyClipboard: useCallback(async (e) => {
5056
5055
  let t = await v();
5057
5056
  if (!t) return;
5058
- let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r == null ? [] : r).map((e) => e != null && e.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = unParse(n, o, a.map((t) => t.map((t) => isNil$1(t) ? "" : s(t.toString(), e))), { delimiter: " " });
5057
+ let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r == null ? [] : r).map((e) => e != null && e.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = unParse(n, o, a.map((t) => t.map((t) => isNullOrUndefined(t) ? "" : s(t.toString(), e))), { delimiter: " " });
5059
5058
  try {
5060
5059
  await navigator.clipboard.writeText(c), transitionToast({ message: {
5061
5060
  type: "Success",
@@ -6017,95 +6016,94 @@ var rich_text_toolbar_module_default = {
6017
6016
  let RichTextIcon = /* @__PURE__ */ function(e) {
6018
6017
  return e.BOLD = "bold", e.ITALIC = "italic", e.CODE = "code", e.UL = "ul", e.OL = "ol", e;
6019
6018
  }({});
6020
- const RichTextToolbar = ({ editor: e, disabled: t = !1, toolbarComponent: n = null }) => {
6021
- var r, i, a, o, s;
6022
- let c = [
6019
+ const RichTextToolbar = ({ disabled: e = !1, toolbarComponent: t = null }) => {
6020
+ let { focus: n, toggleBold: r, toggleBulletList: i, toggleCode: a, toggleItalic: o, toggleOrderedList: s } = useCommands(), c = useActive(), l = [
6023
6021
  {
6024
6022
  icon: RichTextIcon.BOLD,
6025
- onClick: () => e == null ? void 0 : e.chain().focus().toggleBold().run(),
6026
- active: (r = e == null ? void 0 : e.isActive("bold")) == null ? !1 : r
6023
+ onClick: r,
6024
+ active: c.bold()
6027
6025
  },
6028
6026
  {
6029
6027
  icon: RichTextIcon.ITALIC,
6030
- onClick: () => e == null ? void 0 : e.chain().focus().toggleItalic().run(),
6031
- active: (i = e == null ? void 0 : e.isActive("italic")) == null ? !1 : i
6028
+ onClick: o,
6029
+ active: c.italic()
6032
6030
  },
6033
6031
  {
6034
6032
  icon: RichTextIcon.CODE,
6035
- onClick: () => e == null ? void 0 : e.chain().focus().toggleCode().run(),
6036
- active: (a = e == null ? void 0 : e.isActive("code")) == null ? !1 : a
6033
+ onClick: a,
6034
+ active: c.code()
6037
6035
  },
6038
6036
  {
6039
6037
  icon: RichTextIcon.UL,
6040
- onClick: () => e == null ? void 0 : e.chain().focus().toggleBulletList().run(),
6041
- active: (o = e == null ? void 0 : e.isActive("bulletList")) == null ? !1 : o
6038
+ onClick: i,
6039
+ active: c.bulletList()
6042
6040
  },
6043
6041
  {
6044
6042
  icon: RichTextIcon.OL,
6045
- onClick: () => e == null ? void 0 : e.chain().focus().toggleOrderedList().run(),
6046
- active: (s = e == null ? void 0 : e.isActive("orderedList")) == null ? !1 : s
6043
+ onClick: s,
6044
+ active: c.orderedList()
6047
6045
  }
6048
6046
  ];
6049
6047
  return /* @__PURE__ */ jsxs("div", {
6050
6048
  className: rich_text_toolbar_module_default.richTextToolbarContainer,
6051
6049
  children: [/* @__PURE__ */ jsx("div", {
6052
6050
  className: rich_text_toolbar_module_default.richTextToolbar,
6053
- children: c.map((e, n) => /* @__PURE__ */ jsx(Button, {
6051
+ children: l.map((t, r) => /* @__PURE__ */ jsx(Button, {
6054
6052
  small: !0,
6055
6053
  round: !0,
6056
6054
  basic: !0,
6057
- icon: e.icon,
6055
+ icon: t.icon,
6058
6056
  colored: Color.MUTED,
6059
- onClick: e.onClick,
6060
- active: e.active,
6061
- disabled: t
6062
- }, n))
6063
- }), n]
6057
+ onClick: () => {
6058
+ t.onClick(), n();
6059
+ },
6060
+ active: t.active,
6061
+ disabled: e
6062
+ }, r))
6063
+ }), t]
6064
6064
  });
6065
6065
  };
6066
6066
  var rich_text_input_module_default = {
6067
- inputInTable: "_inputInTable_gb097_1",
6068
- inputHover: "_inputHover_gb097_13",
6069
- inputFocus: "_inputFocus_gb097_18",
6070
- inputError: "_inputError_gb097_25",
6071
- inputWarning: "_inputWarning_gb097_26",
6072
- inputDisabled: "_inputDisabled_gb097_61",
6073
- hideScrollbars: "_hideScrollbars_gb097_67",
6074
- richTextInput: "_richTextInput_gb097_77"
6067
+ inputInTable: "_inputInTable_1fb4l_1",
6068
+ inputHover: "_inputHover_1fb4l_13",
6069
+ inputFocus: "_inputFocus_1fb4l_18",
6070
+ inputError: "_inputError_1fb4l_25",
6071
+ inputWarning: "_inputWarning_1fb4l_26",
6072
+ inputDisabled: "_inputDisabled_1fb4l_61",
6073
+ hideScrollbars: "_hideScrollbars_1fb4l_67",
6074
+ richTextInput: "_richTextInput_1fb4l_77"
6075
6075
  };
6076
6076
  const RichTextInput = memo(forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
6077
- let o = useContext(DisabledContext), u = r || o, d = useEditor({
6078
- extensions: [
6079
- StarterKit,
6080
- Placeholder.configure({ placeholder: e }),
6081
- Markdown
6082
- ],
6083
- content: n == null ? "" : n,
6084
- contentType: "markdown",
6085
- editable: !u,
6086
- onUpdate: ({ editor: e }) => {
6087
- t == null || t(e.getMarkdown());
6088
- }
6077
+ let c = useContext(DisabledContext), u = r || c, { manager: d, state: f, setState: p, getContext: m } = useRemirror({
6078
+ extensions: useCallback(() => [
6079
+ new BoldExtension({}),
6080
+ new BulletListExtension({}),
6081
+ new CodeExtension(),
6082
+ new ItalicExtension(),
6083
+ new MarkdownExtension({}),
6084
+ new OrderedListExtension(),
6085
+ new PlaceholderExtension({ placeholder: e })
6086
+ ], [e]),
6087
+ content: n,
6088
+ selection: "start",
6089
+ stringHandler: "markdown"
6089
6090
  });
6090
- return useEffect(() => {
6091
- if (!d) return;
6092
- let e = d.getMarkdown();
6093
- n !== void 0 && n !== e && d.commands.setContent(n, {
6094
- emitUpdate: !1,
6095
- contentType: "markdown"
6096
- });
6097
- }, [n, d]), useEffect(() => {
6098
- d && d.setEditable(!u);
6099
- }, [u, d]), useImperativeHandle(a, () => ({
6100
- clearContent: () => d == null ? void 0 : d.commands.clearContent(!0),
6101
- editor: d
6102
- }), [d]), /* @__PURE__ */ jsxs("div", {
6091
+ return useImperativeHandle(a, () => m(), [m]), /* @__PURE__ */ jsx("div", {
6103
6092
  className: rich_text_input_module_default.richTextInput,
6104
- children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6105
- editor: d,
6106
- disabled: u,
6107
- toolbarComponent: i
6108
- }), /* @__PURE__ */ jsx(EditorContent, { editor: d })]
6093
+ children: /* @__PURE__ */ jsxs(Remirror, {
6094
+ manager: d,
6095
+ state: f,
6096
+ placeholder: e,
6097
+ onChange: ({ helpers: e, state: n }) => {
6098
+ let r = e.getMarkdown(n);
6099
+ t && t(r), p(n);
6100
+ },
6101
+ editable: !u,
6102
+ children: [/* @__PURE__ */ jsx(RichTextToolbar, {
6103
+ disabled: u,
6104
+ toolbarComponent: i
6105
+ }), /* @__PURE__ */ jsx(EditorComponent, {})]
6106
+ })
6109
6107
  });
6110
6108
  }));
6111
6109
  var row_module_default = { row: "_row_n16je_1" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/react-ui-library",
3
- "version": "5.13.6-beta-2",
3
+ "version": "5.13.7-beta-1",
4
4
  "description": "Reusable UI components for React projects",
5
5
  "homepage": "https://oliasoft-open-source.gitlab.io/react-ui-library",
6
6
  "bugs": {
@@ -39,10 +39,9 @@
39
39
  "dependencies": {
40
40
  "@fontsource/noto-sans": "^5.2.5",
41
41
  "@minoru/react-dnd-treeview": "^3.5.0",
42
+ "@remirror/pm": "^3.0.1",
43
+ "@remirror/react": "^3.0.3",
42
44
  "@tanstack/react-virtual": "^3.13.2",
43
- "@tiptap/extension-placeholder": "^3.20.0",
44
- "@tiptap/react": "^3.20.0",
45
- "@tiptap/starter-kit": "^3.20.0",
46
45
  "@types/rc-slider": "^9.3.1",
47
46
  "@types/react-resizable": "^3.0.8",
48
47
  "@types/react-window": "^1.8.8",
@@ -65,10 +64,10 @@
65
64
  "react-toastify": "^9.1.3",
66
65
  "react-transition-group": "^4.4.5",
67
66
  "react-window": "^1.8.11",
67
+ "remirror": "^3.0.3",
68
68
  "resize-observer-polyfill": "^1.5.1",
69
69
  "simplify-ts": "^1.0.2",
70
- "styled-components": "^6.1.15",
71
- "@tiptap/markdown": "^3.20.0"
70
+ "styled-components": "^6.1.15"
72
71
  },
73
72
  "devDependencies": {
74
73
  "@dmsnell/diff-match-patch": "^1.1.0",