Fix WebGL timeline startup ordering
This commit is contained in:
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user