Question
Get the real actual selection in code view. DOM getselection
Dreamweaver automatically gives you the whole node if you
have part of the inside of a tag selected. I want exactly what I
have highlighted in the code view not a node.
Correct would be:
="anid">some text</d
Not expanded to something like this:
<div class="anid">some text</div>
The second is what dreaweaver defaults to, but I want to count the exact number of characters highlighted in code view or the number of characters in the entire document. In fact I'd like to not use the DOM at all. Is there a way to just get a raw array of all the selection without auto-expanding to the nearest node.
I'm using this code:
var theDOM = dw.getDocumentDOM();
var theWholeDoc = theDOM.documentElement.outerHTML;
var theSel = dreamweaver.getSelection(); // Extract the selection
var selText = theWholeDoc.substring(theSel[0],theSel[1]);
alert(selText);
Any help is much appreciated, this is very frustrating. In other words I don't just want to get the selection by whole nodes, I want to get the selection even if it starts halfway through one tag and ends halfway into another.
Thanks!!!
Nick
Correct would be:
="anid">some text</d
Not expanded to something like this:
<div class="anid">some text</div>
The second is what dreaweaver defaults to, but I want to count the exact number of characters highlighted in code view or the number of characters in the entire document. In fact I'd like to not use the DOM at all. Is there a way to just get a raw array of all the selection without auto-expanding to the nearest node.
I'm using this code:
var theDOM = dw.getDocumentDOM();
var theWholeDoc = theDOM.documentElement.outerHTML;
var theSel = dreamweaver.getSelection(); // Extract the selection
var selText = theWholeDoc.substring(theSel[0],theSel[1]);
alert(selText);
Any help is much appreciated, this is very frustrating. In other words I don't just want to get the selection by whole nodes, I want to get the selection even if it starts halfway through one tag and ends halfway into another.
Thanks!!!
Nick