【问题标题】:HTML in TinyMCE (Laravel) show errorsTinyMCE(Laravel)中的HTML显示错误
【发布时间】:2021-05-08 19:13:57
【问题描述】:

我在我的 Laravel 应用程序上安装了 TinyMCE 编辑器。我想在我的 TinyMCE 中编写 HTML,比如

  • 或每个示例。

    这是我在 TinyMCE 中输入的代码:

    <table class="table table-dark">
      <thead>
        <tr>
          <th scope="col">#</th>
          <th scope="col">First</th>
          <th scope="col">Last</th>
          <th scope="col">Handle</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">1</th>
          <td>Mark</td>
          <td>Otto</td>
          <td>@mdo</td>
        </tr>
        <tr>
          <th scope="row">2</th>
          <td>Jacob</td>
          <td>Thornton</td>
          <td>@fat</td>
        </tr>
        <tr>
          <th scope="row">3</th>
          <td>Larry</td>
          <td>the Bird</td>
          <td>@twitter</td>
        </tr>
      </tbody>
    </table>
    

    所以我编辑它并打印这样的结果:

        <p>{!!html_entity_decode($vpn->intro)!!}</p>
    

    结果如下:

    你能帮我解决这个问题吗?

  • 【问题讨论】:

    • $vpn-&gt;intro 是否只有您共享的表?还有你为什么要html_entity_decode?
    • TinyMCE中不能直接放html代码,为此需要安装html编辑器代码插件tiny.cloud/docs/plugins/opensource/code

    标签: php laravel tinymce


    【解决方案1】:

    &lt;table&gt; 不允许打印在&lt;p&gt; 内,请改用&lt;div&gt;。

    <div>
    {!!html_entity_decode($vpn->intro)!!}
    </div>
    

    Here你可以找出原因。

    【讨论】:

    • Miqayel,我做到了,但它仍然是相同的显示
    • 在检查元素中可以看到什么?可以分享一下吗?
    • 有这么多空格“
      ”.......我猜>TinMCE 在每一行添加“
      ”......
    • 如何不粘贴html,而是使用其内置的table,就像在这个例子中link
    • advanced table plugin 每年 300 美元。您仍然可以免费使用basic table support
    猜你喜欢
    • 1970-01-01
    • 2019-02-01
    • 2021-04-06
    • 2017-08-08
    • 1970-01-01
    • 2021-04-09
    • 2020-12-04
    • 2013-11-24
    • 2020-01-17
    相关资源
    最近更新 更多