@lobehub/editor 3.2.0 → 3.2.2
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/react/useAnchor.js +4 -1
- package/es/plugins/auto-complete/react/ReactAutoCompletePlugin.js +2 -4
- package/es/plugins/auto-complete/react/style.d.ts +4 -4
- package/es/plugins/auto-complete/react/style.js +2 -2
- package/es/plugins/code/react/CodeReactPlugin.js +2 -4
- package/es/plugins/code/react/style.d.ts +3 -3
- package/es/plugins/code/react/style.js +4 -4
- package/es/plugins/codeblock/command/index.d.ts +2 -11
- package/es/plugins/codeblock/command/index.js +1 -37
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +0 -6
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +4 -5
- package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +2 -7
- package/es/plugins/codeblock/plugin/FacadeShiki.js +46 -103
- package/es/plugins/codeblock/plugin/index.d.ts +0 -5
- package/es/plugins/codeblock/plugin/index.js +3 -7
- package/es/plugins/codeblock/react/ReactCodeblockPlugin.js +9 -26
- package/es/plugins/codeblock/react/style.d.ts +4 -6
- package/es/plugins/codeblock/react/style.js +5 -32
- package/es/plugins/common/react/Placeholder/index.js +1 -3
- package/es/plugins/common/react/Placeholder/style.d.ts +4 -4
- package/es/plugins/common/react/Placeholder/style.js +4 -4
- package/es/plugins/common/react/ReactPlainText.js +33 -21
- package/es/plugins/common/react/style.d.ts +22 -32
- package/es/plugins/common/react/style.js +27 -30
- package/es/plugins/file/react/ReactFilePlugin.js +1 -3
- package/es/plugins/file/react/style.d.ts +3 -3
- package/es/plugins/file/react/style.js +4 -4
- package/es/plugins/hr/react/components/HRNode.d.ts +2 -2
- package/es/plugins/hr/react/components/HRNode.js +5 -7
- package/es/plugins/hr/react/style.d.ts +1 -1
- package/es/plugins/hr/react/style.js +4 -4
- package/es/plugins/image/react/ReactImagePlugin.js +1 -3
- package/es/plugins/image/react/components/BrokenImage.js +3 -5
- package/es/plugins/image/react/components/Image.js +2 -4
- package/es/plugins/image/react/components/LazyImage.d.ts +9 -8
- package/es/plugins/image/react/components/LazyImage.js +6 -7
- package/es/plugins/image/react/components/ResizeHandle.d.ts +2 -2
- package/es/plugins/image/react/components/ResizeHandle.js +5 -7
- package/es/plugins/image/react/components/style.d.ts +9 -7
- package/es/plugins/image/react/components/style.js +11 -10
- package/es/plugins/image/react/style.d.ts +4 -4
- package/es/plugins/image/react/style.js +5 -5
- package/es/plugins/link/react/ReactLinkPlugin.js +1 -3
- package/es/plugins/link/react/components/LinkEdit.d.ts +2 -2
- package/es/plugins/link/react/components/LinkEdit.js +7 -9
- package/es/plugins/link/react/components/LinkToolbar.js +1 -3
- package/es/plugins/link/react/style.d.ts +4 -4
- package/es/plugins/link/react/style.js +7 -8
- package/es/plugins/link-highlight/react/ReactLinkHighlightPlugin.js +2 -4
- package/es/plugins/link-highlight/react/style.d.ts +3 -3
- package/es/plugins/link-highlight/react/style.js +2 -2
- package/es/plugins/list/react/ReactListPlugin.js +1 -3
- package/es/plugins/list/react/style.d.ts +1 -1
- package/es/plugins/list/react/style.js +4 -5
- package/es/plugins/litexml/react/DiffNodeToolbar/index.js +5 -4
- package/es/plugins/litexml/react/DiffNodeToolbar/style.d.ts +6 -5
- package/es/plugins/litexml/react/DiffNodeToolbar/style.js +7 -7
- package/es/plugins/litexml/react/index.js +1 -3
- package/es/plugins/litexml/react/style.d.ts +1 -1
- package/es/plugins/litexml/react/style.js +4 -4
- package/es/plugins/math/react/components/MathEditorContainer.js +1 -3
- package/es/plugins/math/react/components/MathEditorContent.js +3 -7
- package/es/plugins/math/react/components/MathInline.d.ts +2 -2
- package/es/plugins/math/react/components/MathInline.js +3 -3
- package/es/plugins/math/react/components/Placeholder.js +4 -6
- package/es/plugins/math/react/index.js +1 -3
- package/es/plugins/math/react/style.d.ts +6 -4
- package/es/plugins/math/react/style.js +10 -9
- package/es/plugins/mention/react/ReactMentionPlugin.js +1 -3
- package/es/plugins/mention/react/style.d.ts +3 -3
- package/es/plugins/mention/react/style.js +4 -4
- package/es/plugins/slash/react/components/DefaultSlashMenu.d.ts +2 -2
- package/es/plugins/slash/react/components/DefaultSlashMenu.js +24 -17
- package/es/plugins/slash/react/components/SlashMenu.d.ts +2 -2
- package/es/plugins/slash/react/components/SlashMenu.js +3 -4
- package/es/plugins/slash/react/style.d.ts +1 -1
- package/es/plugins/slash/react/style.js +4 -4
- package/es/plugins/table/react/TableActionMenu/index.js +3 -7
- package/es/plugins/table/react/TableActionMenu/style.d.ts +4 -1
- package/es/plugins/table/react/TableActionMenu/style.js +7 -4
- package/es/plugins/table/react/TableHoverActions/index.js +2 -4
- package/es/plugins/table/react/TableHoverActions/style.d.ts +4 -4
- package/es/plugins/table/react/TableHoverActions/style.js +2 -2
- package/es/plugins/table/react/TableResize/index.js +8 -8
- package/es/plugins/table/react/TableResize/style.d.ts +1 -1
- package/es/plugins/table/react/TableResize/style.js +4 -4
- package/es/plugins/table/react/index.js +2 -4
- package/es/plugins/table/react/style.d.ts +1 -1
- package/es/plugins/table/react/style.js +4 -4
- package/es/plugins/toolbar/react/index.js +6 -8
- package/es/plugins/toolbar/react/style.d.ts +5 -1
- package/es/plugins/toolbar/react/style.js +9 -6
- package/es/react/ChatInput/ChatInput.d.ts +2 -2
- package/es/react/ChatInput/ChatInput.js +16 -27
- package/es/react/ChatInput/style.d.ts +11 -6
- package/es/react/ChatInput/style.js +13 -9
- package/es/react/ChatInputActionBar/ChatInputActionBar.js +2 -4
- package/es/react/ChatInputActionBar/style.d.ts +3 -3
- package/es/react/ChatInputActionBar/style.js +2 -2
- package/es/react/ChatInputActions/ChatInputActions.js +25 -25
- package/es/react/ChatInputActions/components/ActionItem.d.ts +2 -2
- package/es/react/ChatInputActions/components/ActionItem.js +2 -4
- package/es/react/ChatInputActions/components/ActionRender.d.ts +2 -2
- package/es/react/ChatInputActions/components/ActionRender.js +5 -11
- package/es/react/ChatInputActions/components/CollapsedActions.d.ts +2 -2
- package/es/react/ChatInputActions/components/CollapsedActions.js +5 -8
- package/es/react/ChatInputActions/style.d.ts +5 -4
- package/es/react/ChatInputActions/style.js +6 -5
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.d.ts +2 -2
- package/es/react/CodeLanguageSelect/CodeLanguageSelect.js +6 -9
- package/es/react/CodeLanguageSelect/style.d.ts +3 -3
- package/es/react/CodeLanguageSelect/style.js +2 -2
- package/es/react/FloatActions/FloatActions.d.ts +2 -2
- package/es/react/FloatActions/FloatActions.js +4 -8
- package/es/react/FloatActions/components/ActionItem.d.ts +2 -2
- package/es/react/FloatActions/components/ActionItem.js +2 -4
- package/es/react/FloatActions/components/ActionRender.d.ts +2 -2
- package/es/react/FloatActions/components/ActionRender.js +5 -11
- package/es/react/FloatActions/components/CollapsedActions.d.ts +2 -2
- package/es/react/FloatActions/components/CollapsedActions.js +5 -8
- package/es/react/FloatActions/style.d.ts +5 -4
- package/es/react/FloatActions/style.js +6 -5
- package/es/react/FloatMenu/FloatMenu.js +2 -4
- package/es/react/FloatMenu/style.d.ts +5 -4
- package/es/react/FloatMenu/style.js +7 -6
- package/es/react/SendButton/SendButton.d.ts +2 -2
- package/es/react/SendButton/SendButton.js +17 -15
- package/es/react/SendButton/components/SendIcon.js +15 -15
- package/es/react/SendButton/components/StopIcon.js +16 -18
- package/es/react/SendButton/style.d.ts +7 -7
- package/es/react/SendButton/style.js +9 -10
- package/package.json +3 -3
|
@@ -7,7 +7,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
7
7
|
import { addClassNamesToElement, removeClassNamesFromElement } from '@lexical/utils';
|
|
8
8
|
import Katex from 'katex';
|
|
9
9
|
import { $getSelection, $isNodeSelection, CLICK_COMMAND, COMMAND_PRIORITY_NORMAL } from 'lexical';
|
|
10
|
-
import {
|
|
10
|
+
import { useEffect, useRef, useState } from 'react';
|
|
11
11
|
import { useLexicalEditor } from "../../../../editor-kernel/react";
|
|
12
12
|
import { useLexicalNodeSelection } from "../../../../editor-kernel/react/useLexicalNodeSelection";
|
|
13
13
|
import { createDebugLogger } from "../../../../utils/debug";
|
|
@@ -15,7 +15,7 @@ import { $isMathNode, MathBlockNode } from "../../node";
|
|
|
15
15
|
import Placeholder from "./Placeholder";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
var logger = createDebugLogger('plugin', 'math');
|
|
18
|
-
var MathInline =
|
|
18
|
+
var MathInline = function MathInline(_ref) {
|
|
19
19
|
var editor = _ref.editor,
|
|
20
20
|
node = _ref.node,
|
|
21
21
|
className = _ref.className;
|
|
@@ -108,5 +108,5 @@ var MathInline = /*#__PURE__*/memo(function (_ref) {
|
|
|
108
108
|
mathBlock: isMathBlock
|
|
109
109
|
})
|
|
110
110
|
});
|
|
111
|
-
}
|
|
111
|
+
};
|
|
112
112
|
export default MathInline;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Center, Text } from '@lobehub/ui';
|
|
2
|
+
import { cx } from 'antd-style';
|
|
2
3
|
import { useTranslation } from "../../../../editor-kernel/react/useTranslation";
|
|
4
|
+
import { styles } from "../style";
|
|
3
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
6
|
var Placeholder = function Placeholder(_ref) {
|
|
5
7
|
var mathBlock = _ref.mathBlock;
|
|
6
8
|
var t = useTranslation();
|
|
7
9
|
var node = /*#__PURE__*/_jsx(Text, {
|
|
8
10
|
as: 'span',
|
|
9
|
-
className: 'katex',
|
|
11
|
+
className: cx('katex', styles.mathPlaceholder),
|
|
10
12
|
fontSize: mathBlock ? '1.2em' : '1em',
|
|
11
|
-
style: {
|
|
12
|
-
fontStyle: 'italic',
|
|
13
|
-
paddingInline: '0.2em'
|
|
14
|
-
},
|
|
15
13
|
type: 'secondary',
|
|
16
14
|
children: t('math.placeholder')
|
|
17
15
|
});
|
|
@@ -12,7 +12,7 @@ import { MarkdownPlugin } from "../../markdown/plugin";
|
|
|
12
12
|
import { MathPlugin } from "../plugin";
|
|
13
13
|
import MathEdit from "./components/MathEditor";
|
|
14
14
|
import MathInline from "./components/MathInline";
|
|
15
|
-
import {
|
|
15
|
+
import { styles } from "./style";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
export var ReactMathPlugin = function ReactMathPlugin(_ref) {
|
|
18
18
|
var className = _ref.className,
|
|
@@ -21,8 +21,6 @@ export var ReactMathPlugin = function ReactMathPlugin(_ref) {
|
|
|
21
21
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
22
22
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
23
23
|
editor = _useLexicalComposerCo2[0];
|
|
24
|
-
var _useStyles = useStyles(),
|
|
25
|
-
styles = _useStyles.styles;
|
|
26
24
|
useLayoutEffect(function () {
|
|
27
25
|
editor.registerPlugin(MarkdownPlugin);
|
|
28
26
|
editor.registerPlugin(MathPlugin, {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const styles: {
|
|
2
2
|
mathInline: string;
|
|
3
3
|
mathBlock: string;
|
|
4
|
-
mathEditor:
|
|
5
|
-
mathEditorFooter:
|
|
6
|
-
|
|
4
|
+
mathEditor: string;
|
|
5
|
+
mathEditorFooter: string;
|
|
6
|
+
mathEditorTextArea: string;
|
|
7
|
+
mathPlaceholder: string;
|
|
8
|
+
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
4
|
-
import {
|
|
5
|
-
export var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var latex = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n user-select: none;\n font-size: 1em;\n\n .katex-error {\n color: ", " !important;\n }\n\n .katex-html {\n overflow: auto hidden;\n padding: 3px;\n\n .base {\n margin-block: 0;\n margin-inline: auto;\n }\n\n .tag {\n position: relative !important;\n display: inline-block;\n padding-inline-start: 0.5rem;\n }\n }\n\n &.selected {\n color: #000;\n background: ", ";\n }\n\n &:hover {\n background: ", ";\n }\n\n &.editing {\n background: ", ";\n }\n\n &:has(.katex-error) {\n background: ", ";\n }\n "])), token.colorError, token.yellow, token.colorFillTertiary, token.colorFillTertiary, token.colorErrorBg);
|
|
4
|
+
import { createStaticStyles, cx } from 'antd-style';
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
cssVar = _ref.cssVar;
|
|
8
|
+
var latex = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n user-select: none;\n font-size: 1em;\n\n .katex-error {\n color: ", " !important;\n }\n\n .katex-html {\n overflow: auto hidden;\n padding: 3px;\n\n .base {\n margin-block: 0;\n margin-inline: auto;\n }\n\n .tag {\n position: relative !important;\n display: inline-block;\n padding-inline-start: 0.5rem;\n }\n }\n\n &.selected {\n color: #000;\n background: ", ";\n }\n\n &:hover {\n background: ", ";\n }\n\n &.editing {\n background: ", ";\n }\n\n &:has(.katex-error) {\n background: ", ";\n }\n "])), cssVar.colorError, cssVar.yellow, cssVar.colorFillTertiary, cssVar.colorFillTertiary, cssVar.colorErrorBg);
|
|
10
9
|
return {
|
|
11
10
|
mathInline: cx(latex, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: inline-block;\n border-radius: calc(var(--lobe-markdown-border-radius) * 0.5px);\n "])))),
|
|
12
11
|
mathBlock: cx(latex, css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n overflow: auto hidden;\n display: block;\n border-radius: calc(var(--lobe-markdown-border-radius) * 1px);\n white-space: nowrap;\n "])))),
|
|
13
|
-
mathEditor: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 999;\n width: 320px;\n background: ", ";\n\n textarea {\n width: 100%;\n\n font-family: ", ";\n font-size: 13px;\n\n background: transparent !important;\n\n transition: none !important;\n }\n "])),
|
|
14
|
-
mathEditorFooter: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-block-start: 1px solid ", ";\n background: ", ";\n "])),
|
|
12
|
+
mathEditor: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 999;\n width: 320px;\n background: ", ";\n\n textarea {\n width: 100%;\n\n font-family: ", ";\n font-size: 13px;\n\n background: transparent !important;\n\n transition: none !important;\n }\n "])), cssVar.colorBgElevated, cssVar.fontFamilyCode),
|
|
13
|
+
mathEditorFooter: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-block-start: 1px solid ", ";\n background: ", ";\n "])), cssVar.colorBorderSecondary, cssVar.colorFillQuaternary),
|
|
14
|
+
mathEditorTextArea: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-block: 4px;\n "]))),
|
|
15
|
+
mathPlaceholder: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n padding-inline: 0.2em;\n font-style: italic;\n "])))
|
|
15
16
|
};
|
|
16
17
|
});
|
|
@@ -11,7 +11,7 @@ import { useLexicalComposerContext } from "../../../editor-kernel/react/react-co
|
|
|
11
11
|
import { MarkdownPlugin } from "../../markdown/plugin";
|
|
12
12
|
import { MentionPlugin } from "../plugin";
|
|
13
13
|
import Mention from "./components/Mention";
|
|
14
|
-
import {
|
|
14
|
+
import { styles } from "./style";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
var ReactMentionPlugin = function ReactMentionPlugin(_ref) {
|
|
17
17
|
var className = _ref.className,
|
|
@@ -20,8 +20,6 @@ var ReactMentionPlugin = function ReactMentionPlugin(_ref) {
|
|
|
20
20
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
21
21
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
22
22
|
editor = _useLexicalComposerCo2[0];
|
|
23
|
-
var _useStyles = useStyles(),
|
|
24
|
-
styles = _useStyles.styles;
|
|
25
23
|
useLayoutEffect(function () {
|
|
26
24
|
editor.registerPlugin(MarkdownPlugin);
|
|
27
25
|
editor.registerPlugin(MentionPlugin, {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
mention:
|
|
3
|
-
}
|
|
1
|
+
export declare const styles: {
|
|
2
|
+
mention: string;
|
|
3
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
4
|
-
import {
|
|
5
|
-
export var
|
|
4
|
+
import { createStaticStyles } from 'antd-style';
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
6
|
var css = _ref.css,
|
|
7
|
-
|
|
7
|
+
cssVar = _ref.cssVar;
|
|
8
8
|
return {
|
|
9
|
-
mention: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n\n position: relative;\n\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n font-size: 0.875em;\n line-height: 1;\n color: ", ";\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n\n &.selected {\n color: #000;\n background: ", ";\n }\n "])),
|
|
9
|
+
mention: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n\n position: relative;\n\n display: inline;\n\n margin-inline: 0.25em;\n padding-block: 0.2em;\n padding-inline: 0.4em;\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n font-size: 0.875em;\n line-height: 1;\n color: ", ";\n word-break: break-word;\n white-space: break-spaces;\n\n background: ", ";\n\n &.selected {\n color: #000;\n background: ", ";\n }\n "])), cssVar.colorFillTertiary, cssVar.colorInfo, cssVar.colorFillTertiary, cssVar.yellow)
|
|
10
10
|
};
|
|
11
11
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { type FC } from 'react';
|
|
2
2
|
import type { SlashMenuProps } from '../type';
|
|
3
3
|
type DefaultSlashMenuProps = Omit<SlashMenuProps, 'customRender' | 'onActiveKeyChange' | 'editor'>;
|
|
4
|
-
declare const DefaultSlashMenu:
|
|
4
|
+
declare const DefaultSlashMenu: FC<DefaultSlashMenuProps>;
|
|
5
5
|
export default DefaultSlashMenu;
|
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
var _templateObject;
|
|
4
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
5
|
import { Dropdown } from '@lobehub/ui';
|
|
4
|
-
import {
|
|
6
|
+
import { createStaticStyles } from 'antd-style';
|
|
7
|
+
import { useCallback } from 'react';
|
|
5
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
var styles = createStaticStyles(function (_ref) {
|
|
10
|
+
var css = _ref.css;
|
|
11
|
+
return {
|
|
12
|
+
menu: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: fixed;\n z-index: 9999;\n "])))
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
var DefaultSlashMenu = function DefaultSlashMenu(_ref2) {
|
|
16
|
+
var activeKey = _ref2.activeKey,
|
|
17
|
+
anchorClassName = _ref2.anchorClassName,
|
|
18
|
+
loading = _ref2.loading,
|
|
19
|
+
onSelect = _ref2.onSelect,
|
|
20
|
+
open = _ref2.open,
|
|
21
|
+
options = _ref2.options,
|
|
22
|
+
position = _ref2.position,
|
|
23
|
+
_onClose = _ref2.onClose;
|
|
24
|
+
var handleMenuClick = useCallback(function (_ref3) {
|
|
25
|
+
var key = _ref3.key;
|
|
18
26
|
var option = options.find(function (item) {
|
|
19
27
|
return 'key' in item && item.key === key;
|
|
20
28
|
});
|
|
21
29
|
if (option) onSelect(option);
|
|
22
30
|
}, [options, onSelect]);
|
|
23
31
|
return /*#__PURE__*/_jsx("div", {
|
|
32
|
+
className: styles.menu,
|
|
24
33
|
style: {
|
|
25
34
|
left: position.x,
|
|
26
|
-
|
|
27
|
-
top: position.y,
|
|
28
|
-
zIndex: 9999
|
|
35
|
+
top: position.y
|
|
29
36
|
},
|
|
30
37
|
children: /*#__PURE__*/_jsx(Dropdown, {
|
|
31
38
|
menu: {
|
|
@@ -44,6 +51,6 @@ var DefaultSlashMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
44
51
|
})
|
|
45
52
|
})
|
|
46
53
|
});
|
|
47
|
-
}
|
|
54
|
+
};
|
|
48
55
|
DefaultSlashMenu.displayName = 'DefaultSlashMenu';
|
|
49
56
|
export default DefaultSlashMenu;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type FC } from 'react';
|
|
2
2
|
import type { SlashMenuProps } from '../type';
|
|
3
3
|
/**
|
|
4
4
|
* SlashMenu component - Only responsible for rendering the menu UI
|
|
5
5
|
* All state management and plugin registration is handled by ReactSlashPlugin
|
|
6
6
|
*/
|
|
7
|
-
declare const SlashMenu:
|
|
7
|
+
declare const SlashMenu: FC<SlashMenuProps>;
|
|
8
8
|
export default SlashMenu;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
4
|
import DefaultSlashMenu from "./DefaultSlashMenu";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* SlashMenu component - Only responsible for rendering the menu UI
|
|
8
8
|
* All state management and plugin registration is handled by ReactSlashPlugin
|
|
9
9
|
*/
|
|
10
|
-
// Keep memo: Menu rendering with keyboard navigation and selection state
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
var SlashMenu =
|
|
11
|
+
var SlashMenu = function SlashMenu(_ref) {
|
|
13
12
|
var activeKey = _ref.activeKey,
|
|
14
13
|
anchorClassName = _ref.anchorClassName,
|
|
15
14
|
CustomRender = _ref.customRender,
|
|
@@ -48,6 +47,6 @@ var SlashMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
48
47
|
options: options,
|
|
49
48
|
position: position
|
|
50
49
|
});
|
|
51
|
-
}
|
|
50
|
+
};
|
|
52
51
|
SlashMenu.displayName = 'SlashMenu';
|
|
53
52
|
export default SlashMenu;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const styles: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
4
|
-
import {
|
|
5
|
-
export var
|
|
4
|
+
import { createStaticStyles } from 'antd-style';
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
6
|
var css = _ref.css,
|
|
7
|
-
|
|
8
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n "])),
|
|
7
|
+
cssVar = _ref.cssVar;
|
|
8
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background: ", ";\n "])), cssVar.colorBgElevated);
|
|
9
9
|
});
|
|
@@ -20,7 +20,7 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
|
20
20
|
import { useAnchor } from "../../../../editor-kernel/react/useAnchor";
|
|
21
21
|
import { cleanPosition, updatePosition } from "../../../../utils/updatePosition";
|
|
22
22
|
import ActionMenu from "./ActionMenu";
|
|
23
|
-
import {
|
|
23
|
+
import { styles } from "./style";
|
|
24
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
25
|
var TableActionMenu = /*#__PURE__*/memo(function (_ref) {
|
|
26
26
|
var cellMerge = _ref.cellMerge,
|
|
@@ -157,22 +157,18 @@ var TableActionMenu = /*#__PURE__*/memo(function (_ref) {
|
|
|
157
157
|
useEffect(function () {
|
|
158
158
|
prevTableCellDOM.current = tableCellNode;
|
|
159
159
|
}, [prevTableCellDOM, tableCellNode]);
|
|
160
|
-
var _useStyles = useStyles(),
|
|
161
|
-
styles = _useStyles.styles;
|
|
162
160
|
return /*#__PURE__*/_jsx("div", {
|
|
163
|
-
className: styles,
|
|
161
|
+
className: styles.root,
|
|
164
162
|
ref: menuButtonRef,
|
|
165
163
|
children: tableCellNode && /*#__PURE__*/_jsx(ActionMenu, {
|
|
166
164
|
cellMerge: cellMerge,
|
|
167
165
|
editor: editor,
|
|
168
166
|
tableCellNode: tableCellNode,
|
|
169
167
|
children: /*#__PURE__*/_jsx(ActionIcon, {
|
|
168
|
+
className: styles.actionIcon,
|
|
170
169
|
glass: true,
|
|
171
170
|
icon: ChevronDown,
|
|
172
171
|
size: 12,
|
|
173
|
-
style: {
|
|
174
|
-
transform: 'postionX(2px)'
|
|
175
|
-
},
|
|
176
172
|
variant: 'filled'
|
|
177
173
|
})
|
|
178
174
|
})
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
var _templateObject;
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css;
|
|
6
|
-
return
|
|
6
|
+
return {
|
|
7
|
+
actionIcon: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n transform: translateX(2px);\n "]))),
|
|
8
|
+
root: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n will-change: transform;\n\n position: absolute;\n z-index: 3;\n inset-block-start: 0;\n inset-inline-start: 0;\n transform: translateY(100%);\n\n padding: 2px;\n "])))
|
|
9
|
+
};
|
|
7
10
|
});
|
|
@@ -14,12 +14,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
14
14
|
import { $getTableAndElementByKey, $getTableColumnIndexFromTableCellNode, $getTableRowIndexFromTableCellNode, $insertTableColumnAtSelection, $insertTableRowAtSelection, $isTableCellNode, $isTableNode, TableNode, getTableElement } from '@lexical/table';
|
|
15
15
|
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
16
16
|
import { ActionIcon } from '@lobehub/ui';
|
|
17
|
+
import { cx } from 'antd-style';
|
|
17
18
|
import { $getNearestNodeFromDOMNode } from 'lexical';
|
|
18
19
|
import { PlusIcon } from 'lucide-react';
|
|
19
20
|
import { memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
20
21
|
import { useLexicalComposerContext } from "../../../../editor-kernel/react";
|
|
21
22
|
import { useAnchor } from "../../../../editor-kernel/react/useAnchor";
|
|
22
|
-
import {
|
|
23
|
+
import { styles } from "./style";
|
|
23
24
|
import { getMouseInfo, useDebounce } from "./utils";
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -47,9 +48,6 @@ var TableHoverActions = /*#__PURE__*/memo(function (_ref) {
|
|
|
47
48
|
setPosition = _useState8[1];
|
|
48
49
|
var tableSetRef = useRef(new Set());
|
|
49
50
|
var tableCellDOMNodeRef = useRef(null);
|
|
50
|
-
var _useStyles = useStyles(),
|
|
51
|
-
cx = _useStyles.cx,
|
|
52
|
-
styles = _useStyles.styles;
|
|
53
51
|
var debouncedOnMouseMove = useDebounce(function (event) {
|
|
54
52
|
var _getMouseInfo = getMouseInfo(event, iEditor),
|
|
55
53
|
isOutside = _getMouseInfo.isOutside,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const BUTTON_WIDTH_PX = 20;
|
|
2
|
-
export declare const
|
|
3
|
-
tableAddColumns:
|
|
4
|
-
tableAddRows:
|
|
5
|
-
}
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
tableAddColumns: string;
|
|
4
|
+
tableAddRows: string;
|
|
5
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _templateObject, _templateObject2;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
4
|
export var BUTTON_WIDTH_PX = 20;
|
|
5
|
-
export var
|
|
5
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
6
6
|
var css = _ref.css;
|
|
7
7
|
return {
|
|
8
8
|
tableAddColumns: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n "]))),
|
|
@@ -11,10 +11,11 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
import { $computeTableMapSkipCellCheck, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $isTableCellNode, $isTableRowNode, TableNode, getDOMCellFromTarget, getTableElement } from '@lexical/table';
|
|
13
13
|
import { calculateZoomLevel, mergeRegister } from '@lexical/utils';
|
|
14
|
+
import { cssVar, cx } from 'antd-style';
|
|
14
15
|
import { $getNearestNodeFromDOMNode, SKIP_SCROLL_INTO_VIEW_TAG, isHTMLElement } from 'lexical';
|
|
15
16
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
16
17
|
import { createPortal } from 'react-dom';
|
|
17
|
-
import { MIN_COLUMN_WIDTH, MIN_ROW_HEIGHT,
|
|
18
|
+
import { MIN_COLUMN_WIDTH, MIN_ROW_HEIGHT, styles } from "./style";
|
|
18
19
|
import { getCellColumnIndex, getCellNodeHeight } from "./utils";
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -22,10 +23,6 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
22
23
|
export var TableCellResize = /*#__PURE__*/memo(function (_ref) {
|
|
23
24
|
var editor = _ref.editor,
|
|
24
25
|
eventEmitter = _ref.eventEmitter;
|
|
25
|
-
var _useStyles = useStyles(),
|
|
26
|
-
cx = _useStyles.cx,
|
|
27
|
-
styles = _useStyles.styles,
|
|
28
|
-
theme = _useStyles.theme;
|
|
29
26
|
var targetRef = useRef(null);
|
|
30
27
|
var resizerRef = useRef(null);
|
|
31
28
|
// eslint-disable-next-line no-undef
|
|
@@ -336,7 +333,7 @@ export var TableCellResize = /*#__PURE__*/memo(function (_ref) {
|
|
|
336
333
|
_styles[draggingDirection].width = '3px';
|
|
337
334
|
_styles[draggingDirection].height = "".concat(tableRect.height, "px");
|
|
338
335
|
}
|
|
339
|
-
_styles[draggingDirection].backgroundColor =
|
|
336
|
+
_styles[draggingDirection].backgroundColor = cssVar.colorPrimary;
|
|
340
337
|
_styles[draggingDirection].mixBlendMode = 'unset';
|
|
341
338
|
}
|
|
342
339
|
return _styles;
|
|
@@ -347,7 +344,7 @@ export var TableCellResize = /*#__PURE__*/memo(function (_ref) {
|
|
|
347
344
|
right: null,
|
|
348
345
|
top: null
|
|
349
346
|
};
|
|
350
|
-
}, [activeCell, draggingDirection, pointerCurrentPos
|
|
347
|
+
}, [activeCell, draggingDirection, pointerCurrentPos]);
|
|
351
348
|
var resizerStyles = getResizers();
|
|
352
349
|
return /*#__PURE__*/_jsx("div", {
|
|
353
350
|
ref: resizerRef,
|
|
@@ -371,8 +368,11 @@ export default /*#__PURE__*/memo(function (_ref2) {
|
|
|
371
368
|
if (typeof document === 'undefined') {
|
|
372
369
|
return null;
|
|
373
370
|
}
|
|
371
|
+
|
|
372
|
+
// Mount to .ant-app if exists, otherwise document.body
|
|
373
|
+
var container = document.querySelector('.ant-app') || document.body;
|
|
374
374
|
return /*#__PURE__*/createPortal( /*#__PURE__*/_jsx(TableCellResize, {
|
|
375
375
|
editor: editor,
|
|
376
376
|
eventEmitter: eventEmitter
|
|
377
|
-
}),
|
|
377
|
+
}), container);
|
|
378
378
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
4
|
export var MIN_ROW_HEIGHT = 33;
|
|
5
5
|
export var MIN_COLUMN_WIDTH = 92;
|
|
6
|
-
export var
|
|
6
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
7
7
|
var css = _ref.css,
|
|
8
|
-
|
|
9
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n touch-action: none;\n position: absolute;\n z-index: 1;\n\n @media (pointer: coarse) {\n background-color: ", ";\n mix-blend-mode: color;\n }\n "])),
|
|
8
|
+
cssVar = _ref.cssVar;
|
|
9
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n touch-action: none;\n position: absolute;\n z-index: 1;\n\n @media (pointer: coarse) {\n background-color: ", ";\n mix-blend-mode: color;\n }\n "])), cssVar.colorPrimary);
|
|
10
10
|
});
|
|
@@ -7,6 +7,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
7
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
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
9
|
import { $findTableNode, $getElementForTableNode, $isTableSelection } from '@lexical/table';
|
|
10
|
+
import { cx } from 'antd-style';
|
|
10
11
|
import EventEmitter from 'eventemitter3';
|
|
11
12
|
import { $getSelection, $isRangeSelection } from 'lexical';
|
|
12
13
|
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
@@ -18,16 +19,13 @@ import { $updateDOMForSelection } from "../utils";
|
|
|
18
19
|
import TableActionMenuPlugin from "./TableActionMenu";
|
|
19
20
|
import TableHoverActionsPlugin from "./TableHoverActions";
|
|
20
21
|
import TableCellResizePlugin from "./TableResize";
|
|
21
|
-
import {
|
|
22
|
+
import { styles } from "./style";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
25
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
25
26
|
export var ReactTablePlugin = function ReactTablePlugin(_ref) {
|
|
26
27
|
var className = _ref.className,
|
|
27
28
|
locale = _ref.locale;
|
|
28
|
-
var _useStyles = useStyles(),
|
|
29
|
-
cx = _useStyles.cx,
|
|
30
|
-
styles = _useStyles.styles;
|
|
31
29
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
32
30
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
33
31
|
editor = _useLexicalComposerCo2[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const styles: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var _templateObject;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
7
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow-x: auto;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em)\n calc(var(--lobe-markdown-margin-multiple) * 0.5em + 16px);\n\n .editor_table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n\n width: fit-content;\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n\n > tr:first-of-type {\n background: ", ";\n\n .editor_table_cell_header {\n font-weight: bold;\n }\n }\n }\n\n code {\n word-break: break-word;\n }\n\n .editor_table_cell_header {\n font-weight: normal;\n }\n\n .editor_table_cell {\n position: relative;\n\n overflow: auto;\n\n width: 75px;\n padding-block: 6px;\n padding-inline: 8px;\n border: 1px solid ", ";\n\n text-align: start;\n vertical-align: top;\n\n outline: none;\n }\n\n .editor_table_cell_selected {\n color: #000;\n background-color: ", ";\n caret-color: transparent;\n }\n "])),
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow-x: auto;\n margin-block: calc(var(--lobe-markdown-margin-multiple) * 0.5em)\n calc(var(--lobe-markdown-margin-multiple) * 0.5em + 16px);\n\n .editor_table {\n table-layout: fixed;\n border-spacing: 0;\n border-collapse: collapse;\n\n width: fit-content;\n\n text-align: start;\n text-indent: initial;\n text-wrap: pretty;\n word-break: auto-phrase;\n overflow-wrap: break-word;\n\n background: ", ";\n\n > tr:first-of-type {\n background: ", ";\n\n .editor_table_cell_header {\n font-weight: bold;\n }\n }\n }\n\n code {\n word-break: break-word;\n }\n\n .editor_table_cell_header {\n font-weight: normal;\n }\n\n .editor_table_cell {\n position: relative;\n\n overflow: auto;\n\n width: 75px;\n padding-block: 6px;\n padding-inline: 8px;\n border: 1px solid ", ";\n\n text-align: start;\n vertical-align: top;\n\n outline: none;\n }\n\n .editor_table_cell_selected {\n color: #000;\n background-color: ", ";\n caret-color: transparent;\n }\n "])), cssVar.colorFillQuaternary, cssVar.colorFillQuaternary, cssVar.colorFillSecondary, cssVar.yellow);
|
|
8
8
|
});
|
|
@@ -6,6 +6,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { mergeRegister } from '@lexical/utils';
|
|
8
8
|
import { Block } from '@lobehub/ui';
|
|
9
|
+
import { cx, useThemeMode } from 'antd-style';
|
|
9
10
|
import { $getSelection, COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND, getDOMSelection } from 'lexical';
|
|
10
11
|
import { useCallback, useRef } from 'react';
|
|
11
12
|
import { useLexicalComposerContext, useLexicalEditor } from "../../../editor-kernel/react";
|
|
@@ -14,7 +15,7 @@ import { createDebugLogger } from "../../../utils/debug";
|
|
|
14
15
|
import { HIDE_TOOLBAR_COMMAND, registerToolbarCommand } from "../command";
|
|
15
16
|
import { getDOMRangeRect } from "../utils/getDOMRangeRect";
|
|
16
17
|
import { setFloatingElemPosition } from "../utils/setFloatingElemPosition";
|
|
17
|
-
import {
|
|
18
|
+
import { styles } from "./style";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
export var ReactToolbarPlugin = function ReactToolbarPlugin(_ref) {
|
|
20
21
|
var className = _ref.className,
|
|
@@ -24,9 +25,8 @@ export var ReactToolbarPlugin = function ReactToolbarPlugin(_ref) {
|
|
|
24
25
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
25
26
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
26
27
|
kernelEditor = _useLexicalComposerCo2[0];
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
styles = _useStyles.styles;
|
|
28
|
+
var _useThemeMode = useThemeMode(),
|
|
29
|
+
isDarkMode = _useThemeMode.isDarkMode;
|
|
30
30
|
var isMouseDownRef = useRef(false);
|
|
31
31
|
var logger = createDebugLogger('plugin', 'toolbar');
|
|
32
32
|
var $updateTextFormatFloatingToolbar = useCallback(function (editor) {
|
|
@@ -127,12 +127,10 @@ export var ReactToolbarPlugin = function ReactToolbarPlugin(_ref) {
|
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
129
|
return /*#__PURE__*/_jsx("div", {
|
|
130
|
+
className: styles.anchor,
|
|
130
131
|
ref: anchorElemRef,
|
|
131
|
-
style: {
|
|
132
|
-
position: 'relative'
|
|
133
|
-
},
|
|
134
132
|
children: /*#__PURE__*/_jsx(Block, {
|
|
135
|
-
className: cx(styles, className),
|
|
133
|
+
className: cx(isDarkMode ? styles.toolbarDark : styles.toolbarLight, className),
|
|
136
134
|
padding: 4,
|
|
137
135
|
ref: popupCharStylesEditorRef,
|
|
138
136
|
variant: 'outlined',
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
var _templateObject;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
import {
|
|
4
|
-
export var
|
|
3
|
+
import { createStaticStyles } from 'antd-style';
|
|
4
|
+
export var styles = createStaticStyles(function (_ref) {
|
|
5
5
|
var css = _ref.css,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
cssVar = _ref.cssVar;
|
|
7
|
+
return {
|
|
8
|
+
anchor: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n "]))),
|
|
9
|
+
toolbarDark: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n will-change: transform;\n\n position: absolute;\n z-index: 10;\n inset-block-start: 0;\n inset-inline-start: 0;\n transform: translate(-10000px, -10000px);\n\n display: flex;\n\n border-color: ", ";\n\n vertical-align: middle;\n\n opacity: 0;\n background: ", ";\n box-shadow:\n 0 14px 28px -6px color-mix(in srgb, #000 18.75%, transparent),\n 0 2px 4px -1px color-mix(in srgb, #000 12.19%, transparent);\n\n transition: opacity 0.12s ", ";\n "])), cssVar.colorFillSecondary, cssVar.colorBgElevated, cssVar.motionEaseOut),
|
|
10
|
+
toolbarLight: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n will-change: transform;\n\n position: absolute;\n z-index: 10;\n inset-block-start: 0;\n inset-inline-start: 0;\n transform: translate(-10000px, -10000px);\n\n display: flex;\n\n border-color: ", ";\n\n vertical-align: middle;\n\n opacity: 0;\n background: ", ";\n box-shadow:\n 0 14px 28px -6px color-mix(in srgb, #000 10.2%, transparent),\n 0 2px 4px -1px color-mix(in srgb, #000 5.88%, transparent);\n\n transition: opacity 0.12s ", ";\n "])), cssVar.colorFillSecondary, cssVar.colorBgElevated, cssVar.motionEaseOut)
|
|
11
|
+
};
|
|
9
12
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type FC } from 'react';
|
|
2
2
|
import type { ChatInputProps } from './type';
|
|
3
|
-
declare const ChatInput:
|
|
3
|
+
declare const ChatInput: FC<ChatInputProps>;
|
|
4
4
|
export default ChatInput;
|