Changeset 706
- Timestamp:
- 2007-08-23 01:23:53 (17 months ago)
- Location:
- FCKeditor/trunk/editor
- Files:
-
- 10 added
- 10 removed
- 9 modified
-
css/fck_internal.css (modified) (3 diffs)
-
css/images/block_address.png (added)
-
css/images/block_div.png (added)
-
css/images/block_h1.png (added)
-
css/images/block_h2.png (added)
-
css/images/block_h3.png (added)
-
css/images/block_h4.png (added)
-
css/images/block_h5.png (added)
-
css/images/block_h6.png (added)
-
css/images/block_p.png (added)
-
css/images/block_pre.png (added)
-
images/block_address.png (deleted)
-
images/block_div.png (deleted)
-
images/block_h1.png (deleted)
-
images/block_h2.png (deleted)
-
images/block_h3.png (deleted)
-
images/block_h4.png (deleted)
-
images/block_h5.png (deleted)
-
images/block_h6.png (deleted)
-
images/block_p.png (deleted)
-
images/block_pre.png (deleted)
-
skins/default/fck_strip.gif (modified) (previous)
-
skins/office2003/fck_strip.gif (modified) (previous)
-
skins/silver/fck_strip.gif (modified) (previous)
-
_source/commandclasses/fckshowblocks.js (modified) (1 diff)
-
_source/internals/fckregexlib.js (modified) (1 diff)
-
_source/internals/fckxhtml_gecko.js (modified) (1 diff)
-
_source/internals/fckxhtml_ie.js (modified) (1 diff)
-
_source/internals/fckxhtml.js (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/editor/css/fck_internal.css
r228 r706 22 22 */ 23 23 24 /* Fix to allow putting the caret at the end of the 25 content in Firefox if clicking below the content*/24 /* Fix to allow putting the caret at the end of the content in Firefox if 25 clicking below the content. */ 26 26 html 27 27 { 28 28 min-height: 100%; 29 29 } 30 31 30 32 31 table.FCK__ShowTableBorders, table.FCK__ShowTableBorders td, table.FCK__ShowTableBorders th … … 73 72 } 74 73 75 /* Any anchor for non-IE, if we combine it 76 with the previous rule IE ignores all. */ 74 /* Any anchor for non-IE, if we combine it with the previous rule IE ignores all. */ 77 75 a[name] 78 76 { … … 110 108 background-position: center center; 111 109 } 110 111 .FCK__ShowBlocks p, 112 .FCK__ShowBlocks div, 113 .FCK__ShowBlocks pre, 114 .FCK__ShowBlocks address, 115 .FCK__ShowBlocks h1, 116 .FCK__ShowBlocks h2, 117 .FCK__ShowBlocks h3, 118 .FCK__ShowBlocks h4, 119 .FCK__ShowBlocks h5, 120 .FCK__ShowBlocks h6 121 { 122 background-repeat: no-repeat; 123 border: 1px dotted gray; 124 padding-top: 8px; 125 padding-left: 8px; 126 } 127 128 .FCK__ShowBlocks p 129 { 130 background-image: url(images/block_p.png); 131 } 132 133 .FCK__ShowBlocks div 134 { 135 background-image: url(images/block_div.png); 136 } 137 138 .FCK__ShowBlocks pre 139 { 140 background-image: url(images/block_pre.png); 141 } 142 143 .FCK__ShowBlocks address 144 { 145 background-image: url(images/block_address.png); 146 } 147 148 .FCK__ShowBlocks h1 149 { 150 background-image: url(images/block_h1.png); 151 } 152 153 .FCK__ShowBlocks h2 154 { 155 background-image: url(images/block_h2.png); 156 } 157 158 .FCK__ShowBlocks h3 159 { 160 background-image: url(images/block_h3.png); 161 } 162 163 .FCK__ShowBlocks h4 164 { 165 background-image: url(images/block_h4.png); 166 } 167 168 .FCK__ShowBlocks h5 169 { 170 background-image: url(images/block_h5.png); 171 } 172 173 .FCK__ShowBlocks h6 174 { 175 background-image: url(images/block_h6.png); 176 } -
FCKeditor/trunk/editor/_source/commandclasses/fckshowblocks.js
r702 r706 25 25 { 26 26 this.Name = name ; 27 this.CSSText = this._GetCSSText( ['p', 'div', 'pre', 'address', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'] ) ;28 this.StyleSheetObj = null ;29 27 } 28 30 29 FCKShowBlockCommand.prototype.Execute = function() 31 30 { 32 if ( this._IsVisible() ) 33 this._SetInvisible() ; 31 var state = this.GetState() ; 32 33 if ( state == FCK_TRISTATE_DISABLED ) 34 return false ; 35 36 var body = FCK.EditorDocument.body ; 37 38 if ( state == FCK_TRISTATE_ON ) 39 body.className = body.className.replace( /(^| )FCK__ShowBlocks/g, '' ) ; 34 40 else 35 this._SetVisible() ; 41 body.className += ' FCK__ShowBlocks' ; 42 36 43 FCK.Events.FireEvent( 'OnSelectionChange' ) ; 37 44 } 45 38 46 FCKShowBlockCommand.prototype.GetState = function() 39 47 { 40 48 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) 41 49 return FCK_TRISTATE_DISABLED ; 42 return this._IsVisible() ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF ; 43 } 44 FCKShowBlockCommand.prototype._IsVisible = function() 45 { 46 // The try.. catch... statements are here because accessing a stylesheet object of an inactive 47 // document would raise access denied error in IE. 48 // In such a case, we should clear the reference to prevent further errors, before returning false. 50 51 // On some cases FCK.EditorDocument.body is not yet available, so try/catch. 49 52 try 50 53 { 51 if ( ! this.StyleSheetObj)52 return false;54 if ( /FCK__ShowBlocks(?:\s|$)/.test( FCK.EditorDocument.body.className ) ) 55 return FCK_TRISTATE_ON ; 53 56 } 54 catch ( e ) 55 { 56 this.StyleSheetObj = null ; 57 return false ; 58 } 59 if ( FCKBrowserInfo.IsIE ) 60 { 61 try 62 { 63 if ( this.StyleSheetObj.cssText == '' 64 || ! this.StyleSheetObj.owningElement 65 || this.StyleSheetObj.owningElement.ownerDocument != FCK.EditorDocument ) 66 return false ; 67 else 68 return true ; 69 } 70 catch ( e ) 71 { 72 this.StyleSheetObj = null ; 73 return false ; 74 } 75 } 76 else 77 { 78 if ( this.StyleSheetObj.parentNode && this.StyleSheetObj.ownerDocument == FCK.EditorDocument ) 79 return true ; 80 else 81 return false ; 82 } 57 catch (e) 58 {} 59 60 return FCK_TRISTATE_OFF ; 83 61 } 84 FCKShowBlockCommand.prototype._SetVisible = function()85 {86 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )87 return ;88 if ( ! this.StyleSheetObj )89 {90 this.StyleSheetObj = FCKTools._AppendStyleString( FCK.EditorDocument, this.CSSText ) ;91 return ;92 }93 94 if ( FCKBrowserInfo.IsIE )95 this.StyleSheetObj.cssText = this.CSSText ;96 else97 FCK.EditorDocument.getElementsByTagName( 'head' )[0].appendChild( this.StyleSheetObj ) ;98 }99 FCKShowBlockCommand.prototype._SetInvisible = function()100 {101 if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG )102 return ;103 if ( ! this.StyleSheetObj )104 return ;105 106 if ( FCKBrowserInfo.IsIE )107 this.StyleSheetObj.cssText = '' ;108 else109 {110 if ( this.StyleSheetObj.parentNode )111 this.StyleSheetObj.parentNode.removeChild( this.StyleSheetObj ) ;112 }113 }114 FCKShowBlockCommand.prototype._GetCSSText = function( tags )115 {116 var template = '$TAG'117 + '{'118 + 'background-image: url($BASEPATHimages/block_$TAG.png);'119 + 'background-repeat: no-repeat;'120 + 'border: 1px dotted gray;'121 + 'padding-top: 8px;'122 + 'padding-left: 8px;'123 + '}\n';124 125 var retval = '' ;126 for ( var i = 0 ; i < tags.length ; i++ )127 retval += template.replace( new RegExp( '\\$TAG', 'g' ), tags[i] ) ;128 retval = retval.replace( new RegExp( '\\$BASEPATH', 'g' ), FCKConfig.BasePath ) ;129 return retval ;130 } -
FCKeditor/trunk/editor/_source/internals/fckregexlib.js
r704 r706 50 50 51 51 // Temporary classes (Tables without border, Anchors with content) used in IE 52 FCK_Class : / FCK__[^ ]*\s*/ ,52 FCK_Class : /\s*FCK__[^ ]*(?=\s+|$)/ , 53 53 54 54 // Validate element names (it must be in lowercase). -
FCKeditor/trunk/editor/_source/internals/fckxhtml_gecko.js
r694 r706 54 54 // - for the "class" attribute 55 55 else if ( sAttName == 'class' ) 56 sAttValue = oAttribute.nodeValue ; 56 { 57 sAttValue = oAttribute.nodeValue.replace( FCKRegexLib.FCK_Class, '' ) ; 58 if ( sAttValue.length == 0 ) 59 continue ; 60 } 57 61 // XHTML doens't support attribute minimization like "CHECKED". It must be transformed to checked="checked". 58 62 else if ( oAttribute.nodeValue === true ) -
FCKeditor/trunk/editor/_source/internals/fckxhtml_ie.js
r694 r706 55 55 // - for the "class" attribute 56 56 // - for events attributes (on IE only). 57 else if ( sAttName == 'class' || sAttName.indexOf('on') == 0 ) 57 else if ( sAttName == 'class' ) 58 { 59 sAttValue = oAttribute.nodeValue.replace( FCKRegexLib.FCK_Class, '' ) ; 60 if ( sAttValue.length == 0 ) 61 continue ; 62 } 63 else if ( sAttName.indexOf('on') == 0 ) 58 64 sAttValue = oAttribute.nodeValue ; 59 65 else if ( nodeName == 'body' && sAttName == 'contenteditable' ) -
FCKeditor/trunk/editor/_source/internals/fckxhtml.js
r640 r706 325 325 } 326 326 327 // Remove part of an attribute from a node according to a regExp328 FCKXHtml._RemoveAttribute = function( xmlNode, regX, sAttribute )329 {330 var oAtt = xmlNode.attributes.getNamedItem( sAttribute ) ;331 332 if ( oAtt && regX.test( oAtt.nodeValue ) )333 {334 var sValue = oAtt.nodeValue.replace( regX, '' ) ;335 336 if ( sValue.length == 0 )337 xmlNode.attributes.removeNamedItem( sAttribute ) ;338 else339 oAtt.nodeValue = sValue ;340 }341 }342 343 327 // An object that hold tag specific operations. 344 328 FCKXHtml.TagProcessors = … … 371 355 if ( FCKBrowserInfo.IsIE ) 372 356 { 373 FCKXHtml._RemoveAttribute( node, FCKRegexLib.FCK_Class, 'class' ) ;374 375 357 // Buggy IE, doesn't copy the name of changed anchors. 376 358 if ( htmlNode.name ) … … 426 408 }, 427 409 428 table : function( node, htmlNode )429 {430 // There is a trick to show table borders when border=0. We add to the431 // table class the FCK__ShowTableBorders rule. So now we must remove it.432 433 if ( FCKBrowserInfo.IsIE )434 FCKXHtml._RemoveAttribute( node, FCKRegexLib.FCK_Class, 'class' ) ;435 436 node = FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;437 438 return node ;439 },440 441 410 // Fix nested <ul> and <ol>. 442 411 ol : function( node, htmlNode, targetNode )