.fck編輯器插入圖片去掉默認的width和height屬性的處理方法,打開文件 fckeditor/editor/dialog/fck_image/fck_images.js找到對應的代碼段即可處理了.
打開文件 fckeditor/editor/dialog/fck_image/fck_images.js,注釋以下代碼即可,代碼如下:
- if ( oImage.style.width )
- {
- var aMatchW = oImage.style.width.match( regexSize ) ;
- if ( aMatchW )
- {
- iWidth = aMatchW[1] ;
- oImage.style.width = '' ;
- SetAttribute( oImage, 'width' , iWidth ) ;
- }
- }
- if ( oImage.style.height )
- {
- var aMatchH = oImage.style.height.match( regexSize ) ;
- if ( aMatchH )
- {
- iHeight = aMatchH[1] ;
- oImage.style.height = '' ;
- SetAttribute( oImage, 'height', iHeight ) ;
- }
- }
- GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ;
- GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ;
- ----------
- SetAttribute( e, "width" , GetE('txtWidth').value ) ;
- SetAttribute( e, "height", GetE('txtHeight').value ) ;
- ----------
- if ( bLockRatio )
- {
- if ( GetE('txtWidth').value.length > 0 )
- OnSizeChanged( 'Width', GetE('txtWidth').value ) ;
- else
- OnSizeChanged( 'Height', GetE('txtHeight').value ) ;
- }
- ----------
- var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ;
- ----------
- if ( dimension == 'Width' )
- value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ;
- else //開源軟件:Vevb.com
- value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ;
- ----------
- GetE('txtWidth').value = oImageOriginal.width ;
- GetE('txtHeight').value = oImageOriginal.height ;
- ----------
- GetE('txtWidth').value = width ? width : '' ;
- GetE('txtHeight').value = height ? height : '' ;
新聞熱點
疑難解答