@yuntijs/ui 1.1.0-beta.1 → 1.1.0-beta.10
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/ChatItem/index.js +3 -2
- package/es/ChatItem/style.js +3 -2
- package/es/ChatItem/type.d.ts +4 -0
- package/es/Form/collapse-list/index.js +16 -9
- package/es/Form/collapse-list/utils.d.ts +1 -0
- package/es/Form/collapse-list/utils.js +2 -1
- package/es/Mentions/index.d.ts +11 -3
- package/es/Mentions/index.js +19 -20
- package/es/Mentions/plugins/editor-ref.d.ts +5 -0
- package/es/Mentions/plugins/editor-ref.js +13 -0
- package/es/Mentions/plugins/mention-converter.d.ts +32 -0
- package/es/Mentions/plugins/mention-converter.js +151 -0
- package/es/Mentions/plugins/mention-picker/index.js +5 -1
- package/es/Mentions/plugins/shift-enter-key.d.ts +6 -0
- package/es/Mentions/plugins/shift-enter-key.js +48 -0
- package/es/Mentions/types.d.ts +1 -0
- package/es/Mentions/utils.d.ts +1 -1
- package/es/Mentions/utils.js +11 -30
- package/es/MonacoEditor/base/helper.js +5 -1
- package/es/MonacoEditor/base/style.js +1 -1
- package/es/SelectCard/index.js +1 -1
- package/es/hooks/useHighlight.d.ts +1 -3
- package/es/hooks/useHighlight.js +65 -67
- package/package.json +4 -4
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
- /package/es/Mentions/plugins/{OnBlurBlockPlugin.d.ts → on-blur-block.d.ts} +0 -0
- /package/es/Mentions/plugins/{OnBlurBlockPlugin.js → on-blur-block.js} +0 -0
package/es/ChatItem/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "affixation", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "markdownProps", "markdownClassname", "isLatest"];
|
|
5
|
+
var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "affixation", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "markdownProps", "markdownClassname", "isLatest", "hideAvatar"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
8
|
import Avatar from '@lobehub/ui/es/chat/ChatItem/components/Avatar';
|
|
@@ -48,6 +48,7 @@ export var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
48
48
|
markdownProps = _ref.markdownProps,
|
|
49
49
|
markdownClassname = _ref.markdownClassname,
|
|
50
50
|
isLatest = _ref.isLatest,
|
|
51
|
+
hideAvatar = _ref.hideAvatar,
|
|
51
52
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
52
53
|
var _useResponsive = useResponsive(),
|
|
53
54
|
mobile = _useResponsive.mobile;
|
|
@@ -68,7 +69,7 @@ export var ChatItem = /*#__PURE__*/memo(function (_ref) {
|
|
|
68
69
|
direction: placement === 'left' ? 'horizontal' : 'horizontal-reverse',
|
|
69
70
|
gap: mobile ? 6 : 12
|
|
70
71
|
}, rest), {}, {
|
|
71
|
-
children: [/*#__PURE__*/_jsx(Avatar, _objectSpread(_objectSpread({}, avatarProps), {}, {
|
|
72
|
+
children: [hideAvatar ? null : /*#__PURE__*/_jsx(Avatar, _objectSpread(_objectSpread({}, avatarProps), {}, {
|
|
72
73
|
addon: avatarAddon,
|
|
73
74
|
avatar: avatar,
|
|
74
75
|
loading: loading,
|
package/es/ChatItem/style.js
CHANGED
|
@@ -16,11 +16,12 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
16
16
|
editing = _ref2.editing,
|
|
17
17
|
time = _ref2.time,
|
|
18
18
|
isLatest = _ref2.isLatest;
|
|
19
|
-
var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-block: 8px;\n padding-inline: 12px
|
|
19
|
+
var blockStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n /* padding-block: 8px;\n padding-inline: 12px; */\n\n background-color: ", ";\n border-radius: ", "px;\n transition: background-color 100ms ", ";\n "])), primary ? isDarkMode ? token.colorFill : token.colorBgElevated : isDarkMode ? token.colorFillSecondary : token.colorBgContainer, token.borderRadiusLG, token.motionEaseOut);
|
|
20
20
|
var pureStylish = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-block-start: ", ";\n "])), title ? 0 : '6px');
|
|
21
21
|
var pureContainerStylish = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-block-end: -16px;\n transition: background-color 100ms ", ";\n "])), token.motionEaseOut);
|
|
22
22
|
var typeStylish = type === 'block' ? blockStylish : pureStylish;
|
|
23
23
|
var editingStylish = editing && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n "])));
|
|
24
|
+
var insetInline = placement === 'right' ? '-4px unset' : 'unset -4px';
|
|
24
25
|
return {
|
|
25
26
|
actions: cx(css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n flex: none;\n align-self: ", ";\n justify-content: ", ";\n "])), placement === 'left' ? 'flex-start' : 'flex-end', placement === 'left' ? 'flex-end' : 'flex-start'), editing && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n pointer-events: none !important;\n opacity: 0 !important;\n "])))),
|
|
26
27
|
avatarContainer: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n flex: none;\n width: ", "px;\n height: ", "px;\n "])), avatarSize, avatarSize),
|
|
@@ -29,7 +30,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
29
30
|
editingContainer: cx(editingStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n padding-block: 8px 12px;\n padding-inline: 12px;\n border: 1px solid ", ";\n\n &:active,\n &:hover {\n border-color: ", ";\n }\n "])), token.colorBorderSecondary, token.colorBorder), type === 'pure' && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadius)),
|
|
30
31
|
editingInput: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n width: 100%;\n "]))),
|
|
31
32
|
errorContainer: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n width: 100%;\n "]))),
|
|
32
|
-
loading: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n inset-block-end: 0;\n inset-inline: ", "
|
|
33
|
+
loading: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n inset-block-end: 0;\n inset-inline: ", ";\n\n width: 16px;\n height: 16px;\n\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), insetInline, token.colorBgLayout, token.colorPrimary),
|
|
33
34
|
message: cx(typeStylish, css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n ", " {\n width: 100%;\n }\n "])), responsive.mobile)),
|
|
34
35
|
messageContainer: cx(editingStylish, css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n margin-block-start: ", "px;\n\n ", " {\n overflow-x: auto;\n }\n "])), time ? -16 : 0, responsive.mobile)),
|
|
35
36
|
messageContent: cx(editingStylish, css(_templateObject17 || (_templateObject17 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n max-width: 100%;\n\n ", " {\n flex-direction: column !important;\n }\n "])), responsive.mobile)),
|
package/es/ChatItem/type.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { CollapseGroup } from "../../CollapseGroup";
|
|
|
19
19
|
import { FormCollapseListFieldsWatcher } from "./FieldsWatcher";
|
|
20
20
|
import { useFormCollapseListHooks } from "./hooks";
|
|
21
21
|
import { useStyles } from "./style";
|
|
22
|
-
import { FIELD_KEY_PATH, toRowKey } from "./utils";
|
|
22
|
+
import { FIELD_KEY_PATH, TEXT_INPUT_COMPOENT_TYPES, toRowKey } from "./utils";
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
25
|
var Text = Typography.Text;
|
|
@@ -222,14 +222,21 @@ export var FormCollapseList = /*#__PURE__*/memo(function (_ref) {
|
|
|
222
222
|
chidrenProps.disabled = disabled;
|
|
223
223
|
}
|
|
224
224
|
if (readOnly === true) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
225
|
+
var _props, _type;
|
|
226
|
+
chidrenProps.disabled = true;
|
|
227
|
+
if (children !== null && children !== void 0 && (_props = children.props) !== null && _props !== void 0 && _props.showCount) {
|
|
228
|
+
chidrenProps.showCount = undefined;
|
|
229
|
+
}
|
|
230
|
+
if (TEXT_INPUT_COMPOENT_TYPES.includes(children === null || children === void 0 || (_type = children.type) === null || _type === void 0 ? void 0 : _type.displayName)) {
|
|
231
|
+
return /*#__PURE__*/_jsx(Flex, {
|
|
232
|
+
align: "center",
|
|
233
|
+
className: cx(styles.readOnlyItem, className),
|
|
234
|
+
children: text !== null && text !== void 0 ? text : /*#__PURE__*/_jsx(Text, {
|
|
235
|
+
type: "secondary",
|
|
236
|
+
children: "-"
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
}
|
|
233
240
|
}
|
|
234
241
|
return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread(_objectSpread({
|
|
235
242
|
className: className
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export var FIELD_KEY_PATH = '__YUNTI_FORM_COLLAPSE_LIST_FIELD_KEY_PATH';
|
|
2
2
|
export var toRowKey = function toRowKey(keyPath) {
|
|
3
3
|
return keyPath.join('-');
|
|
4
|
-
};
|
|
4
|
+
};
|
|
5
|
+
export var TEXT_INPUT_COMPOENT_TYPES = ['Input', 'InputNumber', 'AutoComplete', 'Mentions', 'Radio', 'RadioGroup', 'CheckBox', 'CheckBoxGroup', 'Rate', 'Slider', 'Switch'];
|
package/es/Mentions/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type MentionPickerPluginProps } from './plugins/mention-picker';
|
|
3
|
-
import
|
|
3
|
+
import { AutoSize, MentionsEditor } from './types';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export * from './utils';
|
|
4
6
|
export interface MentionsProps extends MentionPickerPluginProps {
|
|
5
7
|
className?: string;
|
|
6
8
|
classNames?: {
|
|
@@ -8,7 +10,7 @@ export interface MentionsProps extends MentionPickerPluginProps {
|
|
|
8
10
|
menuOverlay?: string;
|
|
9
11
|
};
|
|
10
12
|
wrapperClassname?: string;
|
|
11
|
-
placeholder?:
|
|
13
|
+
placeholder?: React.ReactNode;
|
|
12
14
|
style?: React.CSSProperties;
|
|
13
15
|
value?: string;
|
|
14
16
|
defaultValue?: string;
|
|
@@ -17,9 +19,15 @@ export interface MentionsProps extends MentionPickerPluginProps {
|
|
|
17
19
|
onChange?: (text: string) => void;
|
|
18
20
|
onBlur?: () => void;
|
|
19
21
|
onFocus?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* 按下回车的回调,指定后会改变回车的默认行为,换行需要使用 shift + enter
|
|
24
|
+
*/
|
|
25
|
+
onPressEnter?: (value: string, { event }: {
|
|
26
|
+
event: KeyboardEvent | null;
|
|
27
|
+
}) => void;
|
|
20
28
|
variant?: 'outlined' | 'filled' | 'borderless';
|
|
21
29
|
autoSize?: AutoSize;
|
|
22
30
|
code?: boolean;
|
|
23
31
|
getPopContainer?: () => HTMLElement;
|
|
24
32
|
}
|
|
25
|
-
export declare const Mentions: React.
|
|
33
|
+
export declare const Mentions: React.ForwardRefExoticComponent<MentionsProps & React.RefAttributes<MentionsEditor>>;
|
package/es/Mentions/index.js
CHANGED
|
@@ -9,21 +9,24 @@ import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
|
9
9
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
10
10
|
import { ConfigProvider } from 'antd';
|
|
11
11
|
// @Todo: 升级 0.25.0 后,ops-console 使用的时候出现了只输入 / 无法触发的问题
|
|
12
|
-
|
|
13
12
|
import { $getRoot, TextNode } from 'lexical';
|
|
14
|
-
import React, { useMemo } from 'react';
|
|
13
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
15
14
|
import { isBrowser } from "../utils/tools";
|
|
16
|
-
import { OnBlurBlockPlugin } from "./plugins/OnBlurBlockPlugin";
|
|
17
15
|
import { CustomTextNode } from "./plugins/custom-text/node";
|
|
18
16
|
import { EditablePlugin } from "./plugins/editable";
|
|
17
|
+
import { EditorRefPlugin } from "./plugins/editor-ref";
|
|
19
18
|
import { MentionNode, MentionNodePlugin, MentionNodePluginReplacement } from "./plugins/mention-node";
|
|
20
19
|
import { MentionPickerPlugin } from "./plugins/mention-picker";
|
|
20
|
+
import { OnBlurBlockPlugin } from "./plugins/on-blur-block";
|
|
21
|
+
import { ShiftEnterKeyPlugin } from "./plugins/shift-enter-key";
|
|
21
22
|
import { MentionsConfigProvider } from "./provider";
|
|
22
23
|
import { useStyles } from "./style";
|
|
23
24
|
import { textToEditorState } from "./utils";
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
-
export
|
|
27
|
+
export * from "./types";
|
|
28
|
+
export * from "./utils";
|
|
29
|
+
export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
30
|
var className = _ref.className,
|
|
28
31
|
classNames = _ref.classNames,
|
|
29
32
|
placeholder = _ref.placeholder,
|
|
@@ -49,7 +52,8 @@ export var Mentions = function Mentions(_ref) {
|
|
|
49
52
|
onSelect = _ref.onSelect,
|
|
50
53
|
_ref$code = _ref.code,
|
|
51
54
|
code = _ref$code === void 0 ? false : _ref$code,
|
|
52
|
-
getPopContainer = _ref.getPopContainer
|
|
55
|
+
getPopContainer = _ref.getPopContainer,
|
|
56
|
+
onPressEnter = _ref.onPressEnter;
|
|
53
57
|
var _ConfigProvider$useCo = ConfigProvider.useConfig(),
|
|
54
58
|
componentDisabled = _ConfigProvider$useCo.componentDisabled;
|
|
55
59
|
var _useStyles = useStyles({
|
|
@@ -73,7 +77,7 @@ export var Mentions = function Mentions(_ref) {
|
|
|
73
77
|
return new CustomTextNode(node.__text);
|
|
74
78
|
}
|
|
75
79
|
}, MentionNode],
|
|
76
|
-
editorState: textToEditorState(value || defaultValue || ''),
|
|
80
|
+
editorState: textToEditorState(value || defaultValue || '', triggers),
|
|
77
81
|
onError: function onError(error) {
|
|
78
82
|
throw error;
|
|
79
83
|
}
|
|
@@ -113,22 +117,13 @@ export var Mentions = function Mentions(_ref) {
|
|
|
113
117
|
if (!isBrowser) {
|
|
114
118
|
return;
|
|
115
119
|
}
|
|
120
|
+
if (getPopContainer) {
|
|
121
|
+
return getPopContainer();
|
|
122
|
+
}
|
|
116
123
|
if (document.fullscreenElement) {
|
|
117
124
|
return document.fullscreenElement;
|
|
118
125
|
}
|
|
119
|
-
}, []);
|
|
120
|
-
if (!isBrowser) {
|
|
121
|
-
return /*#__PURE__*/_jsxs("div", {
|
|
122
|
-
className: cx(styles.wrapper, classNames === null || classNames === void 0 ? void 0 : classNames.wrapper),
|
|
123
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
124
|
-
className: cx(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles.root, true), styles.filled, variant === 'filled'), styles.borderless, variant === 'borderless'), styles.disabled, disabled), className),
|
|
125
|
-
style: style || {}
|
|
126
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
127
|
-
className: styles.placeholder,
|
|
128
|
-
children: placeholder || "\u8F93\u5165 ".concat(triggers.join(' 或 '), " \u63D2\u5165\u5F15\u7528")
|
|
129
|
-
})]
|
|
130
|
-
});
|
|
131
|
-
}
|
|
126
|
+
}, [getPopContainer]);
|
|
132
127
|
return /*#__PURE__*/_jsx(LexicalComposer, {
|
|
133
128
|
initialConfig: _objectSpread(_objectSpread({}, initialConfig), {}, {
|
|
134
129
|
editable: editable
|
|
@@ -165,8 +160,12 @@ export var Mentions = function Mentions(_ref) {
|
|
|
165
160
|
onFocus: onFocus
|
|
166
161
|
}), /*#__PURE__*/_jsx(EditablePlugin, {
|
|
167
162
|
editable: editable
|
|
163
|
+
}), /*#__PURE__*/_jsx(EditorRefPlugin, {
|
|
164
|
+
editorRef: ref
|
|
165
|
+
}), onPressEnter && /*#__PURE__*/_jsx(ShiftEnterKeyPlugin, {
|
|
166
|
+
onPressEnter: onPressEnter
|
|
168
167
|
})]
|
|
169
168
|
})
|
|
170
169
|
})
|
|
171
170
|
});
|
|
172
|
-
};
|
|
171
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
+
import { useImperativeHandle } from 'react';
|
|
4
|
+
export var EditorRefPlugin = function EditorRefPlugin(_ref) {
|
|
5
|
+
var editorRef = _ref.editorRef;
|
|
6
|
+
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
7
|
+
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
8
|
+
editor = _useLexicalComposerCo2[0];
|
|
9
|
+
useImperativeHandle(editorRef, function () {
|
|
10
|
+
return editor;
|
|
11
|
+
});
|
|
12
|
+
return null;
|
|
13
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* source:
|
|
3
|
+
* https://github.com/sodenn/lexical-beautiful-mentions/blob/8d2c8fbfaa63fe0100ac9f6c4bcb61e816d14a30/plugin/src/mention-converter.ts
|
|
4
|
+
*/
|
|
5
|
+
import { LexicalNode, TextNode } from 'lexical';
|
|
6
|
+
interface MentionEntry {
|
|
7
|
+
type: 'mention-node';
|
|
8
|
+
trigger: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
interface TextEntry {
|
|
12
|
+
type: 'custom-text';
|
|
13
|
+
value: string;
|
|
14
|
+
}
|
|
15
|
+
type Entry = MentionEntry | TextEntry;
|
|
16
|
+
export declare function convertToMentionEntries(text: string, triggers: string[], punctuation: string): Entry[];
|
|
17
|
+
/**
|
|
18
|
+
* Utility function that takes a string or a text nodes and converts it to a
|
|
19
|
+
* list of mention and text nodes.
|
|
20
|
+
*
|
|
21
|
+
* 🚨 Only works for mentions without spaces. Ensure spaces are disabled
|
|
22
|
+
* via the `allowSpaces` prop.
|
|
23
|
+
*/
|
|
24
|
+
export declare function $convertToMentionNodes(textOrNode: string | TextNode, triggers: string[], punctuation?: string): LexicalNode[];
|
|
25
|
+
/**
|
|
26
|
+
* Transforms text nodes containing mention strings into mention nodes.
|
|
27
|
+
*
|
|
28
|
+
* 🚨 Only works for mentions without spaces. Ensure spaces are disabled
|
|
29
|
+
* via the `allowSpaces` prop.
|
|
30
|
+
*/
|
|
31
|
+
export declare function $transformTextToMentionNodes(triggers: string[], punctuation?: string): void;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
2
|
+
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); }
|
|
3
|
+
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; }
|
|
4
|
+
/**
|
|
5
|
+
* source:
|
|
6
|
+
* https://github.com/sodenn/lexical-beautiful-mentions/blob/8d2c8fbfaa63fe0100ac9f6c4bcb61e816d14a30/plugin/src/mention-converter.ts
|
|
7
|
+
*/
|
|
8
|
+
import { $createTextNode, $getRoot, $isElementNode, $isTextNode } from 'lexical';
|
|
9
|
+
import { DEFAULT_PUNCTUATION, LENGTH_LIMIT, TRIGGERS, VALID_CHARS } from "../constants";
|
|
10
|
+
import { $createMentionNode } from "./mention-node";
|
|
11
|
+
function findMentions(text, triggers, punctuation) {
|
|
12
|
+
var regex = new RegExp('(?<=\\s|^|\\()' + TRIGGERS(triggers) + '((?:' + VALID_CHARS(triggers, punctuation) + '){1,' + LENGTH_LIMIT + '})', 'g');
|
|
13
|
+
var matches = [];
|
|
14
|
+
var match;
|
|
15
|
+
regex.lastIndex = 0;
|
|
16
|
+
while ((match = regex.exec(text)) !== null) {
|
|
17
|
+
matches.push({
|
|
18
|
+
value: match[0],
|
|
19
|
+
index: match.index
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return matches;
|
|
23
|
+
}
|
|
24
|
+
export function convertToMentionEntries(text, triggers, punctuation) {
|
|
25
|
+
var matches = findMentions(text, triggers, punctuation);
|
|
26
|
+
var result = [];
|
|
27
|
+
var lastIndex = 0;
|
|
28
|
+
var _iterator = _createForOfIteratorHelper(matches),
|
|
29
|
+
_step;
|
|
30
|
+
try {
|
|
31
|
+
var _loop = function _loop() {
|
|
32
|
+
var _step$value = _step.value,
|
|
33
|
+
value = _step$value.value,
|
|
34
|
+
index = _step$value.index;
|
|
35
|
+
// Add text before mention
|
|
36
|
+
if (index > lastIndex) {
|
|
37
|
+
// eslint-disable-next-line unicorn/prefer-string-slice
|
|
38
|
+
var textBeforeMention = text.substring(lastIndex, index);
|
|
39
|
+
result.push({
|
|
40
|
+
type: 'custom-text',
|
|
41
|
+
value: textBeforeMention
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// Add mention
|
|
45
|
+
var triggerRegExp = triggers.find(function (trigger) {
|
|
46
|
+
return new RegExp(trigger).test(value);
|
|
47
|
+
});
|
|
48
|
+
var match = triggerRegExp && new RegExp(triggerRegExp).exec(value);
|
|
49
|
+
if (!match) {
|
|
50
|
+
// should never happen since we only find mentions with the given triggers
|
|
51
|
+
throw new Error('No trigger found for mention');
|
|
52
|
+
}
|
|
53
|
+
var trigger = match[0];
|
|
54
|
+
result.push({
|
|
55
|
+
type: 'mention-node',
|
|
56
|
+
value: value.slice(trigger.length),
|
|
57
|
+
trigger: trigger
|
|
58
|
+
});
|
|
59
|
+
// Update lastIndex
|
|
60
|
+
lastIndex = index + value.length;
|
|
61
|
+
};
|
|
62
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
63
|
+
_loop();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Add text after last mention
|
|
67
|
+
} catch (err) {
|
|
68
|
+
_iterator.e(err);
|
|
69
|
+
} finally {
|
|
70
|
+
_iterator.f();
|
|
71
|
+
}
|
|
72
|
+
if (lastIndex < text.length) {
|
|
73
|
+
var textAfterMentions = text.slice(Math.max(0, lastIndex));
|
|
74
|
+
result.push({
|
|
75
|
+
type: 'custom-text',
|
|
76
|
+
value: textAfterMentions
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Utility function that takes a string or a text nodes and converts it to a
|
|
84
|
+
* list of mention and text nodes.
|
|
85
|
+
*
|
|
86
|
+
* 🚨 Only works for mentions without spaces. Ensure spaces are disabled
|
|
87
|
+
* via the `allowSpaces` prop.
|
|
88
|
+
*/
|
|
89
|
+
export function $convertToMentionNodes(textOrNode, triggers) {
|
|
90
|
+
var punctuation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_PUNCTUATION;
|
|
91
|
+
var text = typeof textOrNode === 'string' ? textOrNode : textOrNode.getTextContent();
|
|
92
|
+
var entries = convertToMentionEntries(text, triggers, punctuation);
|
|
93
|
+
var nodes = [];
|
|
94
|
+
var _iterator2 = _createForOfIteratorHelper(entries),
|
|
95
|
+
_step2;
|
|
96
|
+
try {
|
|
97
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
98
|
+
var entry = _step2.value;
|
|
99
|
+
if (entry.type === 'custom-text') {
|
|
100
|
+
var textNode = $createTextNode(entry.value);
|
|
101
|
+
if (typeof textOrNode !== 'string') {
|
|
102
|
+
textNode.setFormat(textOrNode.getFormat());
|
|
103
|
+
}
|
|
104
|
+
nodes.push(textNode);
|
|
105
|
+
} else {
|
|
106
|
+
nodes.push($createMentionNode(entry.value));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
_iterator2.e(err);
|
|
111
|
+
} finally {
|
|
112
|
+
_iterator2.f();
|
|
113
|
+
}
|
|
114
|
+
return nodes;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Transforms text nodes containing mention strings into mention nodes.
|
|
119
|
+
*
|
|
120
|
+
* 🚨 Only works for mentions without spaces. Ensure spaces are disabled
|
|
121
|
+
* via the `allowSpaces` prop.
|
|
122
|
+
*/
|
|
123
|
+
export function $transformTextToMentionNodes(triggers) {
|
|
124
|
+
var punctuation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_PUNCTUATION;
|
|
125
|
+
var root = $getRoot();
|
|
126
|
+
var nodes = root.getChildren();
|
|
127
|
+
var traverseNodes = function traverseNodes(nodes) {
|
|
128
|
+
var _iterator3 = _createForOfIteratorHelper(nodes),
|
|
129
|
+
_step3;
|
|
130
|
+
try {
|
|
131
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
132
|
+
var node = _step3.value;
|
|
133
|
+
if ($isTextNode(node)) {
|
|
134
|
+
var newNodes = $convertToMentionNodes(node, triggers, punctuation);
|
|
135
|
+
if (newNodes.length > 1) {
|
|
136
|
+
var parent = node.getParent();
|
|
137
|
+
var index = node.getIndexWithinParent();
|
|
138
|
+
parent === null || parent === void 0 || parent.splice(index, 1, newNodes);
|
|
139
|
+
}
|
|
140
|
+
} else if ($isElementNode(node)) {
|
|
141
|
+
traverseNodes(node.getChildren());
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
} catch (err) {
|
|
145
|
+
_iterator3.e(err);
|
|
146
|
+
} finally {
|
|
147
|
+
_iterator3.f();
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
traverseNodes(nodes);
|
|
151
|
+
}
|
|
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
3
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
4
4
|
import { LexicalTypeaheadMenuPlugin } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
5
5
|
import { ConfigProvider, Tree } from 'antd';
|
|
6
|
+
import { COMMAND_PRIORITY_NORMAL } from 'lexical';
|
|
6
7
|
import { flatMap } from 'lodash-es';
|
|
7
8
|
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
8
9
|
import ReactDOM from 'react-dom';
|
|
@@ -163,7 +164,10 @@ export var MentionPickerPlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
163
164
|
return null;
|
|
164
165
|
}, [cx, handleDisabledItem, options, overlayClassName, queryString, renderMenuTree, styles.menuOverlay]);
|
|
165
166
|
return /*#__PURE__*/_jsx(LexicalTypeaheadMenuPlugin, {
|
|
166
|
-
anchorClassName: styles.anchor
|
|
167
|
+
anchorClassName: styles.anchor
|
|
168
|
+
// 优先级要高于 ShiftEnterKeyPlugin
|
|
169
|
+
,
|
|
170
|
+
commandPriority: COMMAND_PRIORITY_NORMAL,
|
|
167
171
|
menuRenderFn: renderMenu,
|
|
168
172
|
onQueryChange: setQueryString,
|
|
169
173
|
onSelectOption: onSelectOption,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
+
import { CAN_USE_BEFORE_INPUT, IS_APPLE_WEBKIT, IS_IOS, IS_SAFARI } from '@lexical/utils';
|
|
4
|
+
import { $getRoot, $getSelection, $isRangeSelection, COMMAND_PRIORITY_LOW, INSERT_PARAGRAPH_COMMAND, KEY_ENTER_COMMAND } from 'lexical';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
export var ShiftEnterKeyPlugin = function ShiftEnterKeyPlugin(_ref) {
|
|
7
|
+
var onPressEnter = _ref.onPressEnter;
|
|
8
|
+
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
9
|
+
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
10
|
+
editor = _useLexicalComposerCo2[0];
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
// https://github.com/facebook/lexical/discussions/4464#discussioncomment-5833227
|
|
13
|
+
editor.registerCommand(KEY_ENTER_COMMAND, function (event) {
|
|
14
|
+
var selection = $getSelection();
|
|
15
|
+
if (!$isRangeSelection(selection)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (event !== null) {
|
|
19
|
+
// If we have beforeinput, then we can avoid blocking
|
|
20
|
+
// the default behavior. This ensures that the iOS can
|
|
21
|
+
// intercept that we're actually inserting a paragraph,
|
|
22
|
+
// and autocomplete, autocapitalize etc work as intended.
|
|
23
|
+
// This can also cause a strange performance issue in
|
|
24
|
+
// Safari, where there is a noticeable pause due to
|
|
25
|
+
// preventing the key down of enter.
|
|
26
|
+
if ((IS_IOS || IS_SAFARI || IS_APPLE_WEBKIT) && CAN_USE_BEFORE_INPUT) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
if (event.shiftKey) {
|
|
31
|
+
return editor.dispatchCommand(INSERT_PARAGRAPH_COMMAND, void 0);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
event === null || event === void 0 || event.preventDefault();
|
|
35
|
+
var text = editor.read(function () {
|
|
36
|
+
return $getRoot().getTextContent();
|
|
37
|
+
});
|
|
38
|
+
var value = text.replaceAll('\n\n', '\n');
|
|
39
|
+
onPressEnter(value, {
|
|
40
|
+
event: event
|
|
41
|
+
});
|
|
42
|
+
return true;
|
|
43
|
+
},
|
|
44
|
+
// 优先级要低于 MentionPickerPlugin
|
|
45
|
+
COMMAND_PRIORITY_LOW);
|
|
46
|
+
}, [editor, onPressEnter]);
|
|
47
|
+
return null;
|
|
48
|
+
};
|
package/es/Mentions/types.d.ts
CHANGED
package/es/Mentions/utils.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export declare const DELETE_MENTION_COMMAND: import("lexical").LexicalCommand<un
|
|
|
6
6
|
export declare const CLEAR_HIDE_MENU_TIMEOUT: import("lexical").LexicalCommand<unknown>;
|
|
7
7
|
export declare const UPDATE_MENTIONS_OPTIONS: import("lexical").LexicalCommand<unknown>;
|
|
8
8
|
export declare const decoratorTransform: (node: CustomTextNode, getMatch: (text: string) => null | EntityMatch, createNode: (textNode: TextNode) => LexicalNode) => void;
|
|
9
|
-
export declare function textToEditorState(
|
|
9
|
+
export declare function textToEditorState(initialValue: string, triggers: string[]): () => void;
|
package/es/Mentions/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import { $isTextNode, createCommand } from 'lexical';
|
|
3
|
+
import { $createParagraphNode, $getRoot, $isTextNode, createCommand } from 'lexical';
|
|
4
|
+
import { $convertToMentionNodes } from "./plugins/mention-converter";
|
|
3
5
|
export var INSERT_MENTION_COMMAND = createCommand('INSERT_MENTION_COMMAND');
|
|
4
6
|
export var DELETE_MENTION_COMMAND = createCommand('DELETE_MENTION_COMMAND');
|
|
5
7
|
export var CLEAR_HIDE_MENU_TIMEOUT = createCommand('CLEAR_HIDE_MENU_TIMEOUT');
|
|
@@ -63,33 +65,12 @@ export var decoratorTransform = function decoratorTransform(node, getMatch, crea
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
|
-
export function textToEditorState(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
root
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
format: 0,
|
|
75
|
-
mode: 'normal',
|
|
76
|
-
style: '',
|
|
77
|
-
text: p,
|
|
78
|
-
type: 'custom-text',
|
|
79
|
-
version: 1
|
|
80
|
-
}],
|
|
81
|
-
direction: 'ltr',
|
|
82
|
-
format: '',
|
|
83
|
-
indent: 0,
|
|
84
|
-
type: 'paragraph',
|
|
85
|
-
version: 1
|
|
86
|
-
};
|
|
87
|
-
}),
|
|
88
|
-
direction: 'ltr',
|
|
89
|
-
format: '',
|
|
90
|
-
indent: 0,
|
|
91
|
-
type: 'root',
|
|
92
|
-
version: 1
|
|
93
|
-
}
|
|
94
|
-
});
|
|
68
|
+
export function textToEditorState(initialValue, triggers) {
|
|
69
|
+
return function () {
|
|
70
|
+
var root = $getRoot();
|
|
71
|
+
root.clear();
|
|
72
|
+
var paragraph = $createParagraphNode();
|
|
73
|
+
paragraph.append.apply(paragraph, _toConsumableArray($convertToMentionNodes(initialValue, triggers)));
|
|
74
|
+
root.append(paragraph);
|
|
75
|
+
};
|
|
95
76
|
}
|
|
@@ -159,6 +159,10 @@ export var useEditor = function useEditor(type, props) {
|
|
|
159
159
|
if (!containerRef.current) {
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
+
if (editorRef.current) {
|
|
163
|
+
editorRef.current.dispose();
|
|
164
|
+
decomposeRef.current = false;
|
|
165
|
+
}
|
|
162
166
|
var editor;
|
|
163
167
|
if (typeRef.current === 'single') {
|
|
164
168
|
var _ref, _valueRef$current;
|
|
@@ -201,7 +205,7 @@ export var useEditor = function useEditor(type, props) {
|
|
|
201
205
|
setLoading(false);
|
|
202
206
|
}
|
|
203
207
|
});
|
|
204
|
-
}, []);
|
|
208
|
+
}, [placeholder]);
|
|
205
209
|
useEffect(function () {
|
|
206
210
|
var _monacoRef$current;
|
|
207
211
|
if (!isEditorReady) {
|
|
@@ -34,7 +34,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
return {
|
|
37
|
-
base: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: content-box;\n min-height: 100px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n &:hover {\n border-color: ", ";\n ", "\n }\n\n &.ve-focused {\n ", "\n ", "\n }\n\n &.ve-outline {\n border: 1px solid var(--color-field-border, rgba(31, 56, 88, 0.05)) !important;\n }\n\n & > .react-monaco-editor-container {\n width: 100%;\n height: 100%;\n min-height: 100px;\n background: transparent;\n\n ", "\n\n .monaco-editor,\n .monaco-editor-background,\n .monaco-editor .inputarea.ime-input,\n .monaco-editor .margin {\n ", "\n }\n\n & > .monaco-editor {\n border-radius: ", "px;\n outline: none;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n .monaco-scrollable-element {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n .monaco-diff-editor {\n border-radius: ", "px;\n & > .original > .monaco-editor {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n }\n .diffViewport {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n\n .syntaxTips {\n position: absolute;\n bottom: 0;\n left: 0;\n\n box-sizing: border-box;\n width: 100%;\n max-height: 0;\n margin: 0;\n padding: 10px 30px;\n\n color: ", ";\n\n background: ", ";\n\n transition: 0.2s ease max-height;\n }\n\n .syntaxTips:hover {\n overflow: auto;\n max-height: 50%;\n }\n\n .syntaxTips .infoIcon {\n position: absolute;\n top: 2px;\n right: 5px;\n transform: rotateY(180deg);\n\n width: 20px;\n height: 16px;\n }\n "])), getBgColor(), variant === 'outlined' ? token.colorBorder : 'transparent', token.borderRadius, variant === 'outlined' ? token.colorPrimaryHover : 'transparent', variant === 'filled' && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillSecondary), variant === 'filled' && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorBgBase), variant !== 'borderless' && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-color: ", ";\n "])), token.colorPrimaryActive), isFullScreen && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: fixed;\n z-index: 9998;\n inset: 0;\n\n width: auto !important;\n height: auto !important;\n "]))), !isFullScreen && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: transparent;\n "]))), token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius - 1, token.borderRadius - 1, token.colorErrorText, token.colorErrorBg),
|
|
37
|
+
base: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n\n box-sizing: content-box;\n min-height: 100px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n &:hover {\n border-color: ", ";\n ", "\n }\n\n &.ve-focused {\n ", "\n ", "\n }\n\n &.ve-outline {\n border: 1px solid var(--color-field-border, rgba(31, 56, 88, 0.05)) !important;\n }\n\n & > .react-monaco-editor-container {\n width: 100%;\n height: 100%;\n min-height: 100px;\n background: transparent;\n\n ", "\n\n .monaco-editor,\n .monaco-editor-background,\n .monaco-editor .inputarea.ime-input,\n .monaco-editor .margin {\n ", "\n }\n\n & > .monaco-editor {\n border-radius: ", "px;\n outline: none;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n .monaco-scrollable-element {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n .monaco-diff-editor {\n border-radius: ", "px;\n & > .gutter {\n outline: none;\n }\n & > .original > .monaco-editor {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n outline: none;\n .overflow-guard,\n .margin {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n }\n & > .modified > .monaco-editor {\n outline: none;\n }\n .diffViewport {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n outline: none;\n }\n }\n }\n\n .syntaxTips {\n position: absolute;\n bottom: 0;\n left: 0;\n\n box-sizing: border-box;\n width: 100%;\n max-height: 0;\n margin: 0;\n padding: 10px 30px;\n\n color: ", ";\n\n background: ", ";\n\n transition: 0.2s ease max-height;\n }\n\n .syntaxTips:hover {\n overflow: auto;\n max-height: 50%;\n }\n\n .syntaxTips .infoIcon {\n position: absolute;\n top: 2px;\n right: 5px;\n transform: rotateY(180deg);\n\n width: 20px;\n height: 16px;\n }\n "])), getBgColor(), variant === 'outlined' ? token.colorBorder : 'transparent', token.borderRadius, variant === 'outlined' ? token.colorPrimaryHover : 'transparent', variant === 'filled' && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorFillSecondary), variant === 'filled' && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n "])), token.colorBgBase), variant !== 'borderless' && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border-color: ", ";\n "])), token.colorPrimaryActive), isFullScreen && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n position: fixed;\n z-index: 9998;\n inset: 0;\n\n width: auto !important;\n height: auto !important;\n "]))), !isFullScreen && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: transparent;\n "]))), token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius - 1, token.borderRadius - 1, token.colorErrorText, token.colorErrorBg),
|
|
38
38
|
fullScreenBtn: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n &.", "-btn {\n position: absolute;\n top: 20px;\n color: ", ";\n transition: none;\n ", "\n }\n "])), prefixCls, token.colorTextSecondary, isFullScreen ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n z-index: 9999;\n right: ", "px;\n "])), diff ? 64 : 138) : css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n right: ", "px;\n "])), minimapEnabled || diff ? 64 : 20)),
|
|
39
39
|
loading: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n position: absolute;\n inset: 0;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n font-size: ", "px;\n color: ", ";\n\n background-color: transparent;\n\n &::after {\n content: '';\n width: 16px;\n /* display: inline; */\n animation: ", " steps(3) 1s infinite;\n }\n "])), token.fontSizeSM, token.colorTextTertiary, dots)
|
|
40
40
|
};
|