Ticket #2988: 2988_5.patch

File 2988_5.patch, 28.6 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _samples/fullpage.html

     
    5656
    5757                                CKEDITOR.replace( 'editor1',
    5858                                        {
    59                                                 fullPage : true
     59                                                fullPage : true,
     60                                                extraPlugins : 'docprops'
    6061                                        });
    6162
    6263                        //]]>
  • _source/core/dom/element.js

     
    429429                                                        name = 'className';
    430430                                                        break;
    431431
     432                                                case 'http-equiv':
     433                                                        name = 'httpEquiv';
     434                                                        break;
     435
    432436                                                case 'name':
    433437                                                        return this.$.name;
    434438
  • _source/lang/en.js

     
    766766        {
    767767                ltr : 'Text direction from left to right',
    768768                rtl : 'Text direction from right to left'
     769        },
     770
     771        docprops :
     772        {
     773                label : 'Document Properties',
     774                title : 'Document Properties',
     775                design : 'Design',
     776                meta : 'Meta Tags',
     777                chooseColor : 'Choose',
     778                other : 'Other...',
     779                docTitle :      'Page Title',
     780                charset :       'Character Set Encoding',
     781                charsetOther : 'Other Character Set Encoding',
     782                charsetASCII : 'ASCII',
     783                charsetCE : 'Central European',
     784                charsetCT : 'Chinese Traditional (Big5)',
     785                charsetCR : 'Cyrillic',
     786                charsetGR : 'Greek',
     787                charsetJP : 'Japanese',
     788                charsetKR : 'Korean',
     789                charsetTR : 'Turkish',
     790                charsetUN : 'Unicode (UTF-8)',
     791                charsetWE : 'Westren European',
     792                docType : 'Document Type Heading',
     793                docTypeOther : 'Other Document Type Heading',
     794                xhtmlDec : 'Include XHTML Declarations',
     795                bgColor : 'Background Color',
     796                bgImage : 'Background Image URL',
     797                bgFixed : 'Non-scrolling (Fixed) Background',
     798                txtColor : 'Text Color',
     799                margin : 'Page Margins',
     800                marginTop : 'Top',
     801                marginLeft : 'Left',
     802                marginRight : 'Right',
     803                marginBottom : 'Bottom',
     804                metaKeywords : 'Document Indexing Keywords (comma separated)',
     805                metaDescription : 'Document Description',
     806                metaAuthor : 'Author',
     807                metaCopyright : 'Copyright',
     808                previewHtml : '<p>This is some <strong>sample text</strong>. You are using <a href="javascript:void(0)">CKEditor</a>.</p>'
    769809        }
    770810};
  • _source/plugins/dialogui/plugin.js

     
    618618                                        for ( var i = 0, item ; i < elementDefinition.items.length && ( item = elementDefinition.items[i] ) ; i++ )
    619619                                        {
    620620                                                innerHTML.push( '<option value="',
    621                                                         CKEDITOR.tools.htmlEncode( item[1] !== undefined ? item[1] : item[0] ), '" /> ',
     621                                                        CKEDITOR.tools.htmlEncode( item[1] !== undefined ? item[1] : item[0] ).replace( /"/g, '&quot;' ), '" /> ',
    622622                                                        CKEDITOR.tools.htmlEncode( item[0] ) );
    623623                                        }
    624624
  • _source/plugins/docprops/dialogs/docprops.js

     
     1/*
     2Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.dialog.add( 'docProps', function( editor )
     7{
     8        var lang = editor.lang.docprops,
     9                langCommon = editor.lang.common,
     10                metaHash = {};
     11
     12        function getDialogValue( dialogName, callback )
     13        {
     14                var onOk = function()
     15                {
     16                        releaseHandlers( this );
     17                        callback( this, this._.parentDialog );
     18                };
     19                var releaseHandlers = function( dialog )
     20                {
     21                        dialog.removeListener( 'ok', onOk );
     22                        dialog.removeListener( 'cancel', releaseHandlers );
     23                };
     24                var bindToDialog = function( dialog )
     25                {
     26                        dialog.on( 'ok', onOk );
     27                        dialog.on( 'cancel', releaseHandlers );
     28                };
     29                editor.execCommand( dialogName );
     30                if ( editor._.storedDialogs.colordialog )
     31                        bindToDialog( editor._.storedDialogs.colordialog );
     32                else
     33                {
     34                        CKEDITOR.on( 'dialogDefinition', function( e )
     35                        {
     36                                if ( e.data.name != dialogName )
     37                                        return;
     38
     39                                var definition = e.data.definition;
     40
     41                                e.removeListener();
     42                                definition.onLoad = CKEDITOR.tools.override( definition.onLoad, function( orginal )
     43                                {
     44                                        return function()
     45                                        {
     46                                                bindToDialog( this );
     47                                                definition.onLoad = orginal;
     48                                                if ( typeof orginal == 'function' )
     49                                                        orginal.call( this );
     50                                        };
     51                                });
     52                        });
     53                }
     54        }
     55        function handleOther()
     56        {
     57                var dialog = this.getDialog(),
     58                        other = dialog.getContentElement( 'general', this.id + 'Other' );
     59                if ( !other )
     60                        return;
     61                if ( this.getValue() == 'other' )
     62                {
     63                        other.getInputElement().removeAttribute( 'readOnly' );
     64                        other.focus();
     65                        other.getElement().removeClass( 'cke_disabled' );
     66                }
     67                else
     68                {
     69                        other.getInputElement().setAttribute( 'readOnly', true );
     70                        other.getElement().addClass( 'cke_disabled' );
     71                }
     72        }
     73        function commitMeta( name, isHttp, value )
     74        {
     75                return function( doc, html, head )
     76                {
     77                        var hash = metaHash,
     78                                val = typeof value != 'undefined' ? value : this.getValue();
     79                        if ( !val && ( name in hash ) )
     80                                hash[ name ].remove();
     81                        else if ( val && ( name in hash ) )
     82                                hash[ name ].setAttribute( 'content', val );
     83                        else if ( val )
     84                        {
     85                                var meta = new CKEDITOR.dom.element( 'meta', editor.document );
     86                                meta.setAttribute( isHttp ? 'http-equiv' : 'name', name );
     87                                meta.setAttribute( 'content', val );
     88                                head.append( meta );
     89                        }
     90                };
     91        }
     92        function setupMeta( name, ret )
     93        {
     94                return function()
     95                {
     96                        var hash = metaHash,
     97                                result = ( name in hash ) ? hash[ name ].getAttribute( 'content' ) || '' : '';
     98                        if ( ret )
     99                                return result;
     100                        this.setValue( result );
     101                };
     102        }
     103        function commitMargin( name )
     104        {
     105                return function( doc, html, head, body )
     106                {
     107                        body.removeAttribute( 'margin' + name );
     108                        var val = this.getValue();
     109                        if ( val !== '' )
     110                                body.setStyle( 'margin-' + name, CKEDITOR.tools.cssLength( val ) );
     111                        else
     112                                body.removeStyle( 'margin-' + name );
     113                };
     114        }
     115
     116        function createMetaHash( doc )
     117        {
     118                var hash = {},
     119                        metas = doc.getElementsByTag( 'meta' ),
     120                        count = metas.count();
     121
     122                for ( var i = 0; i < count; i++ )
     123                {
     124                        var meta = metas.getItem( i );
     125                        hash[ meta.getAttribute( meta.hasAttribute( 'http-equiv' ) ? 'http-equiv' : 'name' ).toLowerCase() ] = meta;
     126                }
     127                return hash;
     128        }
     129        // We cannot just remove the style from the element, as it might be affected from non-inline stylesheets.
     130        // To get the proper result, we should manually set the inline style to its default value.
     131        function resetStyle( element, prop, resetVal )
     132        {
     133                element.removeStyle( prop );
     134                if ( element.getComputedStyle( prop ) != resetVal )
     135                        element.setStyle( prop, resetVal );
     136        }
     137
     138        // Utilty to shorten the creation of color fields in the dialog.
     139        var colorField = function( id, label, fieldProps )
     140        {
     141                return {
     142                        type : 'hbox',
     143                        padding : 0,
     144                        widths : [ '60%', '40%' ],
     145                        children : [
     146                                CKEDITOR.tools.extend( {
     147                                        type : 'text',
     148                                        id : id,
     149                                        label : lang[ label ]
     150                                }, fieldProps || {}, 1 ),
     151                                {
     152                                        type : 'button',
     153                                        id : id + 'Choose',
     154                                        label : lang.chooseColor,
     155                                        className : 'colorChooser',
     156                                        onClick : function()
     157                                        {
     158                                                var self = this;
     159                                                getDialogValue( 'colordialog', function( colorDialog )
     160                                                {
     161                                                        var dialog = self.getDialog();
     162                                                        dialog.getContentElement( dialog._.currentTabId, id ).setValue( colorDialog.getContentElement( 'picker', 'selectedColor' ).getValue() );
     163                                                });
     164                                        }
     165                                }
     166                        ]
     167                };
     168        };
     169        var previewSrc = 'javascript:' +
     170                'void((function(){' +
     171                        encodeURIComponent(
     172                                'document.open();' +
     173                                ( CKEDITOR.env.isCustomDomain() ? 'document.domain=\'' + document.domain + '\';' : '' ) +
     174                                'document.write( \'<html style="background-color: #ffffff; height: 100%"><head></head><body style="width: 100%; height: 100%; margin: 0px">' + lang.previewHtml + '</body></html>\' );' +
     175                                'document.close();'
     176                        ) +
     177                '})())';
     178
     179        return {
     180                title : lang.title,
     181                minHeight: 330,
     182                minWidth: 500,
     183                onShow : function()
     184                {
     185                        var doc = editor.document,
     186                                html = doc.getElementsByTag( 'html' ).getItem( 0 ),
     187                                head = doc.getHead(),
     188                                body = doc.getBody();
     189                        metaHash = createMetaHash( doc );
     190                        this.setupContent( doc, html, head, body );
     191                },
     192                onHide : function()
     193                {
     194                        metaHash = {};
     195                },
     196                onOk : function()
     197                {
     198                        var doc = editor.document,
     199                                html = doc.getElementsByTag( 'html' ).getItem( 0 ),
     200                                head = doc.getHead(),
     201                                body = doc.getBody();
     202                        this.commitContent( doc, html, head, body );
     203                },
     204                contents : [
     205                        {
     206                                id : 'general',
     207                                label : langCommon.generalTab,
     208                                elements : [
     209                                        {
     210                                                type : 'text',
     211                                                id : 'title',
     212                                                label : lang.docTitle,
     213                                                setup : function( doc )
     214                                                {
     215                                                        this.setValue( doc.getElementsByTag( 'title' ).getItem( 0 ).data( 'cke-title' ) );
     216                                                },
     217                                                commit : function( doc, html, head, body, isPreview )
     218                                                {
     219                                                        if ( isPreview )
     220                                                                return;
     221                                                        doc.getElementsByTag( 'title' ).getItem( 0 ).data( 'cke-title', this.getValue() );
     222                                                }
     223                                        },
     224                                        {
     225                                                type : 'hbox',
     226                                                children : [
     227                                                        {
     228                                                                type : 'select',
     229                                                                id : 'dir',
     230                                                                label : langCommon.langDir,
     231                                                                style : 'width: 100%',
     232                                                                items : [
     233                                                                        [ langCommon.notSet , '' ],
     234                                                                        [ langCommon.langDirLtr, 'ltr' ],
     235                                                                        [ langCommon.langDirRtl, 'rtl' ]
     236                                                                ],
     237                                                                setup : function( doc, html, head, body )
     238                                                                {
     239                                                                        this.setValue( body.getDirection() || '' );
     240                                                                },
     241                                                                commit : function( doc, html, head, body )
     242                                                                {
     243                                                                        var val = this.getValue();
     244                                                                        if ( val )
     245                                                                                body.setAttribute( 'dir', val );
     246                                                                        else
     247                                                                                body.removeAttribute( 'dir' );
     248                                                                        body.removeStyle( 'direction' );
     249                                                                }
     250                                                        },
     251                                                        {
     252                                                                type : 'text',
     253                                                                id : 'langCode',
     254                                                                label : langCommon.langCode,
     255                                                                setup : function( doc, html )
     256                                                                {
     257                                                                        this.setValue( html.getAttribute( 'xml:lang' ) || html.getAttribute( 'lang' ) || '' );
     258                                                                },
     259                                                                commit : function( doc, html, head, body, isPreview )
     260                                                                {
     261                                                                        if ( isPreview )
     262                                                                                return;
     263                                                                        var val = this.getValue();
     264                                                                        if ( val )
     265                                                                                html.setAttributes( { 'xml:lang' : val, lang : val } );
     266                                                                        else
     267                                                                                html.removeAttributes( { 'xml:lang' : 1, lang : 1 } );
     268                                                                }
     269                                                        }
     270                                                ]
     271                                        },
     272                                        {
     273                                                type : 'hbox',
     274                                                children : [
     275                                                        {
     276                                                                type : 'select',
     277                                                                id : 'charset',
     278                                                                label : lang.charset,
     279                                                                style : 'width: 100%',
     280                                                                items : [
     281                                                                        [ langCommon.notSet, '' ],
     282                                                                        [ lang.charsetASCII, 'us-ascii' ],
     283                                                                        [ lang.charsetCE, 'iso-8859-2' ],
     284                                                                        [ lang.charsetCT, 'big5' ],
     285                                                                        [ lang.charsetCR, 'iso-8859-5' ],
     286                                                                        [ lang.charsetGR, 'iso-8859-7' ],
     287                                                                        [ lang.charsetJP, 'iso-2022-jp' ],
     288                                                                        [ lang.charsetKR, 'iso-2022-kr' ],
     289                                                                        [ lang.charsetTR, 'iso-8859-9' ],
     290                                                                        [ lang.charsetUN, 'utf-8' ],
     291                                                                        [ lang.charsetWE, 'iso-8859-1' ],
     292                                                                        [ lang.other, 'other' ]
     293                                                                ],
     294                                                                'default' : '',
     295                                                                onChange : function()
     296                                                                {
     297                                                                        this.getDialog().selectedCharset = this.getValue() != 'other' ? this.getValue() : '';
     298                                                                        handleOther.call( this );
     299                                                                },
     300                                                                setup : function()
     301                                                                {
     302                                                                        this.metaCharset = ( 'charset' in metaHash );
     303
     304                                                                        var func = setupMeta( this.metaCharset ? 'charset' : 'content-type', 1, 1 ),
     305                                                                                val = func.call( this );
     306
     307                                                                        !this.metaCharset && val.match( /charset=[^=]+$/ ) && ( val = val.substring( val.indexOf( '=' ) + 1 ) );
     308
     309                                                                        if ( val )
     310                                                                        {
     311                                                                                this.setValue( val.toLowerCase() );
     312                                                                                if ( !this.getValue() )
     313                                                                                {
     314                                                                                        this.setValue( 'other' );
     315                                                                                        var other = this.getDialog().getContentElement( 'general', 'charsetOther' );
     316                                                                                        other && other.setValue( val );
     317                                                                                }
     318                                                                                this.getDialog().selectedCharset = val;
     319                                                                        }
     320
     321                                                                        handleOther.call( this );
     322                                                                },
     323                                                                commit : function( doc, html, head, body, isPreview )
     324                                                                {
     325                                                                        if ( isPreview )
     326                                                                                return;
     327                                                                        var value = this.getValue(),
     328                                                                                other = this.getDialog().getContentElement( 'general', 'charsetOther' );
     329
     330                                                                        value == 'other' && ( value = other ? other.getValue() : '' );
     331
     332                                                                        value && !this.metaCharset && ( value = ( metaHash[ 'content-type' ] ? metaHash[ 'content-type' ].getAttribute( 'content' ).split( ';' )[0] : 'text/html' ) + '; charset=' + value );
     333
     334                                                                        var func = commitMeta( this.metaCharset ? 'charset' : 'content-type', 1, value );
     335                                                                        func.call( this, doc, html, head );
     336                                                                }
     337                                                        },
     338                                                        {
     339                                                                type : 'text',
     340                                                                id : 'charsetOther',
     341                                                                label : lang.charsetOther,
     342                                                                onChange : function(){ this.getDialog().selectedCharset = this.getValue(); }
     343                                                        }
     344                                                ]
     345                                        },
     346                                        {
     347                                                type : 'hbox',
     348                                                children : [
     349                                                        {
     350                                                                type : 'select',
     351                                                                id : 'docType',
     352                                                                label : lang.docType,
     353                                                                style : 'width: 100%',
     354                                                                items : [
     355                                                                        [ langCommon.notSet , '' ],
     356                                                                        [ 'XHTML 1.1', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' ],
     357                                                                        [ 'XHTML 1.0 Transitional', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' ],
     358                                                                        [ 'XHTML 1.0 Strict', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ],
     359                                                                        [ 'XHTML 1.0 Frameset', '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">' ],
     360                                                                        [ 'HTML 5', '<!DOCTYPE html>' ],
     361                                                                        [ 'HTML 4.01 Transitional', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' ],
     362                                                                        [ 'HTML 4.01 Strict', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' ],
     363                                                                        [ 'HTML 4.01 Frameset', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">' ],
     364                                                                        [ 'HTML 3.2', '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' ],
     365                                                                        [ 'HTML 2.0', '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">' ],
     366                                                                        [ lang.other, 'other' ]
     367                                                                ],
     368                                                                onChange : handleOther,
     369                                                                setup : function()
     370                                                                {
     371                                                                        if ( editor.docType )
     372                                                                        {
     373                                                                                this.setValue( editor.docType );
     374                                                                                if ( !this.getValue() )
     375                                                                                {
     376                                                                                        this.setValue( 'other' );
     377                                                                                        var other = this.getDialog().getContentElement( 'general', 'docTypeOther' );
     378                                                                                        other && other.setValue( editor.docType );
     379                                                                                }
     380                                                                        }
     381                                                                        handleOther.call( this );
     382                                                                },
     383                                                                commit : function( doc, html, head, body, isPreview )
     384                                                                {
     385                                                                        if ( isPreview )
     386                                                                                return;
     387                                                                        var value = this.getValue(),
     388                                                                                other = this.getDialog().getContentElement( 'general', 'docTypeOther' );
     389                                                                        editor.docType = value == 'other' ? ( other ? other.getValue() : '' ) : value;
     390                                                                }
     391                                                        },
     392                                                        {
     393                                                                type : 'text',
     394                                                                id : 'docTypeOther',
     395                                                                label : lang.docTypeOther
     396                                                        }
     397                                                ]
     398                                        },
     399                                        {
     400                                                type : 'checkbox',
     401                                                id : 'xhtmlDec',
     402                                                label : lang.xhtmlDec,
     403                                                setup : function()
     404                                                {
     405                                                        this.setValue( !!editor.xmlDeclaration );
     406                                                },
     407                                                commit : function( doc, html, head, body, isPreview )
     408                                                {
     409                                                        if ( isPreview )
     410                                                                return;
     411                                                        if ( this.getValue() )
     412                                                        {
     413                                                                editor.xmlDeclaration = '<?xml version="1.0" encoding="' + ( this.getDialog().selectedCharset || 'utf-8' )+ '"?>' ;
     414                                                                html.setAttribute( 'xmlns', 'http://www.w3.org/1999/xhtml' );
     415                                                        }
     416                                                        else
     417                                                        {
     418                                                                editor.xmlDeclaration = '';
     419                                                                html.removeAttribute( 'xmlns' );
     420                                                        }
     421                                                }
     422                                        }
     423                                ]
     424                        },
     425                        {
     426                                id : 'design',
     427                                label : lang.design,
     428                                elements : [
     429                                        {
     430                                                type : 'hbox',
     431                                                widths : [ '60%', '40%' ],
     432                                                children : [
     433                                                        {
     434                                                                type : 'vbox',
     435                                                                children : [
     436                                                                        colorField( 'txtColor', 'txtColor',
     437                                                                        {
     438                                                                                setup : function( doc, html, head, body )
     439                                                                                {
     440                                                                                        this.setValue( body.getComputedStyle( 'color' ) );
     441                                                                                },
     442                                                                                commit : function( doc, html, head, body )
     443                                                                                {
     444                                                                                        if ( this.isChanged() )
     445                                                                                        {
     446                                                                                                body.removeAttribute( 'text' );
     447                                                                                                var val = this.getValue();
     448                                                                                                if ( val )
     449                                                                                                        body.setStyle( 'color', val );
     450                                                                                                else
     451                                                                                                        body.removeStyle( 'color' );
     452                                                                                        }
     453                                                                                }
     454                                                                        }),
     455                                                                        colorField( 'bgColor', 'bgColor', {
     456                                                                                setup : function( doc, html, head, body )
     457                                                                                {
     458                                                                                        var val = body.getComputedStyle( 'background-color' ) || '';
     459                                                                                        this.setValue( val == 'transparent' ? '' : val );
     460                                                                                },
     461                                                                                commit : function( doc, html, head, body )
     462                                                                                {
     463                                                                                        body.removeAttribute( 'bgcolor' );
     464                                                                                        var val = this.getValue();
     465                                                                                        if ( val )
     466                                                                                                body.setStyle( 'background-color', val );
     467                                                                                        else
     468                                                                                                resetStyle( body, 'background-color', 'transparent' );
     469                                                                                }
     470                                                                        }),
     471                                                                        {
     472                                                                                type : 'hbox',
     473                                                                                widths : [ '60%', '40%' ],
     474                                                                                padding : 0,
     475                                                                                children : [
     476                                                                                        {
     477                                                                                                type : 'text',
     478                                                                                                id : 'bgImage',
     479                                                                                                label : lang.bgImage,
     480                                                                                                setup : function( doc, html, head, body )
     481                                                                                                {
     482                                                                                                        var val = body.getComputedStyle( 'background-image' ) || '';
     483                                                                                                        if ( val == 'none' )
     484                                                                                                                val = '';
     485                                                                                                        else
     486                                                                                                        {
     487                                                                                                                val = val.replace( /url\(\s*(["']?)\s*([^\)]*)\s*\1\s*\)/i, function( match, quote, url )
     488                                                                                                                {
     489                                                                                                                        return url;
     490                                                                                                                });
     491                                                                                                        }
     492                                                                                                        this.setValue( val );
     493                                                                                                },
     494                                                                                                commit : function( doc, html, head, body )
     495                                                                                                {
     496                                                                                                        body.removeAttribute( 'background' );
     497                                                                                                        var val = this.getValue();
     498                                                                                                        if ( val )
     499                                                                                                                body.setStyle( 'background-image', 'url(' + val + ')' );
     500                                                                                                        else
     501                                                                                                                resetStyle( body, 'background-image', 'none' );
     502                                                                                                }
     503                                                                                        },
     504                                                                                        {
     505                                                                                                type : 'button',
     506                                                                                                id : 'bgImageChoose',
     507                                                                                                label : langCommon.browseServer,
     508                                                                                                style : 'display:inline-block;margin-top:10px;',
     509                                                                                                hidden : true,
     510                                                                                                filebrowser : 'bg:bgImage'
     511                                                                                        }
     512                                                                                ]
     513                                                                        },
     514                                                                        {
     515                                                                                type : 'checkbox',
     516                                                                                id : 'bgFixed',
     517                                                                                label : lang.bgFixed,
     518                                                                                setup : function( doc, html, head, body )
     519                                                                                {
     520                                                                                        this.setValue( body.getComputedStyle( 'background-attachment' ) == 'fixed' );
     521                                                                                },
     522                                                                                commit : function( doc, html, head, body )
     523                                                                                {
     524                                                                                        if ( this.getValue() )
     525                                                                                                body.setStyle( 'background-attachment', 'fixed' );
     526                                                                                        else
     527                                                                                                resetStyle( body, 'background-attachment', 'scroll' );
     528                                                                                }
     529                                                                        }
     530                                                                ]
     531                                                        },
     532                                                        {
     533                                                                type : 'vbox',
     534                                                                children : [
     535                                                                        {
     536                                                                                type : 'html',
     537                                                                                id : 'marginTitle',
     538                                                                                html : '<div style="text-align: center; margin: 0px auto; font-weight: bold">' + lang.margin + '</div>'
     539                                                                        },
     540                                                                        {
     541                                                                                type : 'text',
     542                                                                                id : 'marginTop',
     543                                                                                label : lang.marginTop,
     544                                                                                style : 'width: 80px; text-align: center; margin: 0px auto',
     545                                                                                controlStyle : 'text-align: center',
     546                                                                                setup : function( doc, html, head, body )
     547                                                                                {
     548                                                                                        this.setValue( body.getStyle( 'margin-top' ) || body.getAttribute( 'margintop' ) || '' );
     549                                                                                },
     550                                                                                commit : commitMargin( 'top' ),
     551                                                                                onLoad : function()
     552                                                                                {
     553                                                                                        this.getElement().getParent().setStyle( 'text-align', 'center' );
     554                                                                                }
     555                                                                        },
     556                                                                        {
     557                                                                                type : 'hbox',
     558                                                                                children : [
     559                                                                                        {
     560                                                                                                type : 'text',
     561                                                                                                id : 'marginLeft',
     562                                                                                                label : lang.marginLeft,
     563                                                                                                style : 'width: 80px; text-align: center; margin: 0px auto',
     564                                                                                                controlStyle : 'text-align: center',
     565                                                                                                setup : function( doc, html, head, body )
     566                                                                                                {
     567                                                                                                        this.setValue( body.getStyle( 'margin-left' ) || body.getAttribute( 'marginleft' ) || '' );
     568                                                                                                },
     569                                                                                                commit : commitMargin( 'left' ),
     570                                                                                                onLoad : function()
     571                                                                                                {
     572                                                                                                        this.getElement().getParent().setStyle( 'text-align', 'center' );
     573                                                                                                }
     574                                                                                        },
     575                                                                                        {
     576                                                                                                type : 'text',
     577                                                                                                id : 'marginRight',
     578                                                                                                label : lang.marginRight,
     579                                                                                                style : 'width: 80px; text-align: center; margin: 0px auto',
     580                                                                                                controlStyle : 'text-align: center',
     581                                                                                                setup : function( doc, html, head, body )
     582                                                                                                {
     583                                                                                                        this.setValue( body.getStyle( 'margin-right' ) || body.getAttribute( 'marginright' ) || '' );
     584                                                                                                },
     585                                                                                                commit : commitMargin( 'right' ),
     586                                                                                                onLoad : function()
     587                                                                                                {
     588                                                                                                        this.getElement().getParent().setStyle( 'text-align', 'center' );
     589                                                                                                }
     590                                                                                        }
     591                                                                                ]
     592                                                                        },
     593                                                                        {
     594                                                                                type : 'text',
     595                                                                                id : 'marginBottom',
     596                                                                                label : lang.marginBottom,
     597                                                                                style : 'width: 80px; text-align: center; margin: 0px auto',
     598                                                                                controlStyle : 'text-align: center',
     599                                                                                setup : function( doc, html, head, body )
     600                                                                                {
     601                                                                                        this.setValue( body.getStyle( 'margin-bottom' ) || body.getAttribute( 'marginbottom' ) || '' );
     602                                                                                },
     603                                                                                commit : commitMargin( 'bottom' ),
     604                                                                                onLoad : function()
     605                                                                                {
     606                                                                                        this.getElement().getParent().setStyle( 'text-align', 'center' );
     607                                                                                }
     608                                                                        }
     609                                                                ]
     610                                                        }
     611                                                ]
     612                                        }
     613                                ]
     614                        },
     615                        {
     616                                id : 'meta',
     617                                label : lang.meta,
     618                                elements : [
     619                                        {
     620                                                type : 'textarea',
     621                                                id : 'metaKeywords',
     622                                                label : lang.metaKeywords,
     623                                                setup : setupMeta( 'keywords' ),
     624                                                commit : commitMeta( 'keywords' )
     625                                        },
     626                                        {
     627                                                type : 'textarea',
     628                                                id : 'metaDescription',
     629                                                label : lang.metaDescription,
     630                                                setup : setupMeta( 'description' ),
     631                                                commit : commitMeta( 'description' )
     632                                        },
     633                                        {
     634                                                type : 'text',
     635                                                id : 'metaAuthor',
     636                                                label : lang.metaAuthor,
     637                                                setup : setupMeta( 'author' ),
     638                                                commit : commitMeta( 'author' )
     639                                        },
     640                                        {
     641                                                type : 'text',
     642                                                id : 'metaCopyright',
     643                                                label : lang.metaCopyright,
     644                                                setup : setupMeta( 'copyright' ),
     645                                                commit : commitMeta( 'copyright' )
     646                                        }
     647                                ]
     648                        },
     649                        {
     650                                id : 'preview',
     651                                label : langCommon.preview,
     652                                elements : [
     653                                        {
     654                                                type : 'html',
     655                                                id : 'previewHtml',
     656                                                html : '<iframe src="' + previewSrc + '" style="width: 100%; height: 310px" hidefocus="true" frameborder="0" ' +
     657                                                                'id="cke_docProps_preview_iframe"></iframe>',
     658                                                onLoad : function()
     659                                                {
     660                                                        this.getDialog().on( 'selectPage', function( ev )
     661                                                        {
     662                                                                if ( ev.data.page == 'preview' )
     663                                                                {
     664                                                                        var self = this;
     665                                                                        setTimeout( function()
     666                                                                        {
     667                                                                                var doc = CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getFrameDocument(),
     668                                                                                        html = doc.getElementsByTag( 'html' ).getItem( 0 ),
     669                                                                                        head = doc.getHead(),
     670                                                                                        body = doc.getBody();
     671                                                                                self.commitContent( doc, html, head, body, 1 );
     672                                                                        }, 0 );
     673                                                                }
     674                                                        });
     675                                                        CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getAscendant( 'table' ).setStyle( 'height', '100%' );
     676                                                }
     677                                        }
     678                                ]
     679                        }
     680                ]
     681        };
     682});
  • _source/plugins/docprops/plugin.js

     
     1/*
     2Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6CKEDITOR.plugins.add( 'docprops',
     7{
     8        init : function( editor )
     9        {
     10                var cmd = new CKEDITOR.dialogCommand( 'docProps' );
     11                // Only applicable on full page mode.
     12                cmd.modes = { wysiwyg : editor.config.fullPage };
     13                editor.addCommand( 'docProps', cmd );
     14                CKEDITOR.dialog.add( 'docProps', this.path + 'dialogs/docprops.js' );
     15
     16                editor.ui.addButton( 'DocProps',
     17                {
     18                        label : editor.lang.docprops.label,
     19                        command : 'docProps'
     20                });
     21        }
     22});
     23 No newline at end of file
  • _source/plugins/toolbar/plugin.js

     
    461461 * // This is actually the default value.
    462462 * config.toolbar_Full =
    463463 * [
    464  *     { name: 'document',    items : [ 'Source','-','Save','NewPage','Preview','Print','-','Templates' ] },
     464 *     { name: 'document',    items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
    465465 *     { name: 'clipboard',   items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
    466466 *     { name: 'editing',     items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
    467467 *     { name: 'forms',       items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
     
    478478 */
    479479CKEDITOR.config.toolbar_Full =
    480480[
    481         { name: 'document',             items : [ 'Source','-','Save','NewPage','Preview','Print','-','Templates' ] },
     481        { name: 'document',             items : [ 'Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates' ] },
    482482        { name: 'clipboard',    items : [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] },
    483483        { name: 'editing',              items : [ 'Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt' ] },
    484484        { name: 'forms',                items : [ 'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ] },
  • _source/plugins/wysiwygarea/plugin.js

     
    962962                                                                                {
    963963                                                                                        editor.docType = docType = match;
    964964                                                                                        return '';
     965                                                                                }).replace( /<\?xml\s[^\?]*\?>/i, function( match )
     966                                                                                {
     967                                                                                        editor.xmlDeclaration = match;
     968                                                                                        return '';
    965969                                                                                });
    966970                                                                }
    967971
     
    10341038                                                                var config = editor.config,
    10351039                                                                        fullPage = config.fullPage,
    10361040                                                                        docType = fullPage && editor.docType,
     1041                                                                        xmlDeclaration = fullPage && editor.xmlDeclaration,
    10371042                                                                        doc = iframe.getFrameDocument();
    10381043
    10391044                                                                var data = fullPage
     
    10511056                                                                if ( config.ignoreEmptyParagraph )
    10521057                                                                        data = data.replace( emptyParagraphRegexp, function( match, lookback ) { return lookback; } );
    10531058
     1059                                                                if ( xmlDeclaration )
     1060                                                                        data = xmlDeclaration + '\n' + data;
    10541061                                                                if ( docType )
    10551062                                                                        data = docType + '\n' + data;
    10561063
  • _source/skins/kama/icons.css

     
    88        background-position: 0 0;
    99}
    1010
     11.cke_skin_kama .cke_button_docProps .cke_icon
     12{
     13        background-position: 0 -16px;
     14}
     15
    1116.cke_skin_kama .cke_button_newpage .cke_icon
    1217{
    1318        background-position: 0 -48px;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy