2017-05-26 18 views
5

Ckeditorの設定では、私はカスタムのallowedContentを持っています。私はspanタグでstyle属性がCkeditor:カスタムのallowedContentを設定するとstylesSetが動作しない

許可したくないので、私はこれが、この構成では、私のallowedContent

allowedContent : 'span[class]; a[!href](*); caption; div; em; h1; h2; h3; h4; h5; h6; hr; i; img; li; ol; p[*]{*}; pre; strong; sub; sup; table; thead; tbody; tfoot; td; th; tr; tt; u; ul; dl; dt; dd; iframe;' 

あるallowedContent:trueを使用していない、スタイル属性は、上でもう許可されていませんspanタグ

問題は私のstylesSetsである:

stylesSet: 
     - { name: "style 1", element: ['div', 'p', 'a', 'span'], attributes: { class:"display_only_in_popup" } } 
     - { name: "style 2", element: ['div', 'p', 'a', 'span'], attributes: { class:"blockquote" } } 
     - { name: "style 3", element: ['div', 'p', 'a', 'span'], attributes: { class:"note" } } 
     - { name: "style 4", element: ['p', 'span'], attributes: { class:"highlight" } } 
     - { name: "style 5", element: 'span', attributes: { class:"visuallyhidden" } } 

私はallowedContent:trueを持っていたとき、私は見て使用することができました、前にすべて私の5つのスタイルセットが、しかし、何らかの理由で、私はスタイルフィールドで "スタイル5"を参照してください

allowedContent:trueを使わずに5つのスタイルセットを保持することは可能ですか?

どうもありがとう

+0

私は 'allowedContent'をデフォルト値のままにして、' extraAllowedContent'の代わりに変更します – Wizard

答えて

0

あなたの5つのスタイルセットはすべてclass属性を使用しているようですが、あなたのallowedContentルールは、span要素に対してclass属性を可能にします。

私はにallowedContentルールを変更するお勧め:

allowedContent : '*[class]; a[!href](*); caption; div; em; h1; h2; h3; h4; h5; h6; hr; i; img; li; ol; p[*]{*}; pre; strong; sub; sup; table; thead; tbody; tfoot; td; th; tr; tt; u; ul; dl; dt; dd; iframe;' 

またはあなたがより明確になりたい場合:

allowedContent : 'div[class]; p[class]; a[class]; span[class]; a[!href](*); caption; div; em; h1; h2; h3; h4; h5; h6; hr; i; img; li; ol; p[*]{*}; pre; strong; sub; sup; table; thead; tbody; tfoot; td; th; tr; tt; u; ul; dl; dt; dd; iframe;' 

documentation hereを参照してください。

注:私はこのコードをテストすることができませんでした。私はそれが仕事をする場合、コメントに私に教えてください。

関連する問題