Make WordPress Core

Opened 10 years ago

Last modified 5 years ago

#29368 new feature request

Pasted media do not appear in the library

Reported by: matt-mclaughlin's profile Matt McLaughlin Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.2
Component: Media Keywords: needs-patch needs-testing
Focuses: ui Cc:

Description

So I don't know if this is a bug or a feature request, but when I paste an image into a post, i would assume that it goes into the media library (where else would it live?). But when I go to then chose that image as my featured image, surprise, surprise - it's not in the library.

Change History (12)

#1 @ericlewis
10 years ago

  • Keywords reporter-feedback added

How are you "pasting" the image into the post?

#2 @Matt McLaughlin
10 years ago

With system paste. As in:
-go to Word Document
-select photo
-press command-C (this is on a Mac)
-go to the body of the post
-press command-V

The photo shows up in the body of the post just fine. But it is nowhere to be found in the library.

#3 @knutsp
10 years ago

Does the image appear visually in the editor after pasting (command+V)? If so, when switching to the text editor, what do you see?

Pasting an image from a browser (Windows) into the visual editor I get an <img src="url" /> i text. Such images are external references and will not generate a media library entry (attachment).

When I try to paste a copied image from any other Windows application I have, then nothing happens.

#4 @Matt McLaughlin
10 years ago

Yes, it appears visually in the editor after pasting. And I have access to captioning from the "Pencil Menu".

In text editor I get:
<img src="webkit-fake-url://3FE74D5C-C2EF-4CAA-ACFF-88CCE71F2063/application.pdf" alt="" />

OK, and when I log on from another computer it appears as a broken link in the visual editor so it's definitely local.


Anyways it's a poor and unintuitive user interface. Either paste should NOT work so that people aren't misled into thinking they've actually put the image into their post, OR pasting into a post should automatically upload to the library. Obviously I'd prefer the latter.

#5 @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback removed

#6 @knutsp
10 years ago

I think this looks like a behaviour the browser is responsible for. It pastes an URL with a proprietary scheme, only working in that browser on the very same computer. WordPress is doing nothing other receive what is being pasted.

So if WordPress could do anything it would something along the line of detecting and filtering out such things that could mislead the user into thinking it could work on the web.

The other solution would be to complain about it to the makers of browser in question.

It's bad UX.

#7 @azaozz
10 years ago

...this looks like a behaviour the browser is responsible for.

Right, and is different for different browsers. By default Firefox and Safari would encode the image with base64 and paste the whole thing as text, even if it is several MB in size. This is disabled by default in TinyMCE 4.0.

Seems best we could do is to prevent pasting of images with src="webkit-fake-url://... No point having broken images anywhere.

#8 follow-up: @Matt McLaughlin
10 years ago

Yup, tried it in Chrome, Safari and Firefox

Copy paste image from documentCopy Paste image from the web
SafariImage appears in the edit pane - local linkImage appears in the edit pane - local link
ChromeNothingImage URL displayed not the image itself
FirefoxNothingNothing

It's interesting that rather than using the url of things copy pasted from the web Safari choses to do its own weird local link...

The short term fix is to prevent Safari from incorrectly displaying the image when it's nothing but a local link. The better (but vastly more complicated) fix would be to make copy paste into the edit pane work as expected - automatically uploading the image. That seems like it might be the sort of thing that the Image Flow working group could take a look at???

#9 in reply to: ↑ 8 @azaozz
10 years ago

Replying to Matt McLaughlin:

The better (but vastly more complicated) fix would be to make copy paste into the edit pane work as expected - automatically uploading the image. That seems like it might be the sort of thing that the Image Flow working group could take a look at???

We already do that for images dragged and dropped on the editor.

Don't think we can "catch" images on paste in all browsers. Accessing the clipboard is pretty buggy and not well supported even in some of the newest browsers. Getting the data out of the clipboard and putting it in <input type="file"> seems quite troublesome. Looks like it might work in Firefox, but nowhere else.

#10 @Matt McLaughlin
10 years ago

It can be done in Chrome because copy paste images to Google Docs works in Chrome...

Don't know a thing about Safari or Explorer though.

#11 @chriscct7
8 years ago

  • Keywords needs-patch needs-testing added

#12 @chriscct7
8 years ago

It'd be a good first bug task to test several current browsers (IE, Edge, Chrome, FireFox, Safari) and note the current behaviors like in comment:9

Note: See TracTickets for help on using tickets.