@schukai/monster 4.25.3 → 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,18 @@
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
+
5
17
  ## [4.25.3] - 2025-07-01
6
18
 
7
19
  ### 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.3"}
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}':`,
@@ -156,7 +156,7 @@ function getMonsterVersion() {
156
156
  }
157
157
 
158
158
  /** don't touch, replaced by make with package.json version */
159
- monsterVersion = new Version("4.25.0");
159
+ monsterVersion = new Version("4.25.3");
160
160
 
161
161
  return monsterVersion;
162
162
  }
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version("4.25.0")
10
+ monsterVersion = new Version("4.25.3")
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
@@ -9,8 +9,8 @@
9
9
  </head>
10
10
  <body>
11
11
  <div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
12
- <h1 style='margin-bottom: 0.1em;'>Monster 4.25.0</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Mo 30. Jun 16:45:37 CEST 2025</div>
12
+ <h1 style='margin-bottom: 0.1em;'>Monster 4.25.3</h1>
13
+ <div id="lastupdate" style='font-size:0.7em'>last update Do 3. Jul 13:10:44 CEST 2025</div>
14
14
  </div>
15
15
  <div id="mocha-errors"
16
16
  style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>