Repository navigation
Closed
monzerfoda/gutenberg
#20Labels
[Block] CodeAffects the Code BlockAffects the Code Block[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closedUsed to indicate that a current issue matches an existing one and can be closed[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Describe the bug
The code inserted into Block code is overflow
To Reproduce
Steps to reproduce the behavior:
- use 5.0-beta3 43764 inserting code the posts is overflow
- the code scrap
<h2>什么是 Polymer?</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p><strong>Polymer</strong> 是一个名为 <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元素,例如 <code><input></code>, <code><checkbox></code>, <code><audio></code>,等等。它们的数量是有限的,它们的设计和行为是由浏览器定义的,而不是由开发人员定义的。使用Web组件,我们现在可以创建一个自定义 <code></code> 并定义它的样式和行为。不幸的是,由于这个标准是非常新的,所以需要一些时间才能得到所有浏览器的支持。</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>幸运的是,现在有几个开放源码库正在积极开发,允许创建和使用自定义元素:<br>Polymer (Google)和 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>比如说,你有一个博客,需要在你的一些帖子中添加音频(例如,音乐曲目或播客)。要做到这一点,最方便的方法是使用本机 <code><audio></code> 元素。它使用简单,不能与任何周围的代码冲突。只要粘贴 <code><my-super-audio src="track.mp3"></my-super-audio></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><my-super-audio src="track.mp3"></my-super-audio></code></pre>
<!-- /wp:code -->
<!-- wp:paragraph -->
<p>多酷啊?</p>
<!-- /wp:paragraph -->
- 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
Metadata
Metadata
Assignees
Labels
[Block] CodeAffects the Code BlockAffects the Code Block[Status] DuplicateUsed to indicate that a current issue matches an existing one and can be closedUsed to indicate that a current issue matches an existing one and can be closed[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Activity
designsimply commentedon Nov 12, 2018
May I ask for some help clarifying this issue? Is the problem that you are pasting incomplete code such as:
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
>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?finip commentedon Nov 13, 2018
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.
finip commentedon Nov 13, 2018
**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.
finip commentedon Nov 14, 2018
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.designsimply commentedon Nov 22, 2018
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:
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.
finip commentedon Nov 22, 2018
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.
designsimply commentedon Dec 5, 2018
I'm so sorry but I'm still having trouble understanding. Please forgive me for asking more questions.
Near the beginning of your first code example, I see this:
If I try copying that example from GitHub and pasting it into Gutenberg, I see this:
Tested with WordPress 4.9.8 and Gutenberg 4.6.1
master@874321773using 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:
Tested with WordPress 4.9.8 and Gutenberg 4.6.1
master@874321773using 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:
Sample code:
Expected behavior:

I expected to see:
Actual behavior:

Instead I see:
finip commentedon Dec 6, 2018
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.
finip commentedon Dec 6, 2018
wordpress 5.0 rc3
inserted code:
`
Code after posting (it changes automatically):
`
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.
`
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.
designsimply commentedon Dec 20, 2018
Okay. Is your goal to be able to post this:
and have it become this?
Where is the code with the
& lt;and& gt;coming from?finip commentedon Dec 21, 2018
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.

designsimply commentedon Dec 21, 2018
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?
< my-super-audio src="track.mp3"></my-super-audio>into the Code block.Result: I expected
< my-super-audio src="track.mp3"></my-super-audio>to appear in the published code block with<and>but instead<remains and>is converted to>.designsimply commentedon Dec 21, 2018
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.
finip commentedon Dec 22, 2018
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.
finip commentedon Dec 22, 2018
finip commentedon Dec 30, 2018
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.

designsimply commentedon Jan 7, 2019
I have been offline for vacation. I will look at this issue again soon though.
designsimply commentedon Jan 7, 2019
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!
finip commentedon Jan 7, 2019
i just received it. i'm glad to hear that the new topic will be followed up and discussed in the position you provided.