News for hackers. Stuff that matters.
Re:A contentEditable, pasted garbage and caret placement wal... by ljm on Friday July 23, 2021 @10:14PM (#27937854)
A native app will copy a selection into the clipboard in several ways, basically accounting for a selection of common MIME-types.

So when you copy an image from Finder in MacOS, if you paste it into a terminal you get the file path and if you paste it into a comment on github you get the contents of the file as a binary blob.

When pasting, an application is essentially querying the clipboard for a representation of the data it can use, and if there is none, it either defaults to something or fails.

In a well designed program, all of the translating and parsing is done before sending to the clipboard. If you copy text from MS Word and paste it into a content editable field in a website, you might expect some consistency.

Re:A contentEditable, pasted garbage and caret placement wal... by iudqnolq on Friday July 23, 2021 @10:46PM (#27937996)
I believe at least on windows this bit isn't always true

> In a well designed program, all of the translating and parsing is done before sending to the clipboard.

To avoid unnecessary work a program can opt to delay rendering until it's pasted or the program is closed. This is why excel will sometimes ask you if you want to keep your clipboard on save.

Re:A contentEditable, pasted garbage and caret placement wal... by TazeTSchnitzel on Saturday July 24, 2021 @07:27AM (#27939959)
Based on behaviour I've observed on Linux before, I think X11 might only use delayed rendering (at least for non-text stuff), and so pasting from a closed application just hangs the recipient.
Re:A contentEditable, pasted garbage and caret placement wal... by tW4r on Saturday July 24, 2021 @12:42AM (#27938451)
Is there any way to force which gets chosen? I love being able to copy and image and just paste it to WhatsApp/Messenger/Whichever other client, but if I do copy an image from the internet it’s very hit or miss if it shows up as an image when I paste, or a link. If I download the image, and then copy the downloaded one, it always shows up as an image
Re:A contentEditable, pasted garbage and caret placement wal... by TazeTSchnitzel on Saturday July 24, 2021 @07:26AM (#27939957)
I ended up working around this by copying into GIMP and copying from there, but of course that's a suboptimal workaround. There's surely some small utility application for this.
Re:A contentEditable, pasted garbage and caret placement wal... by reportgunner on Saturday July 24, 2021 @08:23AM (#27940293)
The snipping tool.
Re:A contentEditable, pasted garbage and caret placement wal... by dmitryminkovsky on Friday July 23, 2021 @11:47PM (#27938240)
> If you copy text from MS Word and paste it into a content editable field in a website, you might expect some consistency

Hard-fought consistency... https://github.com/ProseMirror/prosemirror-schema-basic/blob...