@yuntijs/ui 1.1.0-beta.15 → 1.1.0-beta.16
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.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type MentionPickerPluginProps } from './plugins/mention-picker';
|
|
|
3
3
|
import { AutoSize, MentionsEditor } from './types';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export * from './utils';
|
|
6
|
+
export { CLEAR_EDITOR_COMMAND } from 'lexical';
|
|
6
7
|
export interface MentionsProps extends MentionPickerPluginProps {
|
|
7
8
|
className?: string;
|
|
8
9
|
classNames?: {
|
package/es/Mentions/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
|
+
import { ClearEditorPlugin } from '@lexical/react/LexicalClearEditorPlugin';
|
|
4
5
|
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
5
6
|
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
6
7
|
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
|
|
@@ -26,6 +27,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
26
27
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
28
|
export * from "./types";
|
|
28
29
|
export * from "./utils";
|
|
30
|
+
export { CLEAR_EDITOR_COMMAND } from 'lexical';
|
|
29
31
|
export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
30
32
|
var className = _ref.className,
|
|
31
33
|
classNames = _ref.classNames,
|
|
@@ -167,7 +169,7 @@ export var Mentions = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
167
169
|
editable: editable
|
|
168
170
|
}), /*#__PURE__*/_jsx(EditorRefPlugin, {
|
|
169
171
|
editorRef: ref
|
|
170
|
-
}), onPressEnter && /*#__PURE__*/_jsx(ShiftEnterKeyPlugin, {
|
|
172
|
+
}), /*#__PURE__*/_jsx(ClearEditorPlugin, {}), onPressEnter && /*#__PURE__*/_jsx(ShiftEnterKeyPlugin, {
|
|
171
173
|
onPressEnter: onPressEnter
|
|
172
174
|
})]
|
|
173
175
|
})
|
|
@@ -36,9 +36,20 @@ export var ShiftEnterKeyPlugin = function ShiftEnterKeyPlugin(_ref) {
|
|
|
36
36
|
return $getRoot().getTextContent();
|
|
37
37
|
});
|
|
38
38
|
var value = text.replaceAll('\n\n', '\n');
|
|
39
|
-
onPressEnter
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
// 这里把 onPressEnter 放在下一次事件循环中触发,是为了避免跟 Lexical 还未结束的输入等事务发生冲突
|
|
40
|
+
if (window.queueMicrotask === undefined) {
|
|
41
|
+
setTimeout(function () {
|
|
42
|
+
onPressEnter(value, {
|
|
43
|
+
event: event
|
|
44
|
+
});
|
|
45
|
+
}, 0);
|
|
46
|
+
} else {
|
|
47
|
+
queueMicrotask(function () {
|
|
48
|
+
onPressEnter(value, {
|
|
49
|
+
event: event
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
}
|
|
42
53
|
return true;
|
|
43
54
|
},
|
|
44
55
|
// 优先级要低于 MentionPickerPlugin
|