Get REAL RAW selection in from dreamweaver.

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default Get REAL RAW selection in from dreamweaver.

    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. I want a
    result like this if this is what I have highlighted:

    ="anid">some text</d

    NOT:

    <div class="anid">some text</div>

    The second is what dreaweaver defaults to, but I want to count the exact
    number of characters highlighted or the number of characters in the entire
    document, not just what is in the root node. 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 characters in
    the document.

    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. I want only what is selected.

    Thanks,
    Nick.





    nicksapoet Guest

  2. Similar Questions and Discussions

    1. real player
      how can i find the plug in real player for MX 2004 to put video on a page with rpm and smi
    2. real help needed
      If any one can help with this or any help would be welcome This runs on a local server I would like to get it to work on a remote one. The...
    3. For real?!!
      Any gamblers out there need Photoshop CS? http://link removed by forum host] Photoshop CS for $80.00
    4. Will a webpage designed in Dreamweaver 4 be compatible with Dreamweaver MX?
      Will a web page designed with Dreamweaver 4 and Fireworks 4 be compatible with the MX versions of Dreamwever and Fireworks? We have one PC with...
    5. Since when UNIX is the "real" system that runs the "real" machines?
      *CROSS POSTED TO comp.unix.solaris In article <o3FNa.611731$vU3.43623@news1.central.cox.net>, David Janes <djanes@cox.net> wrote: Yes, Unix...
  3. #2

    Default Re: Get actual selection from dreamweaver DOM.

    Anyone have this problem?
    nicksapoet Guest

  4. #3

    Default Re: Get REAL RAW selection in from dreamweaver.

    Try this:

    var dom = dw.getDocumentDOM();
    var theSel = dom.source.getSelection();
    var startPoint = theSel[0];
    var endPoint = theSel[1];
    alert(dom.source.getText(startPoint,endPoint));

    It's a bit wordy for clarity, but that should get you what you want.


    --
    Tom Muck, Adobe Community Expert
    Dreamweaver Extensions/Articles -- [url]http://www.tom-muck.com/[/url]
    Cartweaver Development Team - [url]http://www.cartweaver.com/[/url]
    Extending Knowledge Daily - [url]http://www.communitymx.com/[/url]


    "nicksapoet" <webforumsuser@macromedia.com> wrote in message
    news:f862sc$5li$1@forums.macromedia.com...
    > 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. I want
    > a
    > result like this if this is what I have highlighted:
    >
    > ="anid">some text</d
    >
    > NOT:
    >
    > <div class="anid">some text</div>
    >
    > The second is what dreaweaver defaults to, but I want to count the exact
    > number of characters highlighted or the number of characters in the entire
    > document, not just what is in the root node. 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 characters
    > in
    > the document.
    >
    > 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. I want only what is selected.
    >
    > Thanks,
    > Nick.
    >
    >
    >
    >
    >

    Tom Muck Guest

  5. #4

    Default Re: Get actual real selection from dreamweaver DOM.

    Wow great Tom Muck, that worked well.

    I think dreamweaver should add the source property to the extension help
    section under: Objects, properties, and methods of the Dreamweaver DOM

    Thanks again.
    Nick Juntilla


    nicksapoet Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139