@ant-design/agentic-ui 2.30.22 → 2.30.24
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/dist/Bubble/MessagesContent/MarkdownPreview.d.ts +0 -58
- package/dist/Bubble/MessagesContent/MarkdownPreview.js +79 -156
- package/dist/Hooks/useAutoScroll.js +6 -4
- package/dist/MarkdownEditor/BaseMarkdownEditor.d.ts +1 -50
- package/dist/MarkdownEditor/BaseMarkdownEditor.js +11 -55
- package/dist/MarkdownEditor/editor/Editor.js +11 -9
- package/dist/MarkdownEditor/editor/elements/Code/index.js +1 -0
- package/dist/MarkdownEditor/editor/plugins/elements.d.ts +2 -0
- package/dist/MarkdownEditor/editor/plugins/elements.js +4 -2
- package/dist/MarkdownEditor/editor/plugins/handlePaste.js +46 -35
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/backspace.js +133 -133
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/enter.js +156 -140
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.d.ts +2 -1
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/match.js +23 -4
- package/dist/MarkdownEditor/editor/plugins/hotKeyCommands/tab.js +40 -36
- package/dist/MarkdownEditor/editor/plugins/index.d.ts +1 -0
- package/dist/MarkdownEditor/editor/plugins/index.js +1 -0
- package/dist/MarkdownEditor/editor/plugins/useKeyboard.js +46 -44
- package/dist/MarkdownEditor/editor/plugins/withCodeTagPlugin.js +1 -13
- package/dist/MarkdownEditor/editor/plugins/withMarkdown.js +2 -1
- package/dist/MarkdownEditor/editor/plugins/withSanitizeInvalidChildren.d.ts +7 -0
- package/dist/MarkdownEditor/editor/plugins/withSanitizeInvalidChildren.js +217 -0
- package/dist/MarkdownEditor/editor/store.d.ts +3 -1
- package/dist/MarkdownEditor/editor/store.js +15 -29
- package/dist/MarkdownEditor/editor/utils/editorCommands.js +98 -17
- package/dist/MarkdownEditor/editor/utils/editorUtils.d.ts +11 -0
- package/dist/MarkdownEditor/editor/utils/editorUtils.js +43 -6
- package/dist/MarkdownEditor/editor/utils/keyboard.js +14 -12
- package/dist/MarkdownEditor/types.d.ts +36 -414
- package/dist/MarkdownEditor/types.js +1 -4
- package/dist/MarkdownInputField/MarkdownInputField.js +2 -0
- package/dist/MarkdownInputField/SendActions/index.js +7 -4
- package/dist/MarkdownInputField/SendButton/index.d.ts +6 -0
- package/dist/MarkdownInputField/SendButton/index.js +6 -0
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.d.ts +2 -1
- package/dist/MarkdownInputField/hooks/useMarkdownInputFieldHandlers.js +6 -1
- package/dist/MarkdownRenderer/AnimationText.d.ts +1 -5
- package/dist/MarkdownRenderer/AnimationText.js +2 -8
- package/dist/MarkdownRenderer/CharacterQueue.d.ts +0 -2
- package/dist/MarkdownRenderer/CharacterQueue.js +2 -2
- package/dist/MarkdownRenderer/MarkdownRenderer.d.ts +1 -9
- package/dist/MarkdownRenderer/MarkdownRenderer.js +1 -9
- package/dist/MarkdownRenderer/StreamingCursor.d.ts +4 -0
- package/dist/MarkdownRenderer/StreamingCursor.js +20 -0
- package/dist/MarkdownRenderer/markdownReactShared.d.ts +8 -38
- package/dist/MarkdownRenderer/markdownReactShared.js +9 -45
- package/dist/MarkdownRenderer/renderers/ChartRenderer.js +9 -1
- package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.d.ts +1 -3
- package/dist/MarkdownRenderer/streaming/MarkdownBlockPiece.js +16 -28
- package/dist/MarkdownRenderer/style.js +18 -0
- package/dist/MarkdownRenderer/types.d.ts +14 -86
- package/dist/MarkdownRenderer/useStreaming.d.ts +1 -10
- package/dist/MarkdownRenderer/useStreaming.js +5 -13
- package/dist/ThoughtChainList/MarkdownEditor.d.ts +1 -35
- package/dist/ThoughtChainList/MarkdownEditor.js +5 -44
- package/dist/Workspace/RealtimeFollow/index.d.ts +3 -0
- package/dist/Workspace/RealtimeFollow/index.js +5 -3
- package/package.json +2 -2
|
@@ -329,6 +329,7 @@ export var MdElements = {
|
|
|
329
329
|
task: {
|
|
330
330
|
reg: /^\s*\[(x|\s)]\s+/,
|
|
331
331
|
matchKey: ' ',
|
|
332
|
+
gatedByMatchInputToNode: true,
|
|
332
333
|
checkAllow: function checkAllow(ctx) {
|
|
333
334
|
var _ctx_node_, _ctx_node;
|
|
334
335
|
if (((_ctx_node = ctx.node) === null || _ctx_node === void 0 ? void 0 : (_ctx_node_ = _ctx_node[0]) === null || _ctx_node_ === void 0 ? void 0 : _ctx_node_.type) === 'paragraph') {
|
|
@@ -362,6 +363,7 @@ export var MdElements = {
|
|
|
362
363
|
},
|
|
363
364
|
list: {
|
|
364
365
|
matchKey: ' ',
|
|
366
|
+
gatedByMatchInputToNode: true,
|
|
365
367
|
reg: /^\s*(\d+\.|-|\*|\+)\s+?/,
|
|
366
368
|
checkAllow: function checkAllow(ctx) {
|
|
367
369
|
var _ctx_node_, _ctx_node;
|
|
@@ -420,7 +422,7 @@ export var MdElements = {
|
|
|
420
422
|
reg: /^\s*(\*\*\*|___|---)\s*$/,
|
|
421
423
|
checkAllow: function checkAllow(ctx) {
|
|
422
424
|
var _ctx_node_, _ctx_node;
|
|
423
|
-
return ((_ctx_node = ctx.node) === null || _ctx_node === void 0 ? void 0 : (_ctx_node_ = _ctx_node[0]) === null || _ctx_node_ === void 0 ? void 0 : _ctx_node_.type) === 'paragraph'
|
|
425
|
+
return ((_ctx_node = ctx.node) === null || _ctx_node === void 0 ? void 0 : (_ctx_node_ = _ctx_node[0]) === null || _ctx_node_ === void 0 ? void 0 : _ctx_node_.type) === 'paragraph';
|
|
424
426
|
},
|
|
425
427
|
run: function run(param) {
|
|
426
428
|
var editor = param.editor, path = param.path;
|
|
@@ -446,7 +448,7 @@ export var MdElements = {
|
|
|
446
448
|
reg: /^\s*(\*\*\*|___|---)\s*/,
|
|
447
449
|
checkAllow: function checkAllow(ctx) {
|
|
448
450
|
var _ctx_node_, _ctx_node;
|
|
449
|
-
return ((_ctx_node = ctx.node) === null || _ctx_node === void 0 ? void 0 : (_ctx_node_ = _ctx_node[0]) === null || _ctx_node_ === void 0 ? void 0 : _ctx_node_.type) === 'paragraph'
|
|
451
|
+
return ((_ctx_node = ctx.node) === null || _ctx_node === void 0 ? void 0 : (_ctx_node_ = _ctx_node[0]) === null || _ctx_node_ === void 0 ? void 0 : _ctx_node_.type) === 'paragraph';
|
|
450
452
|
},
|
|
451
453
|
run: function run(param) {
|
|
452
454
|
var editor = param.editor, path = param.path;
|
|
@@ -244,7 +244,7 @@ function _ts_generator(thisArg, body) {
|
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
import { Editor, Node, Path, Transforms } from "slate";
|
|
247
|
+
import { Editor, Element, Node, Path, Text, Transforms } from "slate";
|
|
248
248
|
import { isMarkdown } from "../utils";
|
|
249
249
|
import { getMediaType } from "../utils/dom";
|
|
250
250
|
import { EditorUtils } from "../utils/editorUtils";
|
|
@@ -252,13 +252,20 @@ import { isHtml } from "../utils/htmlToMarkdown";
|
|
|
252
252
|
import { toUnixPath } from "../utils/path";
|
|
253
253
|
import { insertParsedHtmlNodes } from "./insertParsedHtmlNodes";
|
|
254
254
|
import { parseMarkdownToNodesAndInsert } from "./parseMarkdownToNodesAndInsert";
|
|
255
|
+
var isValidSlateNode = function isValidSlateNode(node) {
|
|
256
|
+
if (Element.isElement(node)) return true;
|
|
257
|
+
if (Text.isText(node)) return true;
|
|
258
|
+
return false;
|
|
259
|
+
};
|
|
255
260
|
/**
|
|
256
261
|
* 处理粘贴的 Slate Markdown 片段
|
|
257
262
|
*/ export var handleSlateMarkdownFragment = function handleSlateMarkdownFragment(editor, clipboardData, currentTextSelection) {
|
|
258
263
|
try {
|
|
259
264
|
var encoded = clipboardData.getData('application/x-slate-md-fragment');
|
|
260
|
-
var
|
|
261
|
-
|
|
265
|
+
var raw = JSON.parse(encoded || '[]');
|
|
266
|
+
var parsed = (Array.isArray(raw) ? raw : []).filter(isValidSlateNode);
|
|
267
|
+
var fragment = parsed.map(function(node) {
|
|
268
|
+
if (Element.isElement(node) && node.type === 'card') {
|
|
262
269
|
return _object_spread_props(_object_spread({}, node), {
|
|
263
270
|
children: [
|
|
264
271
|
{
|
|
@@ -535,43 +542,47 @@ import { parseMarkdownToNodesAndInsert } from "./parseMarkdownToNodesAndInsert";
|
|
|
535
542
|
}
|
|
536
543
|
if (path && url) {
|
|
537
544
|
if (text.startsWith('media://')) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
var next = Editor.next(editor, {
|
|
543
|
-
at: path
|
|
544
|
-
});
|
|
545
|
-
if (next && next[0].type === 'paragraph' && !Node.string(next[0])) {
|
|
546
|
-
Transforms.delete(editor, {
|
|
547
|
-
at: selection
|
|
545
|
+
Editor.withoutNormalizing(editor, function() {
|
|
546
|
+
Transforms.insertNodes(editor, EditorUtils.createMediaNode(url, 'image'), {
|
|
547
|
+
select: true,
|
|
548
|
+
at: path
|
|
548
549
|
});
|
|
549
|
-
|
|
550
|
+
var next = Editor.next(editor, {
|
|
551
|
+
at: path
|
|
552
|
+
});
|
|
553
|
+
if (next && next[0].type === 'paragraph' && !Node.string(next[0])) {
|
|
554
|
+
Transforms.delete(editor, {
|
|
555
|
+
at: selection
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
});
|
|
550
559
|
return true;
|
|
551
560
|
}
|
|
552
561
|
if (text.startsWith('attach://')) {
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
var next1 = Editor.next(editor, {
|
|
568
|
-
at: path
|
|
569
|
-
});
|
|
570
|
-
if (next1 && next1[0].type === 'paragraph' && !Node.string(next1[0])) {
|
|
571
|
-
Transforms.delete(editor, {
|
|
572
|
-
at: selection
|
|
562
|
+
Editor.withoutNormalizing(editor, function() {
|
|
563
|
+
Transforms.insertNodes(editor, {
|
|
564
|
+
type: 'attach',
|
|
565
|
+
name: urlObject.searchParams.get('name'),
|
|
566
|
+
size: Number(urlObject.searchParams.get('size') || 0),
|
|
567
|
+
url: url || undefined,
|
|
568
|
+
children: [
|
|
569
|
+
{
|
|
570
|
+
text: ''
|
|
571
|
+
}
|
|
572
|
+
]
|
|
573
|
+
}, {
|
|
574
|
+
select: true,
|
|
575
|
+
at: path
|
|
573
576
|
});
|
|
574
|
-
|
|
577
|
+
var next = Editor.next(editor, {
|
|
578
|
+
at: path
|
|
579
|
+
});
|
|
580
|
+
if (next && next[0].type === 'paragraph' && !Node.string(next[0])) {
|
|
581
|
+
Transforms.delete(editor, {
|
|
582
|
+
at: selection
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
});
|
|
575
586
|
return true;
|
|
576
587
|
}
|
|
577
588
|
}
|
|
@@ -104,6 +104,8 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
104
104
|
value: function range() {
|
|
105
105
|
var sel = this.editor.selection;
|
|
106
106
|
if (!sel) return;
|
|
107
|
+
// 折叠选区下 start/end 与文档起止可能重合(如空段落),不能当作「全选」
|
|
108
|
+
if (!Range.isExpanded(sel)) return false;
|
|
107
109
|
var _Range_edges = _sliced_to_array(Range.edges(sel), 2), start = _Range_edges[0], end = _Range_edges[1];
|
|
108
110
|
if (Point.equals(start, Editor.start(this.editor, [])) && Point.equals(end, Editor.end(this.editor, []))) {
|
|
109
111
|
EditorUtils.deleteAll(this.editor);
|
|
@@ -127,6 +129,7 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
127
129
|
{
|
|
128
130
|
key: "run",
|
|
129
131
|
value: function run() {
|
|
132
|
+
var _this = this;
|
|
130
133
|
var _parent_;
|
|
131
134
|
var sel = this.editor.selection;
|
|
132
135
|
if (!sel) return;
|
|
@@ -154,12 +157,14 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
if (el.type === 'media' || el.type === 'attach') {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
160
|
+
Editor.withoutNormalizing(this.editor, function() {
|
|
161
|
+
Transforms.removeNodes(_this.editor, {
|
|
162
|
+
at: path
|
|
163
|
+
});
|
|
164
|
+
Transforms.insertNodes(_this.editor, EditorUtils.p, {
|
|
165
|
+
at: node[1],
|
|
166
|
+
select: true
|
|
167
|
+
});
|
|
163
168
|
});
|
|
164
169
|
return true;
|
|
165
170
|
}
|
|
@@ -178,94 +183,83 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
178
183
|
var listNode = Editor.node(this.editor, listPath);
|
|
179
184
|
var currentItemIndex = parent1[1][parent1[1].length - 1];
|
|
180
185
|
var isLastItem = currentItemIndex === listNode[0].children.length - 1;
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
at: parent1[1]
|
|
186
|
-
});
|
|
187
|
-
// 如果列表为空,删除列表容器
|
|
188
|
-
var updatedList = Node.get(this.editor, listPath);
|
|
189
|
-
if (isListType(updatedList) && Node.string(updatedList).trim() === '') {
|
|
190
|
-
Transforms.removeNodes(this.editor, {
|
|
191
|
-
at: listPath
|
|
192
|
-
});
|
|
193
|
-
// 在列表位置插入 paragraph
|
|
194
|
-
Transforms.insertNodes(this.editor, {
|
|
195
|
-
type: 'paragraph',
|
|
196
|
-
children: [
|
|
197
|
-
{
|
|
198
|
-
text: ''
|
|
199
|
-
}
|
|
200
|
-
]
|
|
201
|
-
}, {
|
|
202
|
-
at: listPath,
|
|
203
|
-
select: true
|
|
204
|
-
});
|
|
205
|
-
} else {
|
|
206
|
-
// 在删除的位置插入 paragraph
|
|
207
|
-
Transforms.insertNodes(this.editor, {
|
|
208
|
-
type: 'paragraph',
|
|
209
|
-
children: [
|
|
210
|
-
{
|
|
211
|
-
text: ''
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
}, {
|
|
215
|
-
at: parent1[1],
|
|
216
|
-
select: true
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
} else {
|
|
220
|
-
// 如果不是最后一个项目,删除当前item和之后的所有items
|
|
221
|
-
// 先删除后面的 items(从后往前删除,避免索引变化)
|
|
222
|
-
for(var i = listNode[0].children.length - 1; i > currentItemIndex; i--){
|
|
223
|
-
Transforms.removeNodes(this.editor, {
|
|
224
|
-
at: _to_consumable_array(listPath).concat([
|
|
225
|
-
i
|
|
226
|
-
])
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
// 删除当前item
|
|
230
|
-
Transforms.removeNodes(this.editor, {
|
|
231
|
-
at: parent1[1]
|
|
232
|
-
});
|
|
233
|
-
// 检查列表是否为空,如果为空则删除列表容器
|
|
234
|
-
var updatedList1 = Node.get(this.editor, listPath);
|
|
235
|
-
if (isListType(updatedList1) && Node.string(updatedList1).trim() === '') {
|
|
236
|
-
// 列表为空,删除列表容器
|
|
237
|
-
Transforms.removeNodes(this.editor, {
|
|
238
|
-
at: listPath
|
|
239
|
-
});
|
|
240
|
-
// 在列表位置插入 paragraph
|
|
241
|
-
Transforms.insertNodes(this.editor, {
|
|
242
|
-
type: 'paragraph',
|
|
243
|
-
children: [
|
|
244
|
-
{
|
|
245
|
-
text: ''
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
}, {
|
|
249
|
-
at: listPath,
|
|
250
|
-
select: true
|
|
186
|
+
Editor.withoutNormalizing(this.editor, function() {
|
|
187
|
+
if (isLastItem) {
|
|
188
|
+
Transforms.removeNodes(_this.editor, {
|
|
189
|
+
at: parent1[1]
|
|
251
190
|
});
|
|
191
|
+
var updatedList = Node.get(_this.editor, listPath);
|
|
192
|
+
if (isListType(updatedList) && Node.string(updatedList).trim() === '') {
|
|
193
|
+
Transforms.removeNodes(_this.editor, {
|
|
194
|
+
at: listPath
|
|
195
|
+
});
|
|
196
|
+
Transforms.insertNodes(_this.editor, {
|
|
197
|
+
type: 'paragraph',
|
|
198
|
+
children: [
|
|
199
|
+
{
|
|
200
|
+
text: ''
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}, {
|
|
204
|
+
at: listPath,
|
|
205
|
+
select: true
|
|
206
|
+
});
|
|
207
|
+
} else {
|
|
208
|
+
Transforms.insertNodes(_this.editor, {
|
|
209
|
+
type: 'paragraph',
|
|
210
|
+
children: [
|
|
211
|
+
{
|
|
212
|
+
text: ''
|
|
213
|
+
}
|
|
214
|
+
]
|
|
215
|
+
}, {
|
|
216
|
+
at: parent1[1],
|
|
217
|
+
select: true
|
|
218
|
+
});
|
|
219
|
+
}
|
|
252
220
|
} else {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
]
|
|
263
|
-
}, {
|
|
264
|
-
at: insertPath,
|
|
265
|
-
select: true
|
|
221
|
+
for(var i = listNode[0].children.length - 1; i > currentItemIndex; i--){
|
|
222
|
+
Transforms.removeNodes(_this.editor, {
|
|
223
|
+
at: _to_consumable_array(listPath).concat([
|
|
224
|
+
i
|
|
225
|
+
])
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
Transforms.removeNodes(_this.editor, {
|
|
229
|
+
at: parent1[1]
|
|
266
230
|
});
|
|
231
|
+
var updatedList1 = Node.get(_this.editor, listPath);
|
|
232
|
+
if (isListType(updatedList1) && Node.string(updatedList1).trim() === '') {
|
|
233
|
+
Transforms.removeNodes(_this.editor, {
|
|
234
|
+
at: listPath
|
|
235
|
+
});
|
|
236
|
+
Transforms.insertNodes(_this.editor, {
|
|
237
|
+
type: 'paragraph',
|
|
238
|
+
children: [
|
|
239
|
+
{
|
|
240
|
+
text: ''
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}, {
|
|
244
|
+
at: listPath,
|
|
245
|
+
select: true
|
|
246
|
+
});
|
|
247
|
+
} else {
|
|
248
|
+
var insertPath = Path.next(listPath);
|
|
249
|
+
Transforms.insertNodes(_this.editor, {
|
|
250
|
+
type: 'paragraph',
|
|
251
|
+
children: [
|
|
252
|
+
{
|
|
253
|
+
text: ''
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
}, {
|
|
257
|
+
at: insertPath,
|
|
258
|
+
select: true
|
|
259
|
+
});
|
|
260
|
+
}
|
|
267
261
|
}
|
|
268
|
-
}
|
|
262
|
+
});
|
|
269
263
|
return true;
|
|
270
264
|
}
|
|
271
265
|
// 如果 list-item 不为空,处理行首 Backspace 减少缩进
|
|
@@ -277,17 +271,17 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
277
271
|
var listParent = Editor.parent(this.editor, listPath1);
|
|
278
272
|
// 如果父节点是 list-item,说明在嵌套列表中,可以提升
|
|
279
273
|
if (listParent && listParent[0] && Element.isElement(listParent[0]) && listParent[0].type === 'list-item') {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
});
|
|
284
|
-
// 如果提升后,原列表为空,需要删除空列表
|
|
285
|
-
var updatedList2 = Node.get(this.editor, listPath1);
|
|
286
|
-
if (isListType(updatedList2) && Node.string(updatedList2).trim() === '') {
|
|
287
|
-
Transforms.removeNodes(this.editor, {
|
|
288
|
-
at: listPath1
|
|
274
|
+
Editor.withoutNormalizing(this.editor, function() {
|
|
275
|
+
Transforms.liftNodes(_this.editor, {
|
|
276
|
+
at: listItemPath
|
|
289
277
|
});
|
|
290
|
-
|
|
278
|
+
var updatedList = Node.get(_this.editor, listPath1);
|
|
279
|
+
if (isListType(updatedList) && Node.string(updatedList).trim() === '') {
|
|
280
|
+
Transforms.removeNodes(_this.editor, {
|
|
281
|
+
at: listPath1
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
});
|
|
291
285
|
return true;
|
|
292
286
|
}
|
|
293
287
|
}
|
|
@@ -327,20 +321,22 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
327
321
|
].includes(pre[0].type)) {
|
|
328
322
|
var end = Editor.end(this.editor, pre[1]);
|
|
329
323
|
if (!Node.string(Node.get(this.editor, end.path))) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
var text = Node.string(el);
|
|
334
|
-
if (text) {
|
|
335
|
-
Transforms.insertNodes(this.editor, pre[0].type === 'code' ? [
|
|
336
|
-
{
|
|
337
|
-
text: text
|
|
338
|
-
}
|
|
339
|
-
] : el.children, {
|
|
340
|
-
at: end
|
|
324
|
+
Editor.withoutNormalizing(this.editor, function() {
|
|
325
|
+
Transforms.delete(_this.editor, {
|
|
326
|
+
at: path
|
|
341
327
|
});
|
|
342
|
-
|
|
343
|
-
|
|
328
|
+
var text = Node.string(el);
|
|
329
|
+
if (text) {
|
|
330
|
+
Transforms.insertNodes(_this.editor, pre[0].type === 'code' ? [
|
|
331
|
+
{
|
|
332
|
+
text: text
|
|
333
|
+
}
|
|
334
|
+
] : el.children, {
|
|
335
|
+
at: end
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
Transforms.select(_this.editor, end);
|
|
339
|
+
});
|
|
344
340
|
return true;
|
|
345
341
|
}
|
|
346
342
|
}
|
|
@@ -359,31 +355,35 @@ export var BackspaceKey = /*#__PURE__*/ function() {
|
|
|
359
355
|
})) {
|
|
360
356
|
var parent2 = Editor.parent(this.editor, path);
|
|
361
357
|
if (parent2[0].type === 'blockquote') {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
358
|
+
Editor.withoutNormalizing(this.editor, function() {
|
|
359
|
+
if (Editor.hasPath(_this.editor, Path.next(path))) {
|
|
360
|
+
Transforms.delete(_this.editor, {
|
|
361
|
+
at: path
|
|
362
|
+
});
|
|
363
|
+
} else {
|
|
364
|
+
Transforms.delete(_this.editor, {
|
|
365
|
+
at: parent2[1]
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
Transforms.insertNodes(_this.editor, {
|
|
369
|
+
type: 'paragraph',
|
|
370
|
+
children: el.children
|
|
371
|
+
}, {
|
|
368
372
|
at: parent2[1]
|
|
369
373
|
});
|
|
370
|
-
|
|
371
|
-
Transforms.insertNodes(this.editor, {
|
|
372
|
-
type: 'paragraph',
|
|
373
|
-
children: el.children
|
|
374
|
-
}, {
|
|
375
|
-
at: parent2[1]
|
|
374
|
+
Transforms.select(_this.editor, Editor.start(_this.editor, parent2[1]));
|
|
376
375
|
});
|
|
377
|
-
Transforms.select(this.editor, Editor.start(this.editor, parent2[1]));
|
|
378
376
|
return true;
|
|
379
377
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
378
|
+
var nextPath = Path.next(path);
|
|
379
|
+
if (Editor.isEditor(parent2[0]) && Editor.hasPath(this.editor, nextPath)) {
|
|
380
|
+
var _Editor_node = _sliced_to_array(Editor.node(this.editor, nextPath), 1), nextNode = _Editor_node[0];
|
|
381
|
+
if ((nextNode === null || nextNode === void 0 ? void 0 : nextNode.type) !== 'hr') {
|
|
382
|
+
Transforms.delete(this.editor, {
|
|
383
|
+
at: path
|
|
384
|
+
});
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
return false;
|