Changeset 110


Ignore:
Timestamp:
05/04/05 06:56:04 (15 years ago)
Author:
niko
Message:

#216
InsertAncor? as dialog

Location:
trunk/plugins/InsertAnchor
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/InsertAnchor/insert-anchor.js

    r82 r110  
    6161} 
    6262 
    63 InsertAnchor.prototype.buttonPress = function(editor, id) { 
    64   var anchor; 
    65   anchor = prompt(this._lc("Anchor name"), ""); 
    66   if (anchor == "" || anchor == null) { 
    67     return; 
    68   } 
    69  
    70   try { 
    71     var doc = editor._doc; 
    72     var alink = doc.createElement("a"); 
    73     alink.id = anchor; 
    74     alink.name = anchor; 
    75     alink.title = anchor; 
    76     alink.className = "anchor"; 
    77     if (HTMLArea.is_ie) { 
    78       var sel = editor._getSelection(); 
    79       var range = editor._createRange(sel); 
    80       range.pasteHTML(alink.outerHTML); 
    81     } else { 
    82       editor.insertNodeAtSelection(alink); 
    83     } 
    84   } 
    85   catch (e) { } 
     63InsertAnchor.prototype.buttonPress = function(editor) { 
     64  var outparam = null; 
     65  editor._popupDialog( "plugin://InsertAnchor/insert_anchor", function( param ) { 
     66                if ( param ) { 
     67            var anchor = param["name"];   
     68      if (anchor == "" || anchor == null) { 
     69        return; 
     70      } 
     71      try { 
     72        var doc = editor._doc; 
     73        var alink = doc.createElement("a"); 
     74        alink.id = anchor; 
     75        alink.name = anchor; 
     76        alink.title = anchor; 
     77        alink.className = "anchor"; 
     78        if (HTMLArea.is_ie) { 
     79          var sel = editor._getSelection(); 
     80          var range = editor._createRange(sel); 
     81          range.pasteHTML(alink.outerHTML); 
     82        } else { 
     83          editor.insertNodeAtSelection(alink); 
     84        } 
     85      } 
     86      catch (e) { } 
     87    }   
     88  }, outparam); 
    8689} 
Note: See TracChangeset for help on using the changeset viewer.