raimohanska / ourboard

An online whiteboard
Other
763 stars 58 forks source link

Text doesn't wrap in a sticky note when pasting #175

Closed timojaask closed 3 years ago

timojaask commented 3 years ago
Screen Shot 2021-10-15 at 8 50 44 AM

In the screenshot above, both sticky notes have exactly the same text. The first one was entered entirely by typing "OOOOO OOOOO". The second one was entered by typing the first word "OOOOO " and then pasting from clipboard the second word "OOOOO".

I'm guessing that the text measurement step is only done when you type, and omitted when pasting?

raimohanska commented 3 years ago

Interestingly in the latter case, the DOM element ends up having a non-breaking space between the OOOOOs.

image

raimohanska commented 3 years ago

Already when the space after the first OOOOO is input by pressing the spacebar, it's actually an   which is then converted to a normal space after typing more characters. In case of paste, it will remaing  . Oh the quirks.

raimohanska commented 3 years ago

To add more spin, this weirdness happens with Chrome and Safari but not Firefox. On Firefox the space is just an ordinary space.

raimohanska commented 3 years ago

Hopefully the fix is acceptable. Would appreciate some testing after the fix is in production. Should be in a few minutes.