Changes between Initial Version and Version 1 of Ticket #13775, comment 2


Ignore:
Timestamp:
Oct 6, 2015, 7:07:56 AM (9 years ago)
Author:
Jakub Ś
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13775, comment 2

    initial v1  
    11As a workaround ACF transformations might be used:
    22{{{
    3                         editor.on('pluginsLoaded', function(evt){
    4                                 evt.editor.filter.addTransformations( [
    5                                         [
    6                                                 {
    7                                                         element: 'font',
    8                                                         left: function( el ) {
    9                                                                 return el.name == 'font' && ( el.attributes.face || el.attributes.color );
    10                                                         },
    11                                                         right: function( el, tools ) {
    12                                                                 if( el.attributes.face ) {
    13                                                                         el.styles['font-family'] = el.attributes.face;
    14                                                                         delete el.attributes.face;
    15                                                                 }
     3var editor = CKEDITOR.replace('textarea_id', {/*instance specific configuration*/});
     4
     5editor.on('pluginsLoaded', function(evt){
     6        evt.editor.filter.addTransformations( [
     7                [
     8                        {
     9                                element: 'font',
     10                                left: function( el ) {
     11                                        return el.name == 'font' && ( el.attributes.face || el.attributes.color );
     12                                },
     13                                right: function( el, tools ) {
     14                                        if( el.attributes.face ) {
     15                                                el.styles['font-family'] = el.attributes.face;
     16                                                delete el.attributes.face;
     17                                        }
    1618                                                               
    17                                                                 if( el.attributes.color ) {
    18                                                                         el.styles['color'] = el.attributes.color;
    19                                                                         delete el.attributes.color;
    20                                                                 }
     19                                        if( el.attributes.color ) {
     20                                                el.styles['color'] = el.attributes.color;
     21                                                delete el.attributes.color;
     22                                        }
    2123                                                               
    22                                                                 el.name = 'span';
    23                                                         }
    24                                                 }
    25                                         ]
    26                                 ]);
    27                         });
     24                                        el.name = 'span';
     25                                }
     26                        }
     27                ]
     28        ]);
     29});
    2830}}}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy