Customize behavior of Insert Image dialog.

Last post 11-08-2011, 12:08 PM by ivanb. 4 replies.
Sort Posts: Previous Next
  •  11-03-2011, 12:18 PM 70999

    Customize behavior of Insert Image dialog.

    I would like to customize Insert Image to do the following:
    1. Set some attributes on the img element rigtht before it gets inserted into the document.
    2. Control where the img element is inserted. Normally the dialog will insert the image at the current caret position (or selection). However under certain circumstances I would like the img inserted at a different location. For example - inside specific div element.
    What is the best way to achieve these?
  •  11-04-2011, 7:34 AM 71033 in reply to 70999

    Re: Customize behavior of Insert Image dialog.

    Hi ivanb,
     
    I suggest you create your own "insert image" dialog to achieve these requirement.
     
    What you need to do is replace this file "\CuteSoft_Client\CuteEditor\Dialogs\InsertImage.aspx "
     
    Regards,
     
    Ken
  •  11-04-2011, 9:55 AM 71058 in reply to 71033

    Re: Customize behavior of Insert Image dialog.

    Hi Ken,
    unfortunately writing  my own Insert Image dialog from scratch is not an option. The existing dialog has a lot of useful functionality that I cannot implement in a reasonable amount of time.
    I was able to achieve requirement #1 by adding a script to InsertImage.aspx that sets the attributes on load (this is a modified requirement, but still works for me).
     
    I was thinking of implementing #2 by adding a custom "insert special image" button that, when clicked, will change the document selection to position the caret inside the <div> element and then invoke Insert Image dialog. This way the dialog should insert the image in the desired position. I have 2 questions:
    1. Do you think this approach will work?
    2. Is there a way for me to get notification from Insert Image dialog when Cancel button is clicked? I would like to restore the selection in this case.
     
    Thanks,
    ivanb
  •  11-07-2011, 7:36 AM 71194 in reply to 71058

    Re: Customize behavior of Insert Image dialog.

    Hi ivanb,
     
    1. Do you think this approach will work?
     
    Yes
     
    2. Is there a way for me to get notification from Insert Image dialog when Cancel button is clicked? I would like to restore the selection in this case.
     
    The cancel button at in the insert image dialog by the code below.
     
     <input class="formbutton" type="button" value="[[Cancel]]" onclick="do_Close()" id="Button2" /> 
     
    You can change it to 
     
    <input class="formbutton" type="button" value="[[Cancel]]" onclick="myFunction()" id="Button2" /> 
     
    Then add the script to the bottom of the page. Mean that you can fire any code you need. (notification Etc..)
     
    <script>
    function myFunction()
    {
        //alert("method");
       //add your own code here
       do_Close();
    }
    </script> 
     
    Regards,
     
    Ken
  •  11-08-2011, 12:08 PM 71232 in reply to 71194

    Re: Customize behavior of Insert Image dialog.

    That worked. Thanks.
View as RSS news feed in XML