2017-05-26 19 views
5

W mojej konfiguracji Ckeditor mam niestandardową dozwoloną zawartość. Nie używam allowedContent:true ponieważ nie chcę, aby umożliwić atrybut style w znacznikach rozpiętościCkeditor: stylesSet nie działa, gdy ustawiam niestandardowy dozwolonyContent

Więc to jest mój 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;' 

Przy tej konfiguracji, atrybuty stylu nie mogą już na tagi zakresowe

problem jest z moimi 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" } } 

Wcześniej, kiedy miałem allowedContent:true, udało mi się zobaczyć i wykorzystanie wszystkie moje 5 stylów, ale teraz, z jakiegoś powodu, widzę tylko "styl 5" w polu Style

Czy mogę zachować moje 5 stylów bez używania allowedContent:true?

dziękuję

+0

Pozostawiłbym "allowedContent' na wartość domyślną i wprowadziłbym zmiany zamiast" extraAllowedContent' – Wizard

Odpowiedz

0

Wydaje się, że 5 stylesets wszystkie użyć atrybutu class, ale reguła allowedContent pozwala jedynie atrybut class dla span elementów.

Proponuję zmianę reguły allowedContent do:

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;' 

lub jeśli chcesz być bardziej wyraźne:

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;' 

Proszę odnieść się do documentation here.

Uwaga: Nie udało mi się przetestować tego kodu, proszę dać mi znać w komentarzach, jeśli wykona to zadanie.