有谁知道如何通过 TinyMCE 界面启用标题标签的文本对齐?如果我选择(任何标题标签的)文本并选择对齐选项,它似乎已在编辑器中正确排列。但是,当我保存页面时,它会移回默认对齐方式(在我的例子中为左侧)。
我也尝试过直接编辑 HTML,但是当我关闭对话框时,HTML 似乎没有更新。
我在维基上找到了一些关于我尝试更新的 extended_valid_elements 的文档在 tiny_mce.js
文件中,但它似乎没有什么区别。
以下是tinyMceConfig.config 文件中标头标签的“valid_elements”设置:
-h1[id|dir|class|align],-h2[id|dir|class|align],
-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|style|dir|class|align]< /代码>
Does anyone know how I can enable text alignment of header tags through the TinyMCE interface? If I select the text (of any header tag) and select an aligment option it appears to have lined up correctly in the editor. However, when I save the page it gets shifted back to the default alignment (in my case left).
I have also tried editing the HTML directly but when I close the dialog the HTML doesn't seem to update.
I found some documentation on the wiki about the extended_valid_elements which I tried to update in the tiny_mce.js
file but it didn't seem to make a difference.
Here is the `valid_elements' setting for the header tags from the tinyMceConfig.config file:
-h1[id|dir|class|align],-h2[id|dir|class|align],
-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|style|dir|class|align]
发布评论
评论(2)
对于任何有类似问题的人来说,我设法解决了这个问题。
当您选择任何对齐选项时,编辑器会尝试将
style
属性应用于标题标记,默认情况下,在valid_elements
配置中未启用此功能。为了使其正常工作,您只需将
style
属性添加到每个标头的配置中,例如-h1[id|dir|class|align|style], -h2[id |dir|class|align|style]
等如果使用 Umbraco,您需要在
~/config/tinyMceConfig.config
文件中进行这些更改,然后回收您网站正在运行的应用程序池在下面。Just for anyone who has a similar issue, I managed to resolve this.
The editor attempts to apply the
style
attribute to header tags when you select any of the alignment options, by default this is not enabled in thevalid_elements
configuration.In order to get this to work you just need to add the
style
attribute to the configuration for each header e.g.-h1[id|dir|class|align|style], -h2[id|dir|class|align|style]
etcIf using Umbraco you need to make these changes in the
~/config/tinyMceConfig.config
file and then recycle the app pool your site is running under.valid_elements 怎么样?我认为这应该是适合您的设置,因为标头标记是有效的 xhtml 标记,您不需要 Extended_valid_elements。
What about valid_elements? I think this should be the right setting for you, because header tags are valid xhtml tags, you do not need extended_valid_elements.