@yuntijs/ui 1.0.0-beta.37 → 1.0.0-beta.39
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/Mentions/index.js +34 -30
- package/es/Mentions/plugins/mention-node/component.d.ts +0 -2
- package/es/Mentions/plugins/mention-node/component.js +9 -17
- package/es/Mentions/plugins/mention-node/index.d.ts +0 -2
- package/es/Mentions/plugins/mention-node/index.js +5 -12
- package/es/Mentions/plugins/mention-node/node.d.ts +2 -5
- package/es/Mentions/plugins/mention-node/node.js +5 -18
- package/es/Mentions/plugins/mention-node/replacement.d.ts +0 -2
- package/es/Mentions/plugins/mention-node/replacement.js +3 -4
- package/es/Mentions/plugins/mention-node/style.js +2 -4
- package/es/Mentions/plugins/mention-node/utils.d.ts +0 -1
- package/es/Mentions/plugins/mention-node/utils.js +0 -1
- package/es/Mentions/provider.d.ts +12 -0
- package/es/Mentions/provider.js +15 -0
- package/es/Page/Content/style.js +1 -1
- package/es/Page/Header/style.js +1 -1
- package/es/Page/Title/style.js +1 -3
- package/package.json +1 -1
- package/umd/index.min.js +1 -1
- package/umd/index.min.js.map +1 -1
package/es/Mentions/index.js
CHANGED
|
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
5
5
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
6
6
|
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
7
|
+
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
|
|
7
8
|
import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
|
|
8
9
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
9
10
|
import { $getRoot, TextNode } from 'lexical';
|
|
@@ -12,6 +13,7 @@ import { CustomTextNode } from "./plugins/custom-text/node";
|
|
|
12
13
|
import { MentionNode, MentionNodePlugin, MentionNodePluginReplacement } from "./plugins/mention-node";
|
|
13
14
|
import { MentionPickerPlugin } from "./plugins/mention-picker";
|
|
14
15
|
import OnBlurBlock from "./plugins/on-blur-or-focus-block";
|
|
16
|
+
import { MentionsConfigProvider } from "./provider";
|
|
15
17
|
import { useStyles } from "./style";
|
|
16
18
|
import { textToEditorState } from "./utils";
|
|
17
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -61,9 +63,10 @@ export var Mentions = function Mentions(_ref) {
|
|
|
61
63
|
onError: function onError(error) {
|
|
62
64
|
throw error;
|
|
63
65
|
}
|
|
64
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
66
|
};
|
|
66
|
-
},
|
|
67
|
+
},
|
|
68
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
+
[]);
|
|
67
70
|
var handleEditorChange = function handleEditorChange(editorState) {
|
|
68
71
|
var text = editorState.read(function () {
|
|
69
72
|
return $getRoot().getTextContent();
|
|
@@ -86,35 +89,36 @@ export var Mentions = function Mentions(_ref) {
|
|
|
86
89
|
initialConfig: _objectSpread(_objectSpread({}, initialConfig), {}, {
|
|
87
90
|
editable: editable
|
|
88
91
|
}),
|
|
89
|
-
children: /*#__PURE__*/
|
|
90
|
-
|
|
91
|
-
children: [/*#__PURE__*/_jsx(RichTextPlugin, {
|
|
92
|
-
ErrorBoundary: LexicalErrorBoundary,
|
|
93
|
-
contentEditable: /*#__PURE__*/_jsx(ContentEditable, {
|
|
94
|
-
className: cx((_cx = {}, _defineProperty(_cx, styles.root, true), _defineProperty(_cx, styles.filled, variant === 'filled'), _defineProperty(_cx, styles.borderless, variant === 'borderless'), _defineProperty(_cx, styles.disabled, disabled), _cx), className),
|
|
95
|
-
style: style || {}
|
|
96
|
-
}),
|
|
97
|
-
placeholder: /*#__PURE__*/_jsx("div", {
|
|
98
|
-
className: styles.placeholder,
|
|
99
|
-
children: placeholder || "\u8F93\u5165 ".concat(triggers.join(' 或 '), " \u63D2\u5165\u5F15\u7528")
|
|
100
|
-
})
|
|
101
|
-
}), /*#__PURE__*/_jsx(MentionPickerPlugin, {
|
|
102
|
-
allowSpaces: allowSpaces,
|
|
103
|
-
onSelect: onSelect,
|
|
104
|
-
options: options,
|
|
105
|
-
preTriggerChars: preTriggerChars,
|
|
106
|
-
punctuation: punctuation,
|
|
107
|
-
triggers: triggers
|
|
108
|
-
}), /*#__PURE__*/_jsx(MentionNodePlugin, {
|
|
92
|
+
children: /*#__PURE__*/_jsx(MentionsConfigProvider, {
|
|
93
|
+
value: {
|
|
109
94
|
optionsMap: optionsMap
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
},
|
|
96
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
97
|
+
className: cx(styles.wrapper, wrapperClassname),
|
|
98
|
+
children: [/*#__PURE__*/_jsx(RichTextPlugin, {
|
|
99
|
+
ErrorBoundary: LexicalErrorBoundary,
|
|
100
|
+
contentEditable: /*#__PURE__*/_jsx(ContentEditable, {
|
|
101
|
+
className: cx((_cx = {}, _defineProperty(_cx, styles.root, true), _defineProperty(_cx, styles.filled, variant === 'filled'), _defineProperty(_cx, styles.borderless, variant === 'borderless'), _defineProperty(_cx, styles.disabled, disabled), _cx), className),
|
|
102
|
+
style: style || {}
|
|
103
|
+
}),
|
|
104
|
+
placeholder: /*#__PURE__*/_jsx("div", {
|
|
105
|
+
className: styles.placeholder,
|
|
106
|
+
children: placeholder || "\u8F93\u5165 ".concat(triggers.join(' 或 '), " \u63D2\u5165\u5F15\u7528")
|
|
107
|
+
})
|
|
108
|
+
}), /*#__PURE__*/_jsx(MentionPickerPlugin, {
|
|
109
|
+
allowSpaces: allowSpaces,
|
|
110
|
+
onSelect: onSelect,
|
|
111
|
+
options: options,
|
|
112
|
+
preTriggerChars: preTriggerChars,
|
|
113
|
+
punctuation: punctuation,
|
|
114
|
+
triggers: triggers
|
|
115
|
+
}), /*#__PURE__*/_jsx(MentionNodePlugin, {}), /*#__PURE__*/_jsx(MentionNodePluginReplacement, {}), /*#__PURE__*/_jsx(HistoryPlugin, {}), /*#__PURE__*/_jsx(OnChangePlugin, {
|
|
116
|
+
onChange: handleEditorChange
|
|
117
|
+
}), /*#__PURE__*/_jsx(OnBlurBlock, {
|
|
118
|
+
onBlur: onBlur,
|
|
119
|
+
onFocus: onFocus
|
|
120
|
+
})]
|
|
121
|
+
})
|
|
118
122
|
})
|
|
119
123
|
});
|
|
120
124
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MentionsOptionsMap } from '../../types';
|
|
3
2
|
export interface MentionNodeComponentProps {
|
|
4
3
|
nodeKey: string;
|
|
5
4
|
variable: string;
|
|
6
|
-
optionsMap: MentionsOptionsMap;
|
|
7
5
|
}
|
|
8
6
|
export declare const MentionNodeComponent: React.FC<MentionNodeComponentProps>;
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
3
|
-
import { mergeRegister } from '@lexical/utils';
|
|
4
3
|
import { Icon } from '@lobehub/ui';
|
|
5
4
|
import { Flex, Tooltip } from 'antd';
|
|
6
|
-
import { COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
7
5
|
import { CircleAlert } from 'lucide-react';
|
|
8
|
-
import React, { memo, useEffect
|
|
6
|
+
import React, { memo, useEffect } from 'react';
|
|
7
|
+
import { useOptionsMap } from "../../provider";
|
|
9
8
|
import { useSelectOrDelete } from "../../hooks";
|
|
10
9
|
import { MentionNode } from "./node";
|
|
11
10
|
import { useStyles } from "./style";
|
|
12
|
-
import { DELETE_MENTION_COMMAND
|
|
11
|
+
import { DELETE_MENTION_COMMAND } from "./utils";
|
|
13
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
13
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
14
|
export var MentionNodeComponent = /*#__PURE__*/memo(function (_ref) {
|
|
16
15
|
var nodeKey = _ref.nodeKey,
|
|
17
|
-
variable = _ref.variable
|
|
18
|
-
|
|
19
|
-
optionsMap = _ref$optionsMap === void 0 ? {} : _ref$optionsMap;
|
|
16
|
+
variable = _ref.variable;
|
|
17
|
+
var optionsMap = useOptionsMap();
|
|
20
18
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
21
19
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
22
20
|
editor = _useLexicalComposerCo2[0];
|
|
@@ -24,22 +22,16 @@ export var MentionNodeComponent = /*#__PURE__*/memo(function (_ref) {
|
|
|
24
22
|
_useSelectOrDelete2 = _slicedToArray(_useSelectOrDelete, 2),
|
|
25
23
|
ref = _useSelectOrDelete2[0],
|
|
26
24
|
isSelected = _useSelectOrDelete2[1];
|
|
27
|
-
var
|
|
28
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
-
localMentionsOptionsMap = _useState2[0],
|
|
30
|
-
setLocalMentionsOptionsMap = _useState2[1];
|
|
31
|
-
var option = localMentionsOptionsMap === null || localMentionsOptionsMap === void 0 ? void 0 : localMentionsOptionsMap[variable];
|
|
25
|
+
var option = optionsMap === null || optionsMap === void 0 ? void 0 : optionsMap[variable];
|
|
32
26
|
var _useStyles = useStyles({
|
|
33
27
|
isSelected: isSelected,
|
|
34
28
|
isError: !option || !!option.error
|
|
35
29
|
}),
|
|
36
30
|
styles = _useStyles.styles;
|
|
37
31
|
useEffect(function () {
|
|
38
|
-
if (!editor.hasNodes([MentionNode]))
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return true;
|
|
42
|
-
}, COMMAND_PRIORITY_EDITOR));
|
|
32
|
+
if (!editor.hasNodes([MentionNode])) {
|
|
33
|
+
throw new Error('MentionsNodePlugin: MentionNode not registered on editor');
|
|
34
|
+
}
|
|
43
35
|
}, [editor]);
|
|
44
36
|
var Item = /*#__PURE__*/_jsx(Flex, {
|
|
45
37
|
className: styles.root,
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MentionsOptionsMap } from '../../types';
|
|
3
2
|
export * from './node';
|
|
4
3
|
export * from './replacement';
|
|
5
4
|
export * from './utils';
|
|
6
5
|
export interface MentionNodePluginProps {
|
|
7
6
|
onInsert?: () => void;
|
|
8
7
|
onDelete?: () => void;
|
|
9
|
-
optionsMap: MentionsOptionsMap;
|
|
10
8
|
}
|
|
11
9
|
export declare const MentionNodePlugin: React.FC<MentionNodePluginProps>;
|
|
@@ -4,28 +4,21 @@ import { mergeRegister } from '@lexical/utils';
|
|
|
4
4
|
import { $insertNodes, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
5
5
|
import { memo, useEffect } from 'react';
|
|
6
6
|
import { $createMentionNode, MentionNode } from "./node";
|
|
7
|
-
import { CLEAR_HIDE_MENU_TIMEOUT, DELETE_MENTION_COMMAND, INSERT_MENTION_COMMAND
|
|
7
|
+
import { CLEAR_HIDE_MENU_TIMEOUT, DELETE_MENTION_COMMAND, INSERT_MENTION_COMMAND } from "./utils";
|
|
8
8
|
export * from "./node";
|
|
9
9
|
export * from "./replacement";
|
|
10
10
|
export * from "./utils";
|
|
11
11
|
export var MentionNodePlugin = /*#__PURE__*/memo(function (_ref) {
|
|
12
|
-
var
|
|
13
|
-
onInsert = _ref.onInsert,
|
|
12
|
+
var onInsert = _ref.onInsert,
|
|
14
13
|
onDelete = _ref.onDelete;
|
|
15
14
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
16
15
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
17
16
|
editor = _useLexicalComposerCo2[0];
|
|
18
|
-
useEffect(function () {
|
|
19
|
-
editor.update(function () {
|
|
20
|
-
editor.dispatchCommand(UPDATE_MENTIONS_OPTIONS, optionsMap);
|
|
21
|
-
});
|
|
22
|
-
}, [editor, optionsMap]);
|
|
23
17
|
useEffect(function () {
|
|
24
18
|
if (!editor.hasNodes([MentionNode])) throw new Error('MentionsNodePlugin: MentionNode not registered on editor');
|
|
25
19
|
return mergeRegister(editor.registerCommand(INSERT_MENTION_COMMAND, function (variable) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var mentionNode = $createMentionNode(variable, optionsMap);
|
|
20
|
+
editor.dispatchCommand(CLEAR_HIDE_MENU_TIMEOUT, null);
|
|
21
|
+
var mentionNode = $createMentionNode(variable);
|
|
29
22
|
$insertNodes([mentionNode]);
|
|
30
23
|
if (onInsert) onInsert();
|
|
31
24
|
return true;
|
|
@@ -33,7 +26,7 @@ export var MentionNodePlugin = /*#__PURE__*/memo(function (_ref) {
|
|
|
33
26
|
if (onDelete) onDelete();
|
|
34
27
|
return true;
|
|
35
28
|
}, COMMAND_PRIORITY_EDITOR));
|
|
36
|
-
}, [editor, onInsert, onDelete
|
|
29
|
+
}, [editor, onInsert, onDelete]);
|
|
37
30
|
return null;
|
|
38
31
|
});
|
|
39
32
|
MentionNodePlugin.displayName = 'MentionNodePlugin';
|
|
@@ -4,23 +4,20 @@ import { DecoratorNode } from 'lexical';
|
|
|
4
4
|
import type { MentionsOptionsMap } from '../../types';
|
|
5
5
|
export type SerializedNode = SerializedLexicalNode & {
|
|
6
6
|
variable: string;
|
|
7
|
-
optionsMap: MentionsOptionsMap;
|
|
8
7
|
};
|
|
9
8
|
export declare class MentionNode extends DecoratorNode<JSX.Element> {
|
|
10
9
|
__variable: string;
|
|
11
|
-
__optionsMap: MentionsOptionsMap;
|
|
12
10
|
static getType(): string;
|
|
13
11
|
static clone(node: MentionNode): MentionNode;
|
|
14
12
|
isInline(): boolean;
|
|
15
|
-
constructor(variable: string, optionsMap
|
|
13
|
+
constructor(variable: string, optionsMap?: MentionsOptionsMap, key?: NodeKey);
|
|
16
14
|
createDOM(): HTMLElement;
|
|
17
15
|
updateDOM(): false;
|
|
18
16
|
decorate(): JSX.Element;
|
|
19
17
|
static importJSON(serializedNode: SerializedNode): MentionNode;
|
|
20
18
|
exportJSON(): SerializedNode;
|
|
21
19
|
getVariable(): string;
|
|
22
|
-
getOptionsMap(): MentionsOptionsMap;
|
|
23
20
|
getTextContent(): string;
|
|
24
21
|
}
|
|
25
|
-
export declare function $createMentionNode(variable: string
|
|
22
|
+
export declare function $createMentionNode(variable: string): MentionNode;
|
|
26
23
|
export declare function $isMentionNode(node: MentionNode | LexicalNode | null | undefined): node is MentionNode;
|
|
@@ -19,9 +19,7 @@ export var MentionNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
|
19
19
|
_classCallCheck(this, MentionNode);
|
|
20
20
|
_this = _super.call(this, key);
|
|
21
21
|
_defineProperty(_assertThisInitialized(_this), "__variable", void 0);
|
|
22
|
-
_defineProperty(_assertThisInitialized(_this), "__optionsMap", void 0);
|
|
23
22
|
_this.__variable = variable;
|
|
24
|
-
_this.__optionsMap = optionsMap;
|
|
25
23
|
return _this;
|
|
26
24
|
}
|
|
27
25
|
_createClass(MentionNode, [{
|
|
@@ -36,9 +34,6 @@ export var MentionNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
|
36
34
|
div.style.display = 'inline-flex';
|
|
37
35
|
div.style.alignItems = 'center';
|
|
38
36
|
div.style.verticalAlign = 'middle';
|
|
39
|
-
// div.style['align-items'] = 'center';
|
|
40
|
-
// div.style['vertical-align'] = 'middle';
|
|
41
|
-
|
|
42
37
|
return div;
|
|
43
38
|
}
|
|
44
39
|
}, {
|
|
@@ -51,7 +46,6 @@ export var MentionNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
|
51
46
|
value: function decorate() {
|
|
52
47
|
return /*#__PURE__*/_jsx(MentionNodeComponent, {
|
|
53
48
|
nodeKey: this.getKey(),
|
|
54
|
-
optionsMap: this.__optionsMap,
|
|
55
49
|
variable: this.__variable
|
|
56
50
|
});
|
|
57
51
|
}
|
|
@@ -61,8 +55,7 @@ export var MentionNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
|
61
55
|
return {
|
|
62
56
|
type: 'mention-node',
|
|
63
57
|
version: 1,
|
|
64
|
-
variable: this.getVariable()
|
|
65
|
-
optionsMap: this.getOptionsMap()
|
|
58
|
+
variable: this.getVariable()
|
|
66
59
|
};
|
|
67
60
|
}
|
|
68
61
|
}, {
|
|
@@ -71,12 +64,6 @@ export var MentionNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
|
71
64
|
var self = this.getLatest();
|
|
72
65
|
return self.__variable;
|
|
73
66
|
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "getOptionsMap",
|
|
76
|
-
value: function getOptionsMap() {
|
|
77
|
-
var self = this.getLatest();
|
|
78
|
-
return self.__optionsMap;
|
|
79
|
-
}
|
|
80
67
|
}, {
|
|
81
68
|
key: "getTextContent",
|
|
82
69
|
value: function getTextContent() {
|
|
@@ -90,20 +77,20 @@ export var MentionNode = /*#__PURE__*/function (_DecoratorNode) {
|
|
|
90
77
|
}, {
|
|
91
78
|
key: "clone",
|
|
92
79
|
value: function clone(node) {
|
|
93
|
-
return new MentionNode(node.__variable
|
|
80
|
+
return new MentionNode(node.__variable);
|
|
94
81
|
}
|
|
95
82
|
}, {
|
|
96
83
|
key: "importJSON",
|
|
97
84
|
value: function importJSON(serializedNode) {
|
|
98
85
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
99
|
-
var node = $createMentionNode(serializedNode.variable
|
|
86
|
+
var node = $createMentionNode(serializedNode.variable);
|
|
100
87
|
return node;
|
|
101
88
|
}
|
|
102
89
|
}]);
|
|
103
90
|
return MentionNode;
|
|
104
91
|
}(DecoratorNode);
|
|
105
|
-
export function $createMentionNode(variable
|
|
106
|
-
return new MentionNode(variable
|
|
92
|
+
export function $createMentionNode(variable) {
|
|
93
|
+
return new MentionNode(variable);
|
|
107
94
|
}
|
|
108
95
|
export function $isMentionNode(node) {
|
|
109
96
|
return node instanceof MentionNode;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { MentionsOptionsMap } from '../../types';
|
|
3
2
|
export interface MentionNodePluginReplacementProps {
|
|
4
|
-
optionsMap: MentionsOptionsMap;
|
|
5
3
|
onInsert?: () => void;
|
|
6
4
|
}
|
|
7
5
|
export declare const MentionNodePluginReplacement: React.FC<MentionNodePluginReplacementProps>;
|
|
@@ -8,8 +8,7 @@ import { CustomTextNode } from "../custom-text/node";
|
|
|
8
8
|
import { $createMentionNode, MentionNode } from "./node";
|
|
9
9
|
import { MENTION_REGEX } from "./utils";
|
|
10
10
|
export var MentionNodePluginReplacement = /*#__PURE__*/memo(function (_ref) {
|
|
11
|
-
var
|
|
12
|
-
onInsert = _ref.onInsert;
|
|
11
|
+
var onInsert = _ref.onInsert;
|
|
13
12
|
var _useLexicalComposerCo = useLexicalComposerContext(),
|
|
14
13
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
15
14
|
editor = _useLexicalComposerCo2[0];
|
|
@@ -19,8 +18,8 @@ export var MentionNodePluginReplacement = /*#__PURE__*/memo(function (_ref) {
|
|
|
19
18
|
var createMentionNode = useCallback(function (textNode) {
|
|
20
19
|
if (onInsert) onInsert();
|
|
21
20
|
var nodePathString = textNode.getTextContent().slice(2, -2);
|
|
22
|
-
return $applyNodeReplacement($createMentionNode(nodePathString
|
|
23
|
-
}, [onInsert
|
|
21
|
+
return $applyNodeReplacement($createMentionNode(nodePathString));
|
|
22
|
+
}, [onInsert]);
|
|
24
23
|
var getMatch = useCallback(function (text) {
|
|
25
24
|
var matchArr = MENTION_REGEX.exec(text);
|
|
26
25
|
if (matchArr === null) return null;
|
|
@@ -24,10 +24,8 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
24
24
|
}
|
|
25
25
|
if (isSelected) {
|
|
26
26
|
return {
|
|
27
|
-
|
|
28
|
-
background: token.colorInfoBg,
|
|
27
|
+
background: token.colorInfoBgHover,
|
|
29
28
|
border: token.colorInfoBorder,
|
|
30
|
-
// color: token.colorInfoTextActive,
|
|
31
29
|
color: token.colorInfoText
|
|
32
30
|
};
|
|
33
31
|
}
|
|
@@ -42,7 +40,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
42
40
|
border = _getColors.border,
|
|
43
41
|
color = _getColors.color;
|
|
44
42
|
return {
|
|
45
|
-
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 1px 2px;\n padding: 0 4px;\n\n font-family: ", ";\n color: ", ";\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.fontFamilyCode, color, background, border, token.borderRadius),
|
|
43
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n user-select: none;\n\n margin: 1px 2px;\n padding: 0 4px;\n\n font-family: ", ";\n color: ", ";\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.fontFamilyCode, color, background, border, token.borderRadius),
|
|
46
44
|
text: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n display: inline-block;\n\n max-width: 200px;\n\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n "])), token.colorTextSecondary),
|
|
47
45
|
error: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorErrorText)
|
|
48
46
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const INSERT_MENTION_COMMAND: import("lexical").LexicalCommand<unknown>;
|
|
2
2
|
export declare const DELETE_MENTION_COMMAND: import("lexical").LexicalCommand<unknown>;
|
|
3
3
|
export declare const CLEAR_HIDE_MENU_TIMEOUT: import("lexical").LexicalCommand<unknown>;
|
|
4
|
-
export declare const UPDATE_MENTIONS_OPTIONS: import("lexical").LexicalCommand<unknown>;
|
|
5
4
|
export declare const MENTION_REGEX: RegExp;
|
|
@@ -2,5 +2,4 @@ import { createCommand } from 'lexical';
|
|
|
2
2
|
export var INSERT_MENTION_COMMAND = createCommand('INSERT_MENTION_COMMAND');
|
|
3
3
|
export var DELETE_MENTION_COMMAND = createCommand('DELETE_MENTION_COMMAND');
|
|
4
4
|
export var CLEAR_HIDE_MENU_TIMEOUT = createCommand('CLEAR_HIDE_MENU_TIMEOUT');
|
|
5
|
-
export var UPDATE_MENTIONS_OPTIONS = createCommand('UPDATE_MENTIONS_OPTIONS');
|
|
6
5
|
export var MENTION_REGEX = /{{([\w-]{1,50}(\.[_a-z]\w{0,29}){1,10})}}/gi;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { MentionsOptionsMap } from './types';
|
|
3
|
+
interface Value {
|
|
4
|
+
optionsMap: MentionsOptionsMap;
|
|
5
|
+
}
|
|
6
|
+
export declare const MentionsConfigContext: import("react").Context<Value | null>;
|
|
7
|
+
export declare const MentionsConfigProvider: import("react").NamedExoticComponent<{
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
value: Value;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const useOptionsMap: () => MentionsOptionsMap | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createContext, memo, useContext } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export var MentionsConfigContext = /*#__PURE__*/createContext(null);
|
|
4
|
+
export var MentionsConfigProvider = /*#__PURE__*/memo(function (_ref) {
|
|
5
|
+
var children = _ref.children,
|
|
6
|
+
value = _ref.value;
|
|
7
|
+
return /*#__PURE__*/_jsx(MentionsConfigContext.Provider, {
|
|
8
|
+
value: value,
|
|
9
|
+
children: children
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
export var useOptionsMap = function useOptionsMap() {
|
|
13
|
+
var config = useContext(MentionsConfigContext);
|
|
14
|
+
return config === null || config === void 0 ? void 0 : config.optionsMap;
|
|
15
|
+
};
|
package/es/Page/Content/style.js
CHANGED
|
@@ -5,7 +5,7 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
return {
|
|
8
|
-
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
8
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 100%;\n "])))
|
|
9
9
|
};
|
|
10
10
|
}, {
|
|
11
11
|
hashPriority: 'low'
|
package/es/Page/Header/style.js
CHANGED
|
@@ -10,7 +10,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
10
10
|
_ref2$divider = _ref2.divider,
|
|
11
11
|
divider = _ref2$divider === void 0 ? true : _ref2$divider;
|
|
12
12
|
return {
|
|
13
|
-
root: bordered ? css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: ", "px;\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n "])), token.padding, token.colorBgBase, token.borderRadius, token.boxShadowTertiary) : css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-top: ", "px;\n ", "\n "])), token.paddingXS, divider && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-bottom: ", "px;\n border-bottom: 1px solid ", ";\n "])), token.paddingLG, token.colorSplit)),
|
|
13
|
+
root: bordered ? css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n padding: ", "px;\n\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n "])), token.marginXS, token.padding, token.colorBgBase, token.borderRadius, token.boxShadowTertiary) : css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding-top: ", "px;\n margin-bottom: ", "px;\n ", "\n "])), token.paddingXS, token.marginXS, divider && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding-bottom: ", "px;\n border-bottom: 1px solid ", ";\n "])), token.paddingLG, token.colorSplit)),
|
|
14
14
|
icon: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n &.", "-avatar.", "-avatar-square {\n border-radius: 10px;\n }\n .", "-skeleton-avatar {\n border-radius: 10px;\n }\n "])), prefixCls, prefixCls, prefixCls),
|
|
15
15
|
titleBox: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin-bottom: ", "px;\n "])), token.marginSM),
|
|
16
16
|
subTitle: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n &.", "-typography {\n margin-bottom: 0 !important;\n font-size: ", "px;\n color: ", ";\n }\n "])), token.marginXXS, prefixCls, token.fontSize, token.colorTextSecondary),
|
package/es/Page/Title/style.js
CHANGED
|
@@ -5,8 +5,6 @@ export var useStyles = createStyles(function (_ref) {
|
|
|
5
5
|
var css = _ref.css,
|
|
6
6
|
token = _ref.token;
|
|
7
7
|
return {
|
|
8
|
-
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
8
|
+
root: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin: 0;\n\n font-family: ", ";\n font-size: 16px;\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n "])), token.fontFamily, token.fontWeightStrong, token.lineHeight, token.colorText)
|
|
9
9
|
};
|
|
10
|
-
}, {
|
|
11
|
-
hashPriority: 'low'
|
|
12
10
|
});
|