@antscorp/antsomi-ui 1.3.7-beta.41 → 1.3.7-beta.43

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.
@@ -115,7 +115,7 @@ export const usePermission = () => {
115
115
  },
116
116
  });
117
117
  const flattenMenuPermission = flattenMenuArray(menuListPermission || [], 'childs');
118
- const permissionMenu = useMemo(() => recursivePermissionMenu(sortBy(menuList?.rows || [], ['level_position']), flattenMenuPermission), [menuList?.rows, flattenMenuPermission]);
118
+ const permissionMenu = useMemo(() => recursivePermissionMenu(sortBy(menuList?.rows || [], [item => Number(item?.level_position)]), flattenMenuPermission), [menuList?.rows, flattenMenuPermission]);
119
119
  const mappingChildrenMenu = useMemo(() => getMappingAppChildren({
120
120
  menuList: permissionMenu,
121
121
  auth,
@@ -84,7 +84,7 @@ export const recursivePermissionMenu = (menuItems, menuPermissions) => {
84
84
  ...item,
85
85
  ...(isArray(item.children)
86
86
  ? {
87
- children: recursivePermissionMenu(sortBy(item.children || [], ['level_position']), menuPermissions),
87
+ children: recursivePermissionMenu(sortBy(item.children || [], [item => Number(item.level_position)]), menuPermissions),
88
88
  }
89
89
  : {}),
90
90
  }))
@@ -106,7 +106,7 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
106
106
  bulletList: false,
107
107
  orderedList: false,
108
108
  listItem: false,
109
- undoRedo: config?.UndoRedo ?? {
109
+ undoRedo: config?.UndoRedo && {
110
110
  depth: 100,
111
111
  },
112
112
  }),
@@ -282,6 +282,7 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
282
282
  });
283
283
  }, [editor]);
284
284
  useImperativeHandle(ref, () => ({
285
+ editor,
285
286
  setLink: params => {
286
287
  editor?.chain().setCustomLink(params).run();
287
288
  },
@@ -308,6 +309,9 @@ const TextEditorInternal = memo(forwardRef((props, ref) => {
308
309
  deleteSmartTag: handleDeleteSmartTag,
309
310
  updateSmartTagAttrs: handleUpdateSmartTagAttrs,
310
311
  blur: handleBlur,
312
+ focus() {
313
+ editor.chain().focus().run();
314
+ },
311
315
  setContent: editor.commands.setContent,
312
316
  style: contentRef.current?.style,
313
317
  }));
@@ -352,6 +356,9 @@ const TextEditorWithProvider = forwardRef((props, ref) => {
352
356
  }, [colors]);
353
357
  useImperativeHandle(ref, () => ({
354
358
  // Forward TextEditorRef methods - accessed at call time
359
+ get editor() {
360
+ return editorRef.current?.editor;
361
+ },
355
362
  get style() {
356
363
  return editorRef.current?.style;
357
364
  },
@@ -388,6 +395,9 @@ const TextEditorWithProvider = forwardRef((props, ref) => {
388
395
  get blur() {
389
396
  return editorRef.current.blur;
390
397
  },
398
+ get focus() {
399
+ return editorRef.current.focus;
400
+ },
391
401
  get setContent() {
392
402
  return editorRef.current.setContent;
393
403
  },
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { JSONContent, MarkRange } from '@tiptap/core';
2
+ import type { Editor, JSONContent, MarkRange } from '@tiptap/core';
3
3
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
4
4
  import type { Mark, Node } from '@tiptap/pm/model';
5
5
  import { ORDERED_LIST_STYLE_TYPE, UNORDERED_LIST_STYLE_TYPE } from './constants';
@@ -29,9 +29,13 @@ export type HandleLinkRef = {
29
29
  };
30
30
  export type TextEditorRef = HandleSmartTagRef & HandleLinkRef & {
31
31
  blur: (perserveSelection?: boolean) => void;
32
+ focus: () => void;
32
33
  style?: CSSStyleDeclaration;
33
34
  getHTML?: () => string;
34
- setContent?: (text: string) => void;
35
+ setContent?: (text: string, options?: Partial<{
36
+ emitUpdate: boolean;
37
+ }>) => void;
38
+ readonly editor: Editor;
35
39
  };
36
40
  export type SmartTagHandler = Partial<{
37
41
  edit: (id: string, event: React.MouseEvent) => void;
@@ -46,15 +46,20 @@ export const FormattingToolbar = (props) => {
46
46
  letterSpacing: _jsx(LetterSpacingAction, { editor: editor }, "letterSpacing"),
47
47
  indent: _jsx(IndentAction, { editor: editor }, "indent"),
48
48
  outdent: _jsx(OutdentAction, { editor: editor }, "outdent"),
49
- history: _jsx(HistoryAction, { editor: editor }, "history"),
49
+ history: config?.UndoRedo !== false ? _jsx(HistoryAction, { editor: editor }, "history") : null,
50
50
  clearFormatting: _jsx(ClearFormattingAction, { editor: editor }, "clearFormatting"),
51
51
  }), [
52
52
  editor,
53
- config?.FontFamily,
54
- config?.UnorderedList,
55
- defaultTextStyle,
56
- linkHanlder,
57
- smartTagHandler,
53
+ config?.FontFamily?.fonts,
54
+ config?.FontFamily?.fontGroupingFn,
55
+ config?.FontFamily?.groupOrder,
56
+ config?.UnorderedList?.useCustomBullet,
57
+ config?.UndoRedo,
58
+ defaultTextStyle.fontFamily,
59
+ defaultTextStyle.fontSize,
60
+ defaultTextStyle?.lineHeight,
61
+ linkHanlder?.onUpsert,
62
+ smartTagHandler?.onUpsert,
58
63
  onChangeFont,
59
64
  ]);
60
65
  // Group actions into rows
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.7-beta.41",
3
+ "version": "1.3.7-beta.43",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",