WordPress.org

Ready to get started?Download WordPress

Forums

How to: href modification ... "link" button in quicktags? (5 posts)

  1. Nicki Faulk
    Member
    Posted 9 years ago #

    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!

  2. Nicki Faulk
    Member
    Posted 9 years ago #

    Ok ... for grins and giggles I deleted my remark statement and it worked. How weird is that?

  3. Salvatore
    Member
    Posted 9 years ago #

    Hi, exactly where you did these changes?

  4. Kafkaesqui

    Posted 9 years ago #

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

  5. Salvatore
    Member
    Posted 9 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.