@lobehub/editor 4.27.3 → 4.28.0

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.
Files changed (56) hide show
  1. package/es/codemirror/components/CopyButton.js +1 -1
  2. package/es/codemirror/components/LanguageSelect.js +8 -11
  3. package/es/codemirror/components/MoreOptions.js +3 -2
  4. package/es/codemirror/components/Toolbar.js +2 -1
  5. package/es/editor-kernel/react/useAnchor.js +1 -1
  6. package/es/headless.js +23 -5
  7. package/es/plugins/block/react/ReactBlockPlugin.js +6 -5
  8. package/es/plugins/codemirror-block/react/CodemirrorNode.js +2 -1
  9. package/es/plugins/codemirror-block/react/MermaidPreview.js +1 -1
  10. package/es/plugins/file/react/components/ReactFile.js +1 -1
  11. package/es/plugins/image/react/components/Image.js +3 -2
  12. package/es/plugins/image/react/components/ImageEditPopover.js +3 -3
  13. package/es/plugins/link/react/ReactLinkPlugin.js +2 -2
  14. package/es/plugins/link/react/components/LinkEdit.js +7 -7
  15. package/es/plugins/link/react/components/LinkToolbar.js +1 -1
  16. package/es/plugins/list/plugin/index.js +2 -1
  17. package/es/plugins/litexml/command/diffCommand.js +1 -1
  18. package/es/plugins/litexml/command/index.js +18 -3
  19. package/es/plugins/litexml/plugin/index.js +2 -0
  20. package/es/plugins/litexml/react/DiffNodeToolbar/index.js +2 -1
  21. package/es/plugins/litexml/react/TableRowDiffToolbar.js +2 -1
  22. package/es/plugins/markdown/react/index.js +1 -1
  23. package/es/plugins/math/react/components/MathEditor.js +1 -1
  24. package/es/plugins/math/react/components/MathEditorContainer.js +1 -1
  25. package/es/plugins/math/react/components/MathEditorContent.js +3 -3
  26. package/es/plugins/math/react/components/Placeholder.js +2 -1
  27. package/es/plugins/slash/react/components/DefaultSlashMenu.js +1 -1
  28. package/es/plugins/slash/service/i-slash-service.d.ts +1 -1
  29. package/es/plugins/table/react/TableActionMenu/ActionMenu.js +1 -1
  30. package/es/plugins/table/react/TableActionMenu/index.js +1 -1
  31. package/es/plugins/table/react/TableHoverActions/index.js +1 -1
  32. package/es/plugins/toolbar/react/index.js +1 -1
  33. package/es/react/ChatInput/ChatInput.js +1 -1
  34. package/es/react/ChatInput/type.d.ts +1 -1
  35. package/es/react/ChatInputActionBar/ChatInputActionBar.js +1 -1
  36. package/es/react/ChatInputActionBar/type.d.ts +1 -1
  37. package/es/react/ChatInputActions/ChatInputActions.js +1 -1
  38. package/es/react/ChatInputActions/components/ActionItem.js +4 -3
  39. package/es/react/ChatInputActions/components/ActionRender.js +1 -2
  40. package/es/react/ChatInputActions/components/CollapsedActions.js +2 -1
  41. package/es/react/ChatInputActions/type.d.ts +1 -1
  42. package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +4 -10
  43. package/es/react/CodeLanguageSelect/type.d.ts +1 -1
  44. package/es/react/FloatActions/FloatActions.js +1 -1
  45. package/es/react/FloatActions/components/ActionItem.js +4 -3
  46. package/es/react/FloatActions/components/ActionRender.js +1 -2
  47. package/es/react/FloatActions/components/CollapsedActions.js +2 -1
  48. package/es/react/FloatActions/type.d.ts +1 -1
  49. package/es/react/SendButton/SendButton.js +26 -46
  50. package/es/react/SendButton/index.d.ts +2 -2
  51. package/es/react/SendButton/style.js +36 -44
  52. package/es/react/SendButton/type.d.ts +20 -5
  53. package/es/renderer/LexicalRenderer.js +1 -1
  54. package/es/renderer/renderers/codeblock.js +1 -1
  55. package/es/renderer/renderers/mermaid.js +1 -1
  56. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { ActionIcon } from "@lobehub/ui";
2
+ import { ActionIcon } from "@lobehub/ui/base-ui";
3
3
  import { Check, CopyIcon } from "lucide-react";
