@schukai/monster 4.25.2 → 4.25.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 CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.25.4] - 2025-07-03
6
+
7
+ ### Bug Fixes
8
+
9
+ - Refactor image handling in MessageContent for better readability [#328](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/328)
10
+ ### Changes
11
+
12
+ - update webtests
13
+ - close issue [#328](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/328)
14
+
15
+
16
+
17
+ ## [4.25.3] - 2025-07-01
18
+
19
+ ### Bug Fixes
20
+
21
+ - Improve code formatting and readability in viewer component
22
+
23
+
24
+
5
25
  ## [4.25.2] - 2025-06-30
6
26
 
7
27
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.1","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.25.2"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.1","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.25.4"}
@@ -26,6 +26,9 @@ import { isArray, isObject } from "../../../types/is.mjs";
26
26
  import { findTargetElementFromEvent } from "../../../dom/events.mjs";
27
27
  import { getLocaleOfDocument } from "../../../dom/locale.mjs";
28
28
 
29
+ import "./html.mjs";
30
+ import "../../layout/tabs.mjs";
31
+
29
32
  export { MessageContent };
30
33
 
31
34
  /**
@@ -258,6 +261,7 @@ class MessageContent extends CustomElement {
258
261
  (part.filename
259
262
  ? part.filename.split(".").slice(0, -1).join(".")
260
263
  : null);
264
+
261
265
  if (cid) {
262
266
  embeddedImages[cid] = part;
263
267
  } else {
@@ -282,6 +286,7 @@ class MessageContent extends CustomElement {
282
286
  }
283
287
 
284
288
  for (const cid in embeddedImages) {
289
+
285
290
  const imagePart = embeddedImages[cid];
286
291
  if (imagePart.content && imagePart.contentType) {
287
292
  try {
@@ -314,14 +319,11 @@ class MessageContent extends CustomElement {
314
319
  const objectUrl = URL.createObjectURL(blob);
315
320
  this[embeddedImageUrlsSymbol].push(objectUrl); // Speichern zur späteren Widerrufung
316
321
 
317
- // Den CID für die RegExp escapen, um Sonderzeichen zu behandeln
318
- const escapedCid = cleanCid.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
319
- const cidRegex = new RegExp(
320
- `src=["']cid:[^"']*?${escapedCid}[^"']*?["']`,
321
- "gi",
322
+ const imgRegex = /(<img\b(?:(?!src\s*=)[^>])*?)(?:\s+src\s*=\s*(["'])(?:\s*cid:[^'"]*|\s*)\2)?([^>]*>)/gi;
323
+ htmlContent = htmlContent.replace(
324
+ imgRegex,
325
+ `$1 src="${objectUrl}"$3`
322
326
  );
323
-
324
- htmlContent = htmlContent.replace(cidRegex, `src="${objectUrl}"`);
325
327
  } catch (e) {
326
328
  console.error(
327
329
  `Error processing embedded image with CID '${cid}':`,