Bug #21703
closedAfter editing a link title or target with Firefox > 3 which have a custom CSS-Class the link gets lost after "update"
0%
Description
It's no problem to create a link with a custom css class with Firefox 3 and it gets rendered perfectly.
But after editing such a link's title or target with the RTE (Firefox > 3) the link gets totally lost after pressing "update". Links without having this CSS-Class adressed to, can be edited perfectly.
RTE.classesAnchor >
RTE.classesAnchor {
pfeil {
class = arrow
type = page
image >
titleText >
}
}
RTE.default {
useCSS = 1
contentCSS = fileadmin/templates/css/rte.css
classesAnchor = arrow
}
RTE.default.proc.allowedClasses = arrow
(issue imported from #M12782)
Files
Updated by mickthebig almost 15 years ago
Currently running TYPO3 4.2.8 (I know, shame on us)
Updated by Stanislas Rolland almost 15 years ago
Is there an error on the JavaScript console when this happens?
What do you mean by "the link gets totally lost"? What do you get in the RTE?
Updated by mickthebig almost 15 years ago
By the way, on my development system I'm running Typo3 4.2.10 and I've expierenced the same issue.
"Is there an error on the JavaScript console when this happens?"
-> No, unfortunatly there is no error displayed. I think there is something passed wrong to parent window and to the RTE
"What do you mean by "the link gets totally lost"? What do you get in the RTE?"
-> The edited link is no link any more
I uploaded some screenshot to show you better what happens. Sorry for the black marks...
Updated by Stanislas Rolland almost 15 years ago
Please provide a screenshot of the link dialogue. I am unable to reproduce this issue.
Updated by mickthebig almost 15 years ago
Yeah, sorry we needed to delete the screenshots, because our client was named. I uploaded the screenshots again and blacked out all names.
Do you mean, you've created a custom css style for links and you're not experiencing this problem? I neighther have the issue when I'm editing a link without a custom css style. Our client told us that he is not always having this issue when he is editing a link with a custom css style... So the reproducibility is not always...
Our htmlarea version is 1.7.11
Thank you for your help
Updated by Stanislas Rolland almost 15 years ago
Using the Page TSConfig you are providing, I can't reproduce this issue.
If reproducibility is not always, perhaps there is another condition...
Updated by mickthebig almost 15 years ago
Yeah maybe. I keep an eye on it. Funny is that only Firefox has this problem
Updated by mickthebig almost 15 years ago
Dear Stanislas,
there might be a problem in /typo3/sysext/rtehtmlarea/htmlarea/plugins/TYPO3Link/typo3link.js? I'm not sure yet because I haven't finished debugging.
I think the link gets removed like you described (line 161):
"// In FF, if the url is the same except for upper/lower case of a file name, the link is not updated.
// Therefore, we remove the link before creating a new one."
but no new link is build? As I say I'm not sure yet. I have problems debugging it because changes in this file don't take effect because they get delivered as compressed file. I keep on debugging and I'm gonna figure out how changes in this file take effect. For sure just for debugging :-)
Updated by Stanislas Rolland almost 15 years ago
After changing a file, use the Clear RTE Cache option of the TYPO3 Clear Cache menu (available to admin user or users with option set in user config), and clear the browser cache.
Updated by mickthebig almost 15 years ago
For me it's working fine, when I comment out line 164:
//this.editor._doc.execCommand("UnLink", false, null);
Now it's working in FF > 3. I haven't seen any site effects yet but you probably had a reason why you put the UnLink command there!? I can't see that links are not updated, without unlinking them.
But the question is why the link is not re created after unlinking?
Anyway I found a solution which is working for me.
Updated by Stanislas Rolland almost 15 years ago
If the link is a link to a file and if you change part of the name of the file from upper case to lower case or vice versa, the link is not updated if it is not first unlinked. See issue #8996.
Updated by mickthebig almost 15 years ago
Ok, then I have a look why It's not re created.
Updated by Michael almost 15 years ago
Had to create a new typo3 account...
this.editor._doc.execCommand("CreateLink", false, encodeURI(theLink)); is just not working. The Link is there and "this.editor._doc" is a object. What I recognised is, the the link somehow doesn't gets marked/selected after it was unlinked. Links where it is working editing the title which don't have a costum style, they get marked/selected (in the editor) after unlinking the link and before recreating the link. This might be the problem. So the createLink command doesn't know where to create the new link....
You could ask if the link has class and if it's not a link to file you don't need to remove the link. Then it's all working.
Updated by Stanislas Rolland almost 15 years ago
I wish I could reproduce this issue...
What is your css declaration for class arrow?
Updated by Michael almost 15 years ago
The CSS-Style is
a.arrow {
color:#ec1c24;
font-size:11px;
font-weight:bold;
background-image:url('../img/icons/more.gif');
background-repeat:no-repeat;
background-position:100% 50%;
padding: 0 14px 0 0;
}
I thought this issue is caused by the background image or any other style so I commented out for example the background image but it didn't change anything. So the link wasn't set neighter again.
The difference between a usual link (editing working) and a custom css link (editing not working) is what I mentioned before: "What I recognised is, the the link somehow doesn't gets marked or selected after it was unlinked. Links where it is working editing the title which don't have a costum style, they get marked/selected (in the editor) after unlinking the link and before recreating the link."
Maybe there is second fact important which I haven't checked yet. Maybe the link which can not be edited was edited before in the Internet Explorer. Maybe this makes it impossible for the Firefox to edit the link afterwards but this is so far just a guess. I have to check on this.
Updated by Stanislas Rolland almost 15 years ago
Using this style declaration, I am still unable to reproduce the problem.
What Firefox add-ons do you have installed?
Updated by Michael almost 15 years ago
I don't think this is the problem. I've experienced this problem with different firefoxes 3.0.4. and 3.5. under Windows XP and Mac Os X.
If I find a silent minute I try analysing the problem a little bit more.
Updated by Michael almost 15 years ago
alert(selection);
this.editor._doc.execCommand("UnLink", false, null);
alert(selection);
The first output is the link alias.
The second output is emtpy.
I think it's not supposed to do this. Can't we set the selection again?
I found this:
// fix up unlink in Mozilla to unlink the link and not just the selection
+ } else if (command == "unlink" &&
+ this.queryCommandEnabled("unlink") && dojo.render.html.mozilla) {
+ // grab selection
+ // Mozilla gets upset if we just store the range so we have to
+ // get the basic properties and recreate to save the selection
+ var selection = this.window.getSelection();
+ var selectionRange = selection.getRangeAt(0);
+ var selectionStartContainer = selectionRange.startContainer;
+ var selectionStartOffset = selectionRange.startOffset;
+ var selectionEndContainer = selectionRange.endContainer;
+ var selectionEndOffset = selectionRange.endOffset;
+
+ // select our link and unlink
+ var range = document.createRange();
+ var a = this.getSelectedNode();
+ while (a.nodeName != "A") { a = a.parentNode; }
+ range.selectNode(a);
+ selection.removeAllRanges();
+ selection.addRange(range);
+
+ returnValue = this.document.execCommand("unlink", false, null);
+
+ // restore original selection
+ var selectionRange = document.createRange();
+ selectionRange.setStart(selectionStartContainer, selectionStartOffset);
+ selectionRange.setEnd(selectionEndContainer, selectionEndOffset);
+ selection.removeAllRanges();
+ selection.addRange(selectionRange);
Updated by Stanislas Rolland almost 15 years ago
Please try attached patch.
After modifying the script, you must delete all files from directory typo3temp/rtehtmlarea and clear the browser cache.
Updated by Michael almost 15 years ago
Seems to work fantastic. Great work. Thank you so much :-)
Updated by Stanislas Rolland almost 15 years ago
Committed to SVN TYPO3core trunk (revision 6657), branch TYPO3_4-3 (revision 6658) and branch TYPO3_4-2 (revsion 6659).