mcguffin / the-paste

Paste Images in WordPress from many applications and upload them to the media library.
https://wordpress.org/plugins/the-paste/
GNU General Public License v3.0
40 stars 11 forks source link

problem copying/pasting rich text & images within a post #53

Open oferlaor opened 1 year ago

oferlaor commented 1 year ago

I try to copy and paste text inside posts and it's not working on 2.0.7. I had to revert to a previous version. I didn't note the console error.

Does anyone else see this problem too?

oferlaor commented 1 year ago

So, 2.0.8 still has this issue. When I copy & paste text and an image from an existing post onto itself, it doesn't work and I get this error:

image

index.js:71 Uncaught (in promise) DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
    at https://htmag.co.il/wp-content/plugins/the-paste/js/admin/mce/the-paste-plugin.js?wp-mce-49110-20201110-tadv-5900:1:10565
    at l (https://htmag.co.il/wp-content/plugins/the-paste/js/admin/mce/the-paste-plugin.js?wp-mce-49110-20201110-tadv-5900:1:2788)
    at s.value (https://htmag.co.il/wp-content/plugins/the-paste/js/admin/mce/the-paste-plugin.js?wp-mce-49110-20201110-tadv-5900:1:2546)
    at Generator.next (https://htmag.co.il/wp-content/plugins/the-paste/js/admin/mce/the-paste-plugin.js?wp-mce-49110-20201110-tadv-5900:1:3143)
    at s (https://htmag.co.il/wp-content/plugins/the-paste/js/admin/mce/the-paste-plugin.js?wp-mce-49110-20201110-tadv-5900:1:8163)
    at n (https://htmag.co.il/wp-content/plugins/the-paste/js/admin/mce/the-paste-plugin.js?wp-mce-49110-20201110-tadv-5900:1:8365)
(anonymous) @ index.js:71
l @ index.js:2
s.value @ index.js:2
(anonymous) @ index.js:2
s @ index.js:2
n @ index.js:2
Promise.then (async)
s @ index.js:2
n @ index.js:2
(anonymous) @ index.js:2
(anonymous) @ index.js:2
r @ index.js:79
value @ index.js:15
(anonymous) @ index.js:241
c.fire @ wp-tinymce.js?ver=49110-20201110:3
fire @ wp-tinymce.js?ver=49110-20201110:3
Pp @ wp-tinymce.js?ver=49110-20201110:3
t @ wp-tinymce.js?ver=49110-20201110:3
C @ wp-tinymce.js?ver=49110-20201110:3
d @ wp-tinymce.js?ver=49110-20201110:3

From what I can see this is the new code for google docs, which thinks it is getting the html from a google docs, but in actuality if it gets the text/html from an editor, it breaks.

One more problem. If I copy from one post to another and I copy text/html - it uploads the image as if it's a new image.

Is there a way to turn on/off the text/html google docs feature? I think it should be opt-in.

oferlaor commented 1 year ago

@mcguffin are you able to reproduce this issue?

mcguffin commented 1 year ago

@oferlaor This Button enables/disables the plugin‘s pasting behaviour entierly, so whatever you copy from another post should pasted as-is:

image

(@see #49)

mcguffin commented 1 year ago

okay, I got it…

oferlaor commented 1 year ago

Right, but I need to only disable the Google docs behaviorCopying and pasting inside the editor or between posts is very common use case. The current behavior assumes it is a new Google doc, so it sometimes fails or uploads additional copies even when you cut/paste from another part of the document. Best regards,Ofer LaOrOn 19 Oct 2023, at 1:18, Jörn Lund @.***> wrote: @oferlaor This Button enables/disables the plugin‘s pasting behaviour entierly, so whatever you copy from another post should pasted as-is:

@.*** #49)

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

oferlaor commented 1 year ago

IMO, there should be a button to enable/disable google docs and a way to decide the default setting for it. It's far less common to copy/paste from google docs than moving content from one part of the post to another.

mcguffin commented 1 year ago

It's not only google docs, there's SVG detection too (if you copy from Adobe XD, Illustrator and alike). I tend to just skip uploading, if the image URL is on the same domain.

oferlaor commented 1 year ago

Yeah, sounds like a good plan

Any idea why I randomly get the error on the console ?

On Thu, Oct 19, 2023 at 10:31 AM Jörn Lund @.***> wrote:

Reopened #53 https://github.com/mcguffin/the-paste/issues/53.

— Reply to this email directly, view it on GitHub https://github.com/mcguffin/the-paste/issues/53#event-10706268336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXNRHBB5TD4JBUOSQIO2QTYADJLPAVCNFSM6AAAAAA6DOKUVKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJQG4YDMMRWHAZTGNQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Best regards,

amccaugh commented 1 year ago

I agree, if anything gets in the way of very common functionality like copying+pasting in the body text, it's a non-starter. I also agree that it would be very helpful if there were a way to set default settings for the plugin -- we have a lot of users on our blog, and I can't guarantee that they're technically savvy and understand how to chagne the settings in their user page.