SearchSelectionElement

Last post 01-13-2014, 8:57 AM by AndyFel. 1 replies.
Sort Posts: Previous Next
  •  01-10-2014, 12:35 PM 78738

    SearchSelectionElement

    Hi

     

    Using the previous editor we had the following code.... This enabled us to detect if the selected object was an image, then we could extract various parameters. We used this a lot before to detect images, divs etc. Is there something similar using this new editor? 

     

    function getImageResizeURL() {
    // get the cute editor instance
    var editor1 = document.getElementById('ctl00_maincontent_Editor1');
    var oIMG = editor1.SearchSelectionElement('IMG');

    //If selected item is a image
    if (oIMG != null) {
      return oIMG.src;
    }
    return '';
    }

     

    Hope you can help.

     

  •  01-13-2014, 8:57 AM 78744 in reply to 78738

    Re: SearchSelectionElement

     Hi

     

    I solved this by doing....

    function getImageResizeURL() {
    // get the cute editor instance
    var editor1 = document.getElementById('<%=Editor1.ClientID%>').editor;
    var test = editor1.ExtractRangeHTML();
    var nodes = editor1.ExtractRangeNodes();
    if (nodes.length != 0) {
      if (nodes[0].GetName() == "img") {
        return nodes[0].GetAttribute("src");
      }
    }

     

    I found ExtractRangeNodes in your documentation, but only found GetName and GetAttribute by accident in another post. Do you have this and all the other methods in your documentation somewhere, it would really help if I could see all commands available.

     

    Thanks 

     
View as RSS news feed in XML