forked from akai/readest
34f19fd148
In multi-line PDF selections, pdf.js renders each text run as its own <span> and inserts <br role="presentation"> at line endings. getTextFromRange only walked text nodes, so <br>s were dropped and adjacent line-final/line-initial words glued together (e.g. "lastfirst") in highlights, notes, and AI inputs. Walk elements alongside text nodes and emit "\n" for <br>, mirroring how Selection.toString() handles line breaks.