PluginProbe
Tableberg – Simple Gutenberg Table Block / 1.2.0
Tableberg – Simple Gutenberg Table Block v1.2.0
1.2.0 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 All 43 releases
tableberg / src / components / cell-inserter / items.ts

items.ts in Tableberg – Simple Gutenberg Table Block 1.2.0, at src/components/cell-inserter/items.ts

75 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { ReactNode } from "react";
2 import textBlockIcon from "@tableberg/shared/icons/text";
3 import buttonBlockIcon from "@tableberg/shared/icons/button";
4 import imageBlockIcon from "@tableberg/shared/icons/image";
5 import StyledListIcon from "@tableberg/shared/icons/styled-list";
6 import HtmlIcon from "@tableberg/shared/icons/html";
7 import IconIcon from "@tableberg/shared/icons/icon";
8 import StarRatingIcon from "@tableberg/shared/icons/star-rating";
9 import { ElementTypes } from "../../attributes";
10 import { getExtendedElementDefinitions } from "../../extensions";
11 import { isProAvailable } from "../../pro-status";
12
13 export interface InserterItem {
14 name: ElementTypes;
15 title: string;
16 icon: ReactNode;
17 disabled?: boolean;
18 isLocked?: boolean;
19 upsellSelected?: string;
20 }
21
22 const baseCellInserterItems: InserterItem[] = [
23 { name: "text", title: "Text", icon: textBlockIcon },
24 { name: "button", title: "Button", icon: buttonBlockIcon },
25 { name: "image", title: "Image", icon: imageBlockIcon },
26 { name: "list", title: "List", icon: StyledListIcon },
27 ];
28
29 export function getCellInserterItems(): InserterItem[] {
30 const lockedProItems: InserterItem[] = isProAvailable()
31 ? []
32 : [
33 {
34 name: "styled-list" as ElementTypes,
35 title: "Styled List",
36 icon: StyledListIcon,
37 isLocked: true,
38 upsellSelected: "tableberg/styled-list",
39 },
40 {
41 name: "icon" as ElementTypes,
42 title: "Icon",
43 icon: IconIcon,
44 isLocked: true,
45 upsellSelected: "tableberg/icon",
46 },
47 {
48 name: "star-rating" as ElementTypes,
49 title: "Star Rating",
50 icon: StarRatingIcon,
51 isLocked: true,
52 upsellSelected: "tableberg/star-rating",
53 },
54 {
55 name: "custom-html" as ElementTypes,
56 title: "Custom HTML",
57 icon: HtmlIcon,
58 isLocked: true,
59 upsellSelected: "tableberg/html",
60 },
61 ];
62
63 return [
64 ...baseCellInserterItems,
65 ...lockedProItems,
66 ...getExtendedElementDefinitions().map(definition => ({
67 name: definition.name as ElementTypes,
68 title: definition.title,
69 icon: definition.icon,
70 })),
71 ];
72 }
73
74 export const cellInserterItems = getCellInserterItems();
75