Make WordPress Core

Changeset 669


Ignore:
Timestamp:
12/31/2003 04:05:41 AM (22 years ago)
Author:
alex_t_king
Message:

Fixed some bugs and added support for the 'Cancel' button when adding a link or image

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/quicktags.js

    r623 r669  
    158158        edOpenTags[edOpenTags.length] = button;
    159159        document.getElementById(edButtons[button].id).value = '/' + document.getElementById(edButtons[button].id).value;
    160 
    161160    }
    162161}
     
    250249    //IE support
    251250    if (document.selection) {
    252         myField.focus(); 
     251        myField.focus();
    253252        sel = document.selection.createRange();
    254253        if (sel.text.length > 0) {
     
    271270        var startPos = myField.selectionStart;
    272271        var endPos = myField.selectionEnd;
    273         var cursorPos;
     272        var cursorPos = endPos;
    274273        if (startPos != endPos) {
    275274            myField.value = myField.value.substring(0, startPos)
     
    278277                          + edButtons[i].tagEnd
    279278                          + myField.value.substring(endPos, myField.value.length);
    280             cursorPos = endPos
    281                       + edButtons[i].tagStart.length
    282                       + edButtons[i].tagEnd.length;
     279            cursorPos += edButtons[i].tagStart.length + edButtons[i].tagEnd.length;
    283280        }
    284281        else {
     
    344341    }
    345342    if (!edCheckOpenTags(i)) {
    346         edButtons[i].tagStart = '<a href="'
    347                               + prompt('Enter the URL'
    348                                       ,defaultValue
    349                                       )
    350                               + '">';
    351     }
    352     edInsertTag(myField, i);
     343        var URL = prompt('Enter the URL' ,defaultValue);
     344        if (URL) {
     345            edButtons[i].tagStart = '<a href="' + URL + '">';
     346            edInsertTag(myField, i);
     347        }
     348    }
     349    else {
     350        edInsertTag(myField, i);
     351    }
    353352}
    354353
    355354function edInsertImage(myField) {
    356     var myValue = '<img src="'
    357                 + prompt('Enter the URL of the image', 'http://')
    358                 + '" alt="'
    359                 + prompt('Enter a description of the image', '')
    360                 + '" />';
    361     edInsertContent(myField, myValue);
    362 }
     355    var myValue = prompt('Enter the URL of the image', 'http://');
     356    if (myValue) {
     357        myValue = '<img src="'
     358                + myValue
     359                + '" alt="' + prompt('Enter a description of the image', '')
     360                + '" />';
     361        edInsertContent(myField, myValue);
     362    }
     363}
Note: See TracChangeset for help on using the changeset viewer.