Skip to content

Commit d91c24b

Browse files
authored
Fix select/deselect issues with data population and form clearing with multiple images editing (develop) (#5185)
* Fix data not being picked up when multiple images are edited * Deselect all to clear the form
1 parent 609b93d commit d91c24b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

scripts/apps/search/MultiImageEdit.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export function MultiImageEditController(
7373
$scope.images.forEach((image) => {
7474
image.selected = true;
7575
});
76+
updateMetadata();
7677
}
7778
};
7879

@@ -81,6 +82,7 @@ export function MultiImageEditController(
8182
$scope.images.forEach((image) => {
8283
image.selected = false;
8384
});
85+
updateMetadata();
8486
}
8587
};
8688

scripts/core/ui/components/PlainTextEditor/PlainTextEditor.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ export class PlainTextEditor extends React.Component<IProps, IState> {
139139
* This version works fine and we can still handle our own selection state
140140
* */
141141
UNSAFE_componentWillReceiveProps(props: IProps) {
142-
if (this.lastComputedValue !== props.value) {
143-
this.setState({editorState: updateStateWithValue(props.value || '', this.state.editorState)});
142+
const newValue = props.value || '';
143+
144+
if (this.lastComputedValue !== newValue) {
145+
this.lastComputedValue = newValue;
146+
this.setState({editorState: updateStateWithValue(newValue, this.state.editorState)});
144147
}
145148
}
146149

0 commit comments

Comments
 (0)