Opened 14 years ago
Last modified 14 years ago
#7928 confirmed Bug
elementspath + getSelectedElement problem
Reported by: | daveVW | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | General | Version: | 3.6 |
Keywords: | Cc: |
Description
When you click an element in the elements path, the elementspath.js plugin executes the instruction
editor.getSelection().selectElement(element);
However, in all browsers except Firefox, the editor.getSelection().getSelectedElement() returns null !
Is this a problem that has been solved already in some patch ?
Attachments (1)
Change History (12)
comment:1 Changed 14 years ago by
Status: | new → pending |
---|
comment:2 Changed 14 years ago by
This doesn't pose a problem in CKEditor as is. But it gives a problem when adding new plugings. I am writing a styleEditor plugin for adding styles to a given selection. If one makes a selection using the elementspath then following happens :
- In Firefox, the element is selected (editor.getSelection().getSelectedElement()). Hence, the styleEditor plugin will add new styles to the element.
- But in other browsers, the element is NOT selected (getSelectedElement() is null). Hence, the styles will be applied to the selected text using a span element. But the user expects of course the styles to be added to the element itself because he selected the element in the elementspath.
But why does the following elementspath instruction
editor.getSelection().selectElement(element);
fails ?
comment:3 Changed 14 years ago by
Problems using IE 7, 8 & 9 when using the elementspath ! Try the following :
- Create new table
- Put the cursor in a cell
- Click "td" in the elementspath : JAVASCRIPT ERROR
Second example :
- Create new table
- Put the cursor in a cell
- Add some text in the cell
- Click "td" in the elementspath
- Go to cell properties and change the width of the cell
- Save : JAVASCRIPT ERROR
Third example : problem in IE 7, 8 (not in v9)
- Create new table
- Put the cursor in the table
- Click 'table' in the elementspath
- Choose table properties in the context menu and change the height of the table to 200
- Click save
- Click on table properties in the context menu again: the menu item becomes selected and you are blocked.
I think all these problems are related to the getSelectedElement problem which returns null.
comment:4 Changed 14 years ago by
- modifiy sample text on page
<strong id="abc"
- Paste the code below:
setTimeout(function(){ var element2 = CKEDITOR.instances.editor2.document.getById( 'abc' ); //alert(element2.getName()); CKEDITOR.instances.editor2.getSelection().selectElement( element2 ); alert(CKEDITOR.instances.editor2.getSelection().getSelectedElement()); },6000);
- Results:
FF, Webkit and Opera all select element strong but getSelectedElement() method returns null. All IEs throw JS error that selectElement is either empty or undefined.
This hasn't worked from CKEditor 3.0
comment:5 Changed 14 years ago by
@daveVW
I have created two new tickets based on your comment no 3.
Example 1 #7975 and Example 2 #7976
Example 3 I could not reproduce this one. could you explain point 6 in more detail. How do you select table properties again. Do you click on elementspath than on table with RBM and select table properties or you click on table with RBM and select table properties from menu? None of this resulted in error. I think I'll be needing your help on this one.
comment:6 Changed 14 years ago by
I've added an attachment to show the error : menu item selected. The problem occurs on IE 7 & 8.
- Create new table
- Put the cursor in the table
- Click 'table' in the elementspath
- Right-click and choose table properties in the context menu. Change the height of the table to 200.
- Click OK button
- Right-click again and choose table properties in the context menu : the menu item becomes selected and you are blocked.
Don't know what you mean with RBM.
comment:8 Changed 14 years ago by
Click with RMB. (what?)
Right-click. (shorter and easier to understand)
comment:9 Changed 14 years ago by
Status: | pending → confirmed |
---|
I have managed to reproduce third example. It is described in #7978.
This ticket is reproducible from 3.0
comment:10 Changed 14 years ago by
I read #7978 but that is not the problem I experience here. Take a look at the image I uploaded before (error.jpg). When the right-click menu opens and I click on 'table properties', then the menu option itself becomes selected instead of opening the dialog (see the selection border on the image).
comment:11 Changed 14 years ago by
That is what I meant in #7978. I have changed the description of that ticket so that it is less confusing.
Ok the function returns null but what sort of error does it cause in CKEditor itself?
Could you provide us with a sample test case showing the problem in more detail?