Skip to content

Commit

Permalink
chore: reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
sun-jiao committed Sep 17, 2023
1 parent 311a4a9 commit b093d3d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ CommandShortcutEventHandler _backspaceInCollapsedSelection = (editorState) {
),
);
} else {
Node? tableParent = node.findParent((element) => element.type == TableBlockKeys.type);
Node? tableParent =
node.findParent((element) => element.type == TableBlockKeys.type);
Node? prevTableParent;
// table node should be deleted using table menu,
// in-table paragraph should only be deleted inside the table
final prev = node.previousNodeWhere((element) {
prevTableParent = element.findParent((element) => element.type == TableBlockKeys.type);
return tableParent != prevTableParent // break if only one in table or they're in different tables
|| element.delta != null; // merge with the previous node contains delta.
prevTableParent = element
.findParent((element) => element.type == TableBlockKeys.type);
// break if only one is in a table or they're in different tables
return tableParent != prevTableParent ||
// merge with the previous node contains delta.
element.delta != null;
});
// table node should be deleted using table menu
// in-table paragraph should only be deleted inside the table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ CommandShortcutEventHandler _deleteInCollapsedSelection = (editorState) {
final transaction = editorState.transaction;

if (position.offset == delta.length) {
Node? tableParent = node.findParent((element) => element.type == TableBlockKeys.type);
Node? tableParent =
node.findParent((element) => element.type == TableBlockKeys.type);
Node? nextTableParent;
final next = node.findDownward((element) {
nextTableParent = element.findParent((element) => element.type == TableBlockKeys.type);
return tableParent != nextTableParent // break if only one in table or they're in different tables
|| element.delta != null; // merge the next node with delta
nextTableParent =
element.findParent((element) => element.type == TableBlockKeys.type);
// break if only one is in a table or they're in different tables
return tableParent != nextTableParent ||
// merge the next node with delta
element.delta != null;
});
// table node should be deleted using table menu
// in-table paragraph should only be deleted inside the table
Expand Down

0 comments on commit b093d3d

Please sign in to comment.