Wow ... just wow...
-
@NedFodder only works with Chrome …sometimes
-
@Lorne-Kates said in Wow ... just wow...:
Pasting doesn't work for me
A fix for pasting issues got applied... a week ago? A couple weeks, tops? Recently. So you might want to test again
-
@sloosecannon said in Wow ... just wow...:
or you use Snipping Tool, Ctrl+C, Ctrl+V in the post
@Lorne-Kates said in Wow ... just wow...:
E_NOREPRO
Pasting doesn't work for me.
Known bug in Firefox... NodeBB's paste image function is broken in Firefox. It crashes with a JS error when you try it.
@Yamikuronue said in Wow ... just wow...:
A fix for pasting issues got applied... a week ago? A couple weeks, tops? Recently. So you might want to test again
-
@Yamikuronue said in Wow ... just wow...:
@Lorne-Kates said in Wow ... just wow...:
Pasting doesn't work for me
A fix for pasting issues got applied... a week ago? A couple weeks, tops? Recently. So you might want to test again
CTRL-V
Noooooooope.
-
-
@ben_lubar okay, that error means that items is undefined,
which in turn means that items was set to undefined on line 172, which means that @anotherusername and @Lorne-Kates must both be using versions of firefox older than v22....
-google- -head scratch-
-google- -confused tim the tool man sound-
-google- ....
-google- OH YUCK!
..... yeah.......getting access to the clipboard in versions < v22 of firefox are NOT FUN!
-
But it's not just Firefox <22. I get that error in Firefox 46.0.1.
-
@coderpatsy said in Wow ... just wow...:
But it's not just Firefox <22. I get that error in Firefox 46.0.1.
......
NOW I'M EVEN MORE CONFUSED!
-
Saw this news article a couple of days after this topic was created, couldn't find the topic again (couldn't remember Title or OP), even searching with "facebook". Anyhoo:
-
Ok, I just fucking installed Firefox 22. I fucking spent fucking nearly an hour trying to debug this.
IT'S A FUCKING FIREFOX BUG THAT IS STILL UNFIXED.
Lorne, if you ever managed to paste images using Firefox 22, you must be hallucinating, because the paste event contains absolutely no data and no way of obtaining the data.
-
@ben_lubar said in Wow ... just wow...:
Ok, I just fucking installed Firefox 22. I fucking spent fucking nearly an hour trying to debug this.
IT'S A FUCKING FIREFOX BUG THAT IS STILL UNFIXED.
Lorne, if you ever managed to paste images using Firefox 22, you must be hallucinating, because the paste event contains absolutely no data and no way of obtaining the data.
Supposedly it works for him in Gmail.... maybe see if you can figure out what evil hackery they're doing?
-
@ben_lubar said in Wow ... just wow...:
Your browser doesn't support JavaScript?
@accalia said in Wow ... just wow...:
okay, that error means that items is undefined,
which in turn means that items was set to undefined on line 172, which means that @anotherusername and @Lorne-Kates must both be using versions of firefox older than v22....
-google- -head scratch-...it appears that when pasting either an image or raw image data into a textarea, Firefox pastes... nothing. Literally nothing. There's nothing in the paste event's data.
You can paste either an image or raw image data into a
contenteditable
element, but you can't trap the paste event in a textarea and change the focus to acontenteditable
element before letting the default action happen... it still doesn't paste anything.@sloosecannon said in Wow ... just wow...:
Supposedly it works for him in Gmail.... maybe see if you can figure out what evil hackery they're doing?
Gmail uses a WYSIWYG editor. If your editor is
contenteditable
(or if you can get the cursor into one before the paste event -- trapping thekeydown
on Ctrl-V works, although the Paste option still won't be enabled from the right-click menu in your editor), then it's quite easy. The paste event still contains nothing, but the image is pasted as an<img src="data:...">
node, and you just need to grab that and decode/upload the base64-encoded blob in thesrc
.
-
@anotherusername Ideally, I think probably the best way to do this would be to make a
contenteditable
element that's styled to look and behave like an ordinary textarea (white-space: pre-wrap; overflow: auto;
) and then use a mutation observer to flatten everything in it to plain text. Something like this:observer = new MutationObserver(function () { Array.apply(0, div.querySelectorAll('*:not(br)')).forEach(e => { var s = window.getSelection(); var r = document.createRange(); r.selectNode(e); var t = r.toString(); t = e.nodeName == "IMG" ? getImagePlaceholderAndStartUpload(e.src) : e.nodeName == "B" ? "**" + t + "**" : e.nodeName == "I" ? "*" + t + "*" : e.outerHTML; r.extractContents(); r.insertNode(document.createTextNode(t)); }); }); observer.observe(div, {childList: true, subtree: true});
...you'd probably also want to trap the paste event, and detect if the clipboard contains HTML... you probably don't want a blob of HTML if they paste anything that was copied with formatting...
-
Or Firefox could fix their damn bugs instead of ripping off Chrome('s UI).
-
@coderpatsy right, and we'll just sit and pout while plenty of other sites like Imgur and fucking Discourse even are able to work around the bug?
-
@anotherusername said in Wow ... just wow...:
trapping the keydown on Ctrl-V works, although the Paste option still won't be enabled from the right-click menu in your editor), then it's quite easy
E_NO_REPRO
gmail... new email... cursor in compose. ctrl-v....image from clipboard shows
right-click.... paste is there... select paste.... image from clipboard shows
-
@Vaire said in Wow ... just wow...:
why am I always the last to know anything around here? =__=
If you Liked TDWTF on Facebook, you'd be kept up to date automatically.
-
@Lorne-Kates said in Wow ... just wow...:
@anotherusername said in Wow ... just wow...:
trapping the keydown on Ctrl-V works, although the Paste option still won't be enabled from the right-click menu in your editor), then it's quite easy
E_NO_REPRO
gmail... new email... cursor in compose. ctrl-v....image from clipboard shows
right-click.... paste is there... select paste.... image from clipboard shows
Indeed. Because they aren't using the workaround he suggested :)
-
@sloosecannon said in Wow ... just wow...:
Indeed. Because they aren't using the workaround he suggested =)
So it works better by NOT using a workaround? :/
-
@Lorne-Kates said in Wow ... just wow...:
@sloosecannon said in Wow ... just wow...:
Indeed. Because they aren't using the workaround he suggested =)
So it works better by NOT using a workaround? :/
Indeed. What he described is a workaround, gmail can use it the right way
-
@sloosecannon said in Wow ... just wow...:
Indeed. What he described is a workaround, gmail can use it the right way
Ah. So is this the same as the NodeBB devs using a "clever" styling on the Red Boob that makes it oblong in FF22, when if they'd just used a standard styling of (width = X, height = X, border-radius = X/2)--- instead of fancy-ass styling-- it would just be a round circle and I'd never have noticed the boob.
Because new-fancy is ALWAYS better than "yucky old".
-
@Lorne-Kates said in Wow ... just wow...:
@sloosecannon said in Wow ... just wow...:
Indeed. What he described is a workaround, gmail can use it the right way
Ah. So is this the same as the NodeBB devs using a "clever" styling on the Red Boob that makes it oblong in FF22, when if they'd just used a standard styling of (width = X, height = X, border-radius = X/2)--- instead of fancy-ass styling-- it would just be a round circle and I'd never have noticed the boob.
Because new-fancy is ALWAYS better than "yucky old".
It's more of "They're using a
textarea
for an input that is, in fact, a text area." The argument could easily be made that it should be something more (WYSIWYG), but... I'd say the bug is equally due to Firefox not supporting something that's defacto standard and the NodeBB guys using a textarea for something that comes out as not-just-plain-text
-
@coderpatsy said in Wow ... just wow...:
Firefox could fix their damn bugs
They did, in the intervening 23 versions that have come out since Lorne's version.
-
@Yamikuronue no they didn't. I can't paste an image from the snipping tool in the latest Firefox
-
@Jaloopa Huh. So they didn't.
-
@Yamikuronue said in Wow ... just wow...:
Huh. So they didn't.
-
@Lorne-Kates said in Wow ... just wow...:
Or show up here and tell us to fuck off.
https://community.imgur.com/
They use Discourse ...
-
@aliceif said in Wow ... just wow...:
@Lorne-Kates said in Wow ... just wow...:
Or show up here and tell us to fuck off.
https://community.imgur.com/
They use Discourse ...It shows:
-
@Lorne-Kates said in Wow ... just wow...:
E_NO_REPRO
gmail... new email... cursor in compose. ctrl-v....image from clipboard shows
right-click.... paste is there... select paste.... image from clipboard showsPlain ol' textarea vs.
contenteditable
rich-text editor. Firefox doesn't even have code to handle an image paste inside a textarea, so scripts can't grab it -- it doesn't exist. It isn't included in the data that's presented to a script when the user pastes. The paste event has to occur in a rich-text editor; then the image is pasted -- still not included in the data that's presented to a script in the paste event, but it's pasted. Gmail uses a rich-text editor, which is why your example works. This reply box is a textarea, so try it here. And then make up a quick HTML page with a textarea and log the paste event's data; there's nothing in it when you try to paste image data. Then try the same with a div withcontenteditable
-- you can paste, but if you log the paste event it still contains no data.@sloosecannon said in Wow ... just wow...:
Indeed. What he described is a workaround, gmail can use it the right way
Yes... because they use a richtext editor, which appears to be the only "right way" for the user to paste an image.
-
@anotherusername said in Wow ... just wow...:
Plain ol' textarea vs. contenteditable rich-text editor. Firefox doesn't even have code to handle an image paste inside a textarea, so scripts can't grab it -- it doesn't exist. It isn't included in the data that's presented to a script when the user pastes. The paste event has to occur in a rich-text editor; then the image is pasted -- still not included in the data that's presented to a script in the paste event, but it's pasted. Gmail uses a rich-text editor, which is why your example works. This reply box is a textarea, so try it here. And then make up a quick HTML page with a textarea and log the paste event's data; there's nothing in it when you try to paste image data. Then try the same with a div with contenteditable -- you can paste, but if you log the paste event it still contains no data.
So once again, Teh New Modernz (HTML5 in this case) decided to re-implement a standard browser feature that worked just fine, and did so poorly so that half of it is broken.
I'm all for innovation and everything, but Phase 0 for anything should be "Does it still do all the stuff it used to do, in the exact same way, using the exact same interface?"
-
@Dreikin said in Wow ... just wow...:
It shows:
I feel a little bit less bad for the way my unresponsive plugin mangles the header here.
-
@Lorne-Kates said in Wow ... just wow...:
So once again, Teh New Modernz (HTML5 in this case) decided to re-implement a standard browser feature that worked just fine, and did so poorly so that half of it is broken.
...no. What?! No!
Firefox -- the browser -- appears to have no code to support pasting image data into a
<textarea>
(why should it? it's a text-only element. Foresight? what's that?). It never has. The browser should be putting the clipboard contents into the paste event'sclipboardData
object. It's not doing that if the clipboard contents is image data. It has nothing to do with HTML5, or the script.Firefox did apparently put in some sort of hack -- in the browser -- that converts image data to a
data:
URI when you're pasting into acontenteditable
element, but it still doesn't present that data to the script when the paste event fires, in the form of aclipboardData
object, or a file object, or anything. The browser's native code does at least put an<img>
element into the DOM, and this presents a workaround for scripts that need to support pasting image data: if the user pastes into acontenteditable
element, instead of handling the paste event the script can grab the<img>
element that results from the paste event and then handle things from there.