@lobehub/editor 1.4.7 → 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/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/{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
|
-
};
|
|
File without changes
|
|
File without changes
|