2

Is it some how possible to detect a change in TinyMCE ??

I am adding images in TinyMCE by Drag n Drop. I have implement a functionality with Javascript to change the image URL in the process of Drag n Drop. But in IE getData('text/html') does not work. So what I came up is that on drop of the image I add a new image control to tinyMCE with the modified url.

But the problem is now the image is added to TinyMCE no matter where every it is drop. I just want to add the image to tinyMCE if it is dropped into TinyMCE or TinyMCE boundries.

 $('[id*=dataListImages_Image2]').on({
                dragend: dragEndHandlerCustom
        });

var dragEndHandlerCustom = function (e) {
        var oldUrl = $($(this).outerHTML()).attr('src');
        // Modify the url
        var param1Modify = modifyUrlParam(oldUrl, 'maxWidth', 400);
        // Modify the url 
        var param2Modify = modifyUrlParam(param1Modify, 'maxHeight', 300);

        //add to tinyMCE an image control with new url
        var ed = tinyMCE.get('contentpage_0_content_0_txtAreaDetails');                // get editor instance
        var range = ed.selection.getRng();                  // get range
        var newNode = ed.getDoc().createElement("img");  // create img node
        newNode.src = param2Modify;                           // add src attribute
        range.insertNode(newNode);

        };
Kamran
  • 4,010
  • 14
  • 60
  • 112

0 Answers0