将“name”属性添加到<a> tags in WYSIWYG editor... CKEditor or otherwise

时间:2016-12-08 14:47:49

标签: html ckeditor editor wysiwyg bootstrap-wysiwyg

I have an application that builds emails, and part of the includes some non-standard things that you might not see in web such as adding a "name" attribute to links. I need a WYSIWYG and I'm 99% sure we are going with CKEditor so my question is:

1) Is there a way in CKEditor to add a "name" attribute to anchor tags? Is it possible/feasible to write a plugin?

2) If not CKEditor does any other WYSIWYG editors allow this

Here is what I need:

<a href="link.com" name="anchor_name">My Link</a>

Also it would be nice to be able to allow the end use to create custom tags for tracking purposes such as:

<a href="link.com" name="anchor_name" tracking="xs1234567">My Link</a>

Is this possible?

1 个答案:

答案 0 :(得分:1)

默认情况下,CKEditor不支持,但您可以编写自己的插件来扩展行为。

首先要考虑的是“ACF”系统,它只允许元素,属性,类和样式的子集,因此您必须将a元素的属性列入白名单。

然后,您必须使用默认链接对话框并对其进行修改,或者创建一个动态修改它的插件,以允许用户设置属性。

因此,只需阅读文档即可了解如何为CKEditor创建插件并开始编码。