Ticket #6615: 6615_4.patch
File 6615_4.patch, 2.9 KB (added by , 14 years ago) |
---|
-
_source/plugins/tableresize/plugin.js
161 161 162 162 var leftSideCells, rightSideCells, leftShiftBoundary, rightShiftBoundary; 163 163 164 var savedRange; 165 function toggleDesignMode( state ) 166 { 167 document.getBody().$.contentEditable = !!state; 168 } 169 164 170 function detach() 165 171 { 166 172 pillar = null; … … 171 177 resizer.removeListener( 'mousedown', onMouseDown ); 172 178 resizer.removeListener( 'mousemove', onMouseMove ); 173 179 180 needsIEHacks && toggleDesignMode( 1 ); 174 181 document.getBody().setStyle( 'cursor', 'auto' ); 175 182 176 183 // Hide the resizer (remove it on IE7 - #5890). … … 278 285 { 279 286 cancel( evt ); 280 287 288 if ( needsIEHacks ) 289 { 290 toggleDesignMode( 1 ); 291 savedRange = document.$.selection.createRange(); 292 if ( savedRange.parentElement().ownerDocument != editor.document.$ ) 293 savedRange = null; 294 } 295 281 296 resizeStart(); 282 297 283 298 document.on( 'mouseup', onMouseUp, this ); … … 288 303 evt.removeListener(); 289 304 290 305 resizeEnd(); 306 307 if ( needsIEHacks && savedRange ) 308 setTimeout( function() { savedRange.select(); }, 0 ); 309 291 310 } 292 311 293 312 function onMouseMove( evt ) … … 331 350 }); 332 351 333 352 // In IE6/7, it's not possible to have custom cursors for floating 334 // elements in an editable document. Show the resizer in that case, 335 // to give the user a visual clue. 336 needsIEHacks && resizer.setOpacity( 0.25 ); 353 // elements in an editable document. 354 needsIEHacks && toggleDesignMode(); 337 355 338 356 resizer.on( 'mousedown', onMouseDown, this ); 339 357 … … 392 410 if ( !dest || dest.equals( target ) ) 393 411 return; 394 412 } 413 else if ( evt.name == 'keydown' ) 414 target = target.getDocument().getSelection().getStartElement(); 395 415 396 target.getAscendant( 'table', 1 ).removeCustomData( '_cke_table_pillars' ); 397 evt.removeListener(); 416 var table = target.getAscendant( 'table', 1 ); 417 table && table.removeCustomData( '_cke_table_pillars' ); 418 419 if ( evt.name != 'keydown' ) 420 evt.removeListener(); 398 421 } 399 422 400 423 CKEDITOR.plugins.add( 'tableresize', … … 434 457 table.setCustomData( '_cke_table_pillars', ( pillars = buildTableColumnPillars( table ) ) ); 435 458 table.on( 'mouseout', clearPillarsCache ); 436 459 table.on( 'mousedown', clearPillarsCache ); 460 editor.document.removeListener( 'keydown', clearPillarsCache ); 461 editor.document.on( 'keydown', clearPillarsCache ); 437 462 } 438 463 439 464 var pillar = getPillarAtPosition( pillars, evt.$.clientX ); 440 if ( pillar ) 465 466 // Skip mouse drag/drop/selection. 467 if ( pillar && !evt.$.button ) 441 468 { 442 469 !resizer && ( resizer = new columnResizer( editor ) ); 443 470 resizer.attachTo( pillar );