gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Twitter URL Embed automatically in Preformatted Blocks

Open nukaga opened this issue 6 years ago • 8 comments

Describe the bug When two or more Twitter links are included, they will be embedded automatically.

To reproduce Steps to reproduce the behavior:

  1. Go to 'new post'
  2. Click on 'Preformatted'
  3. post 2 twitter URL
  4. See error there URL Embed

Expected behavior Preformatted Blocks have automatically embed when there are two or more Twitter links. This is not expressed when there is one link. The last link URL in the block is displayed in text. This phenomenon occurs not only with Twitter URLs but also with embed URLs.

Screenshots

rzg2o-o6tte

Desktop (please complete the following information):

  • OS: Mac OS 10.12.6
  • Browser chrome
  • Version 74.0.3729.157

Additional context

  • WordPress 5.21 / Twenty Nineteen

nukaga avatar May 25 '19 04:05 nukaga

I'm unable to reproduce:

Example

The first two twitter links are in a pre-format block. The last embed resulted from pasting one of those links in a paragraph block (which transformed to an embed).

Are there any plugins interacting with the WordPress editor active on your site?

nerrad avatar May 25 '19 21:05 nerrad

Thank you for testing! The plug-in was completely stopped. I will try to find a little more about the bug.

nukaga avatar May 26 '19 05:05 nukaga

All plug-ins are turned off. When I put two separate Twitter links in the same way as you did, the bug did not appear. But when I made it three, it appeared. I don't know yet what kind of standard this bug occurs. マイムービー

nukaga avatar May 26 '19 06:05 nukaga

It seems that a similar problem occurs when we unlink the URLs in a preformatted block and open preview. 2nd and later URL turns into embed card if unlinked and the first one doesn't.

gutenberg-preformatted-mis-embedding

kamataryo avatar May 26 '19 07:05 kamataryo

Ya I'm reproducing this now too when I go to three urls in the pre-formatted block. I'm not seeing the pasted urls as linkable (like @kamataryo) though.

I think we can sufficiently say this bug is reproducible though.

nerrad avatar May 26 '19 12:05 nerrad

This command reproduce an unintended embedding and creates a post with an embed card inside <pre />:

$ wp post create --post_author=1 --post_title=test --post_content='
<!-- wp:preformatted -->
<pre class="wp-block-preformatted">
https://wordpress.org/news/2019/05/wordpress-5-2-1-maintenance-release/
</pre>
<!-- /wp:preformatted -->'

Without linebreaks, embed cards would not appear.

$ wp post create --post_author=1 --post_title=test --post_content='
<!-- wp:preformatted -->
<pre class="wp-block-preformatted">https://wordpress.org/news/2019/05/wordpress-5-2-1-maintenance-release/</pre>
<!-- /wp:preformatted -->'

kamataryo avatar May 26 '19 13:05 kamataryo

I included three Twitter URLs and the first link in the block is displayed in text.

image

image

westnz avatar Sep 06 '21 22:09 westnz

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Environment

  • WordPress: 6.9-alpha-60273
  • PHP: 8.2.28
  • Server: Apache/2.4.62 (Debian)
  • Database: mysqli (Server: 11.4.7-MariaDB-ubu2404 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 137.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins:
    • Gutenberg Test Plugin, Disable Login Autofocus
    • Gutenberg Test Plugin, Disable Remote Patterns
    • Gutenberg Test Plugin, Enable Templates UI
    • Gutenberg Test Plugin, No-cache Headers
    • Gutenberg Test Plugin, Normalize Theme
    • server-timing.php
  • Plugins:
    • Gutenberg 21.0.0-rc.1
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

  • To reproduce:
  1. Open Code Editor in the block editor screen.
  2. Add the following content.
<!-- wp:preformatted -->
<pre class="wp-block-preformatted">
https://wordpress.org/news/2019/05/wordpress-5-2-1-maintenance-release/
</pre>
<!-- /wp:preformatted -->
  1. Save and Preview.

Supplemental Artifacts

https://github.com/user-attachments/assets/2f3c8b68-9101-4d5f-9028-0b1cffcd644d

I would like to work on this issue.

shubhtoy avatar Jun 04 '25 12:06 shubhtoy