Skip to content

Commit ec57a92

Browse files
authored
chore: collapse pasted items by default (#848)
1 parent 3765406 commit ec57a92

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/root-cms/ui/components/DocEditor/DocEditor.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,12 +873,13 @@ function arrayReducer(state: ArrayFieldValue, action: ArrayAction) {
873873
[`${action.deepKey}._array`]: order,
874874
[`${action.deepKey}.${newKey}`]: newData,
875875
});
876+
// Don't add to `_new` so that the item is collapsed by default.
876877
const newlyAdded = state._new || [];
877878
return {
878879
...data,
879880
[newKey]: newData,
880881
_array: order,
881-
_new: [...newlyAdded, newKey],
882+
_new: newlyAdded,
882883
_pasted: newKey,
883884
};
884885
}
@@ -900,12 +901,13 @@ function arrayReducer(state: ArrayFieldValue, action: ArrayAction) {
900901
[`${action.deepKey}._array`]: order,
901902
[`${action.deepKey}.${newKey}`]: newData,
902903
});
904+
// Don't add to `_new` so that the item is collapsed by default.
903905
const newlyAdded = state._new || [];
904906
return {
905907
...data,
906908
[newKey]: newData,
907909
_array: order,
908-
_new: [...newlyAdded, newKey],
910+
_new: newlyAdded,
909911
_pasted: newKey,
910912
};
911913
}

0 commit comments

Comments
 (0)