Ticket #2890: 2890.patch

File 2890.patch, 4.8 KB (added by Artur Formella, 15 years ago)
  • _source/core/config.js

     
    146146         * @example
    147147         * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea';
    148148         */
    149         plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,removeformat,smiley,sourcearea,specialchar,tab,toolbar,wysiwygarea',
     149        plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,preview,removeformat,smiley,sourcearea,specialchar,tab,toolbar,wysiwygarea',
    150150
    151151        /**
    152152         * The theme to be used to build the UI.
  • _source/lang/en.js

     
    3030        // Toolbar buttons without dialogs.
    3131        source                  : 'Source',
    3232        newPage                 : 'New Page',
     33        preview                 : 'Preview',
    3334        print                   : 'Print',
    3435        underline               : 'Underline',
    3536        bold                    : 'Bold',
  • _source/plugins/preview/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 * @file Preview plugin.
     8 */
     9
     10(function()
     11{
     12        var previewCmd =
     13        {
     14                exec : function( editor )
     15                {
     16                        var sHTML,
     17                                isCustomDomain = CKEDITOR.env.ie && document.domain != window.location.hostname;
     18                        if ( editor.config.fullPage )
     19                                sHTML = editor.getData();
     20                        else
     21                        {
     22                                var bodyHtml = '<body ',
     23                                        body = CKEDITOR.document.getBody(),
     24                                        baseTag = ( editor.config.baseHref.length > 0 ) ? '<base href="' + editor.config.baseHref + '" _cktemp="true"></base>' : '';
     25
     26                                if ( body.getAttribute( 'id' ) )
     27                                        bodyHtml += 'id="' + body.getAttribute( 'id' ) + '" ';
     28                                if ( body.getAttribute( 'class' ) )
     29                                        bodyHtml += 'class="' + body.getAttribute( 'class' ) + '" ';
     30                                bodyHtml += '>';
     31
     32                                sHTML =
     33                                        editor.config.docType +
     34                                        '<html dir="' + editor.config.contentsLangDirection + '">' +
     35                                        '<head>' +
     36                                        baseTag +
     37                                        '<title>' + editor.lang.preview + '</title>' +
     38                                        '<link href="' + editor.config.contentsCss + '" type="text/css" rel="stylesheet" _cktemp="true"/>' +
     39                                        '</head>' + bodyHtml +
     40                                        editor.getData() +
     41                                        '</body></html>';
     42                        }
     43
     44                        var iWidth      = 640;  // 800 * 0.8,
     45                                iHeight = 420;  // 600 * 0.7,
     46                                iLeft   = 80;   // (800 - 0.8 * 800) /2 = 800 * 0.1.
     47                        try
     48                        {
     49                                iWidth = Math.Round( screen.width * 0.8 );
     50                                iHeight = Math.Round( screen.height * 0.7 );
     51                                iLeft = Math.Round( screen.width * 0.1 );
     52                        }
     53                        catch ( e ){}
     54
     55                        var sOpenUrl = '';
     56                        if ( isCustomDomain )
     57                        {
     58                                window._cke_htmlToLoad = sHTML;
     59                                sOpenUrl = 'javascript:void( (function(){' +
     60                                        'document.open();' +
     61                                        'document.domain="' + document.domain + '";' +
     62                                        'document.write( window.opener._cke_htmlToLoad );' +
     63                                        'document.close();' +
     64                                        'window.opener._cke_htmlToLoad = null;' +
     65                                        '})() )';
     66                        }
     67
     68                        var oWindow = window.open( sOpenUrl, null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' +
     69                                iWidth + ',height=' + iHeight + ',left=' + iLeft );
     70
     71                        if ( !isCustomDomain )
     72                        {
     73                                oWindow.document.write( sHTML );
     74                                oWindow.document.close();
     75                        }
     76                }
     77        };
     78
     79        var pluginName = 'preview';
     80
     81        // Register a plugin named "save".
     82        CKEDITOR.plugins.add( pluginName,
     83        {
     84                init : function( editor, pluginPath )
     85                {
     86                        editor.addCommand( pluginName, previewCmd );
     87                        editor.ui.addButton( 'Preview',
     88                                {
     89                                        label : editor.lang.preview,
     90                                        command : pluginName
     91                                });
     92                }
     93        });
     94})();
  • _source/plugins/toolbar/plugin.js

     
    207207[
    208208        [
    209209                'Source', '-',
    210                 'NewPage', '-',
     210                'NewPage', 'Preview', '-',
    211211                'Bold', 'Italic', 'Underline', 'Strike', '-',
    212212                'Subscript', 'Superscript', '-',
    213213                'SelectAll', 'RemoveFormat', '-',
  • _source/skins/default/toolbar.css

     
    151151        background-position: 0 -48px;
    152152}
    153153
     154.cke_skin_default a.cke_button_preview .cke_icon
     155{
     156        background-position: 0 -64px;
     157}
     158
    154159.cke_skin_default a.cke_button_find .cke_icon
    155160{
    156161        background-position: 0 -240px;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy