open-design/apps
Morzorz 83ddf7609c
fix(web): correct srcdoc injection and deck bridge for JS strings con… (#938)
* fix(web): correct srcdoc injection and deck bridge for JS strings containing HTML tags

- Use indexOf for </head> (real tag precedes JS string occurrences)
- Use lastIndexOf for </body> (real tag follows JS string occurrences)
- Scope deck bridge slide selector to direct children of deck containers
  to avoid counting cloned overview thumbnails
- Update .slide-number data attributes and .progress-bar width from
  deck bridge's updateDeckChrome so page counter and progress track
  with deck navigation

* fix(web): move deck chrome sync into report() for all slide modes

.slide-number and .progress-bar updates were only in updateDeckChrome()
which is called exclusively from setActive(). Scroll decks go through
scrollGo() → report() without ever calling setActive(), so their page
counter and progress bar stayed frozen.

Move the sync logic into report() which is the convergence point for
all navigation paths (class-toggle, scroll, keyboard-dispatch).

* fix(web): use DOMParser for srcdoc injection instead of string matching

Replace all regex/indexOf/lastIndexOf based </head> and </body> matching
with DOM-based injection via domMutate helper. DOMParser correctly
separates raw-text element content from structural markup, so </head>/
</body> inside JavaScript strings no longer hijack injection points.

Also: scope deck bridge slide selector to direct children of deck
containers, and move .slide-number/.progress-bar sync into report()
so all navigation paths update page chrome.

* fix(web): add robust string fallback for srcdoc injection in non-browser environments

When DOMParser is unavailable (Node tests), fall back to structural
boundary matching: lastIndexOf('</head>', before <body) and
lastIndexOf('</body>', before </html>) to skip literal occurrences
inside script/style blocks. Annotate catch blocks.

---------

Co-authored-by: yangjingting <yangjingting@yxqiche.com>
2026-05-09 02:41:49 +08:00
..
daemon Bug FIx: Media generation task state is volatile and lost on daemon restart #648 (#884) 2026-05-09 00:00:18 +08:00
desktop feat(desktop): export artifacts directly to PDF (#532) 2026-05-08 23:42:12 +08:00
landing-page release: Open Design 0.5.0 (#820) 2026-05-08 00:41:01 +08:00
packaged fix(packaged): swallow harmless setTypeOfService EINVAL from undici (#895) (#906) 2026-05-09 01:16:23 +08:00
web fix(web): correct srcdoc injection and deck bridge for JS strings con… (#938) 2026-05-09 02:41:49 +08:00
AGENTS.md test(e2e): gate beta packaged runtime (#637) 2026-05-06 17:44:29 +08:00