Changeset 112
- Timestamp:
- 05/06/05 12:38:25 (8 years ago)
- Location:
- trunk/plugins/InsertAnchor
- Files:
-
- 2 modified
-
insert-anchor.js (modified) (1 diff)
-
popups/insert_anchor.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/InsertAnchor/insert-anchor.js
r110 r112 63 63 InsertAnchor.prototype.buttonPress = function(editor) { 64 64 var outparam = null; 65 var sel = editor._getSelection(); 66 var range = editor._createRange(sel); 67 var a = editor._activeElement(sel); 68 if(!(a != null && a.tagName.toLowerCase() == 'a')) { 69 a = editor._getFirstAncestor(sel, 'a'); 70 } 71 if (a != null && a.tagName.toLowerCase() == 'a') { 72 outparam = { name : a.id }; 73 } else 74 outparam = { name : '' }; 75 65 76 editor._popupDialog( "plugin://InsertAnchor/insert_anchor", function( param ) { 66 if ( param ) {77 if ( param ) { 67 78 var anchor = param["name"]; 68 79 if (anchor == "" || anchor == null) { 80 if (!a) 81 document.getElementById(a); 82 a.parentNode.removeChild(a); 69 83 return; 70 } 84 } 71 85 try { 72 86 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); 87 if (!a) { 88 a = doc.createElement("a"); 89 a.id = anchor; 90 a.name = anchor; 91 a.title = anchor; 92 a.className = "anchor"; 93 if (HTMLArea.is_ie) { 94 range.pasteHTML(a.outerHTML); 95 } else { 96 editor.insertNodeAtSelection(a); 97 } 82 98 } else { 83 editor.insertNodeAtSelection(alink); 99 a.id = anchor; 100 a.name = anchor; 101 a.title = anchor; 102 a.className = "anchor"; 84 103 } 85 104 } -
trunk/plugins/InsertAnchor/popups/insert_anchor.html
r110 r112 26 26 }; 27 27 28 function onDelete() { 29 // pass data back to the calling window 30 var param = new Object(); 31 param["name"] = ""; 32 __dlg_close(param); 33 return false; 34 }; 35 28 36 function onCancel() { 29 37 __dlg_close(null); … … 45 53 <div id="buttons"> 46 54 <button type="submit" name="ok" onclick="return onOK();">OK</button> 55 <button type="button" name="delete" onclick="return onDelete();">Delete</button> 47 56 <button type="button" name="cancel" onclick="return onCancel();">Cancel</button> 48 57 </div>
