Closed Evengard closed 1 year ago
Hyphenopoly.js doesn't "see" the CSS-Styles.
Try Hyphenopoly.unhyphenate()
Thanks, seems to be exactly what I was searching for.
👍 I‘ll close this issue for now. Feel free to reopen if necessary.
Unfortunately, I stumbled upon a bug with unhyphenate. When I have an element such as:
<div class="container">
first long text
<br />
second long text
<br />
third long text
</div>
Only first long text
gets unhyphenated, while second long text
and third long text
won't.
I've managed to implement a fast and dirty hotfix:
Replace that:
with that:
H.res.els.list.forEach((els) => {
els.forEach((elo) => {
elo.element.childNodes.forEach((n) => {
try {
n.data = n.data.replace(RegExp(C[elo.selector].hyphen, "g"), "");
} catch {}
})
});
});
For some reason, can't seem to be able to reopen the issue...
Thanks for pointing out the problem. I think in this case we could savely use innerHTML:
H.res.els.list.forEach((els) => {
els.forEach((elo) => {
elo.element.innerHTML = elo.element.innerHTML.replace(RegExp(C[elo.selector].hyphen, "g"), "");
});
});
Is there a way to trigger a removal of added by this script hyphenation? I'm using it for languages unsupported by browser hyphenation, and I have a toggle which creates a "hyphens: none !important" style for the selector. When using browser hyphenation, it just works, hyphens gets removed. When using Hyphenopoly (with a language unsupported by Edge, eg we fall back to Hyphenopoly in this case), seems like the hyphenation sticks (at least, on Edge). Is there smth I can do with that?