Fix WebGL timeline startup ordering

This commit is contained in:
2026-06-10 10:04:06 +02:00
parent ce8147b5b1
commit 623b42caf9
4 changed files with 79 additions and 6 deletions
+31
View File
@@ -24,6 +24,7 @@ class TextProcessorModule extends BaseModule {
'hyphenate',
'setLocale',
'loadHyphenopolyLoader',
'ensureHyphenopolySeedElements',
'normalizeHyphenationLocale',
'applyLocaleTypography',
'getTypographyLocale',
@@ -162,6 +163,7 @@ class TextProcessorModule extends BaseModule {
this.hyphenatorReady = false;
await this.loadHyphenopolyLoader();
this.ensureHyphenopolySeedElements(locale);
window.Hyphenopoly.config({
require: {
@@ -203,6 +205,35 @@ class TextProcessorModule extends BaseModule {
}
}
ensureHyphenopolySeedElements(locale = 'en-us') {
const normalizedLocale = this.normalizeHyphenationLocale(locale);
let container = document.getElementById('hyphenopoly_seed_elements');
if (!container) {
container = document.createElement('div');
container.id = 'hyphenopoly_seed_elements';
container.setAttribute('aria-hidden', 'true');
Object.assign(container.style, {
position: 'absolute',
width: '1px',
height: '1px',
overflow: 'hidden',
opacity: '0',
pointerEvents: 'none',
left: '-9999px',
top: '-9999px'
});
document.body.appendChild(container);
}
container.innerHTML = '';
['hyphenate', 'hyphenatePipe'].forEach((className) => {
const seed = document.createElement('span');
seed.className = className;
seed.lang = normalizedLocale;
seed.textContent = normalizedLocale.startsWith('de') ? 'Silbentrennung' : 'hyphenation';
container.appendChild(seed);
});
}
loadHyphenopolyLoader() {
return new Promise((resolve, reject) => {
if (window.Hyphenopoly && typeof window.Hyphenopoly.config === 'function') {