Ticket #8246: 8246_3.patch
File 8246_3.patch, 4.1 KB (added by , 13 years ago) |
---|
-
_source/core/dom/node.js
654 654 }, 655 655 656 656 /** 657 * Checks if this node is read-only (should not be changed). Additionally 658 * it returns the element that defines the read-only state of this node 659 * (if present). It may be the node itself or any of its parent 660 * nodes. 661 * @returns {CKEDITOR.dom.element|Boolean} An element containing 662 * read-only attributes or "false" if none is found. 657 * Checks if this node is read-only (should not be changed). 658 * @returns {Boolean} 663 659 * @since 3.5 664 660 * @example 665 661 * // For the following HTML: 666 662 * // <div contenteditable="false">Some <b>text</b></div> 667 663 * 668 664 * // If "ele" is the above <div> 669 * ele.isReadOnly(); // the <div> element 670 * 671 * // If "ele" is the above <b> 672 * ele.isReadOnly(); // the <div> element 665 * ele.isReadOnly(); // true 673 666 */ 674 667 isReadOnly : function() 675 668 { 676 var current = this; 677 while( current ) 678 { 679 if ( current.type == CKEDITOR.NODE_ELEMENT ) 680 { 681 if ( current.is( 'body' ) || !!current.data( 'cke-editable' ) ) 682 break; 669 var element = this; 670 if ( this.type != CKEDITOR.NODE_ELEMENT ) 671 element = this.getParent(); 683 672 684 if ( current.getAttribute( 'contentEditable' ) == 'false' ) 685 return current; 686 else if ( current.getAttribute( 'contentEditable' ) == 'true' ) 687 break; 688 } 689 current = current.getParent(); 690 } 691 692 return false; 673 if ( element 674 && typeof element.$.isContentEditable != 'undefined' 675 && !element.data( 'cke-editable' ) ) 676 { 677 return !element.$.isContentEditable; 678 } 679 else 680 return false; 693 681 } 694 682 } 695 683 ); -
_source/plugins/wysiwygarea/plugin.js
1240 1240 { 1241 1241 // We should flag that the element was locked by our code so 1242 1242 // it'll be editable by the editor functions (#6046). 1243 if ( !element.isReadOnly() ) 1243 var readonly = element.getAttribute( 'contenteditable' ) == 'false'; 1244 if ( !readonly ) 1245 { 1244 1246 element.data( 'cke-editable', element.hasAttribute( 'contenteditable' ) ? 'true' : '1' ); 1245 element.setAttribute( 'contentEditable', false ); 1246 } 1247 element.setAttribute( 'contenteditable', false ); 1248 } 1249 } 1247 1250 }); 1248 1251 1249 1252 } -
_source/plugins/selection/plugin.js
961 961 if ( range.collapsed ) 962 962 continue; 963 963 964 // Range may start inside a non-editable element, 965 // replace the range start after it. 966 if ( range.startContainer.isReadOnly() ) 967 { 968 var current = range.startContainer; 969 while( current ) 970 { 971 if ( current.is( 'body' ) || !current.isReadOnly() ) 972 break; 973 974 if ( current.type == CKEDITOR.NODE_ELEMENT 975 && current.getAttribute( 'contentEditable' ) == 'false' ) 976 range.setStartAfter( current ); 977 978 current = current.getParent(); 979 } 980 } 981 964 982 var startContainer = range.startContainer, 965 983 endContainer = range.endContainer, 966 984 startOffset = range.startOffset, 967 985 endOffset = range.endOffset, 968 986 walkerRange = range.clone(); 969 987 970 // Range may start inside a non-editable element, restart range971 // by the end of it.972 var readOnly;973 if ( ( readOnly = startContainer.isReadOnly() ) )974 range.setStartAfter( readOnly );975 976 988 // Enlarge range start/end with text node to avoid walker 977 989 // being DOM destructive, it doesn't interfere our checking 978 990 // of elements below as well.