PluginProbe
Tableberg – Simple Gutenberg Table Block / 0.0.2
Tableberg – Simple Gutenberg Table Block v0.0.2
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 0.5.8 All 41 releases
tableberg / src / get-classes.ts

get-classes.ts in Tableberg – Simple Gutenberg Table Block 0.0.2, at src/get-classes.ts

23 lines 720 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 //@ts-ignore
2 import { isUndefined, trim, isEmpty } from "lodash";
3 import { TablebergBlockAttrs } from "./types";
4
5 export function getStyleClass(attributes: TablebergBlockAttrs) {
6 const { tableWidth, tableAlignment, enableInnerBorder } = attributes;
7 const isValueEmpty = (value: any) => {
8 return (
9 isUndefined(value) ||
10 value === false ||
11 trim(value) === "" ||
12 trim(value) === "undefined undefined undefined" ||
13 isEmpty(value)
14 );
15 };
16
17 return {
18 "has-table-width": !isValueEmpty(tableWidth),
19 "has-inner-border": enableInnerBorder,
20 [`justify-table-${tableAlignment}`]: !isValueEmpty(tableAlignment),
21 };
22 }
23