Skip to content

Commit 7fcc2ec

Browse files
committed
Fix field options and allow import image tags
1 parent 1b84327 commit 7fcc2ec

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
* Adds keyboard shortcuts for manipulating widgets in areas. Includes Cut, Copy, Paste, Delete, and Duplicate.
88
* Adds dynamic choices working with piece manager filters.
9+
* Allow `import.imageTags` (array of image tag IDs) to be passed to the rich text widget when importing (see https://docs.apostrophecms.org/reference/api/rich-text.html#importing-inline-images).
910

1011
### Changes
1112

modules/@apostrophecms/area/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ module.exports = {
604604
return {};
605605
}
606606
const schema = manager.schema;
607-
const field = _.find(schema, 'name', name);
607+
const field = schema?.find(field => field.name === name);
608608
if (!(field && field.options)) {
609609
return {};
610610
}

modules/@apostrophecms/rich-text-widget/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,8 @@ module.exports = {
10701070
});
10711071
const image = await self.apos.image.insert(req, {
10721072
title: name,
1073-
attachment
1073+
attachment,
1074+
tagsIds: input.import.imageTags || []
10741075
});
10751076
const newSrc = `${self.apos.image.action}/${image.aposDocId}/src`;
10761077
$image.replaceWith(

0 commit comments

Comments
 (0)