4
4
  import { useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  import { LANGUAGES } from "../constants.js";
3
3
  import { styles } from "./style.js";
4
- import { Flexbox, MaterialFileTypeIcon, Select, Text } from "@lobehub/ui";
4
+ import { Select, Text } from "@lobehub/ui/base-ui";
5
5
  import { useMemo } from "react";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { Flexbox, MaterialFileTypeIcon } from "@lobehub/ui";
7
8
  import { cx } from "antd-style";
8
9
  //#region src/codemirror/components/LanguageSelect.tsx
9
10
  const LanguageSelect = ({ selectedLang, onLanguageChange, options, labels, className }) => {
10
11
  const modes = options ?? LANGUAGES;
11
12
  const languageOptions = useMemo(() => modes.map((mode) => ({
12
- aliases: mode.ext || [],
13
13
  label: /* @__PURE__ */ jsxs(Flexbox, {
14
14
  align: "center",
15
15
  gap: 4,
@@ -26,7 +26,11 @@ const LanguageSelect = ({ selectedLang, onLanguageChange, options, labels, class
26
26
  children: mode.name
27
27
  })]
28
28
  }),
29
- title: mode.ext?.length ? mode.ext.map((ext) => `*.${ext}`).join(",") : `*.${mode.value}`,
29
+ title: [
30
+ mode.value,
31
+ mode.name,
32
+ ...mode.ext || []
33
+ ].join(" "),
30
34
  value: mode.value
31
35
  })), [modes]);
32
36
  return /* @__PURE__ */ jsx(Flexbox, {
@@ -37,14 +41,7 @@ const LanguageSelect = ({ selectedLang, onLanguageChange, options, labels, class
37
41
  onClick: (e) => e.stopPropagation(),
38
42
  children: /* @__PURE__ */ jsx(Select, {
39
43
  className: cx(styles.container),
40
- filterOption: (input, option) => {
41
- const lang = input.toLowerCase();
42
- if ((option?.value)?.toLowerCase().startsWith(lang)) return true;
43
- if (String(option?.label).toLowerCase().includes(lang)) return true;
44
- if (option?.aliases?.some((ext) => ext.toLowerCase().startsWith(lang))) return true;
45
- return false;
46
- },
47
- onChange: onLanguageChange,
44
+ onChange: (value) => onLanguageChange(value),
48
45
  options: languageOptions,
49
46
  placeholder: labels?.selectLanguage ?? "Select language",
50
47
  showSearch: true,
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { ActionIcon, Flexbox, InputNumber, Popover, Text } from "@lobehub/ui";
2
+ import { ActionIcon, InputNumber, Switch, Text } from "@lobehub/ui/base-ui";
3
3
  import { MoreHorizontalIcon } from "lucide-react";
4
4
  import { useCallback } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
- import { Switch } from "antd";
6
+ import { Flexbox, Popover } from "@lobehub/ui";
7
7
  //#region src/codemirror/components/MoreOptions.tsx
8
8
  const MoreOptions = ({ tabSize, onTabSizeChange, useTabs, onUseTabsChange, showLineNumbers, onShowLineNumbersChange, labels }) => {
9
9
  const handleTabSizeChange = useCallback((value = 2) => {
@@ -25,6 +25,7 @@ const MoreOptions = ({ tabSize, onTabSizeChange, useTabs, onUseTabsChange, showL
25
25
  min: 1,
26
26
  onChange: handleTabSizeChange,
27
27
  size: "small",
28
+ style: { width: 80 },
28
29
  value: tabSize
29
30
  })]
30
31
  }),
@@ -2,9 +2,10 @@
2
2
  import { CopyButton } from "./CopyButton.js";
3
3
  import { LanguageSelect } from "./LanguageSelect.js";
4
4
  import { MoreOptions } from "./MoreOptions.js";
5
- import { ActionIcon, Flexbox } from "@lobehub/ui";
5
+ import { ActionIcon } from "@lobehub/ui/base-ui";
6
6
  import { ChevronDown, ChevronRight } from "lucide-react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Flexbox } from "@lobehub/ui";
8
9
  //#region src/codemirror/components/Toolbar.tsx
9
10
  const Toolbar = ({ selectedLang, onLanguageChange, onCopy, tabSize, onTabSizeChange, useTabs, onUseTabsChange, showLineNumbers, onShowLineNumbersChange, onClick, expand, toggleExpand, labels, languageOptions, extra }) => {
10
11
  return /* @__PURE__ */ jsxs(Flexbox, {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useLexicalComposerContext } from "./react-context.js";
3
- import { LOBE_THEME_APP_ID } from "@lobehub/ui";
4
3
  import { useMemo } from "react";
4
+ import { LOBE_THEME_APP_ID } from "@lobehub/ui";
5
5
  //#region src/editor-kernel/react/useAnchor.ts
6
6
  const useAnchor = () => {
7
7
  const [editor] = useLexicalComposerContext();
package/es/headless.js CHANGED
@@ -2580,7 +2580,7 @@ function handleReplaceForApplyDelay(oldNode, newNode, modifyBlockNodes, diffNode
2580
2580
  }
2581
2581
  const before = $createDiffContentNode("before");
2582
2582
  const after = $createDiffContentNode("after");
2583
- oldNode.getChildren().forEach((child) => before.append($cloneNode(child, editor)));
2583
+ oldNode.getChildren().forEach((child) => before.append(child));
2584
2584
  newNode.getChildren().forEach((child) => after.append($cloneNode(child, editor)));
2585
2585
  const diffNode = $createDiffNode("modify");
2586
2586
  diffNode.append(before, after);
@@ -2594,10 +2594,19 @@ function handleReplaceForApplyDelay(oldNode, newNode, modifyBlockNodes, diffNode
2594
2594
  oldNode.replace(newNode, false);
2595
2595
  return;
2596
2596
  }
2597
+ if ($isListItemNode(oldNode) && $isListItemNode(newNode)) {
2598
+ const before = $createParagraphNode();
2599
+ const after = $createParagraphNode();
2600
+ oldNode.getChildren().forEach((child) => before.append(child));
2601
+ newNode.getChildren().forEach((child) => after.append(child));
2602
+ oldNode.clear();
2603
+ oldNode.append($createDiffNode("listItemModify").append(before, after));
2604
+ return;
2605
+ }
2597
2606
  if (oldNode === oldBlock) {
2598
2607
  const diffNode = $createDiffNode("modify");
2599
- diffNode.append($cloneNode(oldBlock, editor), newNode);
2600
2608
  oldNode.replace(diffNode, false);
2609
+ diffNode.append($createDiffContentNode("before").append(oldBlock), $createDiffContentNode("after").append(newNode));
2601
2610
  } else {
2602
2611
  if (!modifyBlockNodes.has(oldBlock.getKey())) {
2603
2612
  modifyBlockNodes.add(oldBlock.getKey());
@@ -2829,7 +2838,8 @@ function handleRemove(editor, key, delay) {
2829
2838
  case "modify": {
2830
2839
  const children = originDiffNode.getChildren();
2831
2840
  const newDiff = $createDiffNode("remove");
2832
- newDiff.append(children[0]);
2841
+ const before = children[0];
2842
+ newDiff.append(...$isDiffContentNode(before) ? before.getChildren() : [before]);
2833
2843
  originDiffNode.replace(newDiff, false);
2834
2844
  return;
2835
2845
  }
@@ -2944,6 +2954,11 @@ function handleInsert(editor, payload, dataSource) {
2944
2954
  const originDiffNode = $closest(referenceNode, (node) => node.getType() === DiffNode.getType());
2945
2955
  if (originDiffNode) referenceNode = originDiffNode;
2946
2956
  newNodes.map((node) => {
2957
+ if ($isListItemNode(node)) {
2958
+ const diffNode = $createDiffNode("listItemAdd");
2959
+ node.getChildren().forEach((child) => diffNode.append(child));
2960
+ return node.append(diffNode);
2961
+ }
2947
2962
  const diffNode = $createDiffNode("add");
2948
2963
  diffNode.append(node);
2949
2964
  return diffNode;
@@ -3117,7 +3132,7 @@ function doAction(editor, node, action) {
3117
3132
  });
3118
3133
  node.getParentOrThrow().selectEnd();
3119
3134
  node.remove();
3120
- } else if (action === 0) node.remove();
3135
+ } else if (action === 0) node.getParentOrThrow().remove();
3121
3136
  }
3122
3137
  }
3123
3138
  function registerLiteXMLDiffCommand(editor) {
@@ -4920,6 +4935,7 @@ const LitexmlPlugin = class extends KernelPlugin {
4920
4935
  else nodeToXML(after, lines, indent);
4921
4936
  break;
4922
4937
  }
4938
+ case "listItemAdd":
4923
4939
  case "add":
4924
4940
  diffNode.getChildren().forEach((child) => nodeToXML(child, lines, indent));
4925
4941
  break;
@@ -4971,6 +4987,7 @@ const LitexmlPlugin = class extends KernelPlugin {
4971
4987
  else ctx.processChild(ctx, after);
4972
4988
  break;
4973
4989
  }
4990
+ case "listItemAdd":
4974
4991
  case "add":
4975
4992
  diffNode.getChildren().forEach((child) => ctx.processChild(ctx, child));
4976
4993
  break;
@@ -10022,7 +10039,8 @@ const ListPlugin = class extends KernelPlugin {
10022
10039
  if ($isRootNode(node.getParent())) return 0;
10023
10040
  const parent = node.getParent();
10024
10041
  if (!parent) return 0;
10025
- return getLevel($getNearestNodeOfType(parent, ListNode)) + 1;
10042
+ const parentList = $getNearestNodeOfType(parent, ListNode);
10043
+ return parentList ? getLevel(parentList) + 1 : 0;
10026
10044
  };
10027
10045
  markdownService.registerMarkdownWriter(ListItemNode.getType(), (ctx, node) => {
10028
10046
  const parent = node.getParent();
@@ -10,15 +10,16 @@ import { createRuntimeContext } from "./core/runtime-context.js";
10
10
  import { collectDragBlocks, getBlockMeasureRect, getTableBlockRect, isTableBlockElement } from "./drag/drag-utils.js";
11
11
  import { startBlockDragSession } from "./drag/drag-session.js";
12
12
  import { ANCHOR_PADDING_CSS_VAR, styles } from "./style.js";
13
- import { DropdownMenu, Icon, useAppElement } from "@lobehub/ui";
13
+ import { Button } from "@lobehub/ui/base-ui";
14
14
  import { GripVerticalIcon, PlusIcon } from "lucide-react";
15
15
  import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
16
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
+ import { DropdownMenu as DropdownMenu$1, Icon, useAppElement } from "@lobehub/ui";
17
18
  import { cx } from "antd-style";
18
- import { Button as Button$1, theme } from "antd";
19
19
  import { $findTableNode, $isTableSelection } from "@lexical/table";
20
20
  import { $getNodeByKey, $getSelection, $isRangeSelection } from "lexical";
21
21
  import { createPortal } from "react-dom";
22
+ import { theme } from "antd";
22
23
  //#region src/plugins/block/react/ReactBlockPlugin.tsx
23
24
  init_debug();
24
25
  const logger = createDebugLogger("plugin", "block-react");
@@ -627,7 +628,7 @@ const ReactBlockPlugin = (props) => {
627
628
  icon: PlusIcon,
628
629
  size: 14
629
630
  }) : void 0;
630
- return /* @__PURE__ */ jsx(Button$1, {
631
+ return /* @__PURE__ */ jsx(Button, {
631
632
  "aria-label": title,
632
633
  icon,
633
634
  onClick: () => item.onClick(menuContext),
@@ -635,14 +636,14 @@ const ReactBlockPlugin = (props) => {
635
636
  title,
636
637
  type: "text"
637
638
  }, item.key);
638
- }), /* @__PURE__ */ jsx(DropdownMenu, {
639
+ }), /* @__PURE__ */ jsx(DropdownMenu$1, {
639
640
  items: dropdownItems,
640
641
  onOpenChange: handleOperationMenuOpenChange,
641
642
  open: operationMenuOpen && operationMenuContext?.blockId === menuContext.blockId,
642
643
  placement: "leftTop",
643
644
  popupProps: { className: OPERATION_MENU_OVERLAY_CLASS },
644
645
  positionerProps: { style: { zIndex: 1e3 } },
645
- children: /* @__PURE__ */ jsx(Button$1, {
646
+ children: /* @__PURE__ */ jsx(Button, {
646
647
  "aria-label": "Block actions and drag",
647
648
  className: styles.dragHandle,
648
649
  "data-block-drag-handle": "true",
@@ -8,10 +8,11 @@ import { SELECT_AFTER_CODEMIRROR_COMMAND, SELECT_BEFORE_CODEMIRROR_COMMAND } fro
8
8
  import { useLexicalNodeSelection } from "../../../editor-kernel/react/useLexicalNodeSelection.js";
9
9
  import MermaidPreview from "./MermaidPreview.js";
10
10
  import { useCodemirrorEditLock } from "./useCodemirrorEditLock.js";
11
- import { ActionIcon, Block } from "@lobehub/ui";
11
+ import { ActionIcon } from "@lobehub/ui/base-ui";
12
12
  import { CodeXml, Eye } from "lucide-react";
13
13
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
+ import { Block } from "@lobehub/ui";
15
16
  import { cx } from "antd-style";
16
17
  import { debounce } from "es-toolkit/compat";
17
18
  import { $getSelection, $setSelection, COMMAND_PRIORITY_CRITICAL, KEY_DOWN_COMMAND } from "lexical";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { Mermaid } from "@lobehub/ui";
3
2
  import { useEffect, useState } from "react";
4
3
  import { jsx } from "react/jsx-runtime";
4
+ import { Mermaid } from "@lobehub/ui";
5
5
  import { cssVar } from "antd-style";
6
6
  //#region src/plugins/codemirror-block/react/MermaidPreview.tsx
7
7
  const MermaidPreview = ({ code }) => {
@@ -1,8 +1,8 @@
1
1
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
2
2
  import { useLexicalNodeSelection } from "../../../../editor-kernel/react/useLexicalNodeSelection.js";
3
- import { Center, MaterialFileTypeIcon } from "@lobehub/ui";
4
3
  import { useCallback, useEffect, useRef } from "react";
5
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Center, MaterialFileTypeIcon } from "@lobehub/ui";
6
6
  import { CLICK_COMMAND, COMMAND_PRIORITY_LOW } from "lexical";
7
7
  //#region src/plugins/file/react/components/ReactFile.tsx
8
8
  const ReactFile = ({ className, editor, node }) => {
@@ -7,13 +7,14 @@ import BrokenImage from "./BrokenImage.js";
7
7
  import ImageEditPopover from "./ImageEditPopover.js";
8
8
  import LazyImage from "./LazyImage.js";
9
9
  import { ResizeHandle } from "./ResizeHandle.js";
10
- import { ActionIcon, Icon } from "@lobehub/ui";
10
+ import { ActionIcon } from "@lobehub/ui/base-ui";
11
11
  import { LoaderCircleIcon, ZoomInIcon } from "lucide-react";
12
12
  import { Suspense, memo, useCallback, useMemo, useRef, useState } from "react";
13
13
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ import { Icon } from "@lobehub/ui";
14
15
  import { cx } from "antd-style";
15
- import { Image } from "antd";
16
16
  import { COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND } from "lexical";
17
+ import { Image } from "antd";
17
18
  //#region src/plugins/image/react/components/Image.tsx
18
19
  function getResizedImageWidth(startWidth, deltaX, maxWidth) {
19
20
  const adjustedDeltaX = deltaX * 2;
@@ -1,10 +1,11 @@
1
1
  import { useLexicalEditor } from "../../../../editor-kernel/react/useLexicalEditor.js";
2
2
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
3
3
  import { useEditable } from "../../../../editor-kernel/react/useEditable.js";
4
- import { Button, Flexbox, Icon, Input, Popover } from "@lobehub/ui";
4
+ import { Button, Input } from "@lobehub/ui/base-ui";
5
5
  import { LinkIcon, UploadIcon } from "lucide-react";
6
6
  import { memo, useCallback, useRef, useState } from "react";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Flexbox, Icon, Popover } from "@lobehub/ui";
8
9
  import { cssVar } from "antd-style";
9
10
  //#region src/plugins/image/react/components/ImageEditPopover.tsx
10
11
  const ImageEditPopover = memo(({ children, node, handleUpload, onPickFile }) => {
@@ -138,8 +139,7 @@ const ImageEditPopover = memo(({ children, node, handleUpload, onPickFile }) =>
138
139
  })] }), /* @__PURE__ */ jsx(Button, {
139
140
  onClick: handleUrlSubmit,
140
141
  size: "small",
141
- type: "text",
142
- variant: "filled",
142
+ type: "fill",
143
143
  children: t("confirm")
144
144
  })]
145
145
  })]
@@ -15,9 +15,9 @@ import LinkIframe from "./components/LinkIframe.js";
15
15
  import LinkToolbar from "./components/LinkToolbar.js";
16
16
  import SchemaLink from "./components/SchemaLink.js";
17
17
  import { LinkReactRendererRegistry, splitReactSchemaRules } from "./renderer-registry.js";
18
+ import { toast } from "@lobehub/ui/base-ui";
18
19
  import { useLayoutEffect, useMemo, useRef, useState } from "react";
19
20
  import { jsx, jsxs } from "react/jsx-runtime";
20
- import { message } from "antd";
21
21
  //#region src/plugins/link/react/ReactLinkPlugin.tsx
22
22
  async function copyTextToClipboard(text) {
23
23
  try {
@@ -175,7 +175,7 @@ const ReactLinkPlugin = ({ allowedProtocols, theme, enableHotkey = true, validat
175
175
  label: "link.copy",
176
176
  onClick: async ({ editor, linkNode }) => {
177
177
  await copyTextToClipboard(editor.getEditorState().read(() => linkNode.getURL()));
178
- message.success(t("link.copySuccess"));
178
+ toast.success(t("link.copySuccess"));
179
179
  },
180
180
  order: 30
181
181
  });
@@ -4,10 +4,11 @@ import { UPDATE_LINK_TEXT_COMMAND } from "../../command/index.js";
4
4
  import { EDIT_LINK_CARD_COMMAND } from "../../node/LinkCardNode.js";
5
5
  import { cleanPosition, updatePosition } from "../../../../utils/updatePosition.js";
6
6
  import { styles } from "../style.js";
7
- import { Block, Button, Flexbox, Hotkey, Icon, Input, Text } from "@lobehub/ui";
7
+ import { Button, Input, Text } from "@lobehub/ui/base-ui";
8
8
  import { BaselineIcon, LinkIcon } from "lucide-react";
9
9
  import { useCallback, useEffect, useRef, useState } from "react";
10
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { Block, Flexbox, Hotkey, Icon } from "@lobehub/ui";
11
12
  import { cssVar } from "antd-style";
12
13
  import { COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_NORMAL, KEY_ESCAPE_COMMAND, KEY_TAB_COMMAND, createCommand } from "lexical";
13
14
  import { mergeRegister } from "@lexical/utils";
@@ -38,8 +39,8 @@ const LinkEdit = ({ editor }) => {
38
39
  const handleSubmit = useCallback(() => {
39
40
  if (!editor.isEditable()) return;
40
41
  if (!linkInputRef.current || !linkTextInputRef.current || !editor) return;
41
- const inputDOM = linkInputRef.current.input;
42
- const textInputDOM = linkTextInputRef.current.input;
42
+ const inputDOM = linkInputRef.current;
43
+ const textInputDOM = linkTextInputRef.current;
43
44
  if (cardNodeRef.current) {
44
45
  const cardNode = cardNodeRef.current;
45
46
  editor.update(() => {
@@ -73,8 +74,8 @@ const LinkEdit = ({ editor }) => {
73
74
  const handleKeyDown = useCallback((event) => {
74
75
  if (!linkNodeRef.current && !cardNodeRef.current || !linkInputRef.current || !linkTextInputRef.current || !editor) return;
75
76
  const linkNode = linkNodeRef.current;
76
- const inputDOM = linkInputRef.current.input;
77
- const textInputDOM = linkTextInputRef.current.input;
77
+ const inputDOM = linkInputRef.current;
78
+ const textInputDOM = linkTextInputRef.current;
78
79
  switch (event.key) {
79
80
  case "Enter":
80
81
  event.preventDefault();
@@ -268,8 +269,7 @@ const LinkEdit = ({ editor }) => {
268
269
  handleSubmit();
269
270
  },
270
271
  size: "small",
271
- type: "text",
272
- variant: "filled",
272
+ type: "fill",
273
273
  children: [t("confirm"), /* @__PURE__ */ jsx(Hotkey, {
274
274
  compact: true,
275
275
  keys: "enter",
@@ -8,10 +8,10 @@ import { useEditable } from "../../../../editor-kernel/react/useEditable.js";
8
8
  import { cleanPosition, updatePosition } from "../../../../utils/updatePosition.js";
9
9
  import { styles } from "../style.js";
10
10
  import { $isLinkToolbarNode, convertLinkNodeByKeyToSchema, convertLinkToolbarNodeByKeyToLink, getLinkToolbarCapabilities, replaceNodeByKeyWithBlockCardNode, replaceNodeByKeyWithCardNode, replaceNodeByKeyWithIframeNode } from "../../conversion/index.js";
11
- import { Flexbox, Icon } from "@lobehub/ui";
12
11
  import { CopyIcon, EditIcon, ExternalLinkIcon, GalleryHorizontalEndIcon, LinkIcon, PanelTopOpenIcon, PanelsTopLeftIcon, UnlinkIcon } from "lucide-react";
13
12
  import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
14
13
  import { jsx } from "react/jsx-runtime";
14
+ import { Flexbox, Icon } from "@lobehub/ui";
15
15
  import { $getNodeByKey, $getSelection, $isRangeSelection, COMMAND_PRIORITY_NORMAL } from "lexical";
16
16
  import { mergeRegister } from "@lexical/utils";
17
17
  //#region src/plugins/link/react/components/LinkToolbar.tsx
@@ -130,7 +130,8 @@ const ListPlugin = class extends KernelPlugin {
130
130
  if ($isRootNode(node.getParent())) return 0;
131
131
  const parent = node.getParent();
132
132
  if (!parent) return 0;
133
- return getLevel($getNearestNodeOfType(parent, ListNode)) + 1;
133
+ const parentList = $getNearestNodeOfType(parent, ListNode);
134
+ return parentList ? getLevel(parentList) + 1 : 0;
134
135
  };
135
136
  markdownService.registerMarkdownWriter(ListItemNode.getType(), (ctx, node) => {
136
137
  const parent = node.getParent();
@@ -125,7 +125,7 @@ function doAction(editor, node, action) {
125
125
  });
126
126
  node.getParentOrThrow().selectEnd();
127
127
  node.remove();
128
- } else if (action === 0) node.remove();
128
+ } else if (action === 0) node.getParentOrThrow().remove();
129
129
  }
130
130
  }
131
131
  function registerLiteXMLDiffCommand(editor) {
@@ -96,7 +96,7 @@ function handleReplaceForApplyDelay(oldNode, newNode, modifyBlockNodes, diffNode
96
96
  }
97
97
  const before = $createDiffContentNode("before");
98
98
  const after = $createDiffContentNode("after");
99
- oldNode.getChildren().forEach((child) => before.append($cloneNode(child, editor)));
99
+ oldNode.getChildren().forEach((child) => before.append(child));
100
100
  newNode.getChildren().forEach((child) => after.append($cloneNode(child, editor)));
101
101
  const diffNode = $createDiffNode("modify");
102
102
  diffNode.append(before, after);
@@ -110,10 +110,19 @@ function handleReplaceForApplyDelay(oldNode, newNode, modifyBlockNodes, diffNode
110
110
  oldNode.replace(newNode, false);
111
111
  return;
112
112
  }
113
+ if ($isListItemNode(oldNode) && $isListItemNode(newNode)) {
114
+ const before = $createParagraphNode();
115
+ const after = $createParagraphNode();
116
+ oldNode.getChildren().forEach((child) => before.append(child));
117
+ newNode.getChildren().forEach((child) => after.append(child));
118
+ oldNode.clear();
119
+ oldNode.append($createDiffNode("listItemModify").append(before, after));
120
+ return;
121
+ }
113
122
  if (oldNode === oldBlock) {
114
123
  const diffNode = $createDiffNode("modify");
115
- diffNode.append($cloneNode(oldBlock, editor), newNode);
116
124
  oldNode.replace(diffNode, false);
125
+ diffNode.append($createDiffContentNode("before").append(oldBlock), $createDiffContentNode("after").append(newNode));
117
126
  } else {
118
127
  if (!modifyBlockNodes.has(oldBlock.getKey())) {
119
128
  modifyBlockNodes.add(oldBlock.getKey());
@@ -345,7 +354,8 @@ function handleRemove(editor, key, delay) {
345
354
  case "modify": {
346
355
  const children = originDiffNode.getChildren();
347
356
  const newDiff = $createDiffNode("remove");
348
- newDiff.append(children[0]);
357
+ const before = children[0];
358
+ newDiff.append(...$isDiffContentNode(before) ? before.getChildren() : [before]);
349
359
  originDiffNode.replace(newDiff, false);
350
360
  return;
351
361
  }
@@ -461,6 +471,11 @@ function handleInsert(editor, payload, dataSource) {
461
471
  const originDiffNode = $closest(referenceNode, (node) => node.getType() === DiffNode.getType());
462
472
  if (originDiffNode) referenceNode = originDiffNode;
463
473
  newNodes.map((node) => {
474
+ if ($isListItemNode(node)) {
475
+ const diffNode = $createDiffNode("listItemAdd");
476
+ node.getChildren().forEach((child) => diffNode.append(child));
477
+ return node.append(diffNode);
478
+ }
464
479
  const diffNode = $createDiffNode("add");
465
480
  diffNode.append(node);
466
481
  return diffNode;
@@ -86,6 +86,7 @@ const LitexmlPlugin = class extends KernelPlugin {
86
86
  else nodeToXML(after, lines, indent);
87
87
  break;
88
88
  }
89
+ case "listItemAdd":
89
90
  case "add":
90
91
  diffNode.getChildren().forEach((child) => nodeToXML(child, lines, indent));
91
92
  break;
@@ -137,6 +138,7 @@ const LitexmlPlugin = class extends KernelPlugin {
137
138
  else ctx.processChild(ctx, after);
138
139
  break;
139
140
  }
141
+ case "listItemAdd":
140
142
  case "add":
141
143
  diffNode.getChildren().forEach((child) => ctx.processChild(ctx, child));
142
144
  break;
@@ -2,9 +2,10 @@ import { LexicalPortalContainer } from "../../../../editor-kernel/react/PortalCo
2
2
  import { LITEXML_DIFFNODE_COMMAND } from "../../command/symbols.js";
3
3
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
4
4
  import { styles } from "./style.js";
5
- import { ActionIcon, Block } from "@lobehub/ui";
5
+ import { ActionIcon } from "@lobehub/ui/base-ui";
6
6
  import { Check, X } from "lucide-react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Block } from "@lobehub/ui";
8
9
  import { useThemeMode } from "antd-style";
9
10
  //#region src/plugins/litexml/react/DiffNodeToolbar/index.tsx
10
11
  const ReactDiffNodeToolbar = ({ editor, node }) => {
@@ -2,10 +2,11 @@ import { $isTableRowDiffNode } from "../node/TableRowDiffNode.js";
2
2
  import { LITEXML_DIFFNODE_COMMAND } from "../command/symbols.js";
3
3
  import { useTranslation } from "../../../editor-kernel/react/useTranslation.js";
4
4
  import { styles } from "./DiffNodeToolbar/style.js";
5
- import { ActionIcon, Block } from "@lobehub/ui";
5
+ import { ActionIcon } from "@lobehub/ui/base-ui";
6
6
  import { Check, X } from "lucide-react";
7
7
  import { useCallback, useEffect, useRef, useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
+ import { Block } from "@lobehub/ui";
9
10
  import { useThemeMode } from "antd-style";
10
11
  import { $getNearestNodeFromDOMNode } from "lexical";
11
12
  import { createPortal } from "react-dom";
@@ -3,8 +3,8 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
3
3
  import { INodePlugin } from "../../inode/plugin/index.js";
4
4
  import { MarkdownPlugin } from "../plugin/index.js";
5
5
  import { useTranslation } from "../../../editor-kernel/react/useTranslation.js";
6
- import { toast } from "@lobehub/ui";
7
6
  import { useLayoutEffect } from "react";
7
+ import { toast } from "@lobehub/ui";
8
8
  //#region src/plugins/markdown/react/index.tsx
9
9
  const ReactMarkdownPlugin = () => {
10
10
  const [editor] = useLexicalComposerContext();
@@ -101,7 +101,7 @@ const MathEdit = memo(({ renderComp }) => {
101
101
  }, [mathNode, editor]);
102
102
  const handleFocus = useCallback(() => {
103
103
  textareaRef.current?.focus();
104
- if (prev) textareaRef.current?.resizableTextArea?.textArea?.setSelectionRange(0, 0);
104
+ if (prev) textareaRef.current?.setSelectionRange(0, 0);
105
105
  }, [prev]);
106
106
  const setTextareaRef = useCallback((ref) => {
107
107
  textareaRef.current = ref;
@@ -1,8 +1,8 @@
1
1
  import { cleanPosition, updatePosition } from "../../../../utils/updatePosition.js";
2
2
  import { styles } from "../style.js";
3
- import { Flexbox, Popover } from "@lobehub/ui";
4
3
  import { memo, useCallback, useEffect, useRef, useState } from "react";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { Flexbox, Popover } from "@lobehub/ui";
6
6
  //#region src/plugins/math/react/components/MathEditorContainer.tsx
7
7
  const MathEditorContainer = memo(({ children, isBlockMode, mathDOM, onFocus, prev }) => {
8
8
  const anchorRef = useRef(null);
@@ -1,9 +1,10 @@
1
1
  import { CONTROL_OR_META, init_sys } from "../../../../common/sys.js";
2
2
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
3
3
  import { styles } from "../style.js";
4
- import { Button, Flexbox, Hotkey, Text, TextArea } from "@lobehub/ui";
4
+ import { Button, Text, TextArea } from "@lobehub/ui/base-ui";
5
5
  import { memo, useCallback, useEffect, useRef, useState } from "react";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Flexbox, Hotkey } from "@lobehub/ui";
7
8
  import { isModifierMatch } from "lexical";
8
9
  import { renderToString } from "katex";
9
10
  //#region src/plugins/math/react/components/MathEditorContent.tsx
@@ -118,8 +119,7 @@ const MathEditorContent = memo(({ focusRef, mathNode, onArrowLeft, onArrowRight,
118
119
  onSubmit();
119
120
  },
120
121
  size: "small",
121
- type: "text",
122
- variant: "filled",
122
+ type: "fill",
123
123
  children: [t("confirm"), /* @__PURE__ */ jsx(Hotkey, {
124
124
  compact: true,
125
125
  keys: "mod+enter",
@@ -1,7 +1,8 @@
1
1
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
2
2
  import { styles } from "../style.js";
3
- import { Center, Text } from "@lobehub/ui";
3
+ import { Text } from "@lobehub/ui/base-ui";
4
4
  import { jsx } from "react/jsx-runtime";
5
+ import { Center } from "@lobehub/ui";
5
6
  import { cx } from "antd-style";
6
7
  //#region src/plugins/math/react/components/Placeholder.tsx
7
8
  const Placeholder = ({ mathBlock }) => {
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { flattenSlashOptions, isSlashDividerOption, isSlashSectionOption } from "../../service/i-slash-service.js";
3
3
  import { shouldShowLoadingPlaceholder } from "./menuLoading.js";
4
- import { Icon, LOBE_THEME_APP_ID, menuSharedStyles } from "@lobehub/ui";
5
4
  import { isValidElement, useEffect, useLayoutEffect, useMemo, useRef } from "react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Icon, LOBE_THEME_APP_ID, menuSharedStyles } from "@lobehub/ui";
7
7
  import { createStaticStyles } from "antd-style";
8
8
  import { createPortal } from "react-dom";
9
9
  import { autoUpdate, flip, offset, shift, size, useFloating } from "@floating-ui/react";
@@ -1,8 +1,8 @@
1
1
  import { IEditor, IServiceID } from "../../../types/kernel.js";
2
2
  import "../../../types/index.js";
3
3
  import "../utils/utils.js";
4
- import { DropdownMenuItemType } from "@lobehub/ui";
5
4
  import { ReactNode } from "react";
5
+ import { DropdownMenuItemType } from "@lobehub/ui";
6
6
  import Fuse, { IFuseOptions } from "fuse.js";
7
7
  //#region src/plugins/slash/service/i-slash-service.d.ts
8
8
  type ISlashDividerOption = {
@@ -1,9 +1,9 @@
1
1
  import { useTranslation } from "../../../../editor-kernel/react/useTranslation.js";
2
2
  import { $canUnmerge, $selectLastDescendant, computeSelectionCount, currentCellBackgroundColor } from "./utils.js";
3
- import { DropdownMenu } from "@lobehub/ui";
4
3
  import { Grid2X2XIcon, PanelBottomCloseIcon, PanelLeftCloseIcon, PanelRightCloseIcon, PanelTopCloseIcon, TableColumnsSplitIcon, TableRowsSplitIcon } from "lucide-react";
5
4
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
6
5
  import { jsx } from "react/jsx-runtime";
6
+ import { DropdownMenu } from "@lobehub/ui";
7
7
  import { $computeTableMapSkipCellCheck, $deleteTableColumnAtSelection, $deleteTableRowAtSelection, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableSelection, $mergeCells, $unmergeCell, TableCellHeaderStates, TableCellNode, getTableElement, getTableObserverFromTableElement } from "@lexical/table";
8
8
  import { $getSelection, $setSelection } from "lexical";
9
9
  //#region src/plugins/table/react/TableActionMenu/ActionMenu.tsx
@@ -2,7 +2,7 @@ import { useAnchor } from "../../../../editor-kernel/react/useAnchor.js";
2
2
  import { cleanPosition, updatePosition } from "../../../../utils/updatePosition.js";
3
3
  import TableActionMenu$1 from "./ActionMenu.js";
4
4
  import { styles } from "./style.js";
5
- import { ActionIcon } from "@lobehub/ui";
5
+ import { ActionIcon } from "@lobehub/ui/base-ui";
6
6
  import { ChevronDown } from "lucide-react";
7
7
  import { memo, useCallback, useEffect, useRef, useState } from "react";
8
8
  import { jsx } from "react/jsx-runtime";
@@ -2,7 +2,7 @@ import { useLexicalComposerContext } from "../../../../editor-kernel/react/react
2
2
  import { useAnchor } from "../../../../editor-kernel/react/useAnchor.js";
3
3
  import { styles } from "./style.js";
4
4
  import { getMouseInfo, useDebounce } from "./utils.js";
5
- import { ActionIcon } from "@lobehub/ui";
5
+ import { ActionIcon } from "@lobehub/ui/base-ui";
6
6
  import { PlusIcon } from "lucide-react";
7
7
  import { memo, useEffect, useMemo, useRef, useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -6,9 +6,9 @@ import { HIDE_TOOLBAR_COMMAND, registerToolbarCommand } from "../command/index.j
6
6
  import { getDOMRangeRect } from "../utils/getDOMRangeRect.js";
7
7
  import { setFloatingElemPosition } from "../utils/setFloatingElemPosition.js";
8
8
  import { styles } from "./style.js";
9
- import { Block, LOBE_THEME_APP_ID } from "@lobehub/ui";
10
9
  import { useCallback, useRef, useState } from "react";
11
10
  import { jsx } from "react/jsx-runtime";
11
+ import { Block, LOBE_THEME_APP_ID } from "@lobehub/ui";
12
12
  import { cx, useThemeMode } from "antd-style";
13
13
  import { $getSelection, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, getDOMSelection } from "lexical";
14
14
  import { mergeRegister } from "@lexical/utils";
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import { useHeight } from "../hooks/useSize.js";
3
3
  import { styles } from "./style.js";
4
- import { Flexbox } from "@lobehub/ui";
5
4
  import { useCallback } from "react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Flexbox } from "@lobehub/ui";
7
7
  import { cx, useThemeMode } from "antd-style";
8
8
  import { Resizable } from "re-resizable";
9
9
  import useMergeState from "use-merge-value";
@@ -1,5 +1,5 @@
1
- import { FlexboxProps } from "@lobehub/ui";
2
1
  import { CSSProperties, ReactNode, Ref } from "react";
2
+ import { FlexboxProps } from "@lobehub/ui";
3
3
  //#region src/react/ChatInput/type.d.ts
4
4
  interface ChatInputProps extends Omit<FlexboxProps, 'height'> {
5
5
  classNames?: {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { styles } from "./style.js";
3
- import { Flexbox } from "@lobehub/ui";
4
3
  import { jsxs } from "react/jsx-runtime";
4
+ import { Flexbox } from "@lobehub/ui";
5
5
  import { cx } from "antd-style";
6
6
  //#region src/react/ChatInputActionBar/ChatInputActionBar.tsx
7
7
  const ChatInputActionBar = ({ className, style, left, right, ...rest }) => {
@@ -1,5 +1,5 @@
1
- import { FlexboxProps } from "@lobehub/ui";
2
1
  import { ReactNode } from "react";
2
+ import { FlexboxProps } from "@lobehub/ui";
3
3
  //#region src/react/ChatInputActionBar/type.d.ts
4
4
  interface ChatInputActionBarProps extends Omit<FlexboxProps, 'children'> {
5
5
  left?: ReactNode;
@@ -2,9 +2,9 @@
2
2
  import { styles } from "./style.js";
3
3
  import ActionItem from "./components/ActionItem.js";
4
4
  import { useDisplayActionCount } from "./components/useDisplayActionCount.js";
5
- import { Flexbox, TooltipGroup } from "@lobehub/ui";
6
5
  import { memo, useMemo } from "react";
7
6
  import { jsx } from "react/jsx-runtime";
7
+ import { Flexbox, TooltipGroup } from "@lobehub/ui";
8
8
  import { cx } from "antd-style";
9
9
  import useMergeState from "use-merge-value";
10
10
  //#region src/react/ChatInputActions/ChatInputActions.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import ActionRender from "./ActionRender.js";
3
3
  import CollapsedActions from "./CollapsedActions.js";
4
- import { ActionIcon, Dropdown } from "@lobehub/ui";
4
+ import { ActionIcon, DropdownMenu } from "@lobehub/ui/base-ui";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/react/ChatInputActions/components/ActionItem.tsx
7
7
  const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, collapsed, gap, setGroupCollapsed }) => {
@@ -16,8 +16,9 @@ const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, collapsed,
16
16
  onActionClick
17
17
  }, child?.key || `action-${childIndex}`))
18
18
  });
19
- if (item.type === "dropdown") return /* @__PURE__ */ jsx(Dropdown, {
20
- menu: { items: item.children },
19
+ if (item.type === "dropdown") return /* @__PURE__ */ jsx(DropdownMenu, {
20
+ items: item.children,
21
+ trigger: "hover",
21
22
  children: /* @__PURE__ */ jsx(ActionIcon, {
22
23
  active: item.active,
23
24
  danger: item.danger,
@@ -1,8 +1,7 @@
1
1
  import { styles } from "../style.js";
2
- import { ActionIcon } from "@lobehub/ui";
2
+ import { ActionIcon, Divider } from "@lobehub/ui/base-ui";
3
3
  import { isValidElement } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { Divider } from "antd";
6
5
  //#region src/react/ChatInputActions/components/ActionRender.tsx
7
6
  const ActionRender = ({ item, onActionClick, disabled }) => {
8
7
  if (item.type === "divider") return /* @__PURE__ */ jsx(Divider, {
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { styles } from "../style.js";
3
- import { ActionIcon, Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
3
+ import { ActionIcon } from "@lobehub/ui/base-ui";
4
4
  import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from "lucide-react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
6
7
  //#region src/react/ChatInputActions/components/CollapsedActions.tsx
7
8
  const CollapsedActions = ({ children, groupCollapse = false, onGroupCollapseChange, gap, mode }) => {
8
9
  const Motion = useMotionComponent();
@@ -1,5 +1,5 @@
1
- import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
2
1
  import { ReactNode } from "react";
2
+ import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
3
3
  //#region src/react/ChatInputActions/type.d.ts
4
4
  type ChatInputActionEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
5
5
  interface ActionItem extends MenuItemType {
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { styles } from "./style.js";
3
- import { Flexbox, MaterialFileTypeIcon, Select, Text } from "@lobehub/ui";
3
+ import { Select, Text } from "@lobehub/ui/base-ui";
4
4
  import { useMemo } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Flexbox, MaterialFileTypeIcon } from "@lobehub/ui";
6
7
  import { cx } from "antd-style";
7
8
  import { bundledLanguagesInfo } from "shiki";
8
9
  //#region src/react/CodeLanguageSelect/CodeLanguageSelect.tsx
9
10
  const CodeLanguageSelect = ({ className, ...rest }) => {
10
11
  const options = useMemo(() => [{
11
- aliases: ["text", "txt"],
12
12
  label: /* @__PURE__ */ jsxs(Flexbox, {
13
13
  align: "center",
14
14
  gap: 4,
@@ -25,9 +25,9 @@ const CodeLanguageSelect = ({ className, ...rest }) => {
25
25
  children: "Plaintext"
26
26
  })]
27
27
  }),
28
+ title: "plaintext text txt",
28
29
  value: "plaintext"
29
30
  }, ...bundledLanguagesInfo.map((item) => ({
30
- aliases: item.aliases,
31
31
  label: /* @__PURE__ */ jsxs(Flexbox, {
32
32
  align: "center",
33
33
  gap: 4,
@@ -44,18 +44,12 @@ const CodeLanguageSelect = ({ className, ...rest }) => {
44
44
  children: item.name
45
45
  })]
46
46
  }),
47
- title: (item.aliases || [item.id]).filter(Boolean).map((item) => `*.${item}`).join(","),
47
+ title: [item.id, ...item.aliases || []].join(" "),
48
48
  value: item.id
49
49
  }))], []);
50
50
  return /* @__PURE__ */ jsx(Select, {
51
51
  className: cx(styles.container, className),
52
52
  defaultValue: "plaintext",
53
- filterOption: (input, option) => {
54
- const lang = input.toLowerCase();
55
- if ((option?.value)?.startsWith(lang)) return true;
56
- if (option?.aliases?.some((item) => item.startsWith(lang))) return true;
57
- return false;
58
- },
59
53
  options,
60
54
  showSearch: true,
61
55
  variant: "filled",
@@ -1,4 +1,4 @@
1
- import { SelectProps } from "@lobehub/ui";
1
+ import { SelectProps } from "@lobehub/ui/base-ui";
2
2
  //#region src/react/CodeLanguageSelect/type.d.ts
3
3
  type CodeLanguageSelectProps = Omit<SelectProps, 'options'>;
4
4
  //#endregion
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { styles } from "./style.js";
3
3
  import ActionItem from "./components/ActionItem.js";
4
- import { Flexbox } from "@lobehub/ui";
5
4
  import { jsx } from "react/jsx-runtime";
5
+ import { Flexbox } from "@lobehub/ui";
6
6
  import { cx } from "antd-style";
7
7
  import useMergeState from "use-merge-value";
8
8
  //#region src/react/FloatActions/FloatActions.tsx
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import ActionRender from "./ActionRender.js";
3
3
  import CollapsedActions from "./CollapsedActions.js";
4
- import { ActionIcon, Dropdown } from "@lobehub/ui";
4
+ import { ActionIcon, DropdownMenu } from "@lobehub/ui/base-ui";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  //#region src/react/FloatActions/components/ActionItem.tsx
7
7
  const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, gap, setGroupCollapsed }) => {
@@ -16,8 +16,9 @@ const ActionItem = ({ item, disabled, onActionClick, groupCollapsed, gap, setGro
16
16
  onActionClick
17
17
  }, child?.key || `action-${childIndex}`))
18
18
  });
19
- if (item.type === "dropdown") return /* @__PURE__ */ jsx(Dropdown, {
20
- menu: { items: item.children },
19
+ if (item.type === "dropdown") return /* @__PURE__ */ jsx(DropdownMenu, {
20
+ items: item.children,
21
+ trigger: "hover",
21
22
  children: /* @__PURE__ */ jsx(ActionIcon, {
22
23
  active: item.active,
23
24
  danger: item.danger,
@@ -1,8 +1,7 @@
1
1
  import { styles } from "../style.js";
2
- import { ActionIcon } from "@lobehub/ui";
2
+ import { ActionIcon, Divider } from "@lobehub/ui/base-ui";
3
3
  import { isValidElement } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { Divider } from "antd";
6
5
  //#region src/react/FloatActions/components/ActionRender.tsx
7
6
  const ActionRender = ({ item, onActionClick, disabled }) => {
8
7
  if (item.type === "divider") return /* @__PURE__ */ jsx(Divider, {
@@ -1,8 +1,9 @@
1
1
  "use client";
2
2
  import { styles } from "../style.js";
3
- import { ActionIcon, Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
3
+ import { ActionIcon } from "@lobehub/ui/base-ui";
4
4
  import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from "lucide-react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Flexbox, Popover, useMotionComponent } from "@lobehub/ui";
6
7
  //#region src/react/FloatActions/components/CollapsedActions.tsx
7
8
  const CollapsedActions = ({ children, groupCollapse = false, onGroupCollapseChange, gap, mode }) => {
8
9
  const Motion = useMotionComponent();
@@ -1,5 +1,5 @@
1
- import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
2
1
  import { ReactNode } from "react";
2
+ import { FlexboxProps, MenuInfo, MenuItemType, TooltipProps } from "@lobehub/ui";
3
3
  //#region src/react/FloatActions/type.d.ts
4
4
  type FloatActionsEvent = Pick<MenuInfo, 'key' | 'keyPath' | 'domEvent'>;
5
5
  interface ActionItem extends MenuItemType {
@@ -2,22 +2,26 @@
2
2
  import SendIcon from "./components/SendIcon.js";
3
3
  import StopIcon from "./components/StopIcon.js";
4
4
  import { styles } from "./style.js";
5
- import { Button, Icon } from "@lobehub/ui";
6
- import { ChevronDownIcon } from "lucide-react";
5
+ import { Button, SplitButton } from "@lobehub/ui/base-ui";
7
6
  import { useMemo } from "react";
8
7
  import { jsx, jsxs } from "react/jsx-runtime";
9
8
  import { cx } from "antd-style";
10
- import { Dropdown as Dropdown$1, Space } from "antd";
11
9
  //#region src/react/SendButton/SendButton.tsx
12
- const SendButton = ({ type = "primary", menu, className, style, loading, generating, size = 32, shape, onSend, onStop, disabled, onClick, styles: _styles, classNames: _classNames, ...rest }) => {
10
+ const SendButton = ({ type = "primary", menu, className, style, loading, generating, size = 32, shape, onSend, onStop, disabled, onClick, placement = "topRight", trigger, title, ...rest }) => {
13
11
  const cssVariables = useMemo(() => ({ "--send-button-size": `${size}px` }), [size]);
12
+ const handleSend = (e) => {
13
+ e.stopPropagation();
14
+ e.preventDefault();
15
+ onSend?.(e);
16
+ onClick?.(e);
17
+ };
14
18
  if (generating) return /* @__PURE__ */ jsx(Button, {
15
19
  className: cx(styles.loadingButton, className),
16
20
  onClick: (e) => {
17
21
  e.stopPropagation();
18
22
  e.preventDefault();
19
- if (onStop) onStop(e);
20
- if (onClick) onClick(e);
23
+ onStop?.(e);
24
+ onClick?.(e);
21
25
  },
22
26
  shape,
23
27
  style: {
@@ -25,7 +29,8 @@ const SendButton = ({ type = "primary", menu, className, style, loading, generat
25
29
  ...style,
26
30
  width: menu ? size * 2 : size
27
31
  },
28
- variant: "filled",
32
+ title,
33
+ type: "fill",
29
34
  ...rest,
30
35
  children: /* @__PURE__ */ jsx(StopIcon, { size: size * .75 })
31
36
  });
@@ -39,6 +44,7 @@ const SendButton = ({ type = "primary", menu, className, style, loading, generat
39
44
  ...style,
40
45
  width: menu ? size * 2 : size
41
46
  },
47
+ title,
42
48
  type,
43
49
  ...rest
44
50
  });
@@ -46,59 +52,33 @@ const SendButton = ({ type = "primary", menu, className, style, loading, generat
46
52
  className: cx(styles.button, disabled && styles.disabled, className),
47
53
  disabled,
48
54
  icon: /* @__PURE__ */ jsx(SendIcon, {}),
49
- onClick: (e) => {
50
- e.stopPropagation();
51
- e.preventDefault();
52
- if (onSend) onSend(e);
53
- if (onClick) onClick(e);
54
- },
55
+ onClick: handleSend,
55
56
  shape,
56
57
  style: {
57
58
  ...cssVariables,
58
59
  ...style
59
60
  },
61
+ title,
60
62
  type,
61
63
  ...rest
62
64
  });
63
- return /* @__PURE__ */ jsxs(Space.Compact, {
64
- className: cx(styles.dropdownButton, disabled && styles.disabled, shape === "round" && styles.dropdownButtonRound, className),
65
+ return /* @__PURE__ */ jsxs(SplitButton, {
66
+ className: cx(styles.splitButton, disabled && styles.splitButtonDisabled, shape === "round" && styles.splitButtonRound, className),
67
+ disabled,
65
68
  style: {
66
69
  ...cssVariables,
67
70
  ...style
68
71
  },
69
- ...rest,
70
- children: [/* @__PURE__ */ jsx(Button, {
71
- className: cx(styles.button, disabled && styles.disabled, className),
72
- disabled,
72
+ type,
73
+ children: [/* @__PURE__ */ jsx(SplitButton.Main, {
73
74
  icon: /* @__PURE__ */ jsx(SendIcon, {}),
74
- onClick: (e) => {
75
- e.stopPropagation();
76
- e.preventDefault();
77
- if (onSend) onSend(e);
78
- if (onClick) onClick(e);
79
- },
80
- shape,
81
- style: {
82
- ...cssVariables,
83
- ...style
84
- },
85
- type,
75
+ onClick: handleSend,
76
+ title,
86
77
  ...rest
87
- }), /* @__PURE__ */ jsx(Dropdown$1, {
88
- menu,
89
- placement: "topRight",
90
- ...rest,
91
- children: /* @__PURE__ */ jsx(Button, {
92
- className: cx(styles.button, disabled && styles.disabled, className),
93
- disabled,
94
- icon: /* @__PURE__ */ jsx(Icon, { icon: ChevronDownIcon }),
95
- shape,
96
- style: {
97
- ...cssVariables,
98
- cursor: "pointer"
99
- },
100
- type
101
- })
78
+ }), /* @__PURE__ */ jsx(SplitButton.Menu, {
79
+ items: menu.items,
80
+ placement,
81
+ trigger
102
82
  })]
103
83
  });
104
84
  };
@@ -1,3 +1,3 @@
1
- import { SendButtonProps } from "./type.js";
1
+ import { SendButtonClickHandler, SendButtonProps } from "./type.js";
2
2
  import SendButton from "./SendButton.js";
3
- export { SendButtonProps, SendButton as default };
3
+ export { SendButtonClickHandler, SendButtonProps, SendButton as default };
@@ -1,67 +1,59 @@
1
1
  import { createStaticStyles } from "antd-style";
2
2
  //#region src/react/SendButton/style.ts
3
- const prefixCls = "ant";
4
3
  const styles = createStaticStyles(({ css, cssVar }) => ({
5
4
  button: css`
6
- &.${prefixCls}-btn {
7
- flex: none;
8
- width: var(--send-button-size, 32px) !important;
9
- height: var(--send-button-size, 32px);
10
- padding-inline: 0 !important;
11
- }
5
+ flex: none;
6
+ width: var(--send-button-size, 32px) !important;
7
+ height: var(--send-button-size, 32px) !important;
8
+ padding-inline: 0 !important;
12
9
  `,
13
10
  disabled: css`
14
- &.${prefixCls}-btn {
15
- cursor: default;
16
- border-color: ${cssVar.colorBorderSecondary};
17
- background: transparent;
11
+ cursor: default;
12
+ border-color: ${cssVar.colorBorderSecondary};
13
+ background: transparent;
14
+ `,
15
+ loadingButton: css`
16
+ flex: none;
17
+ height: var(--send-button-size, 32px) !important;
18
+ padding-inline: 0 !important;
19
+ `,
20
+ splitButton: css`
21
+ flex: none;
22
+ width: fit-content;
23
+
24
+ & > :where(button, a) {
25
+ height: var(--send-button-size, 32px) !important;
26
+ padding-inline: 0 !important;
18
27
  }
19
28
 
20
- .${prefixCls}-btn-compact-first-item {
21
- cursor: default;
22
- border-color: ${cssVar.colorBorderSecondary};
23
- background: transparent;
29
+ & > :where(button, a):first-of-type {
30
+ width: calc(var(--send-button-size, 32px) * 1.2) !important;
31
+ }
32
+
33
+ & > :where(button, a):last-of-type {
34
+ width: calc(var(--send-button-size, 32px) * 0.8) !important;
24
35
  }
25
- .${prefixCls}-dropdown-trigger {
36
+ `,
37
+ splitButtonDisabled: css`
38
+ opacity: 1;
39
+
40
+ & > :where(button, a) {
26
41
  cursor: default;
27
42
  border-color: ${cssVar.colorBorderSecondary};
28
- border-inline-start-color: transparent;
29
43
  background: transparent;
30
44
  }
31
45
  `,
32
- dropdownButton: css`
33
- flex: none;
34
- width: fit-content;
35
- .${prefixCls}-btn {
36
- width: calc(var(--send-button-size, 32px) * 1.2);
37
- height: var(--send-button-size, 32px);
38
- }
39
- .${prefixCls}-dropdown-trigger {
40
- width: calc(var(--send-button-size, 32px) * 0.8);
41
- &.${prefixCls}-btn-primary {
42
- &::before {
43
- background-color: color-mix(in srgb, ${cssVar.colorBgLayout} 10%, transparent) !important;
44
- }
45
- }
46
- }
47
- `,
48
- dropdownButtonRound: css`
49
- .${prefixCls}-btn-compact-first-item {
46
+ splitButtonRound: css`
47
+ & > :where(button, a):first-of-type {
50
48
  border-start-start-radius: calc(var(--send-button-size, 32px) / 2);
51
49
  border-end-start-radius: calc(var(--send-button-size, 32px) / 2);
52
50
  }
53
- .${prefixCls}-dropdown-trigger {
54
- width: var(--send-button-size, 32px);
51
+
52
+ & > :where(button, a):last-of-type {
53
+ width: var(--send-button-size, 32px) !important;
55
54
  border-start-end-radius: calc(var(--send-button-size, 32px) / 2);
56
55
  border-end-end-radius: calc(var(--send-button-size, 32px) / 2);
57
56
  }
58
- `,
59
- loadingButton: css`
60
- &.${prefixCls}-btn {
61
- flex: none;
62
- height: var(--send-button-size, 32px);
63
- padding-inline: 0 !important;
64
- }
65
57
  `
66
58
  }));
67
59
  //#endregion
@@ -1,11 +1,26 @@
1
- import { DropdownButtonProps } from "antd/lib/dropdown/index.js";
1
+ import { ButtonProps, DropdownItem, DropdownMenuProps } from "@lobehub/ui/base-ui";
2
+ import { CSSProperties, MouseEvent, Ref } from "react";
2
3
  //#region src/react/SendButton/type.d.ts
3
- interface SendButtonProps extends Omit<DropdownButtonProps, 'children' | 'icon' | 'size'> {
4
+ type SendButtonClickHandler = (e: MouseEvent<HTMLElement>) => void;
5
+ interface SendButtonProps extends Omit<ButtonProps, 'children' | 'className' | 'disabled' | 'icon' | 'loading' | 'onClick' | 'outdent' | 'ref' | 'shape' | 'size' | 'style' | 'title' | 'type'> {
6
+ className?: string;
7
+ disabled?: boolean;
4
8
  generating?: boolean;
5
- onSend?: DropdownButtonProps['onClick'];
6
- onStop?: DropdownButtonProps['onClick'];
9
+ loading?: boolean;
10
+ menu?: {
11
+ items: DropdownItem[];
12
+ };
13
+ onClick?: SendButtonClickHandler;
14
+ onSend?: SendButtonClickHandler;
15
+ onStop?: SendButtonClickHandler;
16
+ placement?: DropdownMenuProps['placement'];
17
+ ref?: Ref<HTMLButtonElement>;
7
18
  shape?: 'default' | 'round';
8
19
  size?: number;
20
+ style?: CSSProperties;
21
+ title?: string;
22
+ trigger?: DropdownMenuProps['trigger'];
23
+ type?: ButtonProps['type'];
9
24
  }
10
25
  //#endregion
11
- export { SendButtonProps };
26
+ export { SendButtonClickHandler, SendButtonProps };
@@ -2,8 +2,8 @@ import { getCSSVariables, getRendererClassName } from "./style.js";
2
2
  import { renderNode } from "./engine/render-tree.js";
3
3
  import { rendererNodes } from "./nodes/index.js";
4
4
  import { createDefaultRenderers } from "./renderers/index.js";
5
- import { MotionComponent, MotionProvider } from "@lobehub/ui";
6
5
  import { createElement, use, useMemo } from "react";
6
+ import { MotionComponent, MotionProvider } from "@lobehub/ui";
7
7
  import { createHeadlessEditor } from "@lexical/headless";
8
8
  import { $getRoot } from "lexical";
9
9
  import { motion } from "motion/react";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { renderMermaidBlock } from "./mermaid.js";
3
- import { Highlighter } from "@lobehub/ui";
4
3
  import { jsx } from "react/jsx-runtime";
4
+ import { Highlighter } from "@lobehub/ui";
5
5
  //#region src/renderer/renderers/codeblock.tsx
6
6
  function CodeBlockRenderer({ node }) {
7
7
  const language = node.language || "";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { Mermaid } from "@lobehub/ui";
3
2
  import { jsx } from "react/jsx-runtime";
3
+ import { Mermaid } from "@lobehub/ui";
4
4
  //#region src/renderer/renderers/mermaid.tsx
5
5
  function renderMermaidBlock(node, key) {
6
6
  const code = node.code || "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/editor",
3
- "version": "4.27.3",
3
+ "version": "4.28.0",
4
4
  "description": "A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -131,7 +131,7 @@
131
131
  "yjs": "^13.6.31"
132
132
  },
133
133
  "peerDependencies": {
134
- "@lobehub/ui": "^5.0.0",
134
+ "@lobehub/ui": "^5.54.0",
135
135
  "antd": "^6.1.1",
136
136
  "motion": "^12.0.0",
137
137
  "react": "^19.0.0",