mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: checkbox error
pressing Enter after a checked-off item, the new checkbox is also checked off. it should be unchecked when it’s newly created.
This commit is contained in:
parent
1391d202a9
commit
0650c40d9d
@ -100,6 +100,13 @@ FlowyKeyEventHandler enterWithoutShiftInTextNodesHandler =
|
|||||||
final needCopyAttributes = StyleKey.globalStyleKeys
|
final needCopyAttributes = StyleKey.globalStyleKeys
|
||||||
.where((key) => key != StyleKey.heading)
|
.where((key) => key != StyleKey.heading)
|
||||||
.contains(textNode.subtype);
|
.contains(textNode.subtype);
|
||||||
|
Attributes attributes = {};
|
||||||
|
if (needCopyAttributes) {
|
||||||
|
attributes = Attributes.from(textNode.attributes);
|
||||||
|
if (attributes.check) {
|
||||||
|
attributes[StyleKey.checkbox] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
final afterSelection = Selection.collapsed(
|
final afterSelection = Selection.collapsed(
|
||||||
Position(path: textNode.path.next, offset: 0),
|
Position(path: textNode.path.next, offset: 0),
|
||||||
);
|
);
|
||||||
@ -107,8 +114,7 @@ FlowyKeyEventHandler enterWithoutShiftInTextNodesHandler =
|
|||||||
..insertNode(
|
..insertNode(
|
||||||
textNode.path.next,
|
textNode.path.next,
|
||||||
textNode.copyWith(
|
textNode.copyWith(
|
||||||
attributes:
|
attributes: attributes,
|
||||||
needCopyAttributes ? Attributes.from(textNode.attributes) : {},
|
|
||||||
delta: textNode.delta.slice(selection.end.offset),
|
delta: textNode.delta.slice(selection.end.offset),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user