WordPress.org

Support

Support » Plugins and Hacks » Modding the “Send to editor” link in the image browser….

Modding the “Send to editor” link in the image browser….

  • Hi, if anyone knows the ins-and-outs of this that would be great.

    Does anyone have an idea how to mod the “Send to editor” link in the image browser so the image URL can be sent to a different text box on the posting page?

    I am using the image2post plugin and IF this can be done so the URL is sent to one of the image2post then it takes out the need to manually typing it.

    The code ive managed to work out comes from the inline-uploading.php page and in the function “sendToEditor()”

    This is the code:

    function sendToEditor(n) {
    o = document.getElementById(‘div’+n);
    h = o.innerHTML.replace(new RegExp(‘^\\s*(.*?)\\s*$’, ”), ‘$1’); // Trim
    h = h.replace(new RegExp(‘ (class|title|width|height|id|onclick|onmousedown)=([^\'”][^ ]*)( |/|>)’, ‘g’), ‘ $1=”$2″$3’); // Enclose attribs in quotes
    h = h.replace(new RegExp(‘ on(click|mousedown)=”[^”]*”‘, ‘g’), ”); // Drop menu events
    h = h.replace(new RegExp(‘<(/?)A’, ‘g’), ‘<$1a’); // Lowercase tagnames
    h = h.replace(new RegExp(‘<IMG’, ‘g’), ‘<img’); // Lowercase again
    h = h.replace(new RegExp(‘(<img .+?”)>’, ‘g’), ‘$1 />’); // XHTML
    if ( richedit )
    win.tinyMCE.execCommand(‘mceInsertContent’, false, h);
    else
    win.edInsertContent(win.edCanvas, h);
    }

    I tried a few things but couldnt work it out. I have NO idea how the main post page is communicating with the upload iframe?

    Hope someone can shed some light!

    OR if anyone has a different idea that could work, please post.. 🙂

  • The topic ‘Modding the “Send to editor” link in the image browser….’ is closed to new replies.