@blocklet/editor 2.1.159 → 2.1.161
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.
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import Box from '@mui/material/Box';
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
5
|
-
import { COMMAND_PRIORITY_EDITOR, KEY_DOWN_COMMAND } from 'lexical';
|
|
6
5
|
import { useGetState } from 'ahooks';
|
|
7
6
|
import { useAideContext } from '../Aide';
|
|
8
7
|
import { insert, getParagraphText } from './utils';
|
|
@@ -79,15 +78,19 @@ function TextGeneration() {
|
|
|
79
78
|
}
|
|
80
79
|
}, [hasFocused]);
|
|
81
80
|
// shortcut: ctrl+k
|
|
82
|
-
useEffect(() => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
// useEffect(() => {
|
|
82
|
+
// return editor.registerCommand<KeyboardEvent>(
|
|
83
|
+
// KEY_DOWN_COMMAND,
|
|
84
|
+
// (e) => {
|
|
85
|
+
// if ((e.metaKey || e.ctrlKey) && e.key === 'k' && getState().status === 'activated') {
|
|
86
|
+
// continueWriting();
|
|
87
|
+
// return true;
|
|
88
|
+
// }
|
|
89
|
+
// return false;
|
|
90
|
+
// },
|
|
91
|
+
// COMMAND_PRIORITY_EDITOR
|
|
92
|
+
// );
|
|
93
|
+
// }, [editor]);
|
|
91
94
|
const rangeRect = state.range?.getBoundingClientRect();
|
|
92
95
|
// 使用 onMouseDown & preventDefault 避免点击时 editor 失去焦点且不触发事件处理,
|
|
93
96
|
// https://github.com/facebook/lexical/issues/3998
|
|
@@ -105,7 +108,7 @@ function TextGeneration() {
|
|
|
105
108
|
position: 'relative',
|
|
106
109
|
color: 'grey.500',
|
|
107
110
|
'&:hover .text-generation-arrow-label': { display: 'inline-flex' },
|
|
108
|
-
}, children: [_jsx(Arrow, {}),
|
|
111
|
+
}, children: [_jsx(Arrow, {}), _jsx(Box, { className: "text-generation-arrow-label", sx: {
|
|
109
112
|
display: 'none',
|
|
110
113
|
alignItems: 'center',
|
|
111
114
|
gap: 1,
|
|
@@ -121,16 +124,7 @@ function TextGeneration() {
|
|
|
121
124
|
whiteSpace: 'nowrap',
|
|
122
125
|
borderRadius: 1,
|
|
123
126
|
bgcolor: 'grey.600',
|
|
124
|
-
}, children:
|
|
125
|
-
display: 'inline-flex',
|
|
126
|
-
alignItems: 'center',
|
|
127
|
-
gap: 0.5,
|
|
128
|
-
px: 1,
|
|
129
|
-
py: 0.25,
|
|
130
|
-
color: 'grey.700',
|
|
131
|
-
bgcolor: '#fff',
|
|
132
|
-
borderRadius: 1,
|
|
133
|
-
}, children: [_jsx("i", { className: "iconify", "data-icon": "mdi:apple-keyboard-command", "data-height": "14px" }), _jsx("span", { children: "K" })] })] })] }) }, state.counter)), state.status === 'waiting' && _jsx(Writing, {})] }) }));
|
|
127
|
+
}, children: _jsx("span", { children: "Continue writing with AI Kit " }) })] }) }, state.counter)), state.status === 'waiting' && _jsx(Writing, {})] }) }));
|
|
134
128
|
}
|
|
135
129
|
return null;
|
|
136
130
|
}
|
|
@@ -9,6 +9,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
9
9
|
*/
|
|
10
10
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
11
11
|
import { LexicalTypeaheadMenuPlugin, useBasicTypeaheadTriggerMatch, } from '@lexical/react/LexicalTypeaheadMenuPlugin';
|
|
12
|
+
import { $createTextNode, $insertNodes } from 'lexical';
|
|
12
13
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
13
14
|
import debounce from 'lodash/debounce';
|
|
14
15
|
import { $createMentionNode } from '../../nodes/MentionNode';
|
|
@@ -134,6 +135,7 @@ export default function NewMentionsPlugin() {
|
|
|
134
135
|
nodeToReplace.replace(mentionNode);
|
|
135
136
|
}
|
|
136
137
|
mentionNode.select();
|
|
138
|
+
$insertNodes([$createTextNode(' ')]);
|
|
137
139
|
closeMenu();
|
|
138
140
|
});
|
|
139
141
|
}, [editor]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/editor",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.161",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@blocklet/code-editor": "^0.4.
|
|
27
|
+
"@blocklet/code-editor": "^0.4.230",
|
|
28
28
|
"@blocklet/embed": "^0.2.3",
|
|
29
29
|
"@blocklet/js-sdk": "^1.16.38",
|
|
30
|
-
"@blocklet/pages-kit": "^0.4.
|
|
30
|
+
"@blocklet/pages-kit": "^0.4.9",
|
|
31
31
|
"@excalidraw/excalidraw": "^0.14.2",
|
|
32
32
|
"@iconify/iconify": "^3.1.1",
|
|
33
33
|
"@iconify/icons-tabler": "^1.2.95",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"ufo": "^1.5.4",
|
|
67
67
|
"url-join": "^4.0.1",
|
|
68
68
|
"zustand": "^4.5.5",
|
|
69
|
-
"@blocklet/pdf": "^2.1.
|
|
69
|
+
"@blocklet/pdf": "^2.1.161"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@babel/core": "^7.25.2",
|