Index: _whatsnew.html =================================================================== --- _whatsnew.html (revision 1467) +++ _whatsnew.html (working copy) @@ -75,6 +75,8 @@ are now properly sized in Opera.
See previous versions history Index: editor/_source/internals/fckselection_gecko.js =================================================================== --- editor/_source/internals/fckselection_gecko.js (revision 1464) +++ editor/_source/internals/fckselection_gecko.js (working copy) @@ -51,30 +51,19 @@ // element (object like and image or a table) is selected. FCKSelection.GetSelectedElement = function() { - var selectedElement = null ; - var selection = !!FCK.EditorWindow && FCK.EditorWindow.getSelection() ; + if ( !selection || selection.rangeCount < 1 ) + return null ; - if ( selection && selection.anchorNode && selection.anchorNode.nodeType == 1 ) - { - if ( this.GetType() == 'Control' ) - { - // This one is good for all browsers, expect Safari Mac. - selectedElement = selection.anchorNode.childNodes[ selection.anchorOffset ] ; + var range = selection.getRangeAt( 0 ) ; + if ( range.startContainer != range.endContainer || range.startContainer.nodeType != 1 || range.startOffset != range.endOffset - 1 ) + return null ; - // For Safari (Mac only), the anchor node for a control selection is - // the control itself, which seams logic. FF and Opera use the parent - // as the anchor node, pointing to the control with the offset. - // As FF created the selection "standard", Safari would do better by - // following their steps. - if ( !selectedElement ) - selectedElement = selection.anchorNode ; - else if ( selectedElement.nodeType != 1 ) - return null ; - } - } + var node = range.startContainer.childNodes[ range.startOffset ] ; + if ( node.nodeType != 1 ) + return null ; - return selectedElement ; + return node ; } FCKSelection.GetParentElement = function()