Skip to content

Commit 498b9e9

Browse files
committed
Merge remote-tracking branch 'origin/main' into pro-8230-improve-schema
2 parents 1451de3 + 311b6f9 commit 498b9e9

6 files changed

Lines changed: 52 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## UNRELEASED
44

5+
### Changes
6+
7+
* Refactors complex logic from `AposSchema` that handle data updates to simplifies it.
8+
9+
## 4.22.0 (2025-10-01)
10+
511
### Adds
612

713
* Custom operations registered with `addCreateWidgetOperation` can now specify an `ifTypesIntersect` property containing an array of widget type names. If the area in question allows at least one, the operation is offered.
@@ -14,13 +20,14 @@
1420
* Fixes a bug in the login `uponSubmit` filter where a user could login without meeting the requirement.
1521
* Fixes pieces filters when values from optional fields are falsy.
1622
* Resolve inline image URLs correctly when in edit mode and not in the default locale.
23+
* Using `CTRL+F` or `CMD+F` in the page manager now works.
1724

1825
### Changes
1926

2027
* Redirects to URLs containing accent marks and other non-ascii characters now behave as expected with Astro. Pre-encoding the URLs exactly the way `res.redirect` would before passing them to Astro prevents an error in Astro and allows the redirect to succeed.
2128
* Removes the non-functional `uniqueUsername` route from the `user` module
29+
* Modifies the `annotateAreaForExternalFront()` method of the `@apostrophecms/template` module to accept a per-module `annotateWidgetForExternalFront()` method. This allows widgets to send project-level options alongside the per-area options to external frontends.
2230
* Updated dependencies to address deprecation warnings.
23-
* Refactors complex logic from `AposSchema` that handle data updates to simplifies it.
2431

2532
## 4.21.0 (2025-09-03)
2633

index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,16 @@ async function apostrophe(options, telemetry, rootSpan) {
350350

351351
return self;
352352
} catch (e) {
353-
if (options.exit !== false) {
353+
if (options.exit === false) {
354+
console.error('apostrophe: error occurred during startup, continuing:');
355+
console.error(e);
356+
// returns undefined, for legacy reasons
357+
} else if (options.exit === 'throw') {
358+
// A more sensible approach for those who want to do something
359+
// if initialization fails
360+
throw e;
361+
} else {
362+
// Longstanding default behavior
354363
console.error(e);
355364
await self._exit(1, e);
356365
}

modules/@apostrophecms/page/index.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,15 @@ module.exports = {
179179
},
180180
shortcut: 'C'
181181
},
182-
[`${self.__meta.name}:search`]: {
183-
type: 'item',
184-
label: 'apostrophe:commandMenuSearch',
185-
action: {
186-
type: 'command-menu-manager-focus-search'
187-
},
188-
shortcut: 'Ctrl+F Meta+F'
189-
},
182+
// NOTE: there is no search in the page manager
183+
// [`${self.__meta.name}:search`]: {
184+
// type: 'item',
185+
// label: 'apostrophe:commandMenuSearch',
186+
// action: {
187+
// type: 'command-menu-manager-focus-search'
188+
// },
189+
// shortcut: 'Ctrl+F Meta+F'
190+
// },
190191
[`${self.__meta.name}:select-all`]: {
191192
type: 'item',
192193
label: 'apostrophe:commandMenuSelectAll',

modules/@apostrophecms/template/index.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ module.exports = {
432432
const parse = config.parse
433433
? config.parse
434434
: function (parser, nodes, lexer) {
435-
// Default parser gets comma separated arguments,
436-
// assumes no body
435+
// Default parser gets comma separated arguments,
436+
// assumes no body
437437

438438
// get the tag token
439439
const token = parser.nextToken();
@@ -696,7 +696,7 @@ module.exports = {
696696
_.extend(args, data);
697697

698698
if (req.aposError) {
699-
// A 500-worthy error occurred already, i.e. in `pageBeforeSend`
699+
// A 500-worthy error occurred already, i.e. in `pageBeforeSend`
700700
telemetry.handleError(span, req.aposError);
701701
span.end();
702702
return error(req.aposError);
@@ -739,8 +739,8 @@ module.exports = {
739739
span.setStatus({ code: telemetry.api.SpanStatusCode.OK });
740740
return content;
741741
} catch (e) {
742-
// The page template threw an exception. Log where it
743-
// occurred for easier debugging
742+
// The page template threw an exception. Log where it
743+
// occurred for easier debugging
744744
telemetry.handleError(span, e);
745745
return error(e);
746746
} finally {
@@ -1303,11 +1303,22 @@ module.exports = {
13031303
label: options.addLabel || manager.label || `No label for ${name}`
13041304
};
13051305
}).filter(choice => !!choice);
1306+
13061307
area.items ||= [];
1307-
if (area._docId) {
1308-
for (const item of area.items) {
1308+
for (const item of area.items) {
1309+
// Add _docId if area has one
1310+
if (area._docId) {
13091311
item._docId = area._docId;
13101312
}
1313+
1314+
// Annotate each individual widget with its options
1315+
// Each widget must elect into this by creating an
1316+
// `annotateWidgetForExternalFront() method.
1317+
const manager = self.apos.area.getManager?.(item.type) ||
1318+
self.apos.area.widgetManagers?.[item.type];
1319+
1320+
const widgetOptions = manager.annotateWidgetForExternalFront() || {};
1321+
item._options = widgetOptions;
13111322
}
13121323
}
13131324
};

modules/@apostrophecms/widget-type/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,12 @@ module.exports = {
449449
}
450450
return true;
451451
});
452+
},
453+
454+
annotateWidgetForExternalFront() {
455+
return {};
452456
}
457+
453458
};
454459
},
455460
extendMethods(self) {

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apostrophe",
3-
"version": "4.21.0",
3+
"version": "4.22.0",
44
"description": "The Apostrophe Content Management System.",
55
"main": "index.js",
66
"scripts": {
@@ -143,4 +143,4 @@
143143
"browserslist": [
144144
"ie >= 10"
145145
]
146-
}
146+
}

0 commit comments

Comments
 (0)