WordPress.org

Support

Support » Plugins and Hacks » How to: href modification … “link” button in quicktags?

How to: href modification … “link” button in quicktags?

  • Hey all!

    I’ve been reading up on editting my quicktags and have made a little success, however I’ve hit a roadblock and would appreciate some help.

    I would like to modify the link button in quicktags to append target=”_blank” in ‘a href’ statements in my posts because I want any links I include to open to new windows. I’ve been doing it manually, but it’s a pain and my efforts to do it in quicktags.js so far have been fruitless.

    I made the following change and it did not work so I’m guessing that this is either incorrect or not the only place to make this change:


    if (!edCheckOpenTags(i)) {
    var URL = prompt('Enter the URL' ,defaultValue);
    if (URL) {
    edButtons[i].tagStart = '<a href="' + URL + '" target="_blank">';
    // Added target - 04.03.2005.n
    edInsertTag(myField, i);
    }
    }

    Has anyone done this, and if so … how?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ok … for grins and giggles I deleted my remark statement and it worked. How weird is that?

    Hi, exactly where you did these changes?

    Salvatore, the change would be made in the edInsertLink() function near the end of quicktags.js.

    I’ve substituted this string:
    if (!edCheckOpenTags(i)) {
    var URL = prompt('Enter the URL' ,defaultValue);
    if (URL) {
    edButtons[i].tagStart = '<a href="' + URL + '">';
    edInsertTag(myField, i);
    }

    with this:
    if (!edCheckOpenTags(i)) {
    var URL = prompt('Enter the URL' ,defaultValue);
    if (URL) {
    edButtons[i].tagStart = '<a href="' + URL + '" target="_blank">';
    edInsertTag(myField, i);
    }

    but nothing happened.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to: href modification … “link” button in quicktags?’ is closed to new replies.