canopycms 0.10.0 → 0.11.1
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/CHANGELOG.md +72 -48
- package/dist/editor/Editor.js +44 -24
- package/dist/editor/PreviewFrame.d.ts +8 -1
- package/dist/editor/PreviewFrame.js +15 -2
- package/dist/editor/PreviewPane.d.ts +7 -2
- package/dist/editor/PreviewPane.js +6 -5
- package/dist/editor/PreviewToolbarTools.d.ts +6 -0
- package/dist/editor/PreviewToolbarTools.js +6 -1
- package/dist/editor/comments/CommentThreadsPopover.d.ts +2 -0
- package/dist/editor/comments/CommentThreadsPopover.js +9 -1
- package/dist/editor/comments/FieldWrapper.js +3 -1
- package/dist/editor/comments/ThreadReplyControls.js +5 -2
- package/dist/editor/hooks/useEditorLayout.d.ts +4 -0
- package/dist/editor/hooks/useEditorLayout.js +5 -0
- package/dist/editor/hooks/usePreviewFollow.d.ts +26 -0
- package/dist/editor/hooks/usePreviewFollow.js +54 -0
- package/dist/editor/preview-bridge.d.ts +25 -0
- package/dist/editor/preview-bridge.js +175 -0
- package/dist/preview.d.ts +2 -2
- package/dist/preview.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,9 +5,9 @@ packages release together, at one version.
|
|
|
5
5
|
|
|
6
6
|
## This build
|
|
7
7
|
|
|
8
|
-
Version `0.
|
|
8
|
+
Version `0.11.1`, built from [`3e35fb5`](https://github.com/safeinsights/canopycms/tree/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e).
|
|
9
9
|
|
|
10
|
-
Its entries are [0.
|
|
10
|
+
Its entries are [0.11.1](#0111), under **Released**.
|
|
11
11
|
|
|
12
12
|
If you upgraded from a build on another branch, compare the `<!-- changeset: … -->` slugs in your previous build's `CHANGELOG.md` (`npm pack canopycms@<old>` fetches it) with this one's: entries whose slug your old file lacks are new to you.
|
|
13
13
|
|
|
@@ -24,7 +24,7 @@ Each entry has up to three parts:
|
|
|
24
24
|
`node_modules/canopycms/CHANGELOG.md`, assembled for that build: its **This build** section lists
|
|
25
25
|
what is new since the previous int on the same branch, or on a stable release links its entries, and its links point at the commit the build
|
|
26
26
|
came from. The copy in the repository holds released history and the entries from before changesets;
|
|
27
|
-
every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/
|
|
27
|
+
every entry written since is a file in [`.changeset/`](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/.changeset/README.md) until a stable release
|
|
28
28
|
moves it here.
|
|
29
29
|
|
|
30
30
|
**Find your starting point.** From a stable pin, start at the first version under **Released**
|
|
@@ -62,6 +62,30 @@ entries under **Released**.
|
|
|
62
62
|
|
|
63
63
|
## Released
|
|
64
64
|
|
|
65
|
+
### 0.11.1
|
|
66
|
+
|
|
67
|
+
#### A comment thread you can't resolve shows Resolve disabled, with the reason
|
|
68
|
+
|
|
69
|
+
<!-- changeset: resolve-disabled-with-reason -->
|
|
70
|
+
|
|
71
|
+
_First in 0.11.1._
|
|
72
|
+
|
|
73
|
+
**What changed.** On a thread someone else started, a user outside Reviewers and Admins used to see Reply but no Resolve, with nothing to say why. Resolve now stays in place, disabled, and its tooltip explains that only the person who started the thread or a reviewer can resolve it, and suggests replying to let them know it's done. Who may resolve a thread is unchanged.
|
|
74
|
+
|
|
75
|
+
### 0.11.0
|
|
76
|
+
|
|
77
|
+
#### The preview follows the form to the field you're on
|
|
78
|
+
|
|
79
|
+
<!-- changeset: preview-follows-form -->
|
|
80
|
+
|
|
81
|
+
_First in 0.11.0._
|
|
82
|
+
|
|
83
|
+
**What changed.** Focusing a field in the form, or opening its comments, scrolls the preview to the element the page marks for that field with `fieldProps`, else to the first mark inside it, else to its nearest marked ancestor, and outlines it briefly. Nothing moves when the element already shows as much as it can, focus stays in the form, focus coming back to the same field leaves the preview where you scrolled it, and reduced motion jumps instead of scrolling. It is on by default; the preview toolbar's "Scroll the preview to the field you're on" toggle turns it off, remembered per browser like the other preview controls. The editor sends a new `canopycms:preview:reveal` message, which a page accepts only from its editor, as it does the others.
|
|
84
|
+
|
|
85
|
+
**To adopt.** Nothing for a page on `useCanopyPreview` or `withCanopyPreview` once it runs this version of `canopycms/preview`. A page on an older version ignores the message, so the preview just doesn't follow. A page that wires the bridge's hooks itself adds `usePreviewReveal({ editorOrigin })` beside `usePreviewHighlight`.
|
|
86
|
+
|
|
87
|
+
**Now deletable.** Nothing.
|
|
88
|
+
|
|
65
89
|
### 0.10.0
|
|
66
90
|
|
|
67
91
|
#### Archived branches move out of the way, with optional retention
|
|
@@ -84,7 +108,7 @@ _First in 0.9.0._
|
|
|
84
108
|
|
|
85
109
|
**What changed.** A new scalar field type, `date`, holds a calendar day as a `YYYY-MM-DD` string, edited with a day picker. `datetime` stores an instant, so a day picked in one zone can read as the day before in another; a `date` is the same day everywhere. A save and a production build refuse a value that is not a real day, such as `2026-02-30` or `2026-5-1`; YAML rolls an unquoted `2026-02-30` forward first, so quote hand-written days. A hand-written unquoted `2024-05-01` in md or mdx frontmatter reads as that day in every zone, and survives a save on its own line. `list: true` is refused on a `date`; use an object list with a `date` field inside, which `itemTitleField` may name. `stampOnPublish` stays on `datetime`, and `datetime` values and checks are unchanged. Editor field errors now meet 4.5:1 contrast.
|
|
86
110
|
|
|
87
|
-
**To adopt.** Change `type: 'string'` to `type: 'date'` on a field that holds `YYYY-MM-DD`: `TypeFromEntrySchema` still gives `string`, and every `YYYY-MM-DD` value stays as it is. A production build lists any entry whose value is not a real day, such as `2026-5-1`; fix those by hand. A custom field type that was named `date` keeps its `customRenderers` entry but is now checked as a `date`, so rename it if its values differ. See [Field Types](https://github.com/safeinsights/canopycms/blob/
|
|
111
|
+
**To adopt.** Change `type: 'string'` to `type: 'date'` on a field that holds `YYYY-MM-DD`: `TypeFromEntrySchema` still gives `string`, and every `YYYY-MM-DD` value stays as it is. A production build lists any entry whose value is not a real day, such as `2026-5-1`; fix those by hand. A custom field type that was named `date` keeps its `customRenderers` entry but is now checked as a `date`, so rename it if its values differ. See [Field Types](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/.changeset/README.md#field-types).
|
|
88
112
|
|
|
89
113
|
**Now deletable.** A `string` field with a hand-written `YYYY-MM-DD` format check, and site code that reads a `datetime` back into a day.
|
|
90
114
|
|
|
@@ -360,7 +384,7 @@ _First in 0.7.0._
|
|
|
360
384
|
|
|
361
385
|
**What changed.** The pull request a submit opens now lists the branch's unresolved editor comment threads: where each one is, the first line of its first comment (80 characters at most) and a link to it in the editor. Once every thread is resolved, it says so. The list is updated whenever a comment is added, replied to or resolved, as well as on submit. Comment excerpts are visible to everyone who can read the pull request, which on a public repository means everyone. Open threads do not block the merge or keep the pull request in draft. A pull request opened before this release shows no list until its branch is next submitted.
|
|
362
386
|
|
|
363
|
-
**To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
387
|
+
**To adopt.** Nothing, if your deploy replaces the worker along with the CMS, as `cdk deploy` of the canopycms-cdk stack does with the default `workerCode`. A worker on an earlier release fails each update of the list and marks the branch's sync failed until a later task succeeds, so a pipeline that leaves the worker behind must roll it no later than the CMS: see [Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#rolling-the-worker-from-ci).
|
|
364
388
|
|
|
365
389
|
#### Pull request bodies link back to the editor
|
|
366
390
|
|
|
@@ -370,7 +394,7 @@ _First in 0.7.0._
|
|
|
370
394
|
|
|
371
395
|
**What changed.** The pull request a submit opens links to the branch in the editor, and each changed entry to that entry. A notice tells reviewers that comments on the pull request do not reach the editor, so the author will not see them. The links use the editor's URL from the submit, accepted only when its host is the one the request was addressed to (`X-Forwarded-Host`, else `Host`), which holds behind `canopycms-cdk`'s CloudFront distribution as it stands.
|
|
372
396
|
|
|
373
|
-
**To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/
|
|
397
|
+
**To adopt.** Nothing, unless a proxy in front of the CMS sets neither header to the editor's public host: then set `editorUrl` in your Canopy config to the editor page's URL, e.g. `editorUrl: 'https://cms.example.org/edit'`. See [the config reference](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#definecanopyconfig-options).
|
|
374
398
|
|
|
375
399
|
#### CloudFront origin read timeout accepted up to 120 s; the editor waits 135 s
|
|
376
400
|
|
|
@@ -456,7 +480,7 @@ _First in 0.6.0._
|
|
|
456
480
|
|
|
457
481
|
**What changed.** `CanopyCmsService` takes `clerkOrganizationsAsGroups` (default `true`, unchanged), which the worker honours; in a deployment it, not the plugin's `useOrganizationsAsGroups`, decides the groups. When Clerk refuses the organization list with a 403 (Organizations disabled), the refresh now writes users with no groups and logs a warning, instead of failing whole; any other failure still keeps the last snapshot. Memberships are fetched instance-wide rather than per user. The scaffolds write `false` explicitly: `useOrganizationsAsGroups` in `canopycms init`'s `canopy.ts`, and `clerkOrganizationsAsGroups` in `canopycms init-deploy aws`'s CDK stack.
|
|
458
482
|
|
|
459
|
-
**To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/
|
|
483
|
+
**To adopt.** On a Clerk instance without Organizations, set `clerkOrganizationsAsGroups: false` on `CanopyCmsService` and `useOrganizationsAsGroups: false` in `createClerkAuthPlugin`. See [Deploying to AWS](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md).
|
|
460
484
|
|
|
461
485
|
### 0.5.0
|
|
462
486
|
|
|
@@ -468,7 +492,7 @@ _First in 0.5.0._
|
|
|
468
492
|
|
|
469
493
|
**What changed.** A `type: 'reference', list: true` field now edits as rows in stored order, like an `object` list: drag a row or use its "…" menu to move or remove it, open a row to swap its entry in place, and pick from Add under the rows to append. Neither control offers an entry the list already holds. Any `list: true` field, and any `block` field, takes `maxItems`. The editor stops adding at the cap and says why, a save over it is refused, and a production build fails on an entry over it, naming the entry, field, count and cap. Adding `maxItems` to a list that already holds more therefore fails the build until an editor removes the extra items. `maxItems` on a field that holds no items is refused when the entry schema registry is created.
|
|
470
494
|
|
|
471
|
-
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/
|
|
495
|
+
**To adopt.** Set `maxItems: 3` on the list field in its entry schema. See [Field Types](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#field-types).
|
|
472
496
|
|
|
473
497
|
#### SEO field location moves into config; reference pickers mark hidden entries and take a sort order — **breaking: `createNextCanopyContext({ seo })` and `AIContentConfig.seo` are removed**
|
|
474
498
|
|
|
@@ -478,7 +502,7 @@ _First in 0.5.0._
|
|
|
478
502
|
|
|
479
503
|
**What changed.** `defineCanopyConfig` takes `seo: { group?, fields? }`, the one place every surface reads an entry's `noindex` flag: the sitemap and `entryToMetadata` that `createNextCanopyContext` returns, AI content and the editor's reference picker. A per-call `seo`/`group`/`fields` still overrides it. The free `generateContentSitemap` takes `seo` as an argument and refuses to run without it when the config sets one; `createNextCanopyContext` and the AI content config refuse a leftover `seo`. A reference picker now badges an entry hidden from search as "Hidden from search", and picking one adds a note naming the setting on that entry's form, since a page listing only indexed entries won't show it. A reference field takes `optionSort`: `'label'` (the default), `'collection'`, or `{ field, direction }`. Point `field` at an ISO date, since strings compare as text.
|
|
480
504
|
|
|
481
|
-
**To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
505
|
+
**To adopt.** Move `seo` from `createNextCanopyContext({ seo })` and from `defineAIContentConfig({ seo })` into `defineCanopyConfig({ seo })`. See [Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#sitemap-and-seo-metadata) and [How References Work in the Editor](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#how-references-work-in-the-editor).
|
|
482
506
|
|
|
483
507
|
**Now deletable.** A shared `seo` constant passed separately to the Next context and the AI content config.
|
|
484
508
|
|
|
@@ -506,7 +530,7 @@ resolved without it.
|
|
|
506
530
|
**To adopt.** Where a reference renders its target's prose, set `includeBody: true` on that
|
|
507
531
|
reference field. Code that reads the body from a link-only reference's resolved type now sees
|
|
508
532
|
`string | undefined`; either set `includeBody: true` or handle the missing value. See
|
|
509
|
-
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/
|
|
533
|
+
[Resolving References in a Listing](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#resolving-references-in-a-listing).
|
|
510
534
|
|
|
511
535
|
### 0.3.3
|
|
512
536
|
|
|
@@ -923,7 +947,7 @@ URL.
|
|
|
923
947
|
2. For a branch preview: wrap views with `withCanopyPreview` in a `'use client'` module, add
|
|
924
948
|
`app/preview/[[...path]]/page.server.tsx`, set `editor.previewPrefix: '/preview'`, and serve that
|
|
925
949
|
route with `frame-ancestors 'self'`, not `X-Frame-Options: DENY` (see
|
|
926
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
950
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#live-preview)).
|
|
927
951
|
3. A test reading view content from the route's server HTML must load the page in a browser.
|
|
928
952
|
Server output rendered during a preview request carries the signed-in asset prefix; keep it out
|
|
929
953
|
of cross-request caches (`unstable_cache`, module memos).
|
|
@@ -938,7 +962,7 @@ kept site styles ahead of Mantine's in the preview.
|
|
|
938
962
|
server components. A string path marks the form's spelling (`'a.0.b'` marks `a[0].b`), and an empty
|
|
939
963
|
path marks nothing. The editor counts and logs marks naming no field. `createEntrySchemaRegistry`
|
|
940
964
|
refuses a field name that is empty, all digits or contains `.`, `[` or `]`. See
|
|
941
|
-
[Live Preview](https://github.com/safeinsights/canopycms/blob/
|
|
965
|
+
[Live Preview](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#live-preview).
|
|
942
966
|
|
|
943
967
|
**To adopt.** Fix each path that stops compiling; the error lists valid ones. Rewrite computed paths
|
|
944
968
|
as literal segments, or type that component's prop as plain `FieldProps`. Pass `fieldProps` as
|
|
@@ -1020,7 +1044,7 @@ or a failed render) renders as its plain text, with no URL; any other form of th
|
|
|
1020
1044
|
fields are nested or renamed, pass the AI config's `seo` the same object you pass
|
|
1021
1045
|
`createNextCanopyContext({ seo })`, so the sitemap and AI content read the flag from the same
|
|
1022
1046
|
place. A field that links to a hidden section by plain URL needs a field transform; the README
|
|
1023
|
-
shows [the recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1047
|
+
shows [the recipe](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#ai-content-configuration).
|
|
1024
1048
|
|
|
1025
1049
|
**Now deletable.** An `exclude.where` that re-read the `noindex` flag by hand.
|
|
1026
1050
|
|
|
@@ -1042,7 +1066,7 @@ A `markdown` field with `renderAs: 'mdx'` is checked as MDX, and `mdxAllow` narr
|
|
|
1042
1066
|
field or site-wide. New: field options `renderAs`, `mdxAllow`; config key `mdxAllow`; type
|
|
1043
1067
|
`MdxAllowlist`. (int.110) A component prop allowance can be `'string'` (or
|
|
1044
1068
|
`{ type: 'string', maxLength }`): a quoted value only, never bare or `{…}`. See
|
|
1045
|
-
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/
|
|
1069
|
+
[MDX content cannot run code](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#mdx-content-cannot-run-code).
|
|
1046
1070
|
|
|
1047
1071
|
**To adopt.** Set `renderAs: 'mdx'` on each `markdown` field your site compiles as MDX, and
|
|
1048
1072
|
`mdxAllow` to what your renderer takes. Set `executable: true` only on a field whose editors you
|
|
@@ -1179,7 +1203,7 @@ a format check.
|
|
|
1179
1203
|
|
|
1180
1204
|
- (int.93) Submit commits gain an `Edited-by: Name (id)` trailer; PR bodies gain a section that
|
|
1181
1205
|
re-submits replace, keeping human text. Options: `gitEditedByTrailers`, `gitCoAuthoredByTrailers`
|
|
1182
|
-
([reference](https://github.com/safeinsights/canopycms/blob/
|
|
1206
|
+
([reference](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#definecanopyconfig-options)).
|
|
1183
1207
|
- (int.110) Submit-commit trailers name every user who saved since the last submit commit, and
|
|
1184
1208
|
the PR-body section every user who edited the branch, not only the submitter; settings commits
|
|
1185
1209
|
(permissions, groups) carry the acting user's trailer.
|
|
@@ -1203,7 +1227,7 @@ saves only push the branch, and no failing PR task lands in System health.
|
|
|
1203
1227
|
that entry type goes unavailable: the editor says so, and its entries answer 503 with
|
|
1204
1228
|
`code: 'SCHEMA_UNAVAILABLE'`. Builds, static deploys and `generate-ai-content` still fail. The
|
|
1205
1229
|
worker holds the base branch for up to 30 minutes while that lasts; see
|
|
1206
|
-
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/
|
|
1230
|
+
[New schemas wait for the editor deploy](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#new-schemas-wait-for-the-editor-deploy).
|
|
1207
1231
|
Public types gain optional `unavailable` on `EntryTypeConfig` and `FlatSchemaItem`, optional
|
|
1208
1232
|
`ApiResponse.code`, and a required `SchemaResolutionResult.issues`.
|
|
1209
1233
|
|
|
@@ -1241,7 +1265,7 @@ hang until the drain heartbeat lets termination continue. Its in-flight task is
|
|
|
1241
1265
|
new stack needs no steps.
|
|
1242
1266
|
|
|
1243
1267
|
**What changed.** (int.109) Detailed in
|
|
1244
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1268
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#the-worker-instance): IMDSv2 with a hop limit of 1; the
|
|
1245
1269
|
bundle is one file whose sha256 user data checks, readable as that one object; a file-system policy
|
|
1246
1270
|
refusing clients without TLS or IAM, replacing the worker's
|
|
1247
1271
|
`AmazonElasticFileSystemClientReadWriteAccess`; an encrypted gp3 root volume; a boot-time upgrade to
|
|
@@ -1295,10 +1319,10 @@ failure and exits non-zero on `selfStopped`, with a code outside `RestartPrevent
|
|
|
1295
1319
|
with its hash, as `worker/dist/index.js` and `index.js.sha256`. The default, `'asset'`, is
|
|
1296
1320
|
unchanged.
|
|
1297
1321
|
- `CanopyCmsService` alarms when the worker logs no git sync for 30 minutes. See
|
|
1298
|
-
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/
|
|
1322
|
+
[Worker-down alarm](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#worker-down-alarm).
|
|
1299
1323
|
|
|
1300
1324
|
**To adopt.** Optional. For parameter-only change sets, see
|
|
1301
|
-
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/
|
|
1325
|
+
[Rolling the worker from CI](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#rolling-the-worker-from-ci). For the alarm, pass
|
|
1302
1326
|
`alarmTopic`.
|
|
1303
1327
|
|
|
1304
1328
|
**Now deletable.** A manual `cdk deploy` after each canopycms bump whose only purpose is moving the
|
|
@@ -1309,7 +1333,7 @@ worker, and a hand-built alarm on the worker log group.
|
|
|
1309
1333
|
**What changed.** (int.112) The boot's `dnf upgrade` could be OOM-killed on every retry. A 1 GiB
|
|
1310
1334
|
swap file now goes on first; an upgrade that still fails starts the worker unpatched and notifies
|
|
1311
1335
|
`alarmTopic` if set; a retried step names itself when it gives up. See
|
|
1312
|
-
[The worker instance](https://github.com/safeinsights/canopycms/blob/
|
|
1336
|
+
[The worker instance](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#the-worker-instance).
|
|
1313
1337
|
|
|
1314
1338
|
**To adopt.** Deploy, which replaces the worker instance. The bundle needs none of this, so it is
|
|
1315
1339
|
not Template first and the worker contract stays at 1.
|
|
@@ -1375,7 +1399,7 @@ and operations may reuse GitHub fetches under 30 seconds old.
|
|
|
1375
1399
|
|
|
1376
1400
|
**To adopt.** Nothing. Seeding `remote.git` stages a copy of the repository beside the gateway's
|
|
1377
1401
|
mirror, so the root volume needs room for two
|
|
1378
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
1402
|
+
([details](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#the-worker-instance)).
|
|
1379
1403
|
|
|
1380
1404
|
#### The worker follows a rebased or deleted GitHub branch
|
|
1381
1405
|
|
|
@@ -1397,7 +1421,7 @@ changes the template too (the fallback bundle's key and hash), so only the contr
|
|
|
1397
1421
|
bundle-only roll is safe.
|
|
1398
1422
|
|
|
1399
1423
|
**To adopt.** Parameter mode: gate bundle-only rolls on the contract
|
|
1400
|
-
([recipe](https://github.com/safeinsights/canopycms/blob/
|
|
1424
|
+
([recipe](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#rolling-the-worker-from-ci)). The gate refuses a stack without the
|
|
1401
1425
|
`WorkerContract` output, so `cdk deploy` the template once, which adds it. A hand-installed unit
|
|
1402
1426
|
copies its `Environment=CANOPYCMS_WORKER_CONTRACT=` line from `worker/canopy-worker.service`.
|
|
1403
1427
|
|
|
@@ -1414,8 +1438,8 @@ units from the bundle's contract: 2 gets the split, an older bundle the single u
|
|
|
1414
1438
|
template, then roll the bundle; on an older template it stops with `template too old for this
|
|
1415
1439
|
bundle`. Inspect EFS only through `sudo /opt/canopy-worker/canopy-inspect <command>`, never from a root shell. A hand install
|
|
1416
1440
|
takes `worker/`'s three units and `gateway.env.example`
|
|
1417
|
-
([steps](https://github.com/safeinsights/canopycms/blob/
|
|
1418
|
-
[checklist](https://github.com/safeinsights/canopycms/blob/
|
|
1441
|
+
([steps](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#installing-the-units-by-hand)). After the first deploy, run the
|
|
1442
|
+
[checklist](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#first-deploy-checklist).
|
|
1419
1443
|
|
|
1420
1444
|
#### `canopycms-cdk`: `CanopyCmsService.attachTo`, and editor response headers — **behaviour change if you frame the CMS**
|
|
1421
1445
|
|
|
@@ -1426,7 +1450,7 @@ response headers policy. `CanopyCmsDistribution` sends the same headers: `frame-
|
|
|
1426
1450
|
`X-Frame-Options: SAMEORIGIN`, `nosniff`, HSTS and `X-Robots-Tag: noindex`. Unless your app sends
|
|
1427
1451
|
its own framing headers, no other origin can frame the editor or any page the CMS domain serves. Every such page is
|
|
1428
1452
|
marked `noindex`. The editor's default preview is same-origin and unaffected. See
|
|
1429
|
-
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/
|
|
1453
|
+
[Serving the editor from a distribution you already own](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#serving-the-editor-from-a-distribution-you-already-own).
|
|
1430
1454
|
|
|
1431
1455
|
**To adopt.** If you wired the Function URL into your own distribution by hand, delete those
|
|
1432
1456
|
behaviors and call `attachTo`, passing your CMS build's `assetPrefix` as `editorAssetPrefix` and a
|
|
@@ -1602,7 +1626,7 @@ one the exclusions leave out. A throw or any other return is logged and treated
|
|
|
1602
1626
|
**To adopt.** If your site's routes, sitemap or bylines decide that some entries have no page,
|
|
1603
1627
|
apply the same rule here, for example `referenceLink: (target, { body }) =>
|
|
1604
1628
|
!body?.trim() ? false : undefined` in `defineAIContentConfig` from `canopycms/ai`. See
|
|
1605
|
-
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
1629
|
+
[AI Content Configuration](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#ai-content-configuration).
|
|
1606
1630
|
|
|
1607
1631
|
**Now deletable.** A `fieldTransforms` entry that re-renders a reference field only to drop or
|
|
1608
1632
|
change its link.
|
|
@@ -1677,7 +1701,7 @@ _First in int.115._
|
|
|
1677
1701
|
entry the base branch also changed, the "updated on the base branch" notice and the branch's
|
|
1678
1702
|
conflict count now stay until the branch merges, so a reviewer still sees which entries replaced a
|
|
1679
1703
|
base change. They used to clear on the next sync, about five minutes later. README's new [Drafts
|
|
1680
|
-
and Unpublishing](https://github.com/safeinsights/canopycms/blob/
|
|
1704
|
+
and Unpublishing](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#drafts-and-unpublishing) section covers long-lived branches and
|
|
1681
1705
|
unpublishing.
|
|
1682
1706
|
|
|
1683
1707
|
#### The editor calls the content drawer "All content"
|
|
@@ -1989,7 +2013,7 @@ editor carries an unsaved draft of a stamped entry onto its stamped version.
|
|
|
1989
2013
|
The flag is refused off a top-level `datetime`, on `list: true`, and with `required: true`.
|
|
1990
2014
|
|
|
1991
2015
|
**To adopt.** Add `stampOnPublish: true` to the date field your site sorts or labels by, such as
|
|
1992
|
-
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/
|
|
2016
|
+
`{ name: 'publishedAt', type: 'datetime', stampOnPublish: true }`. See [Stamping a publication date](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#stamping-a-publication-date).
|
|
1993
2017
|
|
|
1994
2018
|
**Now deletable.** A build step or hook that writes a missing publication date into new entries.
|
|
1995
2019
|
|
|
@@ -2036,7 +2060,7 @@ preview/form divider is now keyboard-resizable within the same 15–85% the spli
|
|
|
2036
2060
|
stored at, and `react-split-pane` is no longer a dependency.
|
|
2037
2061
|
`EditorPanes`, `EditorPanesProps`, the `PaneLayout` type and the `SPLIT_PERCENT_*` and `DEFAULT_*_SPLIT_PERCENT` constants are
|
|
2038
2062
|
no longer exported from `canopycms/client`. See
|
|
2039
|
-
[Your root layout](https://github.com/safeinsights/canopycms/blob/
|
|
2063
|
+
[Your root layout](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#editor-customization).
|
|
2040
2064
|
|
|
2041
2065
|
**To adopt.** Nothing, unless you import `EditorPanes` or those constants: render `CanopyEditor`
|
|
2042
2066
|
instead, which lays out its own panes. Hiding your site chrome on the editor route is now
|
|
@@ -2147,7 +2171,7 @@ never ended. `canopycms-auth-clerk` skips it while the editor is mounted, and ex
|
|
|
2147
2171
|
**To adopt.** Nothing for the editor, if your edit page uses `useClerkAuthConfig()` or
|
|
2148
2172
|
`ClerkSignIn`. If your CMS build renders `<SignIn>`, `UserButton` or `OrganizationSwitcher` on your
|
|
2149
2173
|
own pages, mount the hook as in
|
|
2150
|
-
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/
|
|
2174
|
+
[Clerk components on your own pages](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/packages/canopycms-auth-clerk/README.md#clerk-components-on-your-own-pages).
|
|
2151
2175
|
Your own Server Actions in the CMS build still 403 behind OAC.
|
|
2152
2176
|
|
|
2153
2177
|
**Now deletable.** Any local patch of `window.__internal_onBeforeSetActive` (or 6.x's
|
|
@@ -2188,12 +2212,12 @@ fast naming the ARN, the field and the keys present, never a value.
|
|
|
2188
2212
|
**To adopt.** Nothing, unless one of those secrets holds a JSON document: then set the matching
|
|
2189
2213
|
prop. The scaffolded stack fills them from the repository _variables_
|
|
2190
2214
|
`CANOPY_GITHUB_TOKEN_SECRET_JSON_FIELD` and `CLERK_SECRET_KEY_SECRET_JSON_FIELD`
|
|
2191
|
-
([why the prefix](https://github.com/safeinsights/canopycms/blob/
|
|
2215
|
+
([why the prefix](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#repository-secrets-and-variables)); a stack scaffolded earlier
|
|
2192
2216
|
adds the props to `infrastructure/bin/app.ts` and `infrastructure/lib/cms-stack.ts` and the two `env`
|
|
2193
2217
|
lines to `.github/workflows/deploy-cms.yml`, or re-runs the generator and diffs. `cdk synth` refuses a `…JsonField` prop without its `…SecretArn`, and an ARN carrying the ECS `:KEY::` suffix
|
|
2194
2218
|
(also in `secretsArns`). Don't use CDK's `secretValueFromJson`: it resolves the plaintext into the deployed
|
|
2195
2219
|
resource's configuration, readable by anyone who can describe it. Only `CLERK_SECRET_KEY` goes through Secrets Manager; `CLERK_JWT_KEY` and the publishable
|
|
2196
|
-
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2220
|
+
key are public material ([Security Model](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#security-model)).
|
|
2197
2221
|
|
|
2198
2222
|
**Now deletable.** A wrapper that fetches the secret, parses it and re-exports one field into the
|
|
2199
2223
|
worker's environment, such as a `jq` step in user data or a wrapper entrypoint around
|
|
@@ -2205,7 +2229,7 @@ worker's environment, such as a `jq` step in user data or a wrapper entrypoint a
|
|
|
2205
2229
|
`githubToken` is not deprecated and stays the documented default; `canopycms` neither depends on
|
|
2206
2230
|
nor imports `@octokit/auth-app`. Register one App per site, not one shared across repositories:
|
|
2207
2231
|
anyone holding an App's key can mint a token for any of its installations
|
|
2208
|
-
([why](https://github.com/safeinsights/canopycms/blob/
|
|
2232
|
+
([why](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/ARCHITECTURE.md#why-one-github-app-per-site-not-one-shared-across-an-organisation)).
|
|
2209
2233
|
|
|
2210
2234
|
**To adopt with `canopycms-cdk`** (existing stacks need no edit). `CanopyCmsServiceProps` takes
|
|
2211
2235
|
`githubAppId`, `githubAppInstallationId`, `githubAppPrivateKeySecretArn` and
|
|
@@ -2218,7 +2242,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2218
2242
|
`verify` checks an existing installation's permissions: run it, since an App missing a
|
|
2219
2243
|
permission only shows up later, as `sync-failed`. `create` needs an interactive terminal and
|
|
2220
2244
|
never edits an existing JSON secret (create one and point the JSON-field prop at it)
|
|
2221
|
-
([details](https://github.com/safeinsights/canopycms/blob/
|
|
2245
|
+
([details](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#register-it-with-canopycms-init-github-app)).
|
|
2222
2246
|
2. Set the three props and **remove `githubTokenSecretArn`** (with its JSON field). A partial set
|
|
2223
2247
|
of the three is refused at synth, and so is an App alongside a token.
|
|
2224
2248
|
3. In the generated workflow, store them as `CANOPY_GITHUB_APP_ID`,
|
|
@@ -2229,7 +2253,7 @@ anyone holding an App's key can mint a token for any of its installations
|
|
|
2229
2253
|
|
|
2230
2254
|
The private key is ARN-only; passing the key itself is refused at synth. Its ARN joins the worker's
|
|
2231
2255
|
IAM policy automatically, so you need not add it to `secretsArns`. See
|
|
2232
|
-
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/
|
|
2256
|
+
[Authenticating as a GitHub App](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#authenticating-as-a-github-app).
|
|
2233
2257
|
|
|
2234
2258
|
```bash
|
|
2235
2259
|
canopycms init-github-app create -- \
|
|
@@ -2277,7 +2301,7 @@ downloads the `.pem` from the App's settings page.
|
|
|
2277
2301
|
|
|
2278
2302
|
**What changed.** The worker re-reads a Secrets Manager secret (the GitHub token or the Clerk secret
|
|
2279
2303
|
key) when the operation using it fails. Timings, costs and the store-before-revoke order are in
|
|
2280
|
-
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/
|
|
2304
|
+
[Rotating a secret](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#rotating-a-secret).
|
|
2281
2305
|
|
|
2282
2306
|
**To adopt.** Nothing for credentials from `*_SECRET_ARN`, which is every scaffolded deployment. A
|
|
2283
2307
|
GitHub App private key is still read only at boot: store the new key, replace the instance, and
|
|
@@ -2331,12 +2355,12 @@ also check the bucket policy for its grant.
|
|
|
2331
2355
|
5. `withCanopy()` adds sharp's libvips to Next's file tracing (not for a static export) and, on
|
|
2332
2356
|
Next 16 and later, sets `turbopack: {}` when your config has neither `turbopack` nor your own
|
|
2333
2357
|
`webpack` and it can read your Next version. A webpack build still fails its image transforms
|
|
2334
|
-
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/
|
|
2358
|
+
([Dual Build Support](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#dual-build-support)).
|
|
2335
2359
|
|
|
2336
2360
|
**Breaking:** a stack setting `platform` on `fromImageAsset` without `architecture` gets an arm64
|
|
2337
2361
|
function while `platform` still decides the image, so `Platform.LINUX_AMD64` builds an image the
|
|
2338
2362
|
function cannot run. A stack setting neither moves to arm64 with a matching image, built under QEMU
|
|
2339
|
-
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/
|
|
2363
|
+
on an x86 host ([Where the image is built](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#where-the-image-is-built)).
|
|
2340
2364
|
|
|
2341
2365
|
**To adopt.**
|
|
2342
2366
|
|
|
@@ -2365,7 +2389,7 @@ reason; `platform` on `fromImageAsset`; and, with `withCanopy()`, a hand-written
|
|
|
2365
2389
|
|
|
2366
2390
|
**What changed.** `media.uploadUrl` (s3 adapter; an absolute http(s) URL or a site-relative path)
|
|
2367
2391
|
replaces the `url` that `beginUpload()` returns, leaving the presign's `fields` untouched, so
|
|
2368
|
-
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2392
|
+
uploads can be same-origin. See [Media Configuration](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#media-configuration) for the
|
|
2369
2393
|
CloudFront behavior it expects.
|
|
2370
2394
|
|
|
2371
2395
|
**To adopt.** Optional. Set it from an environment variable: a site-relative value works only where
|
|
@@ -2390,7 +2414,7 @@ needs `lazyPublicTransforms: true`) let you pass a deterministically named role,
|
|
|
2390
2414
|
bucket's stack computes `arn:aws:iam::<account>:role/<name>` from literals instead of a
|
|
2391
2415
|
`Fn::GetStackOutput` reference only the CDK CLI resolves. The constructs re-attach
|
|
2392
2416
|
`AWSLambdaBasicExecutionRole` (and the VPC policy) that `lambda.Function` drops from a role you
|
|
2393
|
-
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/
|
|
2417
|
+
pass. See [Cross-account asset bucket](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#cross-account-asset-bucket).
|
|
2394
2418
|
|
|
2395
2419
|
**To adopt.** Optional:
|
|
2396
2420
|
|
|
@@ -2500,7 +2524,7 @@ public JWKS PEM, used only to verify signatures.
|
|
|
2500
2524
|
to variables (Settings → Secrets and variables → Actions → Variables); `bin/app.ts` refuses the
|
|
2501
2525
|
deploy at synth while it is unset. Check that `bin/app.ts` passes `CLERK_SECRET_KEY` as
|
|
2502
2526
|
`clerkSecretKeySecretArn` (read by the worker), never in the Lambda's `environment`, unless you keep
|
|
2503
|
-
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/
|
|
2527
|
+
`clerkMiddleware` ([Security Model](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/docs/deploying-to-aws.md#security-model)).
|
|
2504
2528
|
|
|
2505
2529
|
#### `readByUrlPath` answers only where `listEntries` publishes — **breaking (routing)**
|
|
2506
2530
|
|
|
@@ -2599,7 +2623,7 @@ basePath: process.env.NEXT_PUBLIC_BASE_PATH,
|
|
|
2599
2623
|
Then pass `baseUrl` to `assetUrl` only if Next serves `/assets` (local adapter, `next dev`, S3 with
|
|
2600
2624
|
no distribution): `assetUrl(image, { width: 960, baseUrl: BASE_PATH })`. Assets on CloudFront via
|
|
2601
2625
|
`AssetSupport` stay at the distribution root; pass no `baseUrl` (mount table under "Where `/assets`
|
|
2602
|
-
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/
|
|
2626
|
+
is mounted" in [Media Configuration](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#media-configuration)). Two traps:
|
|
2603
2627
|
|
|
2604
2628
|
- Don't pass a deployment `basePath` to `contentStaticParams({ basePath })`; that option filters by
|
|
2605
2629
|
a nested route prefix and emits zero params, building green.
|
|
@@ -2758,7 +2782,7 @@ Under `exactOptionalPropertyTypes: true`, omit keys instead of assigning `undefi
|
|
|
2758
2782
|
`withTrailingSlash` and `isAbsoluteUrl` from `canopycms/server`; `defineSeoFieldGroup()` from
|
|
2759
2783
|
`canopycms`; `generateContentSitemap` and `entryToMetadata` from `canopycms-next`, bound on
|
|
2760
2784
|
`createNextCanopyContext`'s result. See
|
|
2761
|
-
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/
|
|
2785
|
+
[Sitemap and SEO Metadata](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#sitemap-and-seo-metadata). Every routable entry type is in
|
|
2762
2786
|
the sitemap unless `exclude`d or `noindex`; one `noindex` predicate drives both robots metadata and
|
|
2763
2787
|
sitemap exclusion. `trailingSlash` is never inferred. `lastModified` defaults to `updatedAt`, a
|
|
2764
2788
|
filesystem mtime. An empty SEO field counts as unset. `siteUrl` must be absolute, colliding URLs are
|
|
@@ -2815,7 +2839,7 @@ underscore-prefixed files are skipped.
|
|
|
2815
2839
|
|
|
2816
2840
|
**What changed.** New scaffolds write `defaultBranchAccess: 'deny'` and
|
|
2817
2841
|
`defaultPathAccess: { read: 'allow' }`
|
|
2818
|
-
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/
|
|
2842
|
+
([Public read on server deployments](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#public-read-on-server-deployments)).
|
|
2819
2843
|
|
|
2820
2844
|
**To adopt.** An older scaffold's `defaultBranchAccess: 'allow'` is wider than recommended;
|
|
2821
2845
|
consider `'deny'`. If you deleted `defaultPathAccess: { read: 'allow' }`, anonymous visitors get no content until you
|
|
@@ -2868,7 +2892,7 @@ re-checked an entry's type (a `switch` on `meta.entryType` can merge them into o
|
|
|
2868
2892
|
**What changed.** `BlockComponentRegistry<Blocks>` (types only, from `canopycms`; `BlockValueOf<Blocks, 'hero'>`
|
|
2869
2893
|
gives one template's value type) requires exactly
|
|
2870
2894
|
one component per block template name when written as an object literal. See
|
|
2871
|
-
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/
|
|
2895
|
+
[Block Component Registries](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#block-component-registries) and
|
|
2872
2896
|
`apps/example1/app/components/PostView.tsx`.
|
|
2873
2897
|
|
|
2874
2898
|
```ts
|
|
@@ -2890,7 +2914,7 @@ templates against the schema.
|
|
|
2890
2914
|
|
|
2891
2915
|
**What changed.** Spreading a `const` field array into several schemas, and nesting
|
|
2892
2916
|
`defineInlineFieldGroup()` inside a block template, are documented
|
|
2893
|
-
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/
|
|
2917
|
+
([Reusable Field Fragments](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#reusable-field-fragments)); `defineFieldFragment()` is an
|
|
2894
2918
|
identity helper for them.
|
|
2895
2919
|
|
|
2896
2920
|
```ts
|
|
@@ -2909,7 +2933,7 @@ field by composing from the same `const` field object.
|
|
|
2909
2933
|
A block template holding a `reference` field is a shared block; `read()`/`readByUrlPath()` resolve
|
|
2910
2934
|
it, and listings do with
|
|
2911
2935
|
[`resolveReferences`](#listings-resolve-references-and-a-resolved-reference-carries-urlpath-and-optionally-its-body-16--breaking-type-level)
|
|
2912
|
-
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/
|
|
2936
|
+
(0.0.64). See [Shared / Referenced Blocks](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#shared--referenced-blocks).
|
|
2913
2937
|
|
|
2914
2938
|
**Now deletable.** A second `read()` in page code to unwrap a shared block's reference.
|
|
2915
2939
|
|
|
@@ -2931,7 +2955,7 @@ Not retro-documented, apart from these:
|
|
|
2931
2955
|
|
|
2932
2956
|
#### The registry is keyed by entry-type name (0.0.42)
|
|
2933
2957
|
|
|
2934
|
-
**What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/
|
|
2958
|
+
**What changed.** `createEntrySchemaRegistry` keys are the entry-type names that `.collection.json` files name in `entry.schema`, and `EntryTypesFromRegistry` derives the typed entry-type map from them. Schema-variable keys (`{ postSchema }`) still work but derive nothing; [README's registry convention](https://github.com/safeinsights/canopycms/blob/3e35fb5d09036c5975fc88fbf08e9c2b960bce4e/README.md#convention-why-key-the-registry-by-entry-type-name) says when to keep them.
|
|
2935
2959
|
|
|
2936
2960
|
**To adopt.**
|
|
2937
2961
|
|
package/dist/editor/Editor.js
CHANGED
|
@@ -64,6 +64,7 @@ import { formatCanopyPath } from './canopy-path.js';
|
|
|
64
64
|
import { itemKeysOnPath, resolveThreadPath, withItemKeys } from '../item-keys.js';
|
|
65
65
|
import { ENTRY_NOT_LOADED_COMMENT_MESSAGE, NEW_ITEM_COMMENT_MESSAGE, } from './comments/item-anchor-copy.js';
|
|
66
66
|
import { findFieldTarget, focusFieldTarget } from './field-target.js';
|
|
67
|
+
import { PreviewFollowContext, usePreviewFollow } from './hooks/usePreviewFollow.js';
|
|
67
68
|
import { UndoToastMessage } from './components/UndoToastMessage.js';
|
|
68
69
|
import { getNotificationDuration } from './utils/env.js';
|
|
69
70
|
import { MayHaveLandedError } from './unanswered.js';
|
|
@@ -149,7 +150,7 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
|
|
|
149
150
|
const commentUserId = userContext?.userId ?? currentUser;
|
|
150
151
|
// Below 64em (1024px) the editor starts stacked and the content panel never docks.
|
|
151
152
|
const wideWindow = useMediaQuery('(min-width: 64em)', true, { getInitialValueInEffect: false }) !== false;
|
|
152
|
-
const { loaded: layoutLoaded, layout, setLayout, highlightEnabled, setHighlightEnabled, sideSplitPercent, stackedSplitPercent, setSplitPercent, previewWidth, setPreviewWidth, siteChrome, setSiteChrome, contentPanelOpen, setContentPanelOpen, contentPanelWidth, setContentPanelWidth, } = useEditorLayout({
|
|
153
|
+
const { loaded: layoutLoaded, layout, setLayout, highlightEnabled, setHighlightEnabled, previewFollowsForm, setPreviewFollowsForm, sideSplitPercent, stackedSplitPercent, setSplitPercent, previewWidth, setPreviewWidth, siteChrome, setSiteChrome, contentPanelOpen, setContentPanelOpen, contentPanelWidth, setContentPanelWidth, } = useEditorLayout({
|
|
153
154
|
storageKey: editorLayoutStorageKey(basePath),
|
|
154
155
|
defaultLayout: wideWindow ? 'side' : 'stacked',
|
|
155
156
|
});
|
|
@@ -388,6 +389,11 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
|
|
|
388
389
|
if (branch === branchNameState)
|
|
389
390
|
void loadComments(branchNameState);
|
|
390
391
|
};
|
|
392
|
+
const { reveal: previewReveal, follow: followInPreview } = usePreviewFollow({
|
|
393
|
+
enabled: previewFollowsForm,
|
|
394
|
+
branch: branchNameState,
|
|
395
|
+
entryId: currentEntry?.contentId,
|
|
396
|
+
});
|
|
391
397
|
const { groupsData, groupsLoading, handleSaveGroups, handleSearchUsers, handleGetUserMetadata, handleSearchExternalGroups, } = useGroupManager({ isOpen: groupManagerOpen });
|
|
392
398
|
// The comments and branches responses name their people, without email; a privileged lookup
|
|
393
399
|
// adds the email.
|
|
@@ -535,9 +541,14 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
|
|
|
535
541
|
]);
|
|
536
542
|
// A jump into another entry waits for its value to place the thread; the stored path may be stale.
|
|
537
543
|
const [pendingFieldJump, setPendingFieldJump] = useState(null);
|
|
544
|
+
// A field whose comments are already open is still followed in the preview.
|
|
545
|
+
const jumpToField = (entryPath, canopyPath, threadId) => {
|
|
546
|
+
handleJumpToField(entryPath, canopyPath, threadId);
|
|
547
|
+
followInPreview?.(canopyPath);
|
|
548
|
+
};
|
|
538
549
|
const jumpToThreadField = (entryPath, canopyPath, threadId) => {
|
|
539
550
|
if (entryPath === currentEntry?.path) {
|
|
540
|
-
|
|
551
|
+
jumpToField(entryPath, canopyPath, threadId);
|
|
541
552
|
return;
|
|
542
553
|
}
|
|
543
554
|
setPendingFieldJump({ entryPath, canopyPath, threadId });
|
|
@@ -559,7 +570,8 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
|
|
|
559
570
|
if (placed?.onRemovedItem)
|
|
560
571
|
handleJumpToEntry(entryPath, threadId);
|
|
561
572
|
else
|
|
562
|
-
|
|
573
|
+
jumpToField(entryPath, placed?.canopyPath ?? canopyPath, threadId);
|
|
574
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- jumpToField reads this render's follow
|
|
563
575
|
}, [pendingFieldJump, selectedPath, currentEntry, displayValue, displayComments]);
|
|
564
576
|
// A thread on an item only the draft has is refused: a discard would leave it on nothing.
|
|
565
577
|
const handleAddDisplayedComment = async (text, type, entryPath, canopyPath, threadId) => {
|
|
@@ -1504,7 +1516,15 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
|
|
|
1504
1516
|
if (maximized && !contentPanelDocked)
|
|
1505
1517
|
setNavigatorOpen(false);
|
|
1506
1518
|
setPreviewMaximized(maximized);
|
|
1507
|
-
}, resizing: paneResizing, siteChrome: siteChrome, onSiteChromeChange: setSiteChrome,
|
|
1519
|
+
}, resizing: paneResizing, siteChrome: siteChrome, onSiteChromeChange: setSiteChrome, reveal: previewReveal, previewFollowsForm: previewFollowsForm,
|
|
1520
|
+
// Only beside a form, the one thing it follows.
|
|
1521
|
+
onPreviewFollowsFormChange: !currentEntryUnavailable &&
|
|
1522
|
+
currentEntry?.canEdit !== false &&
|
|
1523
|
+
schema.length > 0 &&
|
|
1524
|
+
// Kept while the next entry loads, so the toolbar never changes under a switch.
|
|
1525
|
+
(displayValue || previewPending)
|
|
1526
|
+
? setPreviewFollowsForm
|
|
1527
|
+
: undefined, onNavigate: openPreviewLink, notice: previewError && (_jsx(Alert, { color: "red", title: "Preview error", withCloseButton: true, onClose: () => setPreviewError(null), radius: 0, children: previewErrorField
|
|
1508
1528
|
? `${previewErrorField}: ${previewError.message}`
|
|
1509
1529
|
: previewError.message })) })) : (_jsx(Paper, { withBorder: true, shadow: "xs", h: "100%", bg: "var(--mantine-color-body)", style: {
|
|
1510
1530
|
display: 'flex',
|
|
@@ -1654,26 +1674,26 @@ const EditorContent = ({ entries, title, siteTitle = title, branchName = '', col
|
|
|
1654
1674
|
? 'Setting up your branch workspace…'
|
|
1655
1675
|
: entriesInitializing
|
|
1656
1676
|
? 'Loading content…'
|
|
1657
|
-
: 'Select an item to start editing.' })) : currentEntryUnavailable ? (_jsx(UnavailableEntryNotice, { schemaRefs: currentEntry.unavailable ? [currentEntry.unavailable.schemaRef] : [] })) : currentEntry.canEdit === false ? (_jsx(NoEditPermissionNotice, { entryLabel: currentEntry.label })) : schema.length > 0 && displayValue ? (_jsx(EntryLinkContext.Provider, { value: entryLinkContextValue, children: _jsx(SiteMdxAllowContext.Provider, { value: mdxAllow, children: _jsx(FormRenderer, { notice: hiddenDraftNotice && (_jsx(ReadOnlyDraftNotice, { permanentlyReadOnly: (currentBranch?.isProtected ?? true) ||
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
+
: 'Select an item to start editing.' })) : currentEntryUnavailable ? (_jsx(UnavailableEntryNotice, { schemaRefs: currentEntry.unavailable ? [currentEntry.unavailable.schemaRef] : [] })) : currentEntry.canEdit === false ? (_jsx(NoEditPermissionNotice, { entryLabel: currentEntry.label })) : schema.length > 0 && displayValue ? (_jsx(EntryLinkContext.Provider, { value: entryLinkContextValue, children: _jsx(SiteMdxAllowContext.Provider, { value: mdxAllow, children: _jsx(PreviewFollowContext.Provider, { value: followInPreview ?? null, children: _jsx(FormRenderer, { notice: hiddenDraftNotice && (_jsx(ReadOnlyDraftNotice, { permanentlyReadOnly: (currentBranch?.isProtected ?? true) ||
|
|
1678
|
+
currentBranch?.status === 'archived',
|
|
1679
|
+
// A hidden draft's discard changes nothing on screen, so it says so.
|
|
1680
|
+
onDiscard: () => handleDiscardFileDraft(() => navigatorToggleRef.current, {
|
|
1681
|
+
announce: true,
|
|
1682
|
+
}) })), fields: schema, value: displayValue, readOnly: contentReadOnly, onRemoved: handleFieldRemoved, savedValue: loadedValue, commentBlockedReason: commentBlockedReason, removedItemFieldLabel: commentFieldLabel, onGetUserMetadata: getCommentUserMetadata, header: {
|
|
1683
|
+
title: currentEntry.label,
|
|
1684
|
+
typeLabel: entryTypeLabel(activeCollections, currentEntry),
|
|
1685
|
+
},
|
|
1686
|
+
// The one writer of drafts. Read-only content gets none, whatever a
|
|
1687
|
+
// field emits (MDXEditor's mount-time normalisation included).
|
|
1688
|
+
onChange: (next) => {
|
|
1689
|
+
const contentId = currentEntry?.contentId;
|
|
1690
|
+
if (contentId && !contentReadOnlyRef.current) {
|
|
1691
|
+
// Every list item keeps a key, whatever field made it.
|
|
1692
|
+
const keyed = withItemKeys(schema, next, 'random');
|
|
1693
|
+
setDrafts((prev) => ({ ...prev, [contentId]: keyed }));
|
|
1694
|
+
}
|
|
1695
|
+
}, customRenderers: customRenderers, branch: branchNameState, comments: displayComments, currentEntryPath: selectedPath, currentUserId: commentUserId, canResolve: canResolveAnyComment, focusedFieldPath: focusedFieldPath, highlightThreadId: highlightThreadId, onAddComment: handleAddDisplayedComment, onResolveThread: handleResolveThread, fieldErrors: fieldErrors, format: currentEntry.format, conflictNotice: !!(currentEntry?.contentId &&
|
|
1696
|
+
currentBranch?.conflictFiles?.includes(currentEntry.contentId)) }) }) }) })) : schema.length === 0 ? (_jsx(CenteredMessage, { children: "No fields to edit." })) : loadFailedKey !== `${branchNameState}:${currentEntry.contentId}` ? (_jsx(Stack, { gap: "lg", p: "md", "data-testid": "entry-loading-skeleton", children: [0, 1, 2].map((row) => (_jsxs(Stack, { gap: 6, children: [_jsx(Skeleton, { h: 12, w: 120 }), _jsx(Skeleton, { h: 36 })] }, row))) })) : (_jsx(Alert, { color: "red", variant: "light", m: "md", title: "This entry couldn't be loaded.", "data-testid": "entry-load-failed", children: _jsx(Button, { variant: "default", onClick: () => {
|
|
1677
1697
|
setLoadFailedKey(null);
|
|
1678
1698
|
setLoadAttempt((attempt) => attempt + 1);
|
|
1679
1699
|
}, children: "Retry" }) })) }) })] }), overlays: _jsxs(_Fragment, { children: [_jsx(BranchesDrawer, { opened: branchManagerOpen, onClose: () => setBranchManagerOpen(false), confirmOpen: branchConfirmOpen, returnFocusTo: branchReturnTarget, children: _jsx(BranchManager, { startCreating: branchManagerOpening.create, branches: branchSummaries, mode: operatingMode, user: userContext, currentBranchName: currentBranch?.name ?? branchNameState, currentWorkflowBlockedReason: saveAllProgress ? 'Wait for Save all to finish.' : undefined, onSelect: async (name) => {
|
|
@@ -4,6 +4,11 @@ export interface PreviewMarks {
|
|
|
4
4
|
count: number;
|
|
5
5
|
paths?: string[];
|
|
6
6
|
}
|
|
7
|
+
/** A field to bring into view in the preview; a new `id` asks again for the same field. */
|
|
8
|
+
export interface PreviewReveal {
|
|
9
|
+
path: string;
|
|
10
|
+
id: number;
|
|
11
|
+
}
|
|
7
12
|
/**
|
|
8
13
|
* What a page's handshake says of the site's header and footer: its ready message says it renders
|
|
9
14
|
* them for `chrome=1` or that it does not, or no ready message came in `READY_TIMEOUT_MS`.
|
|
@@ -15,7 +20,7 @@ export type SiteChromeSupport = 'supported' | 'unsupported' | 'unanswered';
|
|
|
15
20
|
* runs until the preview's ready message arrives; when none does, a "Live updates off" chip offers
|
|
16
21
|
* to reload the preview. While `busy`, the page stays in view, dimmed and inert, under the bar.
|
|
17
22
|
*/
|
|
18
|
-
export declare const PreviewFrame: ({ src, path, data, isLoading, className, style, highlightEnabled, onPreviewError, onMarks, assetBase, iframeStyle, onReload, onSiteChrome, onNavigate, busy, }: {
|
|
23
|
+
export declare const PreviewFrame: ({ src, path, data, isLoading, className, style, highlightEnabled, onPreviewError, onMarks, assetBase, iframeStyle, onReload, onSiteChrome, onNavigate, reveal, busy, }: {
|
|
19
24
|
src: string;
|
|
20
25
|
path: string;
|
|
21
26
|
data?: unknown;
|
|
@@ -48,4 +53,6 @@ export declare const PreviewFrame: ({ src, path, data, isLoading, className, sty
|
|
|
48
53
|
onNavigate?: (href: string) => void;
|
|
49
54
|
/** The editor is loading the next page's data: this page stays in view, dimmed and inert. */
|
|
50
55
|
busy?: boolean;
|
|
56
|
+
/** Sent once the page connects, and each time its `id` changes. */
|
|
57
|
+
reveal?: PreviewReveal;
|
|
51
58
|
}) => import("react/jsx-runtime").JSX.Element;
|