当我为用户控件中的可本地化内容创建全局数据类型时,我遇到了C1 总是围绕纯文本的问题是,
<p></p>
如果内容只是在链接内,但仍然必须包含 html,我不希望这样。即使我使用可视化编辑器的代码视图,如果我翻译数据,C1 也会读取标签。
有没有办法阻止 C1 在使用可视化编辑器时自动将 html 添加到我的字符串数据中?
When I create a Global Data Type for localizable content in user controls I run into the problem that C1 always surrounds plain text with
<p></p>
I don't want that if the content is just meant to be inside a link for example, but still has to contain html. Even if I use the code view of the Visual Editor, C1 will readd the tags e.h. if I translate the data.
Is there a way to stop C1 from automagically adding html to my string data when using the visual editor?
发布评论
评论(2)
我建议您保持编辑器不变,并继续将 html 存储为有效的 xhtml 文档,并在渲染时处理此问题。从长远来看,存储数据的方式中不渗透自定义功能/设计也可能是一个优点。
实现此目的的一种方法是使用 XSLT,如本文所述 “如何从视觉内容编辑器修改 HTML?” - 您也可以使用 C# 执行此操作。
I suggest you leave the editor as it is and keep on storing your html as valid xhtml documents, and instead handle this when rendering. Not having custom features/design permeate the way you store data could also be a plus in the long run.
One way to achieve this is with XSLT as described in this article "How can I modify the HTML from the Visual Content editor?" - you can also do this with C#.
有一些关于这种不良行为的报告,但不幸的是这是设计使然。您可能会争论是 ts Composite C1 的错误还是底层 TinyMCE 编辑器的错误,但也许您可以调整它的配置。或者使用 xslt-template 包装输出内容的函数,该模板将删除 p。
请参阅这些讨论以获取进一步的解释。
TinyMCE 配置更改 - 强制 P False
可视化编辑器自动添加 p 标签
There has been a few reports of this undesired behavior, but unfortunately its by design. You could argue if ts Composite C1's fault or the underlying TinyMCE editor, but maybe you can tweak the configuration of it. Or wrap the functions that output the content with a xslt-template that will strip out the p's.
See these discussions for further explanations.
TinyMCE Config Change - Force P False
Visual editor adding p tag automatically