mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: refresh number list when delete multiple lines
This commit is contained in:
parent
0310b92723
commit
2775737260
@ -93,9 +93,19 @@ KeyEventResult _handleBackspace(EditorState editorState, RawKeyEvent event) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (textNodes.isNotEmpty) {
|
||||
_deleteTextNodes(transactionBuilder, textNodes, selection);
|
||||
if (textNodes.isEmpty) {
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
final startPosition = selection.start;
|
||||
final nodeAtStart = editorState.document.nodeAtPath(startPosition.path)!;
|
||||
_deleteTextNodes(transactionBuilder, textNodes, selection);
|
||||
transactionBuilder.commit();
|
||||
|
||||
if (nodeAtStart is TextNode && nodeAtStart.subtype == StyleKey.numberList) {
|
||||
makeFollowingNodesIncremental(
|
||||
editorState, startPosition.path, transactionBuilder.afterSelection!);
|
||||
}
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
if (transactionBuilder.operations.isNotEmpty) {
|
||||
@ -156,11 +166,18 @@ KeyEventResult _handleDelete(EditorState editorState, RawKeyEvent event) {
|
||||
);
|
||||
}
|
||||
}
|
||||
transactionBuilder.commit();
|
||||
} else {
|
||||
final startPosition = selection.start;
|
||||
final nodeAtStart = editorState.document.nodeAtPath(startPosition.path)!;
|
||||
_deleteTextNodes(transactionBuilder, textNodes, selection);
|
||||
}
|
||||
transactionBuilder.commit();
|
||||
|
||||
transactionBuilder.commit();
|
||||
if (nodeAtStart is TextNode && nodeAtStart.subtype == StyleKey.numberList) {
|
||||
makeFollowingNodesIncremental(
|
||||
editorState, startPosition.path, transactionBuilder.afterSelection!);
|
||||
}
|
||||
}
|
||||
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =
|
||||
|
||||
// Multiple selection
|
||||
if (!selection.isSingle) {
|
||||
final startNode = editorState.document.nodeAtPath(selection.start.path)!;
|
||||
final length = textNodes.length;
|
||||
final List<TextNode> subTextNodes =
|
||||
length >= 3 ? textNodes.sublist(1, textNodes.length - 1) : [];
|
||||
@ -57,6 +58,12 @@ ShortcutEventHandler enterWithoutShiftInTextNodesHandler =
|
||||
)
|
||||
..afterSelection = afterSelection
|
||||
..commit();
|
||||
|
||||
if (startNode is TextNode && startNode.subtype == StyleKey.numberList) {
|
||||
makeFollowingNodesIncremental(
|
||||
editorState, selection.start.path, afterSelection);
|
||||
}
|
||||
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user