Changeset 2171

Show
Ignore:
Timestamp:
2008-07-04 09:00:18 (6 months ago)
Author:
martinkou
Message:

Fixed the issue where the edit div and delete div context menues don't appear in Firefox/Windows when the user right clicks in the empty space inside the div or in the paragraphs.

Location:
FCKeditor/branches/features/div_container/editor
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • FCKeditor/branches/features/div_container/editor/dialog/fck_div.html

    r2105 r2171  
    3838var AlwaysCreate = dialog.Args().CustomValue ; 
    3939 
    40 var ActiveEl = !AlwaysCreate ? dialog.Selection.GetSelection().MoveToAncestorNode( 'DIV' ) : null ; 
    41 if ( ActiveEl ) 
    42 { 
    43         ActiveEl = ( new FCKElementPath( ActiveEl ) ).BlockLimit ; 
     40var ActiveEl = null ; 
     41if ( !AlwaysCreate ) 
     42{ 
     43        var oSelection = dialog.Selection.GetSelection() ; 
     44        ActiveEl = ( new FCKElementPath( oSelection.GetSelectedElement() || oSelection.GetParentElement() ) ).BlockLimit ; 
    4445        if ( ActiveEl && ActiveEl.nodeName.toLowerCase() != 'div' ) 
    4546                ActiveEl = null ; 
  • FCKeditor/branches/features/div_container/editor/_source/internals/fck_contextmenu.js

    r2121 r2171  
    298298                        AddItems : function( menu, tag, tagName ) 
    299299                        { 
    300                                 var path = new FCKElementPath( FCKSelection.GetParentElement() ) ; 
     300                                var path = new FCKElementPath( FCKSelection.GetSelectedElement() || FCKSelection.GetParentElement() ) ; 
    301301                                if ( path.BlockLimit && path.BlockLimit.nodeName.IEquals( 'div' ) ) 
    302302                                { 
  • FCKeditor/branches/features/div_container/editor/_source/internals/fckselection_gecko.js

    r2072 r2171  
    7676                if ( oSel ) 
    7777                { 
    78                         // make the common case fast - for collapsed/nearly collapsed selections just return anchor.parent. 
     78                        // if anchorNode == focusNode, see if the selection is text only or including nodes. 
     79                        // if text only, return the parent node. 
     80                        // if the selection includes DOM nodes, then the anchorNode is the nearest container. 
    7981                        if ( oSel.anchorNode && oSel.anchorNode == oSel.focusNode ) 
    80                                 return oSel.anchorNode.parentNode ; 
     82                        { 
     83                                var oRange = oSel.getRangeAt( 0 ) ; 
     84                                if ( oRange.collapsed || oRange.startContainer.nodeType == 3 ) 
     85                                        return oSel.anchorNode.parentNode ; 
     86                                else 
     87                                        return oSel.anchorNode ; 
     88                        } 
    8189 
    8290                        // looks like we're having a large selection here. To make the behavior same as IE's TextRange.parentElement(),