Ticket #300 (closed defect: fixed)

Opened 8 years ago

Last modified 7 years ago

creation of span-tags for selected text when selecting a style does not work with firefox

Reported by: Michael Hosse <michael.hosse@…> Owned by: gogo
Priority: high Milestone: 2.0
Component: Plugin_DynamicCSS Version: trunk
Severity: normal Keywords:
Cc:

Description

If you are using IE you can select some text and assign a style to this selection. This is done by adding a span-Tag. But this does not work with Firefox. If you try to assign a style to some selected text the style will be assigned to the whole paragraph. IMO the problem is the HTMLArea.prototype._activeElement. This method should return null if you select some text, but it always returns the parent Node. I added some code to this method, but i am not sure if this is the best solution:

// For Mozilla we just see if the selection is not collapsed (something is selected) // and that the anchor (start of selection) is an element. This might not be totally // correct, we possibly should do a simlar check to IE? if(! sel.isCollapsed) {

if(sel.anchorNode.childNodes.length > sel.anchorOffset && sel.anchorNode.childNodes[sel.anchorOffset].nodeType == 1) {

return sel.anchorNode.childNodes[sel.anchorOffset];

} else if(sel.anchorNode.nodeType == 1) {

return sel.anchorNode;

} else {

// Check if the whole tag is selected or only a part of it. var range = sel.getRangeAt(0);

if (range.startContainer == range.endContainer && (range.startOffset != 0 range.endOffset != range.startContainer.length))

return null;

else

return sel.anchorNode.parentNode;

}

} return null;

Change History

Changed 8 years ago by gogo

  • milestone set to Version 1.0

Changed 7 years ago by Sam

  • priority changed from normal to high
  • component changed from Plugin - Stylist to Plugin_DynamicCSS
  • milestone changed from Version 1.0 to 2.0

The proposition from Michael Hosse doesn't work (when using pageStyle classes). Moreover, this problem arises with IE 6.0 as badly as with FF.

Changed 7 years ago by gogo

  • status changed from new to closed
  • resolution set to fixed

I think this is corrected by a change yesterday (attributed to another ticket).

Note: See TracTickets for help on using tickets.