apostrophe 3.8.0 → 3.8.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
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.8.1 - 2021-11-23
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
* The search field of the pieces manager modal works properly. Thanks to [Miro Yovchev](https://github.com/myovchev) for pointing out the issue and providing a solution.
|
|
8
|
+
* Fixes a bug in `AposRichTextWidgetEditor.vue` when a rich text widget was specifically configured with an empty array as the `styles` option. In that case a new empty rich text widget will initiate with an empty paragraph tag.
|
|
9
|
+
* The`fieldsPresent` method that is used with the `presentFieldsOnly` option in doc-type was broken, looking for properties in strings and wasn't returning anything.
|
|
10
|
+
|
|
3
11
|
## 3.8.0 - 2021-11-15
|
|
4
12
|
|
|
5
13
|
### Adds
|
|
@@ -545,8 +545,11 @@ module.exports = {
|
|
|
545
545
|
|
|
546
546
|
await self.apos.schema.convert(req, schema, input, doc);
|
|
547
547
|
|
|
548
|
-
doc.copyOfId = copyOf && copyOf._id;
|
|
549
548
|
if (copyOf) {
|
|
549
|
+
if (copyOf._id) {
|
|
550
|
+
doc.copyOfId = copyOf._id;
|
|
551
|
+
}
|
|
552
|
+
|
|
550
553
|
self.apos.schema.regenerateIds(req, fullSchema, doc);
|
|
551
554
|
}
|
|
552
555
|
},
|
|
@@ -554,17 +557,9 @@ module.exports = {
|
|
|
554
557
|
// taking into account issues like relationship fields keeping their data in
|
|
555
558
|
// a separate ids property, etc.
|
|
556
559
|
fieldsPresent(input) {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
if (field.type.name.substring(0, 5) === '_relationship') {
|
|
561
|
-
if (_.has(input, field.idsStorage)) {
|
|
562
|
-
output.push(field.name);
|
|
563
|
-
}
|
|
564
|
-
} else {
|
|
565
|
-
output.push(field.name);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
560
|
+
return self.schema
|
|
561
|
+
.filter((field) => _.has(input, field.name))
|
|
562
|
+
.map((field) => field.name);
|
|
568
563
|
},
|
|
569
564
|
// Returns a query that finds docs the current user can edit. Unlike
|
|
570
565
|
// find(), this query defaults to including docs in the archive. Subclasses
|
|
@@ -1274,6 +1269,14 @@ module.exports = {
|
|
|
1274
1269
|
if (query.get('search')) {
|
|
1275
1270
|
// MongoDB mandates this if we want to sort on search result quality
|
|
1276
1271
|
projection.textScore = { $meta: 'textScore' };
|
|
1272
|
+
} else if (projection.textScore) {
|
|
1273
|
+
// Gracefully elide the textScore projection when it is not useful and
|
|
1274
|
+
// would cause an error anyway.
|
|
1275
|
+
//
|
|
1276
|
+
// This allows the reuse of the `project()` value passed to one query
|
|
1277
|
+
// in a second query without worrying about whether the second query
|
|
1278
|
+
// contains a search or not
|
|
1279
|
+
delete projection.textScore;
|
|
1277
1280
|
}
|
|
1278
1281
|
query.set('project', projection);
|
|
1279
1282
|
}
|
package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposRichTextWidgetEditor.vue
CHANGED
|
@@ -100,7 +100,11 @@ export default {
|
|
|
100
100
|
activeOptions.toolbar = (activeOptions.toolbar !== undefined)
|
|
101
101
|
? activeOptions.toolbar : this.defaultOptions.toolbar;
|
|
102
102
|
|
|
103
|
-
activeOptions.styles = this.enhanceStyles(
|
|
103
|
+
activeOptions.styles = this.enhanceStyles(
|
|
104
|
+
activeOptions.styles?.length ?
|
|
105
|
+
activeOptions.styles :
|
|
106
|
+
this.defaultOptions.styles
|
|
107
|
+
);
|
|
104
108
|
|
|
105
109
|
activeOptions.className = (activeOptions.className !== undefined)
|
|
106
110
|
? activeOptions.className : this.moduleOptions.className;
|
|
@@ -118,6 +122,7 @@ export default {
|
|
|
118
122
|
// the text align control will not work until the user manually
|
|
119
123
|
// applies a style or refreshes the page
|
|
120
124
|
const defaultStyle = this.editorOptions.styles.find(style => style.def);
|
|
125
|
+
|
|
121
126
|
const _class = defaultStyle.class ? ` class="${defaultStyle.class}"` : '';
|
|
122
127
|
return `<${defaultStyle.tag}${_class}></${defaultStyle.tag}>`;
|
|
123
128
|
} else {
|
package/package.json
CHANGED
package/test/pieces.js
CHANGED
|
@@ -1263,4 +1263,21 @@ describe('Pieces', function() {
|
|
|
1263
1263
|
assert(fs.readFileSync(path.join(__dirname, 'public', resume.attachment._url), 'utf8') === fs.readFileSync(path.join(__dirname, '/public/static-test.txt'), 'utf8'));
|
|
1264
1264
|
});
|
|
1265
1265
|
|
|
1266
|
+
it('should convert a piece keeping only the present fields', async () => {
|
|
1267
|
+
const req = apos.task.getReq();
|
|
1268
|
+
|
|
1269
|
+
const inputPiece = {
|
|
1270
|
+
title: 'new product name'
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
const existingPiece = {
|
|
1274
|
+
color: 'red'
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
await apos.modules.product.convert(req, inputPiece, existingPiece, { presentFieldsOnly: true });
|
|
1278
|
+
|
|
1279
|
+
assert(Object.keys(existingPiece).length === 2);
|
|
1280
|
+
assert(existingPiece.title === 'new product name');
|
|
1281
|
+
assert(existingPiece.color === 'red');
|
|
1282
|
+
});
|
|
1266
1283
|
});
|