Ticket #3100: 3100_2.patch
File 3100_2.patch, 4.4 KB (added by , 15 years ago) |
---|
-
_source/core/dom/element.js
658 658 return false; 659 659 }, 660 660 661 isEditable : function() 662 { 663 // Get the element name. 664 var name = this.getName(); 665 666 // Get the element DTD (defaults to span for unknown elements). 667 var dtd = !CKEDITOR.dtd.$nonEditable[ name ] 668 && ( CKEDITOR.dtd[ name ] || CKEDITOR.dtd.span ); 669 670 // In the DTD # == text node. 671 return ( dtd && dtd['#'] ); 672 }, 673 661 674 isIdentical : function( otherElement ) 662 675 { 663 676 if ( this.getName() != otherElement.getName() ) -
_source/core/dom/range.js
1418 1418 walker.forward( CKEDITOR.dom.domWalker.blockBoundary() ); 1419 1419 1420 1420 return !walker.checkFailed; 1421 }, 1422 1423 /** 1424 * Moves the range boundaries to the first editing point inside an 1425 * element. For example, in an element tree like 1426 * "<p><b><i></i></b> Text</p>", the start editing point is 1427 * "<p><b><i>^</i></b> Text</p>" (inside <i>). 1428 * @param {CKEDITOR.dom.element} targetElement The element into which 1429 * look for the editing spot. 1430 */ 1431 moveToElementEditStart : function( targetElement ) 1432 { 1433 var editableElement; 1434 1435 while ( targetElement && targetElement.type == CKEDITOR.NODE_ELEMENT ) 1436 { 1437 if ( targetElement.isEditable() ) 1438 editableElement = targetElement; 1439 else if ( editableElement ) 1440 break ; // If we already found an editable element, stop the loop. 1441 1442 targetElement = targetElement.getFirst(); 1443 } 1444 1445 if ( editableElement ) 1446 this.moveToPosition( editableElement, CKEDITOR.POSITION_AFTER_START ); 1421 1447 } 1422 1448 }; 1423 1449 })(); -
_source/core/dtd.js
79 79 $listItem : {dd:1,dt:1,li:1}, 80 80 81 81 /** 82 * Elements that accept text nodes, but are not possible to edit into 83 * the browser. 84 * @type Object 85 * @example 86 */ 87 $nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1}, 88 89 /** 82 90 * List of elements that can be ignored if empty, like "b" or "span". 83 91 * @type Object 84 92 * @example -
_source/plugins/wysiwygarea/plugin.js
32 32 if ( this.mode == 'wysiwyg' ) 33 33 { 34 34 var element = evt.data, 35 isBlock = CKEDITOR.dtd.$block[ element.getName() ]; 35 elementName = element.getName(), 36 isBlock = CKEDITOR.dtd.$block[ elementName ]; 36 37 37 38 var selection = this.getSelection(), 38 39 ranges = selection.getRanges(); … … 48 49 49 50 clone = element.clone( true ); 50 51 52 var toSplit; 53 51 54 // If the new node is a block element, split the current block (if any). 52 55 if ( this.config.enterMode != 'br' && isBlock ) 53 56 { 54 var startPath = new CKEDITOR.dom.elementPath( range.startContainer ); 55 if ( startPath.block ) 56 range.splitBlock(); 57 var startPath = new CKEDITOR.dom.elementPath( range.startContainer ), 58 j = 0, 59 parent; 60 61 while( ( parent = startPath.elements[ j++ ] ) && parent != startPath.blockLimit ) 62 { 63 var parentName = parent.getName(), 64 parentDtd = CKEDITOR.dtd[ parentName ]; 65 66 if ( parentDtd && !parentDtd[ elementName ] ) 67 toSplit = parent; 68 } 57 69 } 58 70 59 71 // Insert the new node. 60 72 range.insertNode( clone ); 61 73 74 if ( toSplit ) 75 clone.breakParent( toSplit ); 76 62 77 // Save the last element reference so we can make the 63 78 // selection later. 64 79 if ( !lastElement ) … … 66 81 } 67 82 68 83 range.moveToPosition( lastElement, CKEDITOR.POSITION_AFTER_END ); 84 85 var next = lastElement.getNextSourceNode( true ); 86 if ( next && next.type == CKEDITOR.NODE_ELEMENT ) 87 range.moveToElementEditStart( next ); 88 69 89 selection.selectRanges( [ range ] ); 70 90 } 71 91 }