Skip to content

Commit 44928ae

Browse files
authored
Merge pull request #72 from eea/develop
feat(ColumnsBlockEdit.jsx): add delete column style button to the sidebar
2 parents 23343b3 + 3c08e80 commit 44928ae

4 files changed

Lines changed: 54 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. Dates are d
44

55
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
66

7+
### [6.3.0](https://github.com/eea/volto-columns-block/compare/6.2.0...6.3.0) - 5 April 2023
8+
9+
#### :rocket: New Features
10+
11+
- feat(ColumnsBlockEdit.jsx): add eraser icon for delete column style button [Miu Razvan - [`f966f37`](https://github.com/eea/volto-columns-block/commit/f966f375fe4384d8889ba41c36350156d378a113)]
12+
- feat(ColumnsBlockEdit.jsx): add delete column style button to the sidebar [Miu Razvan - [`9d895c2`](https://github.com/eea/volto-columns-block/commit/9d895c2ca446d3d683baeefc18eea602566f90d4)]
13+
14+
#### :nail_care: Enhancements
15+
16+
- refactor(eraserIcon): Change title tooltip to Clear column style [Alin Voinea - [`8b07013`](https://github.com/eea/volto-columns-block/commit/8b07013fb9596bde8a4519dd330cce0dfa082b95)]
17+
18+
#### :hammer_and_wrench: Others
19+
20+
- Release 6.3.0 [Alin Voinea - [`fed302e`](https://github.com/eea/volto-columns-block/commit/fed302e7ebe668db040e560d070367d22b283a01)]
721
### [6.2.0](https://github.com/eea/volto-columns-block/compare/6.1.0...6.2.0) - 4 April 2023
822

923
#### :house: Internal changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eeacms/volto-columns-block",
3-
"version": "6.2.0",
3+
"version": "6.3.0",
44
"description": "volto-columns-block: Volto add-on",
55
"main": "src/index.js",
66
"author": "European Environment Agency: IDM2 A-Team",

src/ColumnsBlock/ColumnsBlockEdit.jsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { makeStyleSchema, getStyle } from '../Styles';
3333

3434
import tuneSVG from '@plone/volto/icons/column.svg';
3535
import upSVG from '@plone/volto/icons/up.svg';
36-
36+
import eraserSVG from './icons/eraser.svg';
3737
import '../less/columns.less';
3838

3939
const messages = defineMessages({
@@ -175,6 +175,25 @@ class ColumnsBlockEdit extends React.Component {
175175
}
176176
};
177177

178+
deleteColumnStyle = () => {
179+
const colId = this.state.activeColumn;
180+
const { onChangeBlock, block, data } = this.props;
181+
const coldata = data.data;
182+
onChangeBlock(block, {
183+
...data,
184+
data: {
185+
...coldata,
186+
blocks: {
187+
...coldata.blocks,
188+
[colId]: {
189+
...coldata.blocks?.[colId],
190+
settings: {},
191+
},
192+
},
193+
},
194+
});
195+
};
196+
178197
onSelectBlock = (
179198
id,
180199
colId,
@@ -498,14 +517,29 @@ class ColumnsBlockEdit extends React.Component {
498517
<SidebarPortal selected={selected}>
499518
{this.state.activeColumn ? (
500519
<>
501-
<Segment>
520+
<Segment
521+
style={{
522+
display: 'flex',
523+
justifyContent: 'space-between',
524+
}}
525+
>
502526
<Button onClick={() => this.setState({ activeColumn: null })}>
503527
<Icon name={upSVG} size="14px" />
504528
<FormattedMessage
505529
id="Edit parent columns block"
506530
defaultMessage="Edit parent columns block"
507531
/>
508532
</Button>
533+
<button
534+
onClick={this.deleteColumnStyle}
535+
style={{ cursor: 'pointer' }}
536+
>
537+
<Icon
538+
name={eraserSVG}
539+
size="24px"
540+
title="Clear column style"
541+
/>
542+
</button>
509543
</Segment>
510544
<BlockDataForm
511545
schema={ColumnSchema}

src/ColumnsBlock/icons/eraser.svg

Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)