Skip to content

Commit

Permalink
change(text-align): add clear selection if it's not found as last option
Browse files Browse the repository at this point in the history
  • Loading branch information
ichim-david committed Oct 27, 2022
1 parent fc26773 commit 7761417
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Widgets/TextAlign.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ export const TEXT_ALIGN_VALUE_MAP = [
['right', alignRightSVG, 'Right align'],
['center', alignCenterSVG, 'Center align'],
['justify', alignJustifySVG, 'Justify align'],
['', clearSVG, 'Clear selection'],
];

export default (props) => {
const { value, onChange, id, actions = TEXT_ALIGN_VALUE_MAP } = props;
// add clear selection button to the actions mapping if it's not already present
if (actions[actions.length - 1][0] !== '') {
actions.push(['', clearSVG, 'Clear selection']);
}

return (
<FormFieldWrapper {...props}>
<div className="align-tools">
Expand Down

0 comments on commit 7761417

Please sign in to comment.