Ticket #2869: 2869_3.patch

File 2869_3.patch, 6.0 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/blockoutline/blockoutline.css

     
     1.cke_block_outline p,
     2.cke_block_outline div,
     3.cke_block_outline pre,
     4.cke_block_outline address,
     5.cke_block_outline blockquote,
     6.cke_block_outline h1,
     7.cke_block_outline h2,
     8.cke_block_outline h3,
     9.cke_block_outline h4,
     10.cke_block_outline h5,
     11.cke_block_outline h6
     12{
     13        background-repeat: no-repeat;
     14        border: 1px dotted gray;
     15        padding-top: 8px;
     16        padding-left: 8px;
     17}
     18
     19.cke_block_outline p
     20{
     21        background-image: url(images/blockoutline.block_p.png);
     22}
     23
     24.cke_block_outline div
     25{
     26        background-image: url(images/blockoutline.block_div.png);
     27}
     28
     29.cke_block_outline pre
     30{
     31        background-image: url(images/blockoutline.block_pre.png);
     32}
     33
     34.cke_block_outline address
     35{
     36        background-image: url(images/blockoutline.block_address.png);
     37}
     38
     39.cke_block_outline blockquote
     40{
     41        background-image: url(images/blockoutline.block_blockquote.png);
     42}
     43
     44.cke_block_outline h1
     45{
     46        background-image: url(images/blockoutline.block_h1.png);
     47}
     48
     49.cke_block_outline h2
     50{
     51        background-image: url(images/blockoutline.block_h2.png);
     52}
     53
     54.cke_block_outline h3
     55{
     56        background-image: url(images/blockoutline.block_h3.png);
     57}
     58
     59.cke_block_outline h4
     60{
     61        background-image: url(images/blockoutline.block_h4.png);
     62}
     63
     64.cke_block_outline h5
     65{
     66        background-image: url(images/blockoutline.block_h5.png);
     67}
     68
     69.cke_block_outline h6
     70{
     71        background-image: url(images/blockoutline.block_h6.png);
     72}
  • _source/plugins/blockoutline/plugin.js

     
     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 "blockoutline" 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        BLOCK_OUTLINE_CLASSNAME = 'cke_block_outline';
     15        BLOCK_OUTLINE_CSS_PATH = 'blockoutline.css';
     16
     17        CKEDITOR.plugins.add( 'blockoutline',
     18        {
     19                requires : [ 'wysiwygarea' ],
     20
     21                init : function( editor )
     22                {
     23                        var pluginPath = this.path;
     24                        editor.addCommand( 'showblock' ,
     25                        {
     26                                exec : function ( editor )
     27                                {
     28                                        if ( this.state !== CKEDITOR.TRISTATE_DISABLED )
     29                                        {
     30                                                editor.document.getBody()[
     31                                                        this.state === CKEDITOR.TRISTATE_OFF ?
     32                                                        'addClass'
     33                                                        : 'removeClass' ]
     34                                                        ( BLOCK_OUTLINE_CLASSNAME );
     35                                                this.toggleState();
     36                                        }
     37                                }
     38                        });
     39
     40                        editor.ui.addButton( 'BlockOutline', {
     41                                                lablel :editor.lang.blockOutline,
     42                                                command :'showblock'
     43                                        } );
     44                       
     45                        editor.on( 'contentDom', function(){
     46                               
     47                                // Avoid using skin system since it's about document internal
     48                                // styles, load it manually on startup.
     49                                editor.document.appendStyleSheet( CKEDITOR.basePath
     50                                        + pluginPath + BLOCK_OUTLINE_CSS_PATH );
     51
     52                                // startup outline config
     53                                if ( CKEDITOR.config.startupOutlineBlocks )
     54                                        editor.getCommand( 'showblock' ).exec();
     55
     56                                // Triggered only on startup
     57                                this.removeListener( 'contentDom', arguments.callee );
     58                        } );
     59                       
     60                }
     61        });
     62       
     63})();
     64
     65CKEDITOR.tools.extend( CKEDITOR.config, {
     66        startupOutlineBlocks :false
     67} );
  • _source/core/command.js

     
    55
    66CKEDITOR.command = function( editor, commandDefinition )
    77{
    8         this.state = CKEDITOR.TRISTATE_OFF;
     8        this.state = ( 'state' in commandDefinition ) ? commandDefinition.state : CKEDITOR.TRISTATE_OFF;
    99
    1010        this.exec = function()
    1111        {
     
    1818        CKEDITOR.event.call( this );
    1919};
    2020
     21CKEDITOR.command.prototype =
     22{
     23        setState : function( newState )
     24        {
     25                // Do nothing if there is no state change.
     26                if ( this.state == newState )
     27                        return false;
     28
     29                // Set the new state.
     30                this.state = newState;
     31
     32                // Fire the "state" event, so other parts of the code can react to the
     33                // change.
     34                this.fire( 'state' );
     35
     36                return true;
     37        },
     38       
     39        /*
     40         * Toggle the current state of command and refresh.
     41         */
     42        toggleState : function()
     43        {
     44                this.setState( this.state === CKEDITOR.TRISTATE_ON ?
     45                                CKEDITOR.TRISTATE_OFF
     46                                : CKEDITOR.TRISTATE_ON );
     47        }
     48}
     49
    2150CKEDITOR.event.implementOn( CKEDITOR.command.prototype );
  • _source/core/config.js

     
    147147         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    148148         */
    149149
    150         plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,preview,removeformat,smiley,indent,link,list,sourcearea,table,specialchar,tab,toolbar,wysiwygarea',
     150        plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,preview,removeformat,smiley,indent,link,list,sourcearea,table,specialchar,tab,toolbar,wysiwygarea,blockoutline',
    151151
    152152        /**
    153153         * The theme to be used to build the UI.
  • _source/skins/default/toolbar.css

     
    310310{
    311311        background-position: 0 -880px;
    312312}
     313.cke_skin_default a.cke_button_showblock .cke_icon
     314{
     315        background-position: 0 -1136px;
     316}
    313317
    314318.cke_skin_default a.cke_button_numberedlist .cke_icon
    315319{
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy