Index: _whatsnew.html =================================================================== --- _whatsnew.html (revision 1773) +++ _whatsnew.html (working copy) @@ -112,6 +112,10 @@ as expected.
^ Text
" (inside ). MoveToElementEditStart : function( targetElement ) { - var child ; + var editableElement ; - while ( ( child = targetElement.firstChild ) && child.nodeType == 1 && FCKListsLib.InlineNonEmptyElements[ child.nodeName.toLowerCase() ] ) - targetElement = child ; + while ( targetElement && targetElement.nodeType == 1 ) + { + if ( FCKDomTools.CheckIsEditable( targetElement ) ) + editableElement = targetElement ; + else if ( editableElement ) + break ; // If we already found an editable element, stop the loop. - this.MoveToElementStart( targetElement ) ; + targetElement = targetElement.firstChild ; + } + + if ( editableElement ) + this.MoveToElementStart( editableElement ) ; }, InsertNode : function( node ) Index: editor/_source/internals/fck.js =================================================================== --- editor/_source/internals/fck.js (revision 1772) +++ editor/_source/internals/fck.js (working copy) @@ -669,7 +669,7 @@ range.SplitBlock() ; range.InsertNode( element ) ; - var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ] ) ; + var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ], true ) ; // Be sure that we have something after the new element, so we can move the cursor there. if ( !next && FCKConfig.EnterMode != 'br') Index: editor/_source/internals/fckdomtools.js =================================================================== --- editor/_source/internals/fckdomtools.js (revision 1772) +++ editor/_source/internals/fckdomtools.js (working copy) @@ -1005,5 +1005,20 @@ var currentScroll = FCKTools.GetScrollPosition( window ).Y ; if ( offset > 0 && offset > currentScroll ) window.scrollTo( 0, offset ) ; + }, + + /** + * Check if the element can be edited inside the browser. + */ + CheckIsEditable : function( element ) + { + // Get the element name. + var nodeName = element.nodeName.toLowerCase() ; + + // Get the element DTD (defaults to span for unknown elements). + var childDTD = FCK.DTD[ nodeName ] || FCK.DTD.span ; + + // In the DTD # == text node. + return ( childDTD['#'] && !FCKListsLib.NonEditableElements[ nodeName ] ) ; } } ; Index: editor/_source/internals/fcklistslib.js =================================================================== --- editor/_source/internals/fcklistslib.js (revision 1772) +++ editor/_source/internals/fcklistslib.js (working copy) @@ -54,6 +54,9 @@ // Object elements for the Styles System. StyleObjectElements : { img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1 }, + // Elements that accept text nodes, but are not possible to edit in the browser. + NonEditableElements : { button:1,option:1,script:1,iframe:1,textarea:1,object:1,embed:1,map:1,applet:1 }, + // Elements used to separate block contents. BlockBoundaries : { p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1 }, ListBoundaries : { p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,address:1,pre:1,ol:1,ul:1,li:1,dt:1,de:1,table:1,thead:1,tbody:1,tfoot:1,tr:1,th:1,td:1,caption:1,col:1,colgroup:1,blockquote:1,body:1,br:1 } Index: editor/dtd/fck_dtd_test.html =================================================================== --- editor/dtd/fck_dtd_test.html (revision 1772) +++ editor/dtd/fck_dtd_test.html (working copy) @@ -17,8 +17,6 @@