@aduptive/strapi-blockscene 2.0.0-alpha.11 → 2.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -10
- package/dist/admin.cjs +1081 -545
- package/dist/admin.mjs +1078 -542
- package/dist/server.cjs +135 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,7 +65,7 @@ Right beside the native zone label ("blocks (3)") each zone gets a short bar:
|
|
|
65
65
|
- **Undo and Redo** (Strapi 5, first zone only): icon and text, the shortcut in
|
|
66
66
|
the tooltip. See [Undo and redo](#undo-and-redo).
|
|
67
67
|
- **Editing mode** (first zone only, when a preview route exists): a
|
|
68
|
-
menu with Fields, Fields +
|
|
68
|
+
menu with Fields only, Fields + preview and Visual editor. Without a preview route the
|
|
69
69
|
menu is not shown; Settings, Blockscene says why.
|
|
70
70
|
- **"…" (More actions)**: Select blocks, and "Paste N blocks" while the
|
|
71
71
|
clipboard holds blocks this zone allows (see [Row actions](#row-actions)).
|
|
@@ -97,7 +97,8 @@ The modal is a block browser (80vw wide):
|
|
|
97
97
|
all"; the empty state offers a reset.
|
|
98
98
|
- **Cards**, grouped by typology: facet badges (IMAGE, VIDEO, GALLERY, RICH
|
|
99
99
|
TEXT, LIST, DYNAMIC, FORM), a star and an always-visible magnifying glass.
|
|
100
|
-
Clicking the card
|
|
100
|
+
Clicking the card, or focusing it and pressing Enter, inserts it immediately;
|
|
101
|
+
the magnifying glass opens its preview.
|
|
101
102
|
- The preview **magnifies** the block: the card grows into a large panel over the
|
|
102
103
|
grid (sidebar and top bar stay usable, the grid dims underneath) and shrinks
|
|
103
104
|
back into its card on close (close button, Esc or a click on the dimmed
|
|
@@ -106,8 +107,7 @@ The modal is a block browser (80vw wide):
|
|
|
106
107
|
with Fit / Mobile / Tablet / Desktop widths (scaled to fit, as in the page
|
|
107
108
|
preview) and a compact strip: label, uid, description, badges, fields (on
|
|
108
109
|
demand), the variant choice (see [Insert variants](#insert-variants)), star
|
|
109
|
-
and Insert.
|
|
110
|
-
(the first variant, when the block has variants).
|
|
110
|
+
and Insert. A direct card insert uses the first variant, when the block has variants.
|
|
111
111
|
|
|
112
112
|
The magnified preview shows the card's thumbnail at once and fades the live
|
|
113
113
|
page in over it once it has loaded. Live source, first match wins:
|
|
@@ -190,7 +190,7 @@ components: {
|
|
|
190
190
|
- **Choosing**: with two or more variants the magnified block shows them as a
|
|
191
191
|
row of buttons; the live preview follows the choice (`{variant}` in the
|
|
192
192
|
block preview URL, or the variant's block sent through the bridge) and
|
|
193
|
-
Insert inserts it.
|
|
193
|
+
Insert inserts it. Clicking the card or pressing Enter inserts the first variant.
|
|
194
194
|
The picker opened from a page preview insertion seam offers the same
|
|
195
195
|
choice. A block without variants behaves as before; Settings, Blockscene
|
|
196
196
|
lists each block's variants read-only.
|
|
@@ -215,6 +215,42 @@ components: {
|
|
|
215
215
|
per variant and 256 KB for all of them. An invalid variant is left out with
|
|
216
216
|
a warning naming the problem; the block keeps its valid ones.
|
|
217
217
|
|
|
218
|
+
### Starter kits
|
|
219
|
+
|
|
220
|
+
New entries can start from a named set of blocks instead of an empty Dynamic
|
|
221
|
+
Zone. Kits live in project code, per content type. When every editable zone is
|
|
222
|
+
empty, Blockscene opens the kit chooser once; choosing one only changes the
|
|
223
|
+
unsaved form, so every placeholder remains editable and **Start blank** keeps
|
|
224
|
+
the current behaviour.
|
|
225
|
+
|
|
226
|
+
```js
|
|
227
|
+
// config/plugins.js
|
|
228
|
+
blockscene: { config: {
|
|
229
|
+
kits: {
|
|
230
|
+
'api::page.page': [{
|
|
231
|
+
id: 'landing',
|
|
232
|
+
label: { en: 'Landing page', 'pt-BR': 'Página de campanha' },
|
|
233
|
+
// Optional. A language code such as "pt" also matches "pt-BR".
|
|
234
|
+
locales: ['en', 'pt-BR'],
|
|
235
|
+
zones: { blocks: [
|
|
236
|
+
{ __component: 'blocks.hero', title: 'Replace this headline' },
|
|
237
|
+
{ __component: 'blocks.rich-text', text: 'Replace this text.' },
|
|
238
|
+
] },
|
|
239
|
+
}],
|
|
240
|
+
},
|
|
241
|
+
} }
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Rows use the Content API shape and the same validated values as [insert
|
|
245
|
+
variants](#insert-variants). Schema defaults are merged in, nested components
|
|
246
|
+
work, and configured layout OPEN blocks receive their CLOSE automatically.
|
|
247
|
+
Media and relations are omitted because their ids are installation-specific;
|
|
248
|
+
required ones are called out in the server log and must be completed before
|
|
249
|
+
publishing. Invalid kits, missing required scalar values and kits below or
|
|
250
|
+
above a Dynamic Zone's bounds are ignored with a server warning. The chooser
|
|
251
|
+
is remembered for the current new-entry browser history item, so re-rendering
|
|
252
|
+
or reloading it does not apply or prompt twice.
|
|
253
|
+
|
|
218
254
|
## Row thumbnails
|
|
219
255
|
|
|
220
256
|
Each added block shows its thumbnail at the left of the native accordion
|
|
@@ -398,7 +434,7 @@ ignored (boot continues). `GET /blockscene/settings` returns them as
|
|
|
398
434
|
| Copy and Paste (`clipboard`) | yes/no | yes |
|
|
399
435
|
| Blocks hidden on the site (`hiddenBlocks`) | `strip` / `flag` / `off` | `strip` |
|
|
400
436
|
| Friendly field labels (`friendlyLabels`, see [Field labels](#field-labels)) | yes/no | yes |
|
|
401
|
-
| Page preview toolbar (`previewToolbar`, see [Pane toolbar](#pane-toolbar)) | ordered list of `modes`, `history`, `devices`, `status`, `actions` | all
|
|
437
|
+
| Page preview toolbar (`previewToolbar`, see [Pane toolbar](#pane-toolbar)) | ordered list of `modes`, `history`, `versions`, `devices`, `status`, `actions` | all six (`versions`: Strapi 5) |
|
|
402
438
|
| Page widths (`previewDevices`) | 1 to 8 of `fit`, `mobile`, `tablet`, `desktop`, `{ label, width }` | the four built-in |
|
|
403
439
|
|
|
404
440
|
Every edit view opens in its content type's mode, else the initial preview
|
|
@@ -433,7 +469,7 @@ the two supported versions only.
|
|
|
433
469
|
## Whole-page preview
|
|
434
470
|
|
|
435
471
|
Both distributions add a page preview with three modes, chosen from the
|
|
436
|
-
first zone's bar and from the pane toolbar: Fields (form), Fields +
|
|
472
|
+
first zone's bar and from the pane toolbar: Fields only (form), Fields + preview (side
|
|
437
473
|
by side: resizable pane, native actions moved to a bar above the form) and
|
|
438
474
|
Visual editor. It posts the live values of the first Dynamic Zone to a page
|
|
439
475
|
your frontend serves; the page renders them with its own components and styles
|
|
@@ -551,7 +587,8 @@ blocks use the native insertion at a position. Differences:
|
|
|
551
587
|
### Pane toolbar
|
|
552
588
|
|
|
553
589
|
Which controls the toolbar shows, and in which order, is `previewToolbar`:
|
|
554
|
-
`modes` (Fields, Fields +
|
|
590
|
+
`modes` (Fields only, Fields + preview, Visual editor), `history` (Undo, Redo),
|
|
591
|
+
`versions` (the version history drawer, Strapi 5),
|
|
555
592
|
`devices` (the width menu), `status` (Draft/Modified/Published and the unsaved
|
|
556
593
|
hint) and `actions` (Save, Publish). A missing id is hidden; `status` and
|
|
557
594
|
`actions` stay one group on the right, placed where the first of them is
|
|
@@ -974,11 +1011,47 @@ from what the document has now; fields the editor may not update, fields the
|
|
|
974
1011
|
schema no longer has, blocks whose component is no longer allowed, and media or
|
|
975
1012
|
related entries that no longer exist are left out and listed.
|
|
976
1013
|
|
|
1014
|
+
**Visual editor history (Phase 1).** The preview toolbar's `versions` control
|
|
1015
|
+
opens a drawer on the right. It is separate from `history` (Undo/Redo). If
|
|
1016
|
+
you already configured `previewToolbar`, add `versions` to that list or enable
|
|
1017
|
+
it in Settings. Versions are grouped by local calendar day, with local date
|
|
1018
|
+
and time, actor, action, and captured counts: total top-level Dynamic Zone rows
|
|
1019
|
+
(including group markers), added, removed and changed against the preceding
|
|
1020
|
+
snapshot in that locale. Older or unrecorded events show counts as unavailable;
|
|
1021
|
+
they are not retroactively counted as zero. The actor filter includes only
|
|
1022
|
+
people/tokens recorded for this document and locale. Lists use server pagination
|
|
1023
|
+
(25 per page) and mark events whose snapshots are no longer available.
|
|
1024
|
+
|
|
1025
|
+
Selecting an event hydrates its retained snapshot into a separate, read-only
|
|
1026
|
+
preview. It never calls the form's `setValues`, saves, publishes or restores
|
|
1027
|
+
anything. The banner identifies the version and returns to the current draft,
|
|
1028
|
+
including unsaved changes. Fast selections, returning while a load is pending,
|
|
1029
|
+
and document/locale/permission changes invalidate old responses. The pre-existing
|
|
1030
|
+
side-panel "Load this version" action remains available; restoration and visual
|
|
1031
|
+
diff enhancements are separate phases.
|
|
1032
|
+
|
|
1033
|
+
The parent rejects every mutation, selection, focus and hover message while
|
|
1034
|
+
viewing a version. Each version changes the iframe channel, so delayed messages
|
|
1035
|
+
cannot target the current draft after returning. The `update-page` message adds
|
|
1036
|
+
`readOnly: true`, sends no editable field/media descriptors and no clipboard.
|
|
1037
|
+
The reference bridge in `examples/page-preview` supports this flag, removes
|
|
1038
|
+
editing/insertion controls, and announces `capabilities: ['readOnly']` in `ready`.
|
|
1039
|
+
Custom bridges should do the same and refuse to queue or send edits when
|
|
1040
|
+
read-only. An older bridge can still render the snapshot, but the admin disables
|
|
1041
|
+
iframe interaction (including in-frame scrolling) and explains that it needs an
|
|
1042
|
+
update. Parent-side protection applies regardless of bridge support. The existing
|
|
1043
|
+
`hover` protocol highlights; it does not promise scroll-to-block behavior.
|
|
1044
|
+
|
|
1045
|
+
The drawer button also explains whether history is disabled/not configured for
|
|
1046
|
+
the type, the entry needs its first save, or `history.read` is missing. Permission
|
|
1047
|
+
changes require an administrator; this control cannot grant access.
|
|
1048
|
+
|
|
977
1049
|
**Permission.** `Blockscene: Read version history` (`history.read`), plus read
|
|
978
1050
|
access to the content type in the Content Manager. Snapshots hold removed and
|
|
979
1051
|
unpublished text, so the section is hidden without it. Admin API:
|
|
980
|
-
`GET /blockscene/history/:uid/:documentId?locale=`
|
|
981
|
-
snapshots
|
|
1052
|
+
`GET /blockscene/history/:uid/:documentId?locale=&page=1&pageSize=25&actor=`
|
|
1053
|
+
(no snapshots; `results`, `pagination`, scoped `actors` and resolved `locale`)
|
|
1054
|
+
and `GET /blockscene/history-events/:id` (one event, its snapshot and
|
|
982
1055
|
the media and relation targets that still exist).
|
|
983
1056
|
|
|
984
1057
|
**Retention.** Snapshots are kept `retentionDays` (90) and at most
|
|
@@ -987,6 +1060,10 @@ kept `eventDays` (365, at least `retentionDays`). A cron job added by the plugin
|
|
|
987
1060
|
runs nightly at 03:00 server time, in batches of 500; it only empties snapshots
|
|
988
1061
|
and deletes events, never media files, and running it on several instances is
|
|
989
1062
|
harmless.
|
|
1063
|
+
These are configurable limits, not a guarantee that a version from a week ago
|
|
1064
|
+
still exists: frequent changes can exceed `maxSnapshots` earlier. The snapshot
|
|
1065
|
+
cap is per document across locales; event metadata may outlive its snapshot.
|
|
1066
|
+
Naming versions and protecting them from purge are not implemented in Phase 1.
|
|
990
1067
|
|
|
991
1068
|
```js
|
|
992
1069
|
// config/plugins.js
|