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 / blocks / move-lock.ts

move-lock.ts in Tableberg – Simple Gutenberg Table Block 1.2.0, at src/blocks/move-lock.ts

26 lines 769 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { isProAvailable } from "../pro-status";
2
3 /**
4 * Moving rows and columns is a pro feature, so without pro the row and cell
5 * blocks are locked against the editor's own movers and drag handle, which
6 * is also what the editor's padlock in the toolbar then says. With pro the
7 * lock is simply not there, so the core move handles work as they do on any
8 * other block.
9 *
10 * The lock is applied at registration rather than in block.json, since
11 * block.json can only carry one fixed default.
12 */
13 export function withMoveLock(attributes: Record<string, unknown>) {
14 if (isProAvailable()) {
15 return attributes;
16 }
17
18 return {
19 ...attributes,
20 lock: {
21 type: "object",
22 default: { move: true },
23 },
24 };
25 }
26