Ticket #2869: 2869_4.patch

File 2869_4.patch, 10.9 KB (added by Martin Kou, 15 years ago)
  • _source/lang/en.js

     
    429429                insertOption: 'Replace actual contents',
    430430                selectPromptMsg: 'Please select the template to open in the editor',
    431431                emptyListMsg : '(No templates defined)'
    432         }
     432        },
     433
     434        showBlocks : 'Show Blocks'
    433435};
  • _source/plugins/toolbar/plugin.js

     
    219219                'SelectAll', 'RemoveFormat', '-',
    220220                'Link', 'Unlink', 'Anchor', '-',
    221221                'Image', '-',
    222                 'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak'
     222                'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak', '-',
     223                'ShowBlocks'
    223224        ]
    224225];
  • _source/plugins/showblocks/plugin.js

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_div.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_address.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_pre.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_blockquote.png
    ___________________________________________________________________
    Added: svn:executable
       + *
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_h1.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_h2.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_h3.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_h4.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_h5.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_h6.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source/plugins/showblocks/images/block_p.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
     
     1/*
     2Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6/**
     7 * @fileOverview The "showblocks" plugin. Enable it will make all block level
     8 *               elements being decorated with a border and the element name
     9 *               displayed on the left-right corner.
     10 */
     11
     12(function()
     13{
     14        var cssTemplate =
     15        [
     16                '.cke_show_blocks p,',
     17                '.cke_show_blocks div,',
     18                '.cke_show_blocks pre,',
     19                '.cke_show_blocks address,',
     20                '.cke_show_blocks blockquote,',
     21                '.cke_show_blocks h1,',
     22                '.cke_show_blocks h2,',
     23                '.cke_show_blocks h3,',
     24                '.cke_show_blocks h4,',
     25                '.cke_show_blocks h5,',
     26                '.cke_show_blocks h6',
     27                '{',
     28                        'background-repeat: no-repeat;',
     29                        'border: 1px dotted gray;',
     30                        'padding-top: 8px;',
     31                        'padding-left: 8px;',
     32                '}',
     33
     34                '.cke_show_blocks p',
     35                '{',
     36                        'background-image: url(%1images/block_p.png);',
     37                '}',
     38
     39                '.cke_show_blocks div',
     40                '{',
     41                        'background-image: url(%1images/block_div.png);',
     42                '}',
     43
     44                '.cke_show_blocks pre',
     45                '{',
     46                        'background-image: url(%1images/block_pre.png);',
     47                '}',
     48
     49                '.cke_show_blocks address',
     50                '{',
     51                        'background-image: url(%1images/block_address.png);',
     52                '}',
     53
     54                '.cke_show_blocks blockquote',
     55                '{',
     56                        'background-image: url(%1images/block_blockquote.png);',
     57                '}',
     58
     59                '.cke_show_blocks h1',
     60                '{',
     61                        'background-image: url(%1images/block_h1.png);',
     62                '}',
     63
     64                '.cke_show_blocks h2',
     65                '{',
     66                        'background-image: url(%1images/block_h2.png);',
     67                '}',
     68
     69                '.cke_show_blocks h3',
     70                '{',
     71                        'background-image: url(%1images/block_h3.png);',
     72                '}',
     73
     74                '.cke_show_blocks h4',
     75                '{',
     76                        'background-image: url(%1images/block_h4.png);',
     77                '}',
     78
     79                '.cke_show_blocks h5',
     80                '{',
     81                        'background-image: url(%1images/block_h5.png);',
     82                '}',
     83
     84                '.cke_show_blocks h6',
     85                '{',
     86                        'background-image: url(%1images/block_h6.png);',
     87                '}'
     88        ].join( '\n' );
     89
     90        var cssTemplateRegex = /%1/g;
     91
     92        CKEDITOR.plugins.add( 'showblocks',
     93        {
     94                requires : [ 'wysiwygarea' ],
     95
     96                init : function( editor )
     97                {
     98                        editor.addCommand( 'showblocks' ,
     99                        {
     100                                exec : function ( editor )
     101                                {
     102                                        if ( this.state != CKEDITOR.TRISTATE_DISABLED )
     103                                        {
     104                                                var funcName = this.state == CKEDITOR.TRISTATE_ON ? 'removeClass' : 'addClass';
     105                                                editor.document.getBody()[funcName]( 'cke_show_blocks' );
     106                                                this.toggleState();
     107                                                editor._.showBlocks = ( this.state == CKEDITOR.TRISTATE_ON );
     108                                        }
     109                                }
     110                        });
     111
     112                        editor.addCss( cssTemplate.replace( cssTemplateRegex, CKEDITOR.getUrl( this.path ) ) );
     113
     114                        // Set a flag in the editor object for remembering the show block state on
     115                        // mode switches.
     116                        editor._.showBlocks = editor.config.startupOutlineBlocks;
     117
     118                        editor.ui.addButton( 'ShowBlocks',
     119                                {
     120                                        label : editor.lang.showBlocks,
     121                                        command : 'showblocks'
     122                                } );
     123                       
     124                        editor.on( 'contentDom', function()
     125                        {
     126                                // Restore show blocks state after mode switches.
     127                                this.getCommand( 'showblocks' ).setState( CKEDITOR.TRISTATE_OFF );
     128                                if ( this._.showBlocks )
     129                                        this.getCommand( 'showblocks' ).exec();
     130                        } );
     131                }
     132        });
     133} )();
     134
     135CKEDITOR.config.startupOutlineBlocks = false;
  • _source/skins/default/toolbar.css

    Property changes on: _source/plugins/showblocks/plugin.js
    ___________________________________________________________________
    Added: svn:executable
       + *
    
     
    310310{
    311311        background-position: 0 -816px;
    312312}
     313.cke_skin_default a.cke_button_showblocks .cke_icon
     314{
     315        background-position: 0 -1136px;
     316}
    313317
    314318.cke_skin_default a.cke_button_select .cke_icon
    315319{
  • _source/core/config.js

     
    147147         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    148148         */
    149149
    150         plugins : 'basicstyles,blockquote,button,clipboard,elementspath,find,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',
     150        plugins : 'basicstyles,blockquote,button,clipboard,elementspath,find,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,showblocks,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',
    151151
    152152        /**
    153153         * The theme to be used to build the UI.
  • _source/core/command.js

     
    3737                this.fire( 'state' );
    3838
    3939                return true;
     40        },
     41
     42        toggleState : function()
     43        {
     44                if ( this.state == CKEDITOR.TRISTATE_OFF )
     45                        this.setState( CKEDITOR.TRISTATE_ON );
     46                else if ( this.state == CKEDITOR.TRISTATE_ON )
     47                        this.setState( CKEDITOR.TRISTATE_OFF );
    4048        }
    4149}
    4250
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy