I need your Help
How can I get text with html formating by Selection (FF2 + FF3)?
I can only select text without html formating ...
I need the functionality for an Button:
- add em.abstract for an selection, but the orginal-format should be retained.
With my Code i loose the orginal html format ...
How can I get text with html formating by Selection (FF2 + FF3)?
I can only select text without html formating ...
var fckeditr = FCKeditorAPI.GetInstance('mycontent'); var selection = fckeditr.EditorDocument.getSelection(); fckeditr.InsertHtml('<em class="abstract">'+ selection + '</em>');
I need the functionality for an Button:
- add em.abstract for an selection, but the orginal-format should be retained.
With my Code i loose the orginal html format ...
Re: get text with html formating by Selection
Re: get text with html formating by Selection
getSelection() pretty much mirrors the DOM getSelection() call. In Firefox, you can get the starting and ending node of the selection, generate a list of all child nodes in each of those parent nodes, then test each one to see if it's inside the selection.
See http://developer.mozilla.org/en/docs/DOM:Selection for details.
However, in order to get it to work in IE, you probably need to look at the following code snippet:
http://forums.htmlcenter.com/programming-scripting/1020-grabbing-nodes-range-dhtml-dom.html
I have no idea what other browsers might require...
Re: get text with html formating by Selection
@LesBarstow Many Thanx for your help ...
EditorDocument change to EditorWindow
window.Selection ...