Ticket #171: 171.patch

File 171.patch, 5.5 KB (added by Martin Kou, 16 years ago)
  • editor/_source/internals/fck.js

     
    329329                FCK.Events.FireEvent( 'OnAfterSetHTML' ) ;
    330330        },
    331331
    332         // Saves URLs on links and images on special attributes, so they don't change when
    333         // moving around.
    334         ProtectUrls : function( html )
     332        // Saves special attributes that might be lost if we only assign it directly to document.body.innerHTML.
     333        ProtectAttributes : function( html )
    335334        {
    336335                // <A> href
    337336                html = html.replace( FCKRegexLib.ProtectUrlsA   , '$& _fcksavedurl=$1' ) ;
     
    340339                html = html.replace( FCKRegexLib.ProtectUrlsImg , '$& _fcksavedurl=$1' ) ;
    341340
    342341                // <AREA> href
    343                 html = html.replace( FCKRegexLib.ProtectUrlsArea        , '$& _fcksavedurl=$1' ) ;
     342                html = html.replace( FCKRegexLib.ProtectUrlsArea, '$& _fcksavedurl=$1' ) ;
    344343
     344                // <INPUT type="text"> size
     345                html = html.replace( FCKRegexLib.ProtectSizesInput, '$& _fcksavedsize=$1' ) ;
     346
     347                // <TEXTAREA> cols
     348                html = html.replace( FCKRegexLib.ProtectColsTextarea, '$& _fcksavedcols=$1' ) ;
     349
    345350                return html ;
    346351        },
    347352
     
    399404                // If there was an onSelectionChange listener in IE we must remove it to avoid crashes #1498
    400405                if ( FCKBrowserInfo.IsIE && FCK.EditorDocument )
    401406                {
    402                                 FCK.EditorDocument.detachEvent("onselectionchange", Doc_OnSelectionChange ) ;
     407                        FCK.EditorDocument.detachEvent("onselectionchange", Doc_OnSelectionChange ) ;
    403408                }
    404409
    405410                if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
     
    421426                        data = FCK.ProtectEvents( data ) ;
    422427
    423428                        // Protect some things from the browser itself.
    424                         data = FCK.ProtectUrls( data ) ;
     429                        data = FCK.ProtectAttributes( data ) ;
    425430                        data = FCK.ProtectTags( data ) ;
    426431
    427432                        // Insert the base tag (FCKConfig.BaseHref), if not exists in the source.
  • editor/_source/internals/fckregexlib.js

     
    7575ProtectUrlsImg  : /<img(?=\s).*?\ssrc=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
    7676ProtectUrlsA    : /<a(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
    7777ProtectUrlsArea : /<area(?=\s).*?\shref=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
     78ProtectSizesInput: /<input(?=\s).*?\ssize=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
     79ProtectColsTextarea: /<textarea(?=\s).*?\scols=((?:(?:\s*)("|').*?\2)|(?:[^"'][^ >]+))/gi ,
    7880
    7981Html4DocType    : /HTML 4\.0 Transitional/i ,
    8082DocTypeTag              : /<!DOCTYPE[^>]*>/i ,
  • editor/_source/internals/fckxhtml_ie.js

     
    130130        if ( htmlNode.value && !node.attributes.getNamedItem( 'value' ) )
    131131                FCKXHtml._AppendAttribute( node, 'value', htmlNode.value ) ;
    132132
     133        var sSavedSize = htmlNode.getAttribute( '_fcksavedsize' ) ;
     134        if ( sSavedSize != null )
     135                FCKXHtml._AppendAttribute( node, 'size', sSavedSize ) ;
     136
    133137        if ( !node.attributes.getNamedItem( 'type' ) )
    134138                FCKXHtml._AppendAttribute( node, 'type', 'text' ) ;
    135139
     
    197201        if ( htmlNode.name )
    198202                FCKXHtml._AppendAttribute( node, 'name', htmlNode.name ) ;
    199203
     204        var sSavedCols = htmlNode.getAttribute( '_fcksavedcols' ) ;
     205        if ( sSavedCols != null )
     206                FCKXHtml._AppendAttribute( node, 'cols', sSavedCols ) ;
     207
    200208        node = FCKXHtml._AppendChildNodes( node, htmlNode ) ;
    201209
    202210        return node ;
    203 }
    204  No newline at end of file
     211}
  • editor/dialog/fck_textarea.html

     
    4545        if ( oActiveEl && oActiveEl.tagName == 'TEXTAREA' )
    4646        {
    4747                GetE('txtName').value           = oActiveEl.name ;
    48                 GetE('txtCols').value           = GetAttribute( oActiveEl, 'cols' ) ;
     48                GetE('txtCols').value           = GetAttribute( oActiveEl, 'cols' ) || GetAttribute( oActiveEl, '_fcksavedcols' ) ; ;
    4949                GetE('txtRows').value           = GetAttribute( oActiveEl, 'rows' ) ;
    5050        }
    5151        else
     
    6363        oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'TEXTAREA', {name: GetE('txtName').value} ) ;
    6464
    6565        SetAttribute( oActiveEl, 'cols', GetE('txtCols').value ) ;
     66        SetAttribute( oActiveEl, '_fcksavedcols', GetE('txtCols').value ) ;
    6667        SetAttribute( oActiveEl, 'rows', GetE('txtRows').value ) ;
    6768
    6869        return true ;
  • editor/dialog/fck_textfield.html

     
    4646        {
    4747                GetE('txtName').value   = oActiveEl.name ;
    4848                GetE('txtValue').value  = oActiveEl.value ;
    49                 GetE('txtSize').value   = GetAttribute( oActiveEl, 'size' ) ;
     49                GetE('txtSize').value   = GetAttribute( oActiveEl, 'size' ) || GetAttribute( oActiveEl, '_fcksavedsize' ) ;
    5050                GetE('txtMax').value    = GetAttribute( oActiveEl, 'maxLength' ) ;
    5151                GetE('txtType').value   = oActiveEl.type ;
    5252        }
     
    7979
    8080        SetAttribute( oActiveEl, 'value'        , GetE('txtValue').value ) ;
    8181        SetAttribute( oActiveEl, 'size'         , GetE('txtSize').value ) ;
     82        SetAttribute( oActiveEl, '_fcksavedsize', GetE('txtSize').value ) ;
    8283        SetAttribute( oActiveEl, 'maxlength', GetE('txtMax').value ) ;
    8384
    8485        return true ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy