magento2 中所见即所得编辑器的问题

问题描述 投票:0回答:1

当我们切换显示编辑器时,从前端创建了一个自定义页面,一些代码会自动添加,后端的响应也不同,对于页面,前端没有问题,我们得到了正确的输出,但在后端页面编辑部分代码重复,我们可以通过单击显示或隐藏编辑器按钮来验证这一点。

我该如何解决这个问题?

我当前的项目在 2.4.2-p2 上工作。我在默认的 magento2.4.2-p2 中尝试使用相同的代码。它有同样的问题。

这是原文件

<div>
    <h3 class="passages">LOREM IPSUM</h3>
    <p class="intro">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    </p>
    <ol class="intro">
        <li>What is a variations?</li>
            <p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc..</p>
        <li>Why do we use Loreum?</li>
    </ol>
</div>

保存页面后代码如下所示

<div>
<h3 class="passages">LOREM IPSUM</h3>
<p class="intro">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).</p>
<ol class="intro">
<ol class="intro">
<li>What is a variations?</li>
</ol>
</ol>
<p>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc..</p>
<ol class="intro">
<li>Why do we use Loreum?</li>
</ol>
</div>

以前有没有人遇到过这个问题。 在不禁用所见即所得编辑器的情况下,我们如何解决这个问题?

提前致谢

magento backend editor magento2 wysiwyg
1个回答
0
投票

因为我们不能在

  • 之间使用任何其他标签。 如果我们使用它将在代码中创建中断 对于上面的例子,我们可以使用下面的代码

    <div>
    <h3 class="passages">LOREM IPSUM</h3>
    <p class="intro">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
    </p>
    <ol class="intro">
        <li>What is a variations?</li>
            There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc..
        <li>Why do we use Loreum?</li>
    </ol>
    
  • © www.soinside.com 2019 - 2024. All rights reserved.