mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-06-30 02:33:03 -04:00
feat: make the columns block same width width the editor (#7493)
* feat: make the columns block same width width the editor * chore: turn off column debug mode * feat: add block selection container in outline block * feat: use ratio instead of width in simple columns * fix: document rules * fix: turn off debug mode * fix: update the existing columns block data
This commit is contained in:
parent
7b32a92290
commit
c81f87dcdc
10 changed files with 223 additions and 107 deletions
|
@ -104,6 +104,28 @@ class DocumentRules {
|
|||
} else {
|
||||
// otherwise, delete the column
|
||||
deleteColumnsTransaction.deleteNode(column);
|
||||
|
||||
final deletedColumnRatio =
|
||||
column.attributes[SimpleColumnBlockKeys.ratio];
|
||||
if (deletedColumnRatio != null) {
|
||||
// update the ratio of the columns
|
||||
final columnsNode = column.columnsParent;
|
||||
if (columnsNode != null) {
|
||||
final length = columnsNode.children.length;
|
||||
for (final columnNode in columnsNode.children) {
|
||||
final ratio =
|
||||
columnNode.attributes[SimpleColumnBlockKeys.ratio] ??
|
||||
1.0 / length;
|
||||
if (ratio != null) {
|
||||
deleteColumnsTransaction.updateNode(columnNode, {
|
||||
...columnNode.attributes,
|
||||
SimpleColumnBlockKeys.ratio:
|
||||
ratio + deletedColumnRatio / (length - 1),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue