@asd20/ui-next 2.0.8 → 2.0.9

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,7 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.9](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.8...ui-next-v2.0.9) (2026-03-30)
4
+
3
5
  ## [2.0.8](https://github.com/academydistrict20/asd20-ui-next/compare/ui-next-v2.0.7...ui-next-v2.0.8) (2026-03-30)
4
6
 
5
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asd20/ui-next",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "private": false,
5
5
  "description": "ASD20 UI component library for Vue 3.",
6
6
  "license": "MIT",
@@ -94,8 +94,8 @@
94
94
  ></asd20-feeds-section> -->
95
95
 
96
96
  <asd20-media-section
97
- v-if="(combinedMessageImages.length > 1 || combinedMessageVideos.length) && !primaryDetailMessages[0].bodyHtml.includes('<img')"
98
- :images="combinedMessageImages || []"
97
+ v-if="shouldShowArticleMediaSection"
98
+ :images="articleGalleryImages || []"
99
99
  :videos="combinedMessageVideos || []"
100
100
  >
101
101
  </asd20-media-section>
@@ -1,5 +1,31 @@
1
1
  import responsiveBreakpointMixin from './responsiveBreakpointMixin'
2
2
 
3
+ function getMessageBodyHtml(message) {
4
+ return (message && (message.bodyContent || message.bodyHtml)) || ''
5
+ }
6
+
7
+ function getImageUrls(image) {
8
+ const urls = []
9
+ const files = (image && image.files) || []
10
+ if (image && image.url) urls.push(image.url)
11
+ files.forEach(file => {
12
+ if (file && file.url) urls.push(file.url)
13
+ })
14
+ return urls
15
+ }
16
+
17
+ function normalizeHtmlValue(value) {
18
+ return String(value || '').replace(/&amp;/g, '&')
19
+ }
20
+
21
+ function imageAppearsInBody(image, bodyHtml) {
22
+ if (!bodyHtml) return false
23
+ const normalizedBodyHtml = normalizeHtmlValue(bodyHtml)
24
+ return getImageUrls(image).some(url =>
25
+ normalizedBodyHtml.includes(normalizeHtmlValue(url))
26
+ )
27
+ }
28
+
3
29
  export default {
4
30
  mixins: [responsiveBreakpointMixin],
5
31
 
@@ -212,6 +238,24 @@ export default {
212
238
  }, [])
213
239
  },
214
240
 
241
+ articleGalleryImages() {
242
+ const messageBodies = (this.primaryDetailMessages || [])
243
+ .map(getMessageBodyHtml)
244
+ .filter(Boolean)
245
+
246
+ return this.combinedMessageImages.filter(image => {
247
+ if (!image || image.isCover) return false
248
+ return !messageBodies.some(bodyHtml => imageAppearsInBody(image, bodyHtml))
249
+ })
250
+ },
251
+
252
+ shouldShowArticleMediaSection() {
253
+ return (
254
+ this.articleGalleryImages.length >= 3 ||
255
+ this.combinedMessageVideos.length > 0
256
+ )
257
+ },
258
+
215
259
  combinedMessageVideos() {
216
260
  return (this.messages || []).reduce((a, m) => {
217
261
  const videos = m.videos || []