Opened 16 years ago
Closed 12 years ago
#2894 closed Bug (wontfix)
GetParentElement wrongly gives body sometimes for ff and webkit
Reported by: | Paul Moers | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | FCKeditor 2.6.4 |
Keywords: | Cc: |
Description
GetParentElement in Firefox and webkit wrongly returns the body as parent element when the cursor is simply placed inside a div without an object selected or without the cursor in or bordering text (possibly only when there's no text in the div).
A fix is as following (code assumes to be inside a dialog):
var dialog = window.parent; var editorWindow = dialog.InnerDialogLoaded(); var editorInstance = editorWindow.FCK; selectedElement = editorWindow.FCKSelection.GetParentElement(); if (selectedElement.tagName.toLowerCase() == 'body' && editorInstance.EditorWindow.getSelection) { var selection = editorInstance.EditorWindow.getSelection(); selectedElement = selection.anchorNode; }
FCKeditor was retired and is no longer supported. All active development was moved to its successor, CKEditor 3.x, that is a fully mature and far superior product. We recommend you upgrade as soon as possible.