ckeditor配置.protectedSource对editor. inserthhtml中的html元素属性不起作用

ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml

本文关键字:html 元素 属性 不起作用 中的 inserthhtml 配置 protectedSource editor ckeditor      更新时间:2023-09-26

我已经将ckeditor从4.0更新到4.5.4,现在我的插件不像以前那样工作了

在我的config.js中有

    config.protectedSource.push(  /'{['s'S]*?'}/g );

所以我不想在编辑模式下保护所有{}(聪明的东西)。

接下来是我的代码从对话框按钮。

                onOk: function () {
                    var currentTabId = this._.currentTabId;
                    var link = '';
                    var OXID = this.getContentElement(currentTabId, 'OXID').getValue();
                    link += "{assign var='"aSb_cms_data'" value=$oViewConf->sb_cms_getCategorieData('" + OXID + "')}";
                    link += "<a href='{$aSb_cms_data.link}'";
                    title = "{$aSb_cms_data.title}";
                    link += 'title="' + title + '">' + title;
                    link += "</a>"
                    console.log(link); //
                    editor.insertHtml(link); 
                }

console.log(链接)将输出:

    {assign var="aSb_cms_data" value=$oViewConf->sb_cms_getCategorieData('testid')}<a href='{$aSb_cms_data.link}'title="{$aSb_cms_data.title}">{$aSb_cms_data.title}</a>

这就是我想要的源代码。

但在源代码(ckeditor)现在是:

 {assign var="aSb_cms_data" value=$oViewConf->sb_cms_getCategorieData('testid')}<a href="&lt;!--{cke_protected}%7B%24aSb_cms_data.link%7D--&gt;" title="&lt;!--{cke_protected}%7B%24aSb_cms_data.title%7D--&gt;">{$aSb_cms_data.title}</a>

所有的"a"属性都被cke_protected的东西弄乱了…在V4.0中,源代码等于console.log输出。

我怎么能解决这个问题?

我发现了问题:

缺少空格
link += 'title="' + title + '">' + title;

Title前:

link += ' title="' + title + '">' + title;