Ticket #7193: 7193.patch

File 7193.patch, 1.9 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/horizontalrule/plugin.js

     
    99
    1010(function()
    1111{
     12        // IE9 buggy on horizontal line that allows adding text into it, use fake instead. (#7193)
     13        var useFake = document.documentMode == 9;
     14
    1215        var horizontalruleCmd =
    1316        {
    1417                canUndo : false,    // The undo snapshot will be handled by 'insertElement'.
    1518                exec : function( editor )
    1619                {
    17                         editor.insertElement( editor.document.createElement( 'hr' ) );
     20                        var element =  editor.document.createElement( 'hr' );
     21                        useFake && ( element = editor.createFakeElement( element, 'cke_hr', 'hr' ) );
     22                        editor.insertElement( element );
    1823                }
    1924        };
    2025
     
    3136                                        label : editor.lang.horizontalrule,
    3237                                        command : pluginName
    3338                                });
    34                 }
    35         });
     39
     40                },
     41                afterInit : useFake ? function( editor )
     42                {
     43                        // Direct fake objects lang entry to plugin.
     44                        editor.lang.fakeobjects.hr = editor.lang.horizontalrule;
     45
     46                        // Add the style that renders the horizontal line.
     47                        editor.addCss(
     48                                        'img.cke_hr' +
     49                                                        '{' +
     50                                                        'background-image: url(' + ( CKEDITOR.basePath + 'images/spacer.gif' ) + ');' +
     51                                                        'clear: both;' +
     52                                                        'display: block;' +
     53                                                        'float: none;' +
     54                                                        'width:100% !important; _width:99.9% !important;' +
     55                                                        'border-top: #808080 1px solid;' +
     56                                                        'border-bottom: #808080 1px solid;' +
     57                                                        'height: 0px !important;' +
     58                                                        '}' );
     59
     60                        // Register a filter to transform placeholders on data input.
     61                        var dataProcessor = editor.dataProcessor,
     62                                dataFilter = dataProcessor && dataProcessor.dataFilter;
     63                        dataFilter && dataFilter.addRules( { elements : { hr : function( element ) { return editor.createFakeParserElement( element, 'cke_hr', 'hr' ); } } } );
     64                } : null
     65        } );
    3666})();
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy