TinyMCE - 允许表格单元格元素作为有效的 html [英] TinyMCE - allow table cell element as a valid html

查看:37
本文介绍了TinyMCE - 允许表格单元格元素作为有效的 html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了 answer 可以帮助将表格单元格添加为有效身体的 html 元素,但由于某种原因它没有帮助.我需要这样做的原因是我想将此特定内容用作另一个内容的重复数据,其中包含 table 元素.

I have found the answer which could help to add table cell as a valid html element of a body, but it doesn't help for some reason. The reason I need this is that I would like to use this particular content as a repeated data for another content, which contains table element.

初始内容示例:

<td>{{IMAGE}}</td>
<td><span style="font-weight: bold;">{{SHORT_DESCRIPTION}}</span></td>

以及剥离的内容:

{{IMAGE}}<span style="font-weight: bold;">{{SHORT_DESCRIPTION}}</span>

我已经尝试过的:

valid_children: "+body[style], +body[td]",
valid_elements : '+*[*]'

感谢任何帮助.

推荐答案

在花了几个小时深入TinyMce 的核心之后,发现问题不在于TinyMce.自 起,表格单元格元素不能是正文的直接子元素html 规范.

After spending couple hours and digging into core of TinyMce realized that the problem is not TinyMce. The table cell element cannot be direct child of a body as of html specs.

所以因为 TinyMce 将内容包装到 iframe,这是当前页面上的另一个 HTML 页面, 是脱光了.

So because TinyMce wraps content into iframe, which is another HTML page on the current page, the <td>'s are stripped out.

我没有在评论中执行建议的步骤,而是添加了另一个 textarea,它在加载时没有用 TinyMce 包装它.我认为在我的情况下这样做更好,因为我在页面上有多个 textareas 并且不想通过使用 javascript 进行操作来影响它们.

Instead of doing suggested steps in comments I have added another textarea which is loaded without wrapping it with TinyMce. I think doing this way is better in my case as I have multiple textareas on a page and don't want to affect them all by manipulating with javascript.

这篇关于TinyMCE - 允许表格单元格元素作为有效的 html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