TYPO3:我插件的ckeditor配置中标签的数据属性是带状的 [英] TYPO3: Data-attributes of tags in ckeditor configuration of my plugin are striped

查看:84
本文介绍了TYPO3:我插件的ckeditor配置中标签的数据属性是带状的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个小插件,为ckeditor添加了一个按钮,以便用户可以在编辑器中添加一个工具提示代码片段.这很完美.关闭对话框后,代码已正确插入.之后,当我保存文本时,我的网站正在重新加载,我的数据属性也消失了.

在我的插件中,我添加了:

CKEDITOR.plugins.add('tooltip', {
        lang: [ 'en', 'de'],
        init: function (editor) {
            editor.addCommand('tooltip', new CKEDITOR.dialogCommand('tooltip', {
        allowedContent: 'span[data-hint-content]; sup'
            }));

在我使用的yaml-config中,我还添加了:

editor:
  config:
    allowedContent: 'span[data-*](*){*}; sup'

我在TYPO3环境中使用8.x版本.

我已经尝试将allowedContent更改为extraAllowedContent.但这无济于事.我注意到,我的yaml-config通过允许跨度或跨度标记起作用.但是不能允许属性.还尝试使用span []或span [data-].没有成功.

我在这里尝试过: TYPO3:CKEditor会删除-Tags 中的数据属性

有人有同样的问题吗?

解决方案

解决方案是修改HTMLparser_db的配置.只需将以下代码添加到yaml-config中即可:

processing:
    HTMLparser_db:
        tags:
            span:
                allowedAttribs: "class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop, data-target, data-toggle, data-hint-content"

I wrote a small plugin to add a button to ckeditor, so that the user can add a tooltip-codesnippet into the editor. This works perfect. After closing the dialog the code is correctly inserted. When I save afterward the text my site is reloading and my data-attributes are gone.

In my plugin I added:

CKEDITOR.plugins.add('tooltip', {
        lang: [ 'en', 'de'],
        init: function (editor) {
            editor.addCommand('tooltip', new CKEDITOR.dialogCommand('tooltip', {
        allowedContent: 'span[data-hint-content]; sup'
            }));

And also in my used yaml-config I added:

editor:
  config:
    allowedContent: 'span[data-*](*){*}; sup'

I'm in a TYPO3 context with Version 8.x.

I already tried to change allowedContent to extraAllowedContent. But this doesn't help. I noticed, that my yaml-config is working by allowing the tags span or sup. But cannot allow the attributes. Also tried to use span[] oder span[data-]. No success.

I eather tried this here: TYPO3: CKEditor strips data-attributes in -Tags

Does anybody had equal problems?

解决方案

The solution is to modify the config of the HTMLparser_db. Just add the following code to the yaml-config:

processing:
    HTMLparser_db:
        tags:
            span:
                allowedAttribs: "class, id, title, dir, lang, xml:lang, itemscope, itemtype, itemprop, data-target, data-toggle, data-hint-content"

这篇关于TYPO3:我插件的ckeditor配置中标签的数据属性是带状的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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