the-paste icon indicating copy to clipboard operation
the-paste copied to clipboard

problem copying/pasting rich text & images within a post

Open oferlaor opened this issue 2 years ago • 9 comments

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 avatar Oct 17 '23 08:10 oferlaor

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 avatar Oct 18 '23 18:10 oferlaor

@mcguffin are you able to reproduce this issue?

oferlaor avatar Oct 18 '23 18:10 oferlaor

@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 avatar Oct 18 '23 22:10 mcguffin

okay, I got it…

mcguffin avatar Oct 18 '23 22:10 mcguffin

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 avatar Oct 19 '23 05:10 oferlaor

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.

oferlaor avatar Oct 19 '23 06:10 oferlaor

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.

mcguffin avatar Oct 19 '23 07:10 mcguffin

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,

oferlaor avatar Oct 19 '23 07:10 oferlaor

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.

amccaugh avatar Oct 19 '23 19:10 amccaugh