Copy button shows code upside down when paste
-
Hi Jeff,
I updated to the latest version and there is one issue.
When I use the copy button, it shows upside down in PowerShell.
When I paste the code in notepad, everything looks good.
Something changed, because when I rollback to the previous version, it works as expected.
Thanks
-
Hi worldsdream, I’m not seeing it on default WordPress install, so it must be something local to your theme. You can temporarily switch to one of the default WP themes to see how it displays normally.
Hi Jeff,
Do you have PowerShell (Windows system)?
I have tested this on the default theme without any plugins. I also did a clean WP install (XAMPP) with only the default theme and prismatic. Downgrading to version 2.9.1 works.
People started messaging that they copy, and the commands are corrupted. But, after investigating, I saw that the lines were upside down.
For example:
test1
test2
test3In the back-end: https://i.imgur.com/JygcnY6.png
In the front-end: https://i.imgur.com/c3oQZPU.png
Clik on the COPY button.
When you paste it in PowerShell, it will show:
test3
test2
test1PowerShell paste: https://i.imgur.com/MTV5RPt.png
But when you paste it in notepad or visual studio code, it shows it as expected:
test1
test2
test3Notepad paste: https://i.imgur.com/esLxCpC.png
Thanks
It’s happening since V3.0.
Updated post with pictures to make it a bit easier to understand.
Okay so walk me thru the steps to replicate the issue, so I can follow along on default WordPress install and try to help. Please be specific, let me know which library you are using, block or classic editor, any specific settings, etc. Also I don’t have Windows/Powershell.
@specialk I updated the post with screenshots. I only use Gutenberg.
This only happens when you click the COPY button. When you select the text, everything works fine when pasting in PowerShell.
Did that help you?
Yes that will be useful as I follow along with the steps. Please let me know how to repeat the issue on default WP.
I updated the post.
What I am thinking is: Did this maybe happen because the copy button is changed?
From:
https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js
To:
prismatic/lib/prism/js/plugin-copy-clipboard.js
More information: https://ww.wp.xz.cn/support/topic/plugin-copy-clipboard-loading-from-external-cloudflare/
I will try to get there based on your steps. Btw is this for Prism.js or Highlight.js?
“Did this maybe happen because the copy button is changed?”
No the change mentioned in that other thread was not implemented in the latest version.
It’s on Prism.js.
I can see that it’s not using cloudflare anymore and the code in prismatic/lib/prism/js/plugin-copy-clipboard.js is differently than the code in https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js.
So that change that is mentioned is not added to v3.0. But, something else changed to the plugin-copy-clipboard.js compared with pre v3.0.
For Prism.js, all plugin scripts were updated to the latest versions. So yes the Clipboard plugin was updated, but it has nothing to do with the issue reported in that other thread.
Ok!
So the latest prismjs is causing that issue you think?
If so, I can test it out without prismatic plugin and see if that works.
Yes that would be super useful, worldsdream.
I added the latest prismjs manually and I can tell that it’s prismjs issue. They changed something in the latest release which is having these copy-paste issues!
Thank you for testing it worldsdream, really saves me some time and is appreciated. I noticed you already reported the bug to the Prism.js team, hopefully they can get it fixed up soon. Once it is fixed, it will be added to the next version of Prismatic. Thanks again for your help, and feel free to post again with any further infos, feedback, etc.
The topic ‘Copy button shows code upside down when paste’ is closed to new replies.