在EPiServer的TinyMCE中允许自定义HTML属性 [英] Allow custom HTML attributes in TinyMCE in EPiServer

查看:70
本文介绍了在EPiServer的TinyMCE中允许自定义HTML属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅适用于EPiServer:

EPiServer only:

我们的客户正试图在TinyMCE编辑器中向div标签添加自定义属性-他们切换到HTML模式,进行更改并保存页面.然后删除属性.像这样洗涤HTML是TinyMCE的标准行为,可以将其配置为允许自定义标签属性.

Our clients are trying to add custom attributes to a div-tag in the TinyMCE editor - they switch to HTML mode, makes the changes and save the page. Then the attributes are removed. Washing HTML like this is standard behaviour of TinyMCE, and it is possible to configure it to allow custom tag attributes.

我的问题是如何在EPiServer中配置TinyMCE 以允许自定义HTML属性?我看不到我可以在哪里进行TinyMCE的初始化.并且将div添加到episerver.config中的安全"标签列表中也无法正常工作(请参阅uiSafeHtmlTags).

My question is how do I configure TinyMCE in EPiServer to allow custom HTML attributes? I don't see where I would be able to hook into the inititialization of TinyMCE. And adding div to the list of "safe" tags in episerver.config doesn't see to work either (see uiSafeHtmlTags).

示例:

<div class="fb-like" data-href="http://oursite" data-send="false"></div>

成为

<div class="fb-like"></div>

从TinyMCE文档中,了解如何向标签添加自定义属性: http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements

From the TinyMCE documentation, on how to add custom attributes to tags: http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements

推荐答案

我有此类

using EPiServer.Editor.TinyMCE;

namespace SomeNamespace
{
    [TinyMCEPluginNonVisual(
        AlwaysEnabled = true, 
        EditorInitConfigurationOptions = "{ extended_valid_elements: 'iframe[src|frameborder=0|alt|title|width|height|align|name]' }")]
    public class ExtendedValidElements { }
}

,并且在episerver.config中:

and this in episerver.config:

<episerver>
....
<tinyMCE mergedConfigurationProperties="valid_elements, extended_valid_elements, invalid_elements, valid_child_elements" />
</episerver>

在最近的项目中.如果将iframe部分更改为div [data-href | data-send],则该方法应该相同.

in a recent project. It should work the same if you change the iframe part to div[data-href|data-send].

这篇关于在EPiServer的TinyMCE中允许自定义HTML属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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