- Timestamp:
- 2007-12-05 10:28:42 (12 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/branches/features/floating_dialog/editor/dialog/fck_replace.html
r1054 r1179 45 45 idMap['CheckCase'] = 'chkCase' + tabCode ; 46 46 idMap['CheckWord'] = 'chkWord' + tabCode ; 47 48 if ( tabCode == 'Replace' ) 49 window.parent.SetAutoSize( true ) ; 47 50 } 48 51 … … 61 64 62 65 // Show the appropriate tab at startup. 63 if ( dialogArguments.CustomValue == 'Find' ) 66 if ( window.parent.name.search( 'Replace' ) == -1 ) 67 { 64 68 window.parent.SetSelectedTab( 'Find' ) ; 69 window.parent.SetAutoSize( true ) ; 70 } 65 71 else 66 72 window.parent.SetSelectedTab( 'Replace' ) ; … … 108 114 function GetData( bookmark ) 109 115 { 110 var cur rentNode = oEditor.FCK.EditorDocument.documentElement;111 for ( var i = 0 ; i < bookmark.length ; i++ )112 { 113 if ( currentNode.childNodes.length > bookmark[i] )114 currentNode = currentNode.childNodes.item( bookmark[i] );115 else if ( currentNode.nodeType == 3 ) // text node116 var cursor = oEditor.FCK.EditorDocument.documentElement ; 117 for ( var i = 0 ; i < bookmark.length ; i++ ) 118 { 119 var target = bookmark[i] ; 120 var currentIndex = -1 ; 121 if ( cursor.nodeType != 3 ) 116 122 { 117 var c = currentNode.nodeValue.charAt( bookmark[i] ) ; 118 if ( i == bookmark.length - 1 ) 119 return c != "" ? c : null ; 120 else 123 for (var j = 0 ; j < cursor.childNodes.length ; j++ ) 124 { 125 var candidate = cursor.childNodes[j] ; 126 if ( candidate.nodeType == 3 && 127 candidate.previousSibling && 128 candidate.previousSibling.nodeType == 3 ) 129 continue ; 130 currentIndex++ ; 131 if ( currentIndex == target ) 132 { 133 cursor = candidate ; 134 break ; 135 } 136 } 137 if ( currentIndex < target ) 121 138 return null ; 122 139 } 123 140 else 124 return null; 125 } 126 return currentNode ; 141 { 142 if ( i != bookmark.length - 1 ) 143 return null ; 144 while ( target >= cursor.length && cursor.nextSibling && cursor.nextSibling.nodeType == 3 ) 145 { 146 target -= cursor.length ; 147 cursor = cursor.nextSibling ; 148 } 149 cursor = cursor.nodeValue.charAt( target ) ; 150 if ( cursor == "" ) 151 cursor = null ; 152 } 153 } 154 return cursor ; 127 155 } 128 156 … … 132 160 // See if there's anything further down the tree. 133 161 var next = bookmark.concat( [0] ) ; 134 135 162 if ( GetData( next ) != null ) 136 163 return next ; … … 253 280 { 254 281 if ( oEditor.FCKListsLib.BlockElements[ data.tagName.toLowerCase() ] ) 282 { 255 283 matcher.Reset(); 284 matchBookmark = null ; 285 } 256 286 } 257 287 else if ( data.charAt != undefined ) … … 324 354 while ( focus && focus.nodeType != 1 ) 325 355 focus = focus.parentNode ; 356 326 357 if ( focus ) 327 focus.scrollIntoView( false ) ; 358 { 359 if ( oEditor.FCKBrowserInfo.IsSafari ) 360 oEditor.FCKDomTools.ScrollIntoView( focus, false ) ; 361 else 362 focus.scrollIntoView( false ) ; 363 } 364 328 365 return true; 329 366 }