mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 04:01:48 +08:00
fixed failing scenario: If parent is not set to true but some sub toggles are set to true a user should be able to set the parent toggle to true and make all subs true (with intervention)
This commit is contained in:
parent
f6aa867c4a
commit
7d2e962966
@ -171,18 +171,33 @@ class HighlightToggle extends Component<ToggleProps, {}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onToggle(): void {
|
onToggle(): void {
|
||||||
|
if(this.props.isToggledOn){
|
||||||
for (let element of this.props.elementsToHighlight) {
|
for (let element of this.props.elementsToHighlight) {
|
||||||
const targetElement = getTargetElement(element.target[0]);
|
const targetElement = getTargetElement(element.target[0]);
|
||||||
this.higlightRuleLocation(targetElement, !this.props.isToggledOn);
|
if(this.props.highlightedElementsMap.get(targetElement) && this.props.highlightedElementsMap.get(targetElement).isHighlighted){
|
||||||
if (this.props.highlightedElementsMap.get(targetElement)) {
|
this.higlightRuleLocation(targetElement, false);
|
||||||
this.saveElementDataToMap(
|
this.saveElementDataToMap(
|
||||||
targetElement,
|
targetElement,
|
||||||
!this.props.highlightedElementsMap.get(targetElement).isHighlighted,
|
false,
|
||||||
this.props.highlightedElementsMap.get(targetElement).originalOutline,
|
this.props.highlightedElementsMap.get(targetElement).originalOutline,
|
||||||
this.props.type
|
this.props.type
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (let element of this.props.elementsToHighlight) {
|
||||||
|
const targetElement = getTargetElement(element.target[0]);
|
||||||
|
if(this.props.highlightedElementsMap.get(targetElement) && !this.props.highlightedElementsMap.get(targetElement).isHighlighted){
|
||||||
|
this.higlightRuleLocation(targetElement, true);
|
||||||
|
this.saveElementDataToMap(
|
||||||
|
targetElement,
|
||||||
|
true,
|
||||||
|
this.props.highlightedElementsMap.get(targetElement).originalOutline,
|
||||||
|
this.props.type
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user