Ticket #4648: 4648_2.patch

File 4648_2.patch, 19.3 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/core/config.js

     
    243243         * @type String
    244244         * @example
    245245         */
    246         plugins : 'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
     246        plugins : 'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,iframe,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
    247247
    248248        /**
    249249         * List of additional plugins to be loaded. This is a tool setting which
  • _source/lang/en.js

     
    611611                remove                          : 'Remove Div'
    612612        },
    613613
     614        iframe :
     615        {
     616                title           : 'Iframe Properties',
     617                toolbar         : 'Iframe',
     618                height          : 'Height',
     619                width           : 'Width',
     620                invalidHeight   : 'Iframe height must be a number.',
     621                invalidWidth    : 'Iframe width must be a number.',
     622                noUrl           : 'Please type the iframe URL',
     623                scrolling               : 'Enable scrollbars',
     624                border          : 'Show frame border'
     625        },
     626
    614627        font :
    615628        {
    616629                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: http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5
     9        var checkboxValues =
     10        {
     11                scrolling : { 'true' : 'yes', 'false' : 'no' },
     12                frameborder : { 'true' : '1', 'false' : '0' }
     13        }
     14       
     15        function loadValue( iframeNode )
     16        {
     17                var isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox;
     18                if ( iframeNode.hasAttribute( this.id ) )
     19                {
     20                        var value = iframeNode.getAttribute( this.id );
     21                        if ( isCheckbox )
     22                                this.setValue( checkboxValues[this.id]['true'] == value.toLowerCase() );
     23                        else
     24                                this.setValue( value );
     25                }
     26        }
     27
     28        function commitValue( iframeNode )
     29        {
     30                var isRemove = this.getValue() === '',
     31                        isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox,
     32                        value = this.getValue();
     33                if ( isRemove )
     34                        iframeNode.removeAttribute( this.id );
     35                else if ( isCheckbox )
     36                        iframeNode.setAttribute( this.id, checkboxValues[this.id][value] );
     37                else
     38                        iframeNode.setAttribute( this.id, value );
     39        }
     40
     41        CKEDITOR.dialog.add( 'iframe', function( editor )
     42        {
     43                var iframeLang = editor.lang.iframe,
     44                        commonLang = editor.lang.common;
     45                return {
     46                        title : editor.lang.iframe.title,
     47                        minWidth : 300,
     48                        minHeight : 220,
     49                        onShow : function()
     50                        {
     51                                // Clear previously saved elements.
     52                                this.fakeImage = this.iframeNode = null;
     53
     54                                var fakeImage = this.getSelectedElement();
     55                                if ( fakeImage && fakeImage.getAttribute( '_cke_real_element_type' ) && fakeImage.getAttribute( '_cke_real_element_type' ) == 'iframe' )
     56                                {
     57                                        this.fakeImage = fakeImage;
     58
     59                                        var iframeNode = editor.restoreRealElement( fakeImage );
     60                                        this.iframeNode = iframeNode;
     61
     62                                        this.setupContent( iframeNode, fakeImage );
     63                                }
     64                        },
     65                        onOk : function()
     66                        {
     67                                var iframeNode;
     68                                if ( !this.fakeImage )
     69                                        iframeNode = CKEDITOR.dom.element.createFromHtml( '<cke:iframe></cke:iframe>', editor.document );
     70                                else
     71                                        iframeNode = this.iframeNode;
     72
     73                                // A subset of the specified attributes/styles
     74                                // should also be applied on the fake element to
     75                                // have better visual effect. (#5240)
     76                                var extraStyles = {}, extraAttributes = {};
     77                                this.commitContent( iframeNode, extraStyles, extraAttributes );
     78
     79                                // Refresh the fake image.
     80                                var newFakeImage = editor.createFakeElement( iframeNode, 'cke_iframe', 'iframe', true );
     81                                newFakeImage.setAttributes( extraAttributes );
     82                                newFakeImage.setStyles( extraStyles );
     83                                if ( this.fakeImage )
     84                                {
     85                                        newFakeImage.replace( this.fakeImage );
     86                                        editor.getSelection().selectElement( newFakeImage );
     87                                }
     88                                else
     89                                        editor.insertElement( newFakeImage );
     90                        },
     91                        contents : [
     92                                {
     93                                        id : 'info',
     94                                        label : editor.lang.common.generalTab,
     95                                        accessKey : 'I',
     96                                        elements :
     97                                        [
     98                                                {
     99                                                        type : 'vbox',
     100                                                        padding : 0,
     101                                                        children :
     102                                                        [
     103                                                                {
     104                                                                        id : 'src',
     105                                                                        type : 'text',
     106                                                                        label : commonLang.url,
     107                                                                        required : true,
     108                                                                        validate : CKEDITOR.dialog.validate.notEmpty( iframeLang.noUrl ),
     109                                                                        setup : loadValue,
     110                                                                        commit : commitValue
     111                                                                }
     112                                                        ]
     113                                                },
     114                                                {
     115                                                        type : 'hbox',
     116                                                        widths : [ '25%', '25%' ],
     117                                                        children :
     118                                                        [
     119                                                                {
     120                                                                        id : 'width',
     121                                                                        type : 'text',
     122                                                                        style : 'width:80px',
     123                                                                        labelLayout : 'vertical',
     124                                                                        label : iframeLang.width,
     125                                                                        validate : CKEDITOR.dialog.validate.integer( iframeLang.invalidWidth ),
     126                                                                        setup : function( iframeNode, fakeImage )
     127                                                                        {
     128                                                                                loadValue.apply( this, arguments );
     129                                                                                if ( fakeImage )
     130                                                                                {
     131                                                                                        var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 );
     132                                                                                        if ( !isNaN( fakeImageWidth ) )
     133                                                                                                this.setValue( fakeImageWidth );
     134                                                                                }
     135                                                                        },
     136                                                                        commit : function( iframeNode, extraStyles )
     137                                                                        {
     138                                                                                commitValue.apply( this, arguments );
     139                                                                                if ( this.getValue() )
     140                                                                                        extraStyles.width = this.getValue() + 'px';
     141                                                                        }
     142                                                                },
     143                                                                {
     144                                                                        id : 'height',
     145                                                                        type : 'text',
     146                                                                        style : 'width:80px',
     147                                                                        label : iframeLang.height,
     148                                                                        labelLayout : 'vertical',
     149                                                                        validate : CKEDITOR.dialog.validate.integer( iframeLang.invalidHeight ),
     150                                                                        setup : function( iframeNode, fakeImage )
     151                                                                        {
     152                                                                                loadValue.apply( this, arguments );
     153                                                                                if ( fakeImage )
     154                                                                                {
     155                                                                                        var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 );
     156                                                                                        if ( !isNaN( fakeImageHeight ) )
     157                                                                                                this.setValue( fakeImageHeight );
     158                                                                                }
     159                                                                        },
     160                                                                        commit : function( iframeNode, extraStyles )
     161                                                                        {
     162                                                                                commitValue.apply( this, arguments );
     163                                                                                if ( this.getValue() )
     164                                                                                        extraStyles.height = this.getValue() + 'px';
     165                                                                        }
     166                                                                }
     167                                                        ]
     168                                                },
     169                                                {
     170                                                        type : 'hbox',
     171                                                        widths : [ '50%', '50%' ],
     172                                                        children :
     173                                                        [
     174                                                                {
     175                                                                        id : 'scrolling',
     176                                                                        type : 'checkbox',
     177                                                                        label : iframeLang.scrolling,
     178                                                                        setup : loadValue,
     179                                                                        commit : commitValue
     180                                                                },
     181                                                                {
     182                                                                        id : 'frameborder',
     183                                                                        type : 'checkbox',
     184                                                                        label : iframeLang.border,
     185                                                                        setup : loadValue,
     186                                                                        commit : commitValue
     187                                                                }
     188                                                        ]
     189                                                },
     190                                                {
     191                                                        type : 'hbox',
     192                                                        widths : [ '45%', '55%' ],
     193                                                        children :
     194                                                        [
     195                                                                {
     196                                                                        id : 'id',
     197                                                                        type : 'text',
     198                                                                        label : commonLang.id,
     199                                                                        setup : loadValue,
     200                                                                        commit : commitValue
     201                                                                },
     202                                                                {
     203                                                                        id : 'title',
     204                                                                        type : 'text',
     205                                                                        label : commonLang.advisoryTitle,
     206                                                                        setup : loadValue,
     207                                                                        commit : commitValue
     208                                                                }
     209                                                        ]
     210                                                },
     211                                                {
     212                                                        type : 'hbox',
     213                                                        widths : [ '45%', '55%' ],
     214                                                        children :
     215                                                        [
     216                                                                {
     217                                                                        id : 'class',
     218                                                                        type : 'text',
     219                                                                        label : commonLang.cssClass,
     220                                                                        setup : loadValue,
     221                                                                        commit : commitValue
     222                                                                }
     223                                                        ]
     224                                                },
     225                                                {
     226                                                        id : 'style',
     227                                                        type : 'text',
     228                                                        label : commonLang.cssStyle,
     229                                                        setup : loadValue,
     230                                                        commit : commitValue
     231                                                }
     232                                        ]
     233                                }
     234                        ]
     235                };
     236        });
     237})();
  • _source/plugins/iframe/plugin.js

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: _source\plugins\iframe\images\placeholder.png
    ___________________________________________________________________
    Added: svn:mime-type
       + application/octet-stream
    
     
     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/slicktag/plugin.js

     
     1if( sitePhrases.slickTag && siteSettings.slickTagDialog )
     2{
     3        CKEDITOR.plugins.add( 'slicktag',
     4        {
     5                requires : [ 'iframedialog', 'selection' ],
     6                init : function( editor )
     7                {
     8                        editor.addCommand( 'slickTag', new CKEDITOR.dialogCommand( 'slickTag' ) );
     9                        editor.ui.addButton( 'SlickTag',
     10                                {
     11                                        label : sitePhrases.slickTag,
     12                                        command : 'slickTag',
     13                                        icon : this.path + '../../skins/' + editor.config.skin + '/icons.png'
     14                                });
     15                        var contents = [], tab, definition, j;
     16                        var dialog;
     17                        var fn = CKEDITOR.tools.addFunction( function( title, contentOpener, separator, contentCloser )
     18                        {
     19                                /*var span = editor.document.createElement( 'span',
     20                                {
     21                                        attributes :
     22                                        {
     23                                                'class' : 'slick_tag'
     24                                        }
     25                                });
     26                                span.appendText( content );
     27                                editor.insertElement( span );*/
     28                                var selection = editor.getSelection(),
     29                                        range = selection && selection.getRanges()[0];
     30                                if (
     31                                        title !== null && contentOpener !== null && separator !== null && contentCloser !== null && // All parts exists
     32                                        selection && range && selection.getType() == CKEDITOR.SELECTION_TEXT && !range.collapsed // Selection is valid
     33                                )
     34                                {
     35                                        range.shrink( CKEDITOR.SHRINK_TEXT );
     36                                        var     bm = range.createBookmark(),
     37                                                temp = new CKEDITOR.dom.element( 'span' );
     38                                        // This is a temporary span used to put the caret after the tag ending
     39                                        //temp.setStyle( 'display', 'none' );
     40                                        temp.setHtml( '&nbsp;' );
     41
     42                                        contentOpener = new CKEDITOR.dom.text( contentOpener );
     43                                        separator = new CKEDITOR.dom.text( separator );
     44                                        contentCloser = new CKEDITOR.dom.text( contentCloser );
     45
     46                                        contentOpener.insertBefore( bm.startNode );
     47                                        separator.insertAfter( bm.startNode );
     48                                        temp.insertAfter( bm.endNode );
     49                                        contentCloser.insertAfter( bm.endNode );
     50                                        range.moveToBookmark( bm ); // Remove the bookmark
     51                                        range.collapse();
     52
     53                                        // Place the caret after the tag
     54                                        range.moveToPosition( temp, CKEDITOR.POSITION_BEFORE_END ); // BEFORE_END works better in IE
     55                                        range.select();
     56                                        // IE needs this to be executed after a while, but in FF it makes the cursor blink in the wrong place for some time
     57                                        if ( CKEDITOR.env.ie )
     58                                                setTimeout( function(){ temp.remove(); }, 0 );
     59                                        else
     60                                                temp.remove();
     61                                }
     62                                else {
     63                                        editor.insertHtml(
     64                                                ( contentOpener || '' ) +
     65                                                ( separator || '' ) +
     66                                                ( title || '' ) +
     67                                                ( contentCloser || '' )
     68                                        );
     69                                }
     70
     71                                dialog.hide();
     72                        });
     73                        // Make sure the function is removed when the editor is destoryed
     74                        editor.on( 'destroy', function()
     75                        {
     76                                CKEDITOR.tools.removeFunction( fn );
     77                        });
     78                        for( var i in siteSettings.slickTagDialog )
     79                        {
     80                                tab = siteSettings.slickTagDialog[i];
     81                                definition = {
     82                                        id : 'cke_slicktag_' + i,
     83                                        label : tab.label,
     84                                        title : tab.label,
     85                                        elements : [] //type, label, id, default
     86                                };
     87                                // Attach the function number to each iframe
     88                                for( j in tab.elements )
     89                                {
     90                                        if( tab.elements[j].type && tab.elements[j].type  == 'iframe' )
     91                                                tab.elements[j].src += ( tab.elements[j].src.indexOf( '?' ) == -1 ? '?' : '&' )
     92                                                                        + 'slickTagFn=' + fn + '&slickTagEditorId=' + editor.name;
     93                                }
     94                                definition.elements = tab.elements;
     95                                contents.push( definition );
     96                        }
     97                        CKEDITOR.dialog.add( 'slickTag', function( editor )
     98                        {
     99                                return {
     100                                        title : sitePhrases.slickTag,
     101                                        resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
     102                                        minWidth : 500,
     103                                        minHeight : 400,
     104                                        onLoad : function( evt )
     105                                        {
     106                                                dialog = evt.sender;
     107                                        },
     108                                        /*onShow: function( evt )
     109                                        {
     110                                                var frames = dialog.parts.contents.getElementsByTag( 'iframe' );
     111                                                for( var i = 0; i < frames.count(); i++ )
     112                                                        frames.getItem( i ).getParent().setStyle( 'height', dialog.parts.content.getStyle( 'height' ) );
     113                                        },*/
     114                                        buttons : [ CKEDITOR.dialog.cancelButton ],
     115                                        contents : contents
     116                                };
     117                        });
     118                }
     119        });
     120}
     121 No newline at end of file
  • _source/plugins/toolbar/plugin.js

     
    416416 *     ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
    417417 *     ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    418418 *     ['Link','Unlink','Anchor'],
    419  *     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
     419 *     ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
    420420 *     '/',
    421421 *     ['Styles','Format','Font','FontSize'],
    422422 *     ['TextColor','BGColor'],
     
    434434        ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
    435435        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
    436436        ['Link','Unlink','Anchor'],
    437         ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
     437        ['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe'],
    438438        '/',
    439439        ['Styles','Format','Font','FontSize'],
    440440        ['TextColor','BGColor'],
  • _source/skins/kama/icons.css

     
    320320{
    321321        background-position: 0 -1040px;
    322322}
    323 .cke_skin_office2003 .cke_button_editdiv .cke_icon
     323
     324.cke_skin_kama .cke_button_iframe .cke_icon
    324325{
    325         background-position: 0 -1184px;
     326        background-position: 0 -1216px;
    326327}
  • _source/skins/office2003/icons.css

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    322322{
    323323        background-position: 0 -1200px;
    324324}
     325.cke_skin_office2003 .cke_button_iframe .cke_icon
     326{
     327        background-position: 0 -1216px;
     328}
     329
  • _source/skins/v2/icons.css

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
     
    322322{
    323323        background-position: 0 -1200px;
    324324}
     325
     326.cke_skin_v2 .cke_button_iframe .cke_icon
     327{
     328        background-position: 0 -1216px;
     329}
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy