Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Adds

* 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.
* Add `prependNodes` and `appendNodes` calls for `main`.

### Changes

Expand Down
2 changes: 2 additions & 0 deletions modules/@apostrophecms/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,8 @@ module.exports = {
data.appendHead = self.injectNodes(req, 'append-head');
data.prependBody = self.injectNodes(req, 'prepend-body');
data.appendBody = self.injectNodes(req, 'append-body');
data.prependMain = self.injectNodes(req, 'prepend-main');
data.appendMain = self.injectNodes(req, 'append-main');

return data;
},
Expand Down
2 changes: 2 additions & 0 deletions modules/@apostrophecms/template/views/outerLayoutBase.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
<div data-apos-refreshable>
{% block beforeMain %}{% endblock %}
{% block mainAnchor %}<a name="main"></a>{% endblock %}
{% component '@apostrophecms/template:inject' with { where: 'main', end: 'prepend', when: 'hmr' } %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this line with hmr

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when: 'hmr' means "inject only when in HMR mode". It wasn't added probably due to performance reasons (with the idea "add it if/when needed".

{% component '@apostrophecms/template:inject' with { where: 'main', end: 'prepend' } %}
{% block main %}{% endblock %}
{% component '@apostrophecms/template:inject' with { where: 'main', end: 'append', when: 'hmr' } %}
{% component '@apostrophecms/template:inject' with { where: 'main', end: 'append' } %}
{% block afterMain %}{% endblock %}
</div>
Expand Down