PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.1.5
Tableberg – Simple Gutenberg Table Block v1.1.5
1.1.5 1.1.4 1.1.3 1.1.2 1.1.1 1.1.0 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 trunk 0.0.2 0.2.1 0.3.2 0.3.3 0.4.1 0.5.0 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 All 42 releases
tableberg / src / components / ElementDeleteButton.tsx

ElementDeleteButton.tsx in Tableberg – Simple Gutenberg Table Block 1.1.5, at src/components/ElementDeleteButton.tsx

28 lines 745 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { ToolbarButton } from "@wordpress/components";
2 import { __ } from "@wordpress/i18n";
3 import { trash } from "@wordpress/icons";
4 import { CellKey } from "../attributes";
5 import { useTableStore } from "../store";
6
7 export function ElementDeleteButton({
8 cellCoords,
9 elementIndex,
10 }: {
11 cellCoords: CellKey;
12 elementIndex: number;
13 }) {
14 const removeElementFromCell = useTableStore(
15 state => state.removeElementFromCell
16 );
17
18 return (
19 <ToolbarButton
20 icon={trash}
21 label={__("Delete element", "tableberg")}
22 title={__("Delete element", "tableberg")}
23 isDestructive
24 onClick={() => removeElementFromCell(cellCoords, elementIndex)}
25 />
26 );
27 }
28