| 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 |
|