apostrophe 4.5.2 → 4.5.4
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 +18 -0
- package/modules/@apostrophecms/any-page-type/index.js +6 -1
- package/modules/@apostrophecms/page/index.js +2 -2
- package/modules/@apostrophecms/piece-type/index.js +2 -2
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputRelationship.js +1 -1
- package/modules/@apostrophecms/search/index.js +36 -2
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenu.vue +1 -1
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenuDialog.vue +1 -1
- package/package.json +1 -1
- package/test/search.js +64 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## UNRELEASED
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
* Overriding standard Vue.js components with `editorModal` and `managerModal` are now applied all the time.
|
|
8
|
+
|
|
9
|
+
## 4.5.4 (2024-07-22)
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
|
|
13
|
+
* Add a default projection to ancestors of search results in order to load a reasonable amount of data and avoid request timeouts.
|
|
14
|
+
|
|
15
|
+
## 4.5.3 (2024-07-17)
|
|
16
|
+
|
|
17
|
+
### Fixes
|
|
18
|
+
|
|
19
|
+
* Enhanced media selection with touchpad on Windows by extending focus timeout.
|
|
20
|
+
|
|
3
21
|
## 4.5.2 (2024-07-11)
|
|
4
22
|
|
|
5
23
|
### Fixes
|
|
@@ -120,6 +120,11 @@ module.exports = {
|
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
122
122
|
const subquery = self.apos.page.find(req);
|
|
123
|
+
|
|
124
|
+
if (req.aposAncestors === true && req.aposAncestorsApiProjection) {
|
|
125
|
+
subquery.project(req.aposAncestorsApiProjection);
|
|
126
|
+
}
|
|
127
|
+
|
|
123
128
|
subquery.ancestorPerformanceRestrictions();
|
|
124
129
|
const parameters = applySubqueryOptions(subquery, options, [ 'depth' ]);
|
|
125
130
|
const components = page.path.split('/');
|
|
@@ -145,7 +150,7 @@ module.exports = {
|
|
|
145
150
|
}
|
|
146
151
|
if (!paths.length) {
|
|
147
152
|
page._ancestors = [];
|
|
148
|
-
|
|
153
|
+
continue;
|
|
149
154
|
}
|
|
150
155
|
subquery.and({
|
|
151
156
|
path: { $in: paths }
|
|
@@ -873,8 +873,8 @@ database.`);
|
|
|
873
873
|
components: {}
|
|
874
874
|
});
|
|
875
875
|
_.defaults(browserOptions.components, {
|
|
876
|
-
editorModal: 'AposDocEditor',
|
|
877
|
-
managerModal: 'AposPagesManager'
|
|
876
|
+
editorModal: self.getComponentName('editorModal', 'AposDocEditor'),
|
|
877
|
+
managerModal: self.getComponentName('managerModal', 'AposPagesManager')
|
|
878
878
|
});
|
|
879
879
|
|
|
880
880
|
if (req.data.bestPage) {
|
|
@@ -1146,8 +1146,8 @@ module.exports = {
|
|
|
1146
1146
|
components: {}
|
|
1147
1147
|
});
|
|
1148
1148
|
_.defaults(browserOptions.components, {
|
|
1149
|
-
editorModal: 'AposDocEditor',
|
|
1150
|
-
managerModal: 'AposDocsManager'
|
|
1149
|
+
editorModal: self.getComponentName('editorModal', 'AposDocEditor'),
|
|
1150
|
+
managerModal: self.getComponentName('managerModal', 'AposDocsManager')
|
|
1151
1151
|
});
|
|
1152
1152
|
browserOptions.managerApiProjection = self.getManagerApiProjection(req);
|
|
1153
1153
|
|
|
@@ -52,7 +52,41 @@ module.exports = {
|
|
|
52
52
|
options: {
|
|
53
53
|
alias: 'search',
|
|
54
54
|
perPage: 10,
|
|
55
|
-
label: 'apostrophe:searchLabel'
|
|
55
|
+
label: 'apostrophe:searchLabel',
|
|
56
|
+
|
|
57
|
+
// Default projection for ancestors, used in search results.
|
|
58
|
+
// See `req.aposAncestors` and `req.ancestorsApiProjection`
|
|
59
|
+
// in modules/@apostrophecms/search/index.js and
|
|
60
|
+
// in modules/@apostrophecms/any-page-type/index.js
|
|
61
|
+
ancestorsApiProjection: {
|
|
62
|
+
_id: 1,
|
|
63
|
+
title: 1,
|
|
64
|
+
slug: 1,
|
|
65
|
+
type: 1,
|
|
66
|
+
visibility: 1,
|
|
67
|
+
orphan: 1,
|
|
68
|
+
parkedId: 1,
|
|
69
|
+
parked: 1,
|
|
70
|
+
rank: 1,
|
|
71
|
+
level: 1,
|
|
72
|
+
aposDocId: 1,
|
|
73
|
+
path: 1,
|
|
74
|
+
lastPublishedAt: 1,
|
|
75
|
+
aposLocale: 1,
|
|
76
|
+
aposMode: 1,
|
|
77
|
+
metaType: 1,
|
|
78
|
+
createdAt: 1,
|
|
79
|
+
archived: 1,
|
|
80
|
+
titleSortified: 1,
|
|
81
|
+
updatedAt: 1,
|
|
82
|
+
cacheInvalidatedAt: 1,
|
|
83
|
+
updatedBy: 1,
|
|
84
|
+
highSearchText: 1,
|
|
85
|
+
highSearchWords: 1,
|
|
86
|
+
lowSearchText: 1,
|
|
87
|
+
searchSummary: 1,
|
|
88
|
+
_url: 1
|
|
89
|
+
}
|
|
56
90
|
},
|
|
57
91
|
init(self) {
|
|
58
92
|
|
|
@@ -107,7 +141,6 @@ module.exports = {
|
|
|
107
141
|
},
|
|
108
142
|
methods(self) {
|
|
109
143
|
return {
|
|
110
|
-
|
|
111
144
|
enableFilters() {
|
|
112
145
|
if (self.options.filters) {
|
|
113
146
|
self.filters = self.options.filters;
|
|
@@ -208,6 +241,7 @@ module.exports = {
|
|
|
208
241
|
|
|
209
242
|
async function findDocs() {
|
|
210
243
|
req.aposAncestors = true;
|
|
244
|
+
req.aposAncestorsApiProjection = self.options.ancestorsApiProjection;
|
|
211
245
|
|
|
212
246
|
// Polymorphic find: fetch just the ids at first, then go back
|
|
213
247
|
// and fetch them via their own type managers so that we get the
|
package/package.json
CHANGED
package/test/search.js
CHANGED
|
@@ -22,6 +22,34 @@ describe('Search', function() {
|
|
|
22
22
|
'event-page': {
|
|
23
23
|
extend: '@apostrophecms/piece-page-type'
|
|
24
24
|
},
|
|
25
|
+
'@apostrophecms/search': {
|
|
26
|
+
options: {
|
|
27
|
+
ancestorsApiProjection: {
|
|
28
|
+
_id: 1,
|
|
29
|
+
title: 1,
|
|
30
|
+
slug: 1,
|
|
31
|
+
type: 1,
|
|
32
|
+
visibility: 1,
|
|
33
|
+
orphan: 1,
|
|
34
|
+
parkedId: 1,
|
|
35
|
+
parked: 1,
|
|
36
|
+
rank: 1,
|
|
37
|
+
level: 1,
|
|
38
|
+
aposDocId: 1,
|
|
39
|
+
path: 1,
|
|
40
|
+
lastPublishedAt: 1,
|
|
41
|
+
aposLocale: 1,
|
|
42
|
+
aposMode: 1,
|
|
43
|
+
metaType: 1,
|
|
44
|
+
createdAt: 1,
|
|
45
|
+
archived: 1,
|
|
46
|
+
titleSortified: 1,
|
|
47
|
+
updatedAt: 1,
|
|
48
|
+
updatedBy: 1,
|
|
49
|
+
_url: 1
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
25
53
|
'@apostrophecms/page': {
|
|
26
54
|
options: {
|
|
27
55
|
park: [
|
|
@@ -75,6 +103,7 @@ describe('Search', function() {
|
|
|
75
103
|
it('should carry the _ancestors property', async function() {
|
|
76
104
|
const response1 = await apos.http.get('/search?q=event');
|
|
77
105
|
const [ piece ] = JSON.parse(response1);
|
|
106
|
+
|
|
78
107
|
assert(piece._parent.title === 'Events');
|
|
79
108
|
assert(piece._parent.type === 'event-page');
|
|
80
109
|
assert(piece._parent.slug === '/events');
|
|
@@ -83,6 +112,41 @@ describe('Search', function() {
|
|
|
83
112
|
|
|
84
113
|
const response2 = await apos.http.get('/search?q=home');
|
|
85
114
|
const [ homepage ] = JSON.parse(response2);
|
|
115
|
+
|
|
86
116
|
assert(homepage._ancestors.length === 0);
|
|
87
117
|
});
|
|
118
|
+
|
|
119
|
+
it('should apply a custom projection on the _ancestors', async function() {
|
|
120
|
+
const response1 = await apos.http.get('/search?q=event');
|
|
121
|
+
const [ piece ] = JSON.parse(response1);
|
|
122
|
+
|
|
123
|
+
assert.deepEqual(
|
|
124
|
+
Object.keys(piece._parent._ancestors[0]),
|
|
125
|
+
[
|
|
126
|
+
'_id',
|
|
127
|
+
'title',
|
|
128
|
+
'slug',
|
|
129
|
+
'type',
|
|
130
|
+
'visibility',
|
|
131
|
+
'orphan',
|
|
132
|
+
'parkedId',
|
|
133
|
+
'parked',
|
|
134
|
+
'rank',
|
|
135
|
+
'level',
|
|
136
|
+
'aposDocId',
|
|
137
|
+
'path',
|
|
138
|
+
'lastPublishedAt',
|
|
139
|
+
'aposLocale',
|
|
140
|
+
'aposMode',
|
|
141
|
+
'metaType',
|
|
142
|
+
'createdAt',
|
|
143
|
+
'archived',
|
|
144
|
+
'titleSortified',
|
|
145
|
+
'updatedAt',
|
|
146
|
+
'updatedBy',
|
|
147
|
+
'_url',
|
|
148
|
+
'_ancestors'
|
|
149
|
+
]
|
|
150
|
+
);
|
|
151
|
+
});
|
|
88
152
|
});
|