Ticket #3256: 3256.patch
File 3256.patch, 4.2 KB (added by , 16 years ago) |
---|
-
_source/plugins/domiterator/plugin.js
31 31 return next; 32 32 } 33 33 34 /** 35 * Evaluator for skipping bookmark nodes. 36 */ 37 function bookmarkEvaluator( node ) 38 { 39 return !( node && node.is && node.is ( 'span' ) 40 && node.hasAttribute( '_fck_bookmark' ) 41 || !node.is && !bookmarkEvaluator( node.getParent() ) ) 42 } 43 34 44 var iterator = function( range ) 35 45 { 36 46 if ( arguments.length < 1 ) … … 65 75 { 66 76 range = this.range.clone(); 67 77 range.enlarge( this.forceBrBreak ? CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS : CKEDITOR.ENLARGE_BLOCK_CONTENTS ); 78 79 var walker; 80 walker = new CKEDITOR.dom.walker( range ) 81 // Skip bookmark nodes. 82 walker.evaluator = bookmarkEvaluator; 83 this._.nextNode = walker.next(); 68 84 69 var boundary = range.getBoundaryNodes(); 70 this._.nextNode = boundary.startNode; 71 this._.lastNode = boundary.endNode.getNextSourceNode( true ); 85 range = range.clone(); 86 range.collapse(); 87 range.setEndAt( range.document.getBody(), CKEDITOR.POSITION_BEFORE_END ); 88 walker = new CKEDITOR.dom.walker( range ); 89 // Skip bookmark nodes. 90 walker.evaluator = bookmarkEvaluator; 91 this._.lastNode = walker.next(); 92 72 93 // Probably the document end is reached, we need a marker node. 73 94 if ( !this._.lastNode ) 74 95 { … … 73 94 if ( !this._.lastNode ) 74 95 { 75 96 this._.lastNode = range.document.createText( '' ); 76 this._.lastNode.insertAfter( boundary.endNode );97 range.document.getBody().append( this._.lastNode ); 77 98 } 78 99 79 100 // Let's reuse this variable. -
_source/plugins/justify/plugin.js
67 67 exec : function( editor ) 68 68 { 69 69 var selection = editor.getSelection(), 70 range = selection && selection.getRanges()[0];70 ranges = selection && selection.getRanges(); 71 71 72 if ( !range )72 if ( !ranges ) 73 73 return; 74 74 75 75 var bookmarks = selection.createBookmarks(), … … 74 74 75 75 var bookmarks = selection.createBookmarks(), 76 76 cssClassName = this.cssClassName, 77 iterator = range.createIterator(),77 iterator, 78 78 block; 79 80 while ( ( block = iterator.getNextParagraph() ) ) 81 { 82 block.removeAttribute( 'align' ); 83 84 if ( cssClassName ) 79 for ( var i = ranges.length-1 ; i >= 0 ; i-- ) { 80 iterator = ranges[ i ].createIterator(); 81 while ( ( block = iterator.getNextParagraph() ) ) 85 82 { 86 // Remove any of the alignment classes from the className.87 var className = block.$.className =88 CKEDITOR.tools.ltrim( block.$.className.replace( this.cssClassRegex, '' ) );89 90 // Append the desired class name.91 if ( this.state == CKEDITOR.TRISTATE_OFF && !this.isDefaultAlign )92 block.addClass( cssClassName);93 else if ( !className )94 block.removeAttribute( 'class' );95 }96 else97 {98 if ( this.state == CKEDITOR.TRISTATE_OFF && !this.isDefaultAlign )99 block.setStyle( 'text-align', this.value );83 block.removeAttribute( 'align' ); 84 85 if ( cssClassName ) 86 { 87 // Remove any of the alignment classes from the className. 88 var className = block.$.className = 89 CKEDITOR.tools.ltrim( block.$.className.replace( this.cssClassRegex, '' ) ); 90 91 // Append the desired class name. 92 if ( this.state == CKEDITOR.TRISTATE_OFF && !this.isDefaultAlign ) 93 block.addClass( cssClassName ); 94 else if ( !className ) 95 block.removeAttribute( 'class' ); 96 } 100 97 else 101 block.removeStyle( 'text-align' ); 98 { 99 if ( this.state == CKEDITOR.TRISTATE_OFF && !this.isDefaultAlign ) 100 block.setStyle( 'text-align', this.value ); 101 else 102 block.removeStyle( 'text-align' ); 103 } 102 104 } 105 103 106 } 104 107 105 108 editor.focus();