@lobehub/editor 1.4.6 → 1.5.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 (113) hide show
  1. package/es/editor-kernel/kernel.d.ts +4 -1
  2. package/es/editor-kernel/kernel.js +56 -1
  3. package/es/index.d.ts +2 -0
  4. package/es/index.js +2 -0
  5. package/es/locale/index.d.ts +7 -0
  6. package/es/locale/index.js +7 -0
  7. package/es/plugins/code/command/index.d.ts +3 -0
  8. package/es/plugins/code/command/index.js +48 -0
  9. package/es/plugins/code/index.d.ts +3 -0
  10. package/es/plugins/code/index.js +3 -0
  11. package/es/plugins/code/node/code.d.ts +19 -0
  12. package/es/plugins/{common/node/LexicalLineBreakNode.js → code/node/code.js} +93 -95
  13. package/es/plugins/code/plugin/index.d.ts +5 -0
  14. package/es/plugins/{common/node/ParagraphNode.js → code/plugin/index.js} +40 -33
  15. package/es/plugins/code/plugin/registry.d.ts +3 -0
  16. package/es/plugins/code/plugin/registry.js +48 -0
  17. package/es/plugins/code/react/CodeReactPlugin.d.ts +4 -0
  18. package/es/plugins/code/react/CodeReactPlugin.js +31 -0
  19. package/es/plugins/code/react/index.d.ts +1 -0
  20. package/es/plugins/code/react/index.js +1 -0
  21. package/es/plugins/code/react/style.d.ts +3 -0
  22. package/es/plugins/code/react/style.js +10 -0
  23. package/es/plugins/code/react/type.d.ts +3 -0
  24. package/es/plugins/code/react/type.js +1 -0
  25. package/es/plugins/common/data-source/json-data-source.js +42 -5
  26. package/es/plugins/common/data-source/text-data-source.js +2 -2
  27. package/es/plugins/common/index.d.ts +1 -0
  28. package/es/plugins/common/index.js +1 -0
  29. package/es/plugins/common/node/ElementDOMSlot.d.ts +3 -5
  30. package/es/plugins/common/node/ElementDOMSlot.js +29 -56
  31. package/es/plugins/common/node/cursor.d.ts +12 -0
  32. package/es/plugins/common/node/cursor.js +303 -0
  33. package/es/plugins/common/plugin/index.js +5 -9
  34. package/es/plugins/common/plugin/register.d.ts +3 -1
  35. package/es/plugins/common/plugin/register.js +46 -13
  36. package/es/plugins/link/command/index.d.ts +5 -1
  37. package/es/plugins/link/command/index.js +21 -3
  38. package/es/plugins/link/react/ReactLinkPlugin.js +6 -9
  39. package/es/plugins/link/react/components/LinkEdit.d.ts +2 -1
  40. package/es/plugins/link/react/components/LinkEdit.js +195 -51
  41. package/es/plugins/link/react/components/LinkToolbar.d.ts +10 -0
  42. package/es/plugins/link/react/components/LinkToolbar.js +73 -0
  43. package/es/plugins/link/react/style.d.ts +3 -2
  44. package/es/plugins/link/react/style.js +8 -5
  45. package/es/plugins/list/command/index.d.ts +1 -0
  46. package/es/plugins/list/command/index.js +1 -0
  47. package/es/plugins/list/plugin/checkList.d.ts +3 -0
  48. package/es/plugins/list/plugin/checkList.js +167 -0
  49. package/es/plugins/list/plugin/index.js +9 -2
  50. package/es/plugins/list/react/style.js +4 -2
  51. package/es/plugins/markdown/data-source/markdown-data-source.js +5 -1
  52. package/es/plugins/markdown/service/shortcut.d.ts +3 -3
  53. package/es/plugins/math/command/index.d.ts +13 -0
  54. package/es/plugins/math/command/index.js +47 -0
  55. package/es/plugins/math/index.d.ts +3 -0
  56. package/es/plugins/math/index.js +3 -0
  57. package/es/plugins/math/node/index.d.ts +45 -0
  58. package/es/plugins/math/node/index.js +259 -0
  59. package/es/plugins/math/plugin/index.d.ts +11 -0
  60. package/es/plugins/math/plugin/index.js +103 -0
  61. package/es/plugins/math/react/component/MathEditor.d.ts +10 -0
  62. package/es/plugins/math/react/component/MathEditor.js +253 -0
  63. package/es/plugins/math/react/component/MathEditorContainer.d.ts +14 -0
  64. package/es/plugins/math/react/component/MathEditorContainer.js +60 -0
  65. package/es/plugins/math/react/component/MathEditorContent.d.ts +26 -0
  66. package/es/plugins/math/react/component/MathEditorContent.js +163 -0
  67. package/es/plugins/math/react/component/MathInline.d.ts +10 -0
  68. package/es/plugins/math/react/component/MathInline.js +105 -0
  69. package/es/plugins/math/react/component/Placeholder.d.ts +3 -0
  70. package/es/plugins/math/react/component/Placeholder.js +19 -0
  71. package/es/plugins/math/react/index.d.ts +3 -0
  72. package/es/plugins/math/react/index.js +43 -0
  73. package/es/plugins/math/react/style.d.ts +6 -0
  74. package/es/plugins/math/react/style.js +16 -0
  75. package/es/plugins/math/react/type.d.ts +13 -0
  76. package/es/plugins/math/react/type.js +1 -0
  77. package/es/plugins/slash/react/ReactSlashPlugin.js +12 -10
  78. package/es/react/ChatInputActions/ChatInputActions.js +38 -119
  79. package/es/react/ChatInputActions/components/ActionItem.d.ts +13 -0
  80. package/es/react/ChatInputActions/components/ActionItem.js +60 -0
  81. package/es/react/ChatInputActions/components/ActionRender.d.ts +9 -0
  82. package/es/react/ChatInputActions/components/ActionRender.js +64 -0
  83. package/es/react/ChatInputActions/components/CollapsedActions.d.ts +4 -0
  84. package/es/react/ChatInputActions/components/CollapsedActions.js +82 -0
  85. package/es/react/ChatInputActions/components/useContainerSize.d.ts +9 -0
  86. package/es/react/ChatInputActions/components/useContainerSize.js +43 -0
  87. package/es/react/ChatInputActions/components/useDisplayActionCount.d.ts +13 -0
  88. package/es/react/ChatInputActions/components/useDisplayActionCount.js +66 -0
  89. package/es/react/ChatInputActions/style.js +1 -1
  90. package/es/react/ChatInputActions/type.d.ts +10 -9
  91. package/es/react/FloatMenu/FloatMenu.d.ts +4 -0
  92. package/es/react/FloatMenu/FloatMenu.js +49 -0
  93. package/es/react/FloatMenu/index.d.ts +2 -0
  94. package/es/react/FloatMenu/index.js +2 -0
  95. package/es/react/FloatMenu/type.d.ts +19 -0
  96. package/es/react/FloatMenu/type.js +1 -0
  97. package/es/react/SlashMenu/SlashMenu.js +32 -48
  98. package/es/react/SlashMenu/type.d.ts +5 -13
  99. package/es/react/hooks/useEditorState/index.d.ts +4 -0
  100. package/es/react/hooks/useEditorState/index.js +40 -4
  101. package/es/react/index.d.ts +1 -0
  102. package/es/react/index.js +1 -0
  103. package/es/types/global.d.ts +4 -0
  104. package/es/types/kernel.d.ts +26 -1
  105. package/package.json +2 -1
  106. package/es/plugins/common/node/LexicalLineBreakNode.d.ts +0 -31
  107. package/es/plugins/common/node/ParagraphNode.d.ts +0 -7
  108. package/es/plugins/link/react/components/Toolbar.d.ts +0 -7
  109. package/es/plugins/link/react/components/Toolbar.js +0 -63
  110. package/es/react/ChatInputActions/components/ChatInputActionsCollapse.d.ts +0 -4
  111. package/es/react/ChatInputActions/components/ChatInputActionsCollapse.js +0 -97
  112. /package/es/react/{SlashMenu → FloatMenu}/style.d.ts +0 -0
  113. /package/es/react/{SlashMenu → FloatMenu}/style.js +0 -0
@@ -1,63 +0,0 @@
1
- import { ActionIconGroup } from '@lobehub/ui';
2
- import { EditIcon, ExternalLinkIcon, UnlinkIcon } from 'lucide-react';
3
- import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
4
- import { TOGGLE_LINK_COMMAND } from "../../node/LinkNode";
5
- import { useStyles } from "../style";
6
- import { EDIT_LINK_COMMAND } from "./LinkEdit";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- export var Toolbar = function Toolbar(_ref) {
9
- var linkNode = _ref.linkNode,
10
- editor = _ref.editor;
11
- var _useStyles = useStyles(),
12
- theme = _useStyles.theme;
13
- var t = useTranslation();
14
- var handleEdit = function handleEdit() {
15
- // Edit link
16
- if (linkNode) {
17
- editor.dispatchCommand(EDIT_LINK_COMMAND, {
18
- linkNode: linkNode,
19
- linkNodeDOM: editor.getElementByKey(linkNode.getKey())
20
- });
21
- }
22
- };
23
- var handleRemove = function handleRemove() {
24
- // Remove link
25
- editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
26
- };
27
- var handleOpenLink = function handleOpenLink() {
28
- // Open link in new window
29
- if (linkNode) {
30
- var url = editor.read(function () {
31
- return linkNode.getURL();
32
- });
33
- window.open(url, '_blank');
34
- }
35
- };
36
- return /*#__PURE__*/_jsx(ActionIconGroup, {
37
- items: [{
38
- icon: EditIcon,
39
- key: 'edit',
40
- label: t('link.edit'),
41
- onClick: handleEdit
42
- }, {
43
- icon: ExternalLinkIcon,
44
- key: 'openLink',
45
- label: t('link.open'),
46
- onClick: handleOpenLink
47
- }, {
48
- icon: UnlinkIcon,
49
- key: 'unlink',
50
- label: t('link.unlink'),
51
- onClick: handleRemove
52
- }],
53
- shadow: true,
54
- size: {
55
- blockSize: 32,
56
- size: 16
57
- },
58
- style: {
59
- background: theme.colorBgElevated
60
- },
61
- variant: 'outlined'
62
- });
63
- };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import type { ChatInputActionsCollapseProps } from '../type';
3
- declare const ChatInputActionsCollapse: import("react").NamedExoticComponent<ChatInputActionsCollapseProps>;
4
- export default ChatInputActionsCollapse;
@@ -1,97 +0,0 @@
1
- 'use client';
2
-
3
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
6
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
- import { ActionIcon } from '@lobehub/ui';
10
- import { Popover } from 'antd';
11
- import { motion } from 'framer-motion';
12
- import { CircleChevronLeftIcon, CircleChevronRightIcon, CircleChevronUpIcon } from 'lucide-react';
13
- import { memo } from 'react';
14
- import { Flexbox } from 'react-layout-kit';
15
- import useMergeState from 'use-merge-value';
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { jsxs as _jsxs } from "react/jsx-runtime";
18
- var ChatInputActionsCollapse = /*#__PURE__*/memo(function (_ref) {
19
- var children = _ref.children,
20
- expand = _ref.expand,
21
- _ref$defaultExpand = _ref.defaultExpand,
22
- defaultExpand = _ref$defaultExpand === void 0 ? true : _ref$defaultExpand,
23
- onChange = _ref.onChange,
24
- gap = _ref.gap,
25
- mode = _ref.mode;
26
- var _useMergeState = useMergeState(defaultExpand, {
27
- defaultValue: defaultExpand,
28
- onChange: onChange,
29
- value: expand
30
- }),
31
- _useMergeState2 = _slicedToArray(_useMergeState, 2),
32
- expanded = _useMergeState2[0],
33
- setExpaned = _useMergeState2[1];
34
- if (mode === 'popup') {
35
- return /*#__PURE__*/_jsx(Popover, {
36
- arrow: false,
37
- content: /*#__PURE__*/_jsx(Flexbox, {
38
- align: 'center',
39
- gap: gap,
40
- horizontal: true,
41
- children: children
42
- }),
43
- styles: {
44
- body: {
45
- padding: 4
46
- }
47
- },
48
- children: /*#__PURE__*/_jsx(ActionIcon, {
49
- icon: CircleChevronUpIcon,
50
- size: {
51
- blockSize: 36,
52
- size: 20
53
- }
54
- })
55
- });
56
- }
57
- return /*#__PURE__*/_jsxs(Flexbox, {
58
- align: 'center',
59
- flex: 'none',
60
- gap: gap,
61
- horizontal: true,
62
- children: [/*#__PURE__*/_jsx(motion.div, {
63
- animate: expanded ? 'open' : 'closed',
64
- style: {
65
- alignItems: 'center',
66
- display: 'flex',
67
- gap: gap,
68
- overflow: 'hidden'
69
- },
70
- transition: {
71
- duration: 0.2
72
- },
73
- variants: {
74
- closed: {
75
- opacity: 0,
76
- width: 0
77
- },
78
- open: {
79
- opacity: 1,
80
- width: 'auto'
81
- }
82
- },
83
- children: children
84
- }), /*#__PURE__*/_jsx(ActionIcon, {
85
- icon: expanded ? CircleChevronLeftIcon : CircleChevronRightIcon,
86
- onClick: function onClick() {
87
- return setExpaned(!expanded);
88
- },
89
- size: {
90
- blockSize: 36,
91
- size: 20
92
- }
93
- })]
94
- });
95
- });
96
- ChatInputActionsCollapse.displayName = 'ChatInputActionsCollapse';
97
- export default ChatInputActionsCollapse;
File without changes
File without changes