mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-21 23:03:11 -05:00
Work around Chrome bug not rendering text
There seems to be a bug in Chrome where it will sometimes not render some of the text in the DOM when there are multiple zero-width spaces around the beginning and ends of inline tags (not sure on the exact details). Steps to reproduce (prior to this commit): 1. Turn on bold and underlined text 2. Type something in bold and underlined text 3. Turn off bold and underline 4. Try to type something — it will not show up! That is, until you press the enter key and we remove the zero-width spaces.
This commit is contained in:
parent
9cef52d963
commit
57f2d37c1d
1 changed files with 12 additions and 0 deletions
|
@ -1622,6 +1622,18 @@ class Squire {
|
|||
}
|
||||
mergeInlines(root, range);
|
||||
|
||||
if (cantFocusEmptyTextNodes && fixer) {
|
||||
// Clean up any previous ZWS in this block. They are not needed,
|
||||
// and this works around a Chrome bug where it doesn't render the
|
||||
// text in some situations with multiple ZWS(!)
|
||||
fixer = fixer.parentNode!;
|
||||
let block = fixer;
|
||||
while (isInline(block)) {
|
||||
block = block.parentNode!;
|
||||
}
|
||||
removeZWS(block, fixer);
|
||||
}
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue