Bug #22091
closed
Jump to end of text when inserting paragraph
Added by Christian Hennecke almost 15 years ago.
Updated about 6 years ago.
Description
Sometimes when inserting a new paragraph by pressing enter, the paragraph is not inserted and instead the cursor jumps to the end of the text in the RTE field. This seems to happen only if the cursor is currently placed at the end of a URL which would normally be automatically linked when pressing Enter.
Steps to reproduce:
1. Create a content element with an RTE field.
2. Insert text in the RTE.
3. Move the cursor to a place inside the text.
4. Enter a URL like http://www.example.com and press Enter.
Normally, the URL would be linked automatically and a new paragraph would be created. But sometimes, the linking does take place but the paragraph is not inserted and the cursor jumps to the very end of the text in the field.
This happens in recent versions of Firefox, e.g., 3.5.7 under Linux. Other browsers have not been tested.
(issue imported from #M13479)
Files
Hum... I tried many sequences but I have been unable to reproduce this issue with TYPO3 4.3. Could you describe with precision a sequence that always reproduces the issue?
It's difficult because it does not happen that often.
Try this:
1. Create a new content element.
2. Insert text in the RTE.
3. Inside the text, press Enter so that you have text above and in the new paragraph.
4. Enter a URL at the beginning of the paragraph.
5. Place the cursor at the end of the URL.
6. Press Enter.
The problem only seems to occur when the URL will be the only thing in the resulting paragraph.
Another scenario:
1. Create a new content element.
2. Insert text in the RTE.
3. Inside the text, create an unordered list with several items.
4. Inside one item of the list, move to the end of the item and press Shift-Enter to create a line break.
5. Enter a URL in the new line.
6. Ensure that the cursor is at the end of the URL.
7. Press Delete to merge the item with the next one.
8. Press Enter to seperate the items again.
Hope this helps.
Strange. I tried both scenarios and everything works fine. But I am testing with Firefox 3.6 (although I doubt that it could make a difference).
Is a JS error raised on the JavaScript console when this happens?
No errors in the console.
However, I just tried it with Firefox 3.6 and there actually IS a difference. With 3.5.7, the cursor jumped to the end of the text and a new, empty paragraph was inserted there. With 3.6, the cursor jumps into the next line and inserts a new, empty paragraph. The text after the cursor that should have been moved into the new paragraph remains in the old one in both cases.
Ok, well, I will try to inspect the code. There are two scripts involved for this enter key event: one for the paragraph insertion and another for the url recognition. Still, I wonder why I can't reproduce this behaviour. Maybe the Firefox Linux implementation is different.
Did you try with Opera or Safari?
OT:
Hi Stan, I saw that you only applied the fixes you committed today to the branch for 4.3.
Isn't trunk affected, too?
Yes, it is. However, I have this huge patch pending in core list for trunk (#13580) and I do not want to mess things up.
With Opera 10.10 on Linux, the effect is different. There, the RTE loses focus. (Also, it often looks like it inserts non-breaking spaces, but it actually doesn't. But that's another story.)
I think the attached patch should fix this issue. Please confirm.
Regarding the Opera behaviour, I think it is caused by the undo/redo feature. If you disable those two buttons, the behaviour stops. As you say, this is another issue, that will require a different patch.
Definitely an improvement! Now Firefox behaves like Opera: The RTE loses focus but the paragraph is inserted correctly.
Please test the second version of the patch. I was able to reproduce this last issue (after disabling undo/redo) and the patch fixes the issue for me in both browsers.
The second version of the patch has fixed the issue. Thanks!
Thank you for your patience.
Committed to SVN TYPO3core branch TYPO3_4-3 (revision 7020). (for inclusion in TYPO3 4.3.3).
Committed to TYPO3core trunk (revision 6978) as part of related issue #13619.
- Status changed from Resolved to Closed
Also available in: Atom
PDF