Commit fdb31dcd authored by Fred Chasen's avatar Fred Chasen

Merge branch 'hyphens' into 'master'

Turn soft hyphens to hard when chunking after them

See merge request tools/pagedjs!21
parents 32455eb9 7c7b5c78
Pipeline #67 passed with stage
in 2 minutes and 53 seconds
......@@ -65,7 +65,7 @@
<body>
<p>CSS IS AWESOME!</p>
<p>CSS IS AWE&shy;SOME!</p>
<p>
The quick brown fox jumps over the lazy dog.
......
......@@ -348,8 +348,8 @@ class Layout {
let startOffset = overflow.startOffset;
let prevLetter = startText[startOffset-1];
// Add a hyphen if previous character is a letter
if (/^\w$/.test(prevLetter)) {
// Add a hyphen if previous character is a letter or soft hyphen
if (/^\w|\u00AD$/.test(prevLetter)) {
overflow.startContainer.textContent = startText.slice(0, startOffset) + "\u2010";
overflow.setStart(overflow.startContainer, startOffset + 1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment