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 / hooks / block-editor-compat / useBlockCardUpdateShim.ts

useBlockCardUpdateShim.ts in Tableberg – Simple Gutenberg Table Block 1.1.5, at src/hooks/block-editor-compat/useBlockCardUpdateShim.ts

27 lines 840 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useCallback } from "react";
2
3 export function useBlockCardUpdateShim() {
4 return useCallback(
5 (element: HTMLElement, title: string, description: string) => {
6 const ownerDoc = element.ownerDocument;
7 const parentDoc =
8 ownerDoc.defaultView?.parent?.document || ownerDoc;
9
10 const blockCardTitle = parentDoc.querySelector(
11 ".block-editor-block-card__title"
12 );
13 if (blockCardTitle) {
14 blockCardTitle.textContent = title;
15 }
16
17 const blockCardDescription = parentDoc.querySelector(
18 ".block-editor-block-card__description"
19 );
20 if (blockCardDescription) {
21 blockCardDescription.textContent = description;
22 }
23 },
24 []
25 );
26 }
27