Ticket #3564: 3564.patch

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

     
    647647                copy : 'Copyright © $1. All rights reserved.'
    648648        },
    649649
    650         maximize : 'Maximize'
     650        maximize : 'Maximize',
     651
     652        resize : 'Drag to resize'
    651653};
  • _source/plugins/resize/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
     6CKEDITOR.plugins.add( 'resize',
     7{
     8        init : function( editor )
     9        {
     10                var config = editor.config;
     11
     12                function attachResizer()
     13                {
     14                        var bottom = editor.getThemeSpace( 'bottom' );
     15
     16                        // Add the resize handle.
     17                        var resizer = CKEDITOR.dom.element.createFromHtml( '<div class="cke_resizer"' +
     18                                ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' +
     19                                '></div>' );
     20                        resizer.appendTo( bottom );
     21
     22                        // Add event handlers to the resize handle.
     23                        var origin,
     24                                startSize,
     25                                container = editor.getThemeSpace( 'contents' ).getAscendant( 'table' );
     26                        function dragHandler( evt )
     27                        {
     28                                var dx = evt.data.$.screenX - origin.x;
     29                                var dy = evt.data.$.screenY - origin.y;
     30                                var internalWidth = startSize.width + dx;
     31                                var internalHeight = startSize.height + dy;
     32
     33                                editor.resize( Math.max( config.resizeMinWidth, Math.min( internalWidth, config.resizeMaxWidth ) ),
     34                                                Math.max( config.resizeMinHeight, Math.min( internalHeight, config.resizeMaxHeight ) ) );
     35                        }
     36
     37                        function dragEndHandler ( evt )
     38                        {
     39                                CKEDITOR.document.removeListener( 'mousemove', dragHandler );
     40                                CKEDITOR.document.removeListener( 'mouseup', dragEndHandler );
     41
     42                                if ( editor.document )
     43                                {
     44                                        editor.document.removeListener( 'mousemove', dragHandler );
     45                                        editor.document.removeListener( 'mouseup', dragEndHandler );
     46                                }
     47                        }
     48
     49                        resizer.on( 'mousedown', function( evt )
     50                                {
     51                                        startSize = { width : container.$.offsetWidth || 0, height : container.$.offsetHeight || 0 };
     52                                        origin = { x : evt.data.$.screenX, y : evt.data.$.screenY };
     53
     54                                        CKEDITOR.document.on( 'mousemove', dragHandler );
     55                                        CKEDITOR.document.on( 'mouseup', dragEndHandler );
     56
     57                                        if ( editor.document )
     58                                        {
     59                                                editor.document.on( 'mousemove', dragHandler );
     60                                                editor.document.on( 'mouseup', dragEndHandler );
     61                                        }
     62                                } );
     63
     64                }
     65
     66                if ( config.resizeEnabled )
     67                        editor.on( 'themeLoaded', attachResizer );
     68        }
     69} );
     70
     71CKEDITOR.config.resizeMinWidth = 100;
     72CKEDITOR.config.resizeMinHeight = 250;
     73CKEDITOR.config.resizeMaxWidth = 3000;
     74CKEDITOR.config.resizeMaxHeight = 3000;
     75CKEDITOR.config.resizeEnabled = true;
  • _source/themes/default/theme.js

     
    186186        var delta = isContentHeight ? 0 : ( outer.$.offsetHeight || 0 ) - ( contents.$.clientHeight || 0 );
    187187
    188188        // Resize the height.
    189         contents.setStyle( 'height', ( height - delta ) + 'px' );
     189        contents.setStyle( 'height', Math.max( ( height - delta ), 0 ) + 'px' );
    190190
    191191        // Emit a resize event.
    192192        this.fire( 'resize' );
  • _source/skins/office2003/elementspath.css

     
    1414.cke_skin_office2003 .cke_path
    1515{
    1616        padding: 3px 3px 0 3px;
     17        display: block;
     18        float: left;
     19        width: 75%;
    1720}
    1821
    1922.cke_skin_office2003 .cke_path a,
  • _source/skins/office2003/mainui.css

     
    5454        white-space: pre;
    5555        background-color: #fff;
    5656}
     57
     58.cke_skin_office2003 .cke_resizer
     59{
     60        width: 12px;
     61        height: 12px;
     62        margin-top: 12px;
     63        display: block;
     64        float: right;
     65        background-image: url(images/resizer.gif);
     66        cursor: se-resize;
     67}
  • _source/skins/v2/elementspath.css

     
    1414.cke_skin_v2 .cke_path
    1515{
    1616        padding: 3px 3px 0 3px;
     17        display: block;
     18        float: left;
     19        width: 75%;
    1720}
    1821
    1922.cke_skin_v2 .cke_path a,
  • _source/skins/v2/mainui.css

     
    6565        /* For IE6+Quirks only */
    6666        _white-space: normal;
    6767}
     68
     69.cke_skin_v2 .cke_resizer
     70{
     71        width: 12px;
     72        height: 12px;
     73        margin-top: 12px;
     74        display: block;
     75        float: right;
     76        background-image: url(images/resizer.gif);
     77        cursor: se-resize;
     78}
  • _source/core/config.js

     
    150150         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    151151         */
    152152
    153         plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,save,scayt,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     153        plugins : 'about,basicstyles,blockquote,button,clipboard,colorbutton,contextmenu,elementspath,enterkey,entities,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,maximize,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,resize,save,scayt,smiley,showblocks,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    154154
    155155        /**
    156156         * List of additional plugins to be loaded. This is a tool setting which
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy