Clear the editor when clicking on the active bang.
This commit is contained in:
parent
d66b43e9fd
commit
28123cfb3f
|
@ -120,9 +120,18 @@ export class PageMain extends Component<Props, State> {
|
|||
const availableBangs = bangs.map((bang) => {
|
||||
const active = bang.id === this.state.editorBang.id ? 'active' : '';
|
||||
const onClick = () => {
|
||||
const allEqual = Object.entries(this.state.editorBang).every(
|
||||
([key, value]) => bang[key as keyof BangParameters] === value,
|
||||
);
|
||||
if (allEqual) {
|
||||
this.setState({
|
||||
editorBang: {...this.emptyBang},
|
||||
});
|
||||
} else {
|
||||
this.setState({
|
||||
editorBang: {...bang},
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return html`
|
||||
|
|
Loading…
Reference in New Issue