Skip to content

I used 5.0-beta3 43764 version the posts is overflow, when inserting code. #11624

Closed
monzerfoda/gutenberg
#20

Description

@finip

Describe the bug
The code inserted into Block code is overflow

To Reproduce
Steps to reproduce the behavior:

  1. use 5.0-beta3 43764 inserting code the posts is overflow
  2. the code scrap
<h2>什么是 Polymer?</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><strong>Polymer</strong>&nbsp;是一个名为 <strong>Web组件</strong>的新 web标准的垫片,它使我们能够创建完全自定义的 HTML元素。</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":10347} -->
<figure class="wp-block-image"><img src="http://localhost:8082/wp-content/uploads/2016/01/a017e0caf9119cc47e6729799c0161ba-1.jpg" alt="" class="wp-image-10347"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>我们每天都使用本机 web元素,例如&nbsp;<code>&lt;input&gt;</code>,&nbsp;<code>&lt;checkbox&gt;</code>,&nbsp;<code>&lt;audio&gt;</code>,等等。它们的数量是有限的,它们的设计和行为是由浏览器定义的,而不是由开发人员定义的。使用Web组件,我们现在可以创建一个自定义&nbsp;<code></code>&nbsp;并定义它的样式和行为。不幸的是,由于这个标准是非常新的,所以需要一些时间才能得到所有浏览器的支持。</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>幸运的是,现在有几个开放源码库正在积极开发,允许创建和使用自定义元素:<br>Polymer (Google)和&nbsp;X-Tag (Mozilla)。今年夏天,在 I/O峰会期间,Polymer 团队推出了v1.0,并宣布它现在可以生产了。</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><!--more--></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>什么是自定义元素?</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>比如说,你有一个博客,需要在你的一些帖子中添加音频(例如,音乐曲目或播客)。要做到这一点,最方便的方法是使用本机&nbsp;<code>&lt;audio&gt;</code>&nbsp;元素。它使用简单,不能与任何周围的代码冲突。只要粘贴&nbsp;<code>&lt;my-super-audio src="track.mp3"&gt;&lt;/my-super-audio&gt;</code>,就会得到一个 100%受控的结果,如下所示:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":10348} -->
<figure class="wp-block-image"><img src="http://localhost:8082/wp-content/uploads/2016/01/11f5315d0fdebb3df4e4554339df02f2.jpg" alt="" class="wp-image-10348"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>但如果你希望它看起来不一样呢?或者有一些额外的功能,比如显示时间和标题?最重要的是,您希望保持它的<strong>简单和模块化</strong>,就像本机解决方案一样。</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>比如说,我们想要建造这样的东西:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":10349} -->
<figure class="wp-block-image"><img src="http://localhost:8082/wp-content/uploads/2016/01/9c3c0da200c92b4703ae40246d591184.jpg" alt="" class="wp-image-10349"/></figure>
<!-- /wp:image -->

<!-- wp:paragraph -->
<p>这就是 Web组件和 polymer发挥作用的地方。当我们有一个自定义元素时,我们可以像使用本机元素一样简单地使用它:</p>
<!-- /wp:paragraph -->

<!-- wp:code -->
<pre class="wp-block-code"><code>&lt;my-super-audio src="track.mp3"&gt;&lt;/my-super-audio&gt;</code></pre>
<!-- /wp:code -->

<!-- wp:paragraph -->
<p>多酷啊?</p>
<!-- /wp:paragraph -->
  1. Overflow and misalignment occurred without using highlighted plug-ins. If you use code highlighting plug-ins, you will not be misplaced. I checked the reasons for this because <> & lt;& gt;, where < was correctly parsed, but the end of the posts & gt; was converted into >, so the front page was misaligned. I tried several similar articles with code fragments, all of which I want to ask. The problem arises. It must be that the code block of the Gutenberg editor is automatically escaped, but I can't fix it. At present, we can only replace the insertion of multi-line code with html block, so that the front desk won't.

Desktop (please complete the following information):

  • OS: Windows server 2012r2/2016 iis8.5 and iis10
  • Browser chrome, firefox64bit, ie11
  • Version newest

Additional context

  • 5.0-beta3 43764
  • No extra Gutenberg plugin installed

Activity

  1. designsimply commented on Nov 12, 2018

    @designsimply
    Member

    May I ask for some help clarifying this issue? Is the problem that you are pasting incomplete code such as:

    <h2>什么是 Polymer?</h2>
    <!-- /wp:heading -->
    
    <!-- wp:paragraph -->
    <p><strong>Polymer</strong>&nbsp;是一个名为 <strong>Web组件</strong>的新 web标准的垫片,它使我们能够创建完全自定义的 HTML元素。</p>
    <!-- /wp:paragraph -->
    

    and it is not saving properly or is the problem that you are using a plugin that is somehow causing escaped character entities such as &gt; to become > and break the HTML? If you are using a plugin which is causing this, can you please list the plugin name and version?

  2. added and removed
    Needs TestingNeeds further testing to be confirmed.
    on Nov 12, 2018
  3. finip commented on Nov 13, 2018

    @finip
    Author

    May I ask for some help clarifying this issue? Is the problem that you are pasting incomplete code such as:

    Thank you for your attention, this is not a complete code post code, I'll prepare a test of the two level demonstration site, that I said this code insertion problem, because it seems like no way the pictures here. Please wait for my post again, which includes a page address that generates overflow code.

  4. finip commented on Nov 13, 2018

    @finip
    Author

    **beta3:**https://wp5beta343764.mmtheme.com/2018/11/13/create-a-custom-audio-player-element-using-polymer-2.shtml
    **beta4:**https://wp5beta443764.mmtheme.com/2018/11/13/create-a-custom-audio-player-element-using-polymer-2.shtml

    These are two versions of the insert code article pages, beta3 and beta4. Although they look similar, they are different. After upgrading the latest version today, the code overflow problem has been solved. Although it looks right on the surface, I looked specifically at the insertion code in the background. They haven't changed, because the articles on the two websites are pasted in with the same piece of code. It's strange that the < code > area is escaped < Has the problem been solved or correctly resolved? At least it still exists, but how can it be solved? I hope someone can study or understand it. I don't like to solve it without any reason, because I don't know how to solve it at all. At least tell me a list of beta4 patches, for example #823435. And where to repair it is in order to meet the needs of a program.

  5. finip commented on Nov 14, 2018

    @finip
    Author

    My problem is not over, although beta4 is no longer misaligned and overflowed, but the first < is displayed as & lt;, both in the background code mode and in the front desk, it shows this way. And the latter is correctly parsed. This still prevents me from inserting code in the way of and only continues to insert code in the HTML block module. I hope I can continue to get help, which is really a problem.

  6. designsimply commented on Nov 22, 2018

    @designsimply
    Member

    I would like to include a screenshot for reference and note that further testing is still needed. I think this is the overflow you are referring to:

    screen shot 2018-11-13 at 7 48 38 pm
    Seen at https://wp5beta343764.mmtheme.com/2018/11/13/create-a-custom-audio-player-element-using-polymer-2.shtml using Firefox 63.0.1 on macOS 10.13.6.

  7. finip commented on Nov 22, 2018

    @finip
    Author

    Yes, it's only beta3 that spills over. But this problem also exists in beta5 at present, but it will not spill over again, and the problem has not really been solved, because the sign on the left <, is still parsed as & lt;, and the right is right >, which is the real problem. There is no need for demo websites anymore. I hope you will pay attention to the little problem I mentioned. After that, you can use the code block as usual, instead of the HTML block you've been using now. In fact, as mentioned earlier, this problem only appears in the code block, and single-line code is normal.

  8. designsimply commented on Dec 5, 2018

    @designsimply
    Member

    I'm so sorry but I'm still having trouble understanding. Please forgive me for asking more questions.

    It must be that the code block of the Gutenberg editor is automatically escaped

    Near the beginning of your first code example, I see this:

    <!-- wp:paragraph -->
    <p>我们每天都使用本机 web元素,例如&nbsp;<code>&lt;input&gt;</code>,&nbsp;<code>&lt;checkbox&gt;</code>,&nbsp;<code>&lt;audio&gt;</code>,等等。它们的数量是有限的,它们的设计和行为是由浏览器定义的,而不是由开发人员定义的。使用Web组件,我们现在可以创建一个自定义&nbsp;<code></code>&nbsp;并定义它的样式和行为。不幸的是,由于这个标准是非常新的,所以需要一些时间才能得到所有浏览器的支持。</p>
    <!-- /wp:paragraph -->
    

    If I try copying that example from GitHub and pasting it into Gutenberg, I see this:

    screen shot 2018-12-05 at 1 28 46 pm
    Tested with WordPress 4.9.8 and Gutenberg 4.6.1 master @ 874321773 using Firefox 63.0.3 on macOS 10.13.6.

    However, if I first copy the example to a plain text editor (such as TextEdit on macOS) and then paste into Gutenberg, I see this:

    screen shot 2018-12-05 at 1 29 38 pm
    Tested with WordPress 4.9.8 and Gutenberg 4.6.1 master @ 874321773 using Firefox 63.0.3 on macOS 10.13.6.

    I feel this must have something to do with how the original content was created or copied, but I am not sure what or how yet. Let's go back to the start. Can you please tell me exactly what steps I can use to see the problem happen and try again to explain the expected behavior and the actual behavior? For example, is the following correct? Also, does the problem happen if you temporarily turn off all other plugins other than Gutenberg?

    Steps to reproduce:

    1. Go to Posts > Add New.
    2. Copy the sample code from below.
    3. Paste the sample code directly into a new block.

    Sample code:

    <!-- wp:paragraph -->
    <p>我们每天都使用本机 web元素,例如&nbsp;<code>&lt;input&gt;</code>,&nbsp;<code>&lt;checkbox&gt;</code>,&nbsp;<code>&lt;audio&gt;</code>,等等。它们的数量是有限的,它们的设计和行为是由浏览器定义的,而不是由开发人员定义的。使用Web组件,我们现在可以创建一个自定义&nbsp;<code></code>&nbsp;并定义它的样式和行为。不幸的是,由于这个标准是非常新的,所以需要一些时间才能得到所有浏览器的支持。</p>
    <!-- /wp:paragraph -->
    

    Expected behavior:
    I expected to see:
    screen shot 2018-12-05 at 1 46 32 pm

    Actual behavior:
    Instead I see:
    screen shot 2018-12-05 at 1 47 27 pm

  9. finip commented on Dec 6, 2018

    @finip
    Author

    Thank you for your continued attention to this question, which I will test the latest version of RC3 later. Detailed explanations will be given. Thank you very much for your reply, which gives me hope to solve it. Maybe the new version does not exist, but it will be tested before the result is achieved. My English is obviously not good. I hope you can understand what I said. Please wait for my results later.

  10. finip commented on Dec 6, 2018

    @finip
    Author

    wordpress 5.0 rc3
    inserted code:
    `

     & lt; my-super-audio src="track.mp3" & gt; </my-super-audio>
    `

    Code after posting (it changes automatically):
    `

     & lt; my-super-audio src="track.mp3" > </my-super-audio>
    `

    I think this place has attracted your attention, as I mentioned before.
    the first < is displayed as & lt;, both in the background code mode and in the front desk, it shows this way. And the latter is correctly parsed. This still prevents me from inserting code in the way of and only continues to insert code in the HTML block module.

    When I insert such code directly, it parses correctly.
    `

     < my-super-audio src="track.mp3" >  < /my-super-audio > 
    `

    left < is <,not as before & lt; right > is >,The previous right is the correct parse
    Now there is only one problem, that is, when both sides use < & gt; at the same time, the left parsing is still incorrect, while the right parsing is correct. When both sides use <>, the problem does not exist, and it parses all correctly.

  11. designsimply commented on Dec 20, 2018

    @designsimply
    Member

    Okay. Is your goal to be able to post this:

     & lt; my-super-audio src="track.mp3" & gt; </my-super-audio>
    

    and have it become this?

    < my-super-audio src="track.mp3" >  < /my-super-audio > 
    

    Where is the code with the & lt; and & gt; coming from?

  12. finip commented on Dec 21, 2018

    @finip
    Author

    i did this deliberately, because there is an extra space in the middle to correctly show what I want to say. I hope you can understand that the problem lies on the left lt, which is parsed into this, but the right one is correct.
    001

  13. designsimply commented on Dec 21, 2018

    @designsimply
    Member

    Thank you, that was helpful. I think the next thing we should do is state the problem in a list of steps that include example code. I tested with WordPress 5.0.2 and no active plugins and wrote down some steps. Does the following sound correct?

    1. Go to Posts > Add New.
    2. Add a Code block.
    3. Add &lt; my-super-audio src="track.mp3"&gt;</my-super-audio> into the Code block.
    4. Publish the post and view it.

    Result: I expected &lt; my-super-audio src="track.mp3"&gt;</my-super-audio> to appear in the published code block with &lt; and &gt; but instead &lt; remains and &gt; is converted to >.

  14. designsimply commented on Dec 21, 2018

    @designsimply
    Member

    I would also like to double check that you have updated to 5.0.2 now and that this is still a problem for you in version 5.0.2.

  15. finip commented on Dec 22, 2018

    @finip
    Author

    yes, yes, what you are saying is correct. i do have this problem. yesterday's screenshot is 5.0.2. sometimes i cut a specific picture again and again. 5.0.2 also has such a problem. the lt on the left has not been properly parsed. although it does not affect the display of the front desk, it has a problem, and it does not discuss whether to install the code highlighting plug-in first, because this original problem will lead to other plug-ins and then problems, i would like to get your help to solve it.

  16. finip commented on Dec 22, 2018

    @finip
    Author

    001
    002
    003
    004
    005
    006
    007

  17. finip commented on Dec 30, 2018

    @finip
    Author

    i'm no longer being noticed by you, but I have to submit a picture of this, which happened in the case of plug-ins, and also because of previous reasons. Anything I do at the moment is meaningless, but I hope this problem can be solved as soon as possible.
    001

  18. designsimply commented on Jan 7, 2019

    @designsimply
    Member

    i'm no longer being noticed by you,

    I have been offline for vacation. I will look at this issue again soon though.

  19. added
    [Type] BugAn existing feature does not function as intended
    [Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed
    and removed on Jan 7, 2019
  20. designsimply commented on Jan 7, 2019

    @designsimply
    Member

    These latest screenshots you have provided are excellent and very helpful. Thank you! I found the issue reported again and I would like to close this issue in favor of continuing work in the new one at #13218 while still referencing your screenshots. Thank you for your persistence and patience!

  21. finip commented on Jan 7, 2019

    @finip
    Author

    i just received it. i'm glad to hear that the new topic will be followed up and discussed in the position you provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] CodeAffects the Code Block[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closed[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions