@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.
- package/es/editor-kernel/kernel.d.ts +4 -1
- package/es/editor-kernel/kernel.js +56 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/es/locale/index.d.ts +7 -0
- package/es/locale/index.js +7 -0
- package/es/plugins/code/command/index.d.ts +3 -0
- package/es/plugins/code/command/index.js +48 -0
- package/es/plugins/code/index.d.ts +3 -0
- package/es/plugins/code/index.js +3 -0
- package/es/plugins/code/node/code.d.ts +19 -0
- package/es/plugins/{common/node/LexicalLineBreakNode.js → code/node/code.js} +93 -95
- package/es/plugins/code/plugin/index.d.ts +5 -0
- package/es/plugins/{common/node/ParagraphNode.js → code/plugin/index.js} +40 -33
- package/es/plugins/code/plugin/registry.d.ts +3 -0
- package/es/plugins/code/plugin/registry.js +48 -0
- package/es/plugins/code/react/CodeReactPlugin.d.ts +4 -0
- package/es/plugins/code/react/CodeReactPlugin.js +31 -0
- package/es/plugins/code/react/index.d.ts +1 -0
- package/es/plugins/code/react/index.js +1 -0
- package/es/plugins/code/react/style.d.ts +3 -0
- package/es/plugins/code/react/style.js +10 -0
- package/es/plugins/code/react/type.d.ts +3 -0
- package/es/plugins/code/react/type.js +1 -0
- package/es/plugins/common/data-source/json-data-source.js +42 -5
- package/es/plugins/common/data-source/text-data-source.js +2 -2
- package/es/plugins/common/index.d.ts +1 -0
- package/es/plugins/common/index.js +1 -0
- package/es/plugins/common/node/ElementDOMSlot.d.ts +3 -5
- package/es/plugins/common/node/ElementDOMSlot.js +29 -56
- package/es/plugins/common/node/cursor.d.ts +12 -0
- package/es/plugins/common/node/cursor.js +303 -0
- package/es/plugins/common/plugin/index.js +5 -9
- package/es/plugins/common/plugin/register.d.ts +3 -1
- package/es/plugins/common/plugin/register.js +46 -13
- package/es/plugins/link/command/index.d.ts +5 -1
- package/es/plugins/link/command/index.js +21 -3
- package/es/plugins/link/react/ReactLinkPlugin.js +6 -9
- package/es/plugins/link/react/components/LinkEdit.d.ts +2 -1
- package/es/plugins/link/react/components/LinkEdit.js +195 -51
- package/es/plugins/link/react/components/LinkToolbar.d.ts +10 -0
- package/es/plugins/link/react/components/LinkToolbar.js +73 -0
- package/es/plugins/link/react/style.d.ts +3 -2
- package/es/plugins/link/react/style.js +8 -5
- package/es/plugins/list/command/index.d.ts +1 -0
- package/es/plugins/list/command/index.js +1 -0
- package/es/plugins/list/plugin/checkList.d.ts +3 -0
- package/es/plugins/list/plugin/checkList.js +167 -0
- package/es/plugins/list/plugin/index.js +9 -2
- package/es/plugins/list/react/style.js +4 -2
- package/es/plugins/markdown/data-source/markdown-data-source.js +5 -1
- package/es/plugins/markdown/service/shortcut.d.ts +3 -3
- package/es/plugins/math/command/index.d.ts +13 -0
- package/es/plugins/math/command/index.js +47 -0
- package/es/plugins/math/index.d.ts +3 -0
- package/es/plugins/math/index.js +3 -0
- package/es/plugins/math/node/index.d.ts +45 -0
- package/es/plugins/math/node/index.js +259 -0
- package/es/plugins/math/plugin/index.d.ts +11 -0
- package/es/plugins/math/plugin/index.js +103 -0
- package/es/plugins/math/react/component/MathEditor.d.ts +10 -0
- package/es/plugins/math/react/component/MathEditor.js +253 -0
- package/es/plugins/math/react/component/MathEditorContainer.d.ts +14 -0
- package/es/plugins/math/react/component/MathEditorContainer.js +60 -0
- package/es/plugins/math/react/component/MathEditorContent.d.ts +26 -0
- package/es/plugins/math/react/component/MathEditorContent.js +163 -0
- package/es/plugins/math/react/component/MathInline.d.ts +10 -0
- package/es/plugins/math/react/component/MathInline.js +105 -0
- package/es/plugins/math/react/component/Placeholder.d.ts +3 -0
- package/es/plugins/math/react/component/Placeholder.js +19 -0
- package/es/plugins/math/react/index.d.ts +3 -0
- package/es/plugins/math/react/index.js +43 -0
- package/es/plugins/math/react/style.d.ts +6 -0
- package/es/plugins/math/react/style.js +16 -0
- package/es/plugins/math/react/type.d.ts +13 -0
- package/es/plugins/math/react/type.js +1 -0
- package/es/plugins/slash/react/ReactSlashPlugin.js +12 -10
- package/es/react/ChatInputActions/ChatInputActions.js +38 -119
- package/es/react/ChatInputActions/components/ActionItem.d.ts +13 -0
- package/es/react/ChatInputActions/components/ActionItem.js +60 -0
- package/es/react/ChatInputActions/components/ActionRender.d.ts +9 -0
- package/es/react/ChatInputActions/components/ActionRender.js +64 -0
- package/es/react/ChatInputActions/components/CollapsedActions.d.ts +4 -0
- package/es/react/ChatInputActions/components/CollapsedActions.js +82 -0
- package/es/react/ChatInputActions/components/useContainerSize.d.ts +9 -0
- package/es/react/ChatInputActions/components/useContainerSize.js +43 -0
- package/es/react/ChatInputActions/components/useDisplayActionCount.d.ts +13 -0
- package/es/react/ChatInputActions/components/useDisplayActionCount.js +66 -0
- package/es/react/ChatInputActions/style.js +1 -1
- package/es/react/ChatInputActions/type.d.ts +10 -9
- package/es/react/FloatMenu/FloatMenu.d.ts +4 -0
- package/es/react/FloatMenu/FloatMenu.js +49 -0
- package/es/react/FloatMenu/index.d.ts +2 -0
- package/es/react/FloatMenu/index.js +2 -0
- package/es/react/FloatMenu/type.d.ts +19 -0
- package/es/react/FloatMenu/type.js +1 -0
- package/es/react/SlashMenu/SlashMenu.js +32 -48
- package/es/react/SlashMenu/type.d.ts +5 -13
- package/es/react/hooks/useEditorState/index.d.ts +4 -0
- package/es/react/hooks/useEditorState/index.js +40 -4
- package/es/react/index.d.ts +1 -0
- package/es/react/index.js +1 -0
- package/es/types/global.d.ts +4 -0
- package/es/types/kernel.d.ts +26 -1
- package/package.json +2 -1
- package/es/plugins/common/node/LexicalLineBreakNode.d.ts +0 -31
- package/es/plugins/common/node/ParagraphNode.d.ts +0 -7
- package/es/plugins/link/react/components/Toolbar.d.ts +0 -7
- package/es/plugins/link/react/components/Toolbar.js +0 -63
- package/es/react/ChatInputActions/components/ChatInputActionsCollapse.d.ts +0 -4
- package/es/react/ChatInputActions/components/ChatInputActionsCollapse.js +0 -97
- /package/es/react/{SlashMenu → FloatMenu}/style.d.ts +0 -0
- /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,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
|