# tableberg/1.1.5/src/extensions.tsx

Tableberg – Simple Gutenberg Table Block, version 1.1.5. 62 lines.

- Page: https://pluginprobe.com/plugins/tableberg/1.1.5/code/src/extensions.tsx
- Raw: https://pluginprobe.com/plugins/tableberg/1.1.5/raw/src/extensions.tsx
- Modified: 2026-09-16T03:30:32+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/tableberg/1.1.5/code/src/extensions.tsx#L10-L20`.

```tsx
import { ReactNode } from "react";
import { applyFilters } from "@wordpress/hooks";

import { CellElement, CellKey } from "./attributes";
import { BindableAttribute } from "./dynamic-data";

export interface ExtendedElementRendererProps {
    element: CellElement;
    cellCoords: CellKey;
    elementIndex: number;
}

export interface ExtendedElementDefinition {
    name: string;
    title: string;
    icon: ReactNode;
    blockName: string;
    create: () => CellElement;
    render: (props: ExtendedElementRendererProps) => ReactNode;
    bindableAttributes?: BindableAttribute[];
    autocompleteLabel?: string;
}

export function getExtendedElementDefinitions(): ExtendedElementDefinition[] {
    return applyFilters(
        "tableberg.extendedElementDefinitions",
        [] as ExtendedElementDefinition[]
    ) as ExtendedElementDefinition[];
}

export function getExtendedElementDefinition(
    name: string
): ExtendedElementDefinition | undefined {
    return getExtendedElementDefinitions().find(
        definition => definition.name === name
    );
}

export function createExtendedElement(name: string): CellElement | null {
    return getExtendedElementDefinition(name)?.create() ?? null;
}

export function renderExtendedElement(
    element: CellElement,
    cellCoords: CellKey,
    elementIndex: number
): ReactNode | null {
    return (
        getExtendedElementDefinition(element.name)?.render({
            element,
            cellCoords,
            elementIndex,
        }) ?? null
    );
}

export function getExtendedElementBlockName(
    element: CellElement
): string | undefined {
    return getExtendedElementDefinition(element.name)?.blockName;
}

```
