Changeset 1803

Show
Ignore:
Timestamp:
2008-03-26 08:48:46 (2 years ago)
Author:
fredck
Message:

Fixed #1997 : With IE, the first character of table captions where being lost on table creation. Also, the selection and cursor position was not being properly handled when creating some elements like forms and tables.

Location:
FCKeditor/trunk
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/trunk/editor/dtd/fck_dtd_test.html

    r911 r1803  
    1717        <table border="1"> 
    1818                <script type="text/javascript"> 
    19  
    20     alert(FCK.DTD); 
    2119 
    2220for ( var p in FCK.DTD ) 
  • FCKeditor/trunk/editor/fckdialog.html

    r1795 r1803  
    673673        window.Cancel = function( dontFireChange ) 
    674674        { 
     675                Selection.EnsureSelection() ; 
    675676                return CloseDialog( dontFireChange ) ; 
    676677        } ; 
     
    679680        { 
    680681                Throbber.Hide() ; 
    681  
    682                 Selection.EnsureSelection() ; 
    683682 
    684683                // Points the src to a non-existent location to avoid loading errors later, in case the dialog 
  • FCKeditor/trunk/editor/_source/classes/fckdomrange.js

    r1729 r1803  
    150150        MoveToElementEditStart : function( targetElement ) 
    151151        { 
    152                 var child ; 
    153  
    154                 while ( ( child = targetElement.firstChild ) && child.nodeType == 1 && FCKListsLib.InlineNonEmptyElements[ child.nodeName.toLowerCase() ] ) 
    155                         targetElement = child ; 
    156  
    157                 this.MoveToElementStart( targetElement ) ; 
     152                var editableElement ; 
     153 
     154                while ( targetElement && targetElement.nodeType == 1 ) 
     155                { 
     156                        if ( FCKDomTools.CheckIsEditable( targetElement ) ) 
     157                                editableElement = targetElement ; 
     158                        else if ( editableElement ) 
     159                                break ;         // If we already found an editable element, stop the loop. 
     160 
     161                        targetElement = targetElement.firstChild ; 
     162                } 
     163 
     164                if ( editableElement ) 
     165                        this.MoveToElementStart( editableElement ) ; 
    158166        }, 
    159167 
  • FCKeditor/trunk/editor/_source/internals/fckdomtools.js

    r1693 r1803  
    10061006                if ( offset > 0 && offset > currentScroll ) 
    10071007                        window.scrollTo( 0, offset ) ; 
     1008        }, 
     1009 
     1010        /** 
     1011         * Check if the element can be edited inside the browser. 
     1012         */ 
     1013        CheckIsEditable : function( element ) 
     1014        { 
     1015                // Get the element name. 
     1016                var nodeName = element.nodeName.toLowerCase() ; 
     1017 
     1018                // Get the element DTD (defaults to span for unknown elements). 
     1019                var childDTD = FCK.DTD[ nodeName ] || FCK.DTD.span ; 
     1020 
     1021                // In the DTD # == text node. 
     1022                return ( childDTD['#'] && !FCKListsLib.NonEditableElements[ nodeName ] ) ; 
    10081023        } 
    10091024} ; 
  • FCKeditor/trunk/editor/_source/internals/fck.js

    r1795 r1803  
    672672                        range.InsertNode( element ) ; 
    673673 
    674                         var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ] ) ; 
     674                        var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ], true ) ; 
    675675 
    676676                        // Be sure that we have something after the new element, so we can move the cursor there. 
  • FCKeditor/trunk/editor/_source/internals/fcklistslib.js

    r1565 r1803  
    5555        StyleObjectElements : { img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1 }, 
    5656 
     57        // Elements that accept text nodes, but are not possible to edit in the browser. 
     58        NonEditableElements : { button:1,option:1,script:1,iframe:1,textarea:1,object:1,embed:1,map:1,applet:1 }, 
     59 
    5760        // Elements used to separate block contents. 
    5861        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 }, 
  • FCKeditor/trunk/_whatsnew.html

    r1798 r1803  
    139139                        dialogs using API calls which deals with the selection, like InsertHtml now can 
    140140                        be sure the selection will be placed in the correct position.</li> 
     141                <li>[<a target="_blank" href="http://dev.fckeditor.net/ticket/1997">#1997</a>] With 
     142                        IE, the first character of table captions where being lost on table creation.</li> 
     143                <li>The selection and cursor position was not being properly handled when creating some 
     144                        elements like forms and tables.</li> 
    141145        </ul> 
    142146        <h3>