CKEditor链接插件为渲染元素

时间:2017-10-26 03:00:54

标签: attributes ckeditor ckeditor4.x

我试图将以下属性添加到我在链接插件对话框中单击“确定”后创建的元素

style="color:#1cb9b0"

不确定我将在onOk函数中添加属性的位置?目前是

        onOk: function () {
            var data = {};

            // Collect data from fields.
            this.commitContent(data);

            if (!this._.selectedElements.length) {
                insertLinksIntoSelection(editor, data);
            } else {
                editLinksInSelection(editor, this._.selectedElements, data);

                delete this._.selectedElements;
            }
        },

任何提示或提示都会很棒。

1 个答案:

答案 0 :(得分:0)

因此,建议在插入或编辑现有链接时,我可以在那里添加样式属性。

insertLinksIntoSelectioneditLinksInSelection函数中,我添加了以下行

attributes.set.style = "color: #1cb9b0;"; // add style attribute

工作得很好。