Ticket #4648: 4648_5.patch

File 4648_5.patch, 14.1 KB (added by Sa'ar Zac Elias, 14 years ago)
  • _source/core/config.js

     
    267267                'forms,' +
    268268                'horizontalrule,' +
    269269                'htmldataprocessor,' +
     270                'iframe,' +
    270271                'image,' +
    271272                'indent,' +
    272273                'justify,' +
  • _source/lang/en.js

     
    615615                remove                          : 'Remove Div'
    616616        },
    617617
     618        iframe :
     619        {
     620                title           : 'Iframe Properties',
     621                toolbar         : 'Iframe',
     622                height          : 'Height',
     623                width           : 'Width',
     624                invalidHeight   : 'Iframe height must be a number.',
     625                invalidWidth    : 'Iframe width must be a number.',
     626                noUrl           : 'Please type the iframe URL',
     627                scrolling               : 'Enable scrollbars',
     628                border          : 'Show frame border',
     629                align           : 'Alignment',
     630                alignLeft               : 'Left',
     631                alignRight      : 'Right',
     632                alignTop                : 'Top',
     633                alignMiddle     : 'Middle',
     634                alignBottom     : 'Bottom'
     635        },
     636
    618637        font :
    619638        {
    620639                label           : 'Font',
  • _source/plugins/iframe/dialogs/iframe.js

     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6(function()
     7{
     8        // Map 'true' and 'false' values to match W3C's specifications
     9        // http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5
     10        var checkboxValues =
     11        {
     12                scrolling : { 'true' : 'yes', 'false' : 'no' },
     13                frameborder : { 'true' : '1', 'false' : '0' }
     14        };
     15       
     16        function loadValue( iframeNode )
     17        {
     18                var isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox;
     19                if ( iframeNode.hasAttribute( this.id ) )
     20                {
     21                        var value = iframeNode.getAttribute( this.id );
     22                        if ( isCheckbox )
     23                                this.setValue( checkboxValues[ this.id ][ 'true' ] == value.toLowerCase() );
     24                        else
     25                                this.setValue( value );
     26                }
     27        }
     28
     29        function commitValue( iframeNode )
     30        {
     31                var isRemove = this.getValue() === '',
     32                        isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox,
     33                        value = this.getValue();
     34                if ( isRemove )
     35                        iframeNode.removeAttribute( this.att || this.id );
     36                else if ( isCheckbox )
     37                        iframeNode.setAttribute( this.id, checkboxValues[ this.id ][ value ] );
     38                else
     39                        iframeNode.setAttribute( this.att || this.id, value );
     40        }
     41
     42        CKEDITOR.dialog.add( 'iframe', function( editor )
     43        {
     44                var iframeLang = editor.lang.iframe,
     45                        commonLang = editor.lang.common,
     46                        dialogadvtab = editor.plugins.dialogadvtab;
     47                return {
     48                        title : iframeLang.title,
     49                        minWidth : 350,
     50                        minHeight : 260,
     51                        onShow : function()
     52                        {
     53                                // Clear previously saved elements.
     54                                this.fakeImage = this.iframeNode = null;
     55
     56                                var fakeImage = this.getSelectedElement();
     57                                if ( fakeImage && fakeImage.getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'iframe' )
     58                                {
     59                                        this.fakeImage = fakeImage;
     60
     61                                        var iframeNode = editor.restoreRealElement( fakeImage );
     62                                        this.iframeNode = iframeNode;
     63
     64                                        this.setupContent( iframeNode, fakeImage );
     65                                }
     66                        },
     67                        onOk : function()
     68                        {
     69                                var iframeNode;
     70                                if ( !this.fakeImage )
     71                                        iframeNode = new CKEDITOR.dom.element( 'iframe' );
     72                                else
     73                                        iframeNode = this.iframeNode;
     74
     75                                // A subset of the specified attributes/styles
     76                                // should also be applied on the fake element to
     77                                // have better visual effect. (#5240)
     78                                var extraStyles = {}, extraAttributes = {};
     79                                this.commitContent( iframeNode, extraStyles, extraAttributes );
     80
     81                                // Refresh the fake image.
     82                                var newFakeImage = editor.createFakeElement( iframeNode, 'cke_iframe', 'iframe', true );
     83                                newFakeImage.setAttributes( extraAttributes );
     84                                newFakeImage.setStyles( extraStyles );
     85                                if ( this.fakeImage )
     86                                {
     87                                        newFakeImage.replace( this.fakeImage );
     88                                        editor.getSelection().selectElement( newFakeImage );
     89                                }
     90                                else
     91                                        editor.insertElement( newFakeImage );
     92                        },
     93                        contents : [
     94                                {
     95                                        id : 'info',
     96                                        label : commonLang.generalTab,
     97                                        accessKey : 'I',
     98                                        elements :
     99                                        [
     100                                                {
     101                                                        type : 'vbox',
     102                                                        padding : 0,
     103                                                        children :
     104                                                        [
     105                                                                {
     106                                                                        id : 'src',
     107                                                                        type : 'text',
     108                                                                        label : commonLang.url,
     109                                                                        required : true,
     110                                                                        validate : CKEDITOR.dialog.validate.notEmpty( iframeLang.noUrl ),
     111                                                                        setup : loadValue,
     112                                                                        commit : commitValue
     113                                                                }
     114                                                        ]
     115                                                },
     116                                                {
     117                                                        type : 'hbox',
     118                                                        children :
     119                                                        [
     120                                                                {
     121                                                                        id : 'width',
     122                                                                        type : 'text',
     123                                                                        style : 'width:100%',
     124                                                                        labelLayout : 'vertical',
     125                                                                        label : iframeLang.width,
     126                                                                        validate : CKEDITOR.dialog.validate.integer( iframeLang.invalidWidth ),
     127                                                                        setup : function( iframeNode, fakeImage )
     128                                                                        {
     129                                                                                loadValue.apply( this, arguments );
     130                                                                                if ( fakeImage )
     131                                                                                {
     132                                                                                        var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 );
     133                                                                                        if ( !isNaN( fakeImageWidth ) )
     134                                                                                                this.setValue( fakeImageWidth );
     135                                                                                }
     136                                                                        },
     137                                                                        commit : function( iframeNode, extraStyles )
     138                                                                        {
     139                                                                                commitValue.apply( this, arguments );
     140                                                                                if ( this.getValue() )
     141                                                                                        extraStyles.width = this.getValue() + 'px';
     142                                                                        }
     143                                                                },
     144                                                                {
     145                                                                        id : 'height',
     146                                                                        type : 'text',
     147                                                                        style : 'width:100%',
     148                                                                        labelLayout : 'vertical',
     149                                                                        label : iframeLang.height,
     150                                                                        validate : CKEDITOR.dialog.validate.integer( iframeLang.invalidHeight ),
     151                                                                        setup : function( iframeNode, fakeImage )
     152                                                                        {
     153                                                                                loadValue.apply( this, arguments );
     154                                                                                if ( fakeImage )
     155                                                                                {
     156                                                                                        var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 );
     157                                                                                        if ( !isNaN( fakeImageHeight ) )
     158                                                                                                this.setValue( fakeImageHeight );
     159                                                                                }
     160                                                                        },
     161                                                                        commit : function( iframeNode, extraStyles )
     162                                                                        {
     163                                                                                commitValue.apply( this, arguments );
     164                                                                                if ( this.getValue() )
     165                                                                                        extraStyles.height = this.getValue() + 'px';
     166                                                                        }
     167                                                                },
     168                                                                {
     169                                                                        id : 'align',
     170                                                                        type : 'select',
     171                                                                        'default' : '',
     172                                                                        items :
     173                                                                        [
     174                                                                                [ commonLang.notSet , '' ],
     175                                                                                [ iframeLang.alignLeft , 'left' ],
     176                                                                                [ iframeLang.alignRight , 'right' ],
     177                                                                                [ iframeLang.alignTop , 'top' ],
     178                                                                                [ iframeLang.alignMiddle , 'middle' ],
     179                                                                                [ iframeLang.alignBottom , 'bottom' ]
     180                                                                        ],
     181                                                                        style : 'width:100%',
     182                                                                        labelLayout : 'vertical',
     183                                                                        label : iframeLang.align,
     184                                                                        setup : function( iframeNode, fakeImage )
     185                                                                        {
     186                                                                                loadValue.apply( this, arguments );
     187                                                                                if ( fakeImage )
     188                                                                                {
     189                                                                                        var fakeImageAlign = fakeImage.getAttribute( 'align' );
     190                                                                                        this.setValue( fakeImageAlign && fakeImageAlign.toLowerCase() || '' );
     191                                                                                }
     192                                                                        },
     193                                                                        commit : function( iframeNode, extraStyles, extraAttributes )
     194                                                                        {
     195                                                                                commitValue.apply( this, arguments );
     196                                                                                if ( this.getValue() )
     197                                                                                        extraAttributes.align = this.getValue();
     198                                                                        }
     199                                                                }
     200                                                        ]
     201                                                },
     202                                                {
     203                                                        type : 'hbox',
     204                                                        widths : [ '50%', '50%' ],
     205                                                        children :
     206                                                        [
     207                                                                {
     208                                                                        id : 'scrolling',
     209                                                                        type : 'checkbox',
     210                                                                        label : iframeLang.scrolling,
     211                                                                        setup : loadValue,
     212                                                                        commit : commitValue
     213                                                                },
     214                                                                {
     215                                                                        id : 'frameborder',
     216                                                                        type : 'checkbox',
     217                                                                        label : iframeLang.border,
     218                                                                        setup : loadValue,
     219                                                                        commit : commitValue
     220                                                                }
     221                                                        ]
     222                                                },
     223                                                {
     224                                                        type : 'hbox',
     225                                                        widths : [ '50%', '50%' ],
     226                                                        children :
     227                                                        [
     228                                                                {
     229                                                                        id : 'name',
     230                                                                        type : 'text',
     231                                                                        label : commonLang.name,
     232                                                                        setup : loadValue,
     233                                                                        commit : commitValue
     234                                                                },
     235                                                                {
     236                                                                        id : 'title',
     237                                                                        type : 'text',
     238                                                                        label : commonLang.advisoryTitle,
     239                                                                        setup : loadValue,
     240                                                                        commit : commitValue
     241                                                                }
     242                                                        ]
     243                                                },
     244                                                {
     245                                                        id : 'longdesc',
     246                                                        type : 'text',
     247                                                        label : commonLang.longDescr,
     248                                                        setup : loadValue,
     249                                                        commit : commitValue
     250                                                }
     251                                        ]
     252                                },
     253                                dialogadvtab && dialogadvtab.createAdvancedTab( editor, { id:1, classes:1, styles:1 })
     254                        ]
     255                };
     256        });
     257})();
  • _source/plugins/iframe/plugin.js

     
     1/*
     2Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
     3For licensing, see LICENSE.html or http://ckeditor.com/license
     4*/
     5
     6(function()
     7{
     8        function createFakeElement( editor, realElement )
     9        {
     10                var fakeElement = editor.createFakeParserElement( realElement, 'cke_iframe', 'iframe', true ),
     11                        fakeStyle = fakeElement.attributes.style || '';
     12
     13                var width = realElement.attributes.width,
     14                        height = realElement.attributes.height;
     15
     16                if ( typeof width != 'undefined' )
     17                        fakeStyle += 'width:' + CKEDITOR.tools.cssLength( width ) + ';';
     18
     19                if ( typeof height != 'undefined' )
     20                        fakeStyle += 'height:' + CKEDITOR.tools.cssLength( height ) + ';';
     21
     22                fakeElement.attributes.style = fakeStyle;
     23
     24                return fakeElement;
     25        }
     26
     27        CKEDITOR.plugins.add( 'iframe',
     28        {
     29                requires : [ 'dialog', 'fakeobjects' ],
     30                init : function( editor )
     31                {
     32                        var pluginName = 'iframe',
     33                                lang = editor.lang.iframe;
     34
     35                        CKEDITOR.dialog.add( pluginName, this.path + 'dialogs/iframe.js' );
     36                        editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName ) );
     37
     38                        editor.addCss(
     39                                'img.cke_iframe' +
     40                                '{' +
     41                                        'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.png' ) + ');' +
     42                                        'background-position: center center;' +
     43                                        'background-repeat: no-repeat;' +
     44                                        'border: 1px solid #a9a9a9;' +
     45                                        'width: 80px;' +
     46                                        'height: 80px;' +
     47                                '}'
     48                        );
     49
     50                        editor.ui.addButton( 'Iframe',
     51                                {
     52                                        label : lang.toolbar,
     53                                        command : pluginName
     54                                });
     55
     56                        editor.on( 'doubleclick', function( evt )
     57                                {
     58                                        var element = evt.data.element;
     59                                        if ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'iframe' )
     60                                                evt.data.dialog = 'iframe';
     61                                });
     62
     63                        if ( editor.addMenuItems )
     64                        {
     65                                editor.addMenuItems(
     66                                {
     67                                        iframe :
     68                                        {
     69                                                label : lang.title,
     70                                                command : 'iframe',
     71                                                group : 'image'
     72                                        }
     73                                });
     74                        }
     75
     76                        // If the "contextmenu" plugin is loaded, register the listeners.
     77                        if ( editor.contextMenu )
     78                        {
     79                                editor.contextMenu.addListener( function( element, selection )
     80                                        {
     81                                                if ( element && element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'iframe' )
     82                                                        return { iframe : CKEDITOR.TRISTATE_OFF };
     83                                        });
     84                        }
     85                },
     86                afterInit : function( editor )
     87                {
     88                        var dataProcessor = editor.dataProcessor,
     89                                dataFilter = dataProcessor && dataProcessor.dataFilter;
     90
     91                        if ( dataFilter )
     92                        {
     93                                dataFilter.addRules(
     94                                {
     95                                        elements :
     96                                        {
     97                                                iframe : function( element )
     98                                                {
     99                                                        return createFakeElement( editor, element );
     100                                                }
     101                                        }
     102                                });
     103                        }
     104                }
     105        });
     106})();
  • _source/plugins/toolbar/plugin.js

     
    417417 *     ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    418418 *     ['BidiLtr', 'BidiRtl' ],
    419419 *     ['Link','Unlink','Anchor'],
    420  *     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
     420 *     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
    421421 *     '/',
    422422 *     ['Styles','Format','Font','FontSize'],
    423423 *     ['TextColor','BGColor'],
     
    436436        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    437437        ['BidiLtr', 'BidiRtl' ],
    438438        ['Link','Unlink','Anchor'],
    439         ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
     439        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
    440440        '/',
    441441        ['Styles','Format','Font','FontSize'],
    442442        ['TextColor','BGColor'],
  • _source/skins/kama/icons.css

     
    355355{
    356356        background-position: 0 -1056px;
    357357}
     358.cke_skin_kama .cke_button_iframe .cke_icon
     359{
     360        background-position: 0 -1279px;
     361}
  • _source/skins/office2003/icons.css

     
    352352{
    353353        background-position: 0 -1056px;
    354354}
     355.cke_skin_office2003 .cke_button_iframe .cke_icon
     356{
     357        background-position: 0 -1279px;
     358}
     359
  • _source/skins/v2/icons.css

     
    342342{
    343343        background-position: 0 -1200px;
    344344}
    345 
    346345.cke_skin_v2 .cke_button_bidirtl .cke_icon
    347346{
    348347        background-position: 0 -1072px;
     
    352351{
    353352        background-position: 0 -1056px;
    354353}
     354
     355.cke_skin_v2 .cke_button_iframe .cke_icon
     356{
     357        background-position: 0 -1279px;
     358}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy