Upgrade to Xinha 0.931. Xinha has been optimized for size and dozens of issues have been closed
out since the last upgrade . Add Firefox and Xinha buttons to main page to show our support.
This commit is contained in:
@@ -1,97 +1,76 @@
|
||||
function InsertAnchor(editor) {
|
||||
this.editor = editor;
|
||||
var cfg = editor.config;
|
||||
var self = this;
|
||||
function InsertAnchor(_1){
|
||||
this.editor=_1;
|
||||
var _2=_1.config;
|
||||
var _3=this;
|
||||
_2.registerButton({id:"insert-anchor",tooltip:this._lc("Insert Anchor"),image:_1.imgURL("insert-anchor.gif","InsertAnchor"),textMode:false,action:function(_4){
|
||||
_3.buttonPress(_4);
|
||||
}});
|
||||
_2.addToolbarElement("insert-anchor","createlink",1);
|
||||
}
|
||||
InsertAnchor._pluginInfo={name:"InsertAnchor",origin:"version: 1.0, by Andre Rabold, MR Printware GmbH, http://www.mr-printware.de",version:"2.0",developer:"Udo Schmal",developer_url:"http://www.schaffrath-neuemedien.de",c_owner:"Udo Schmal",sponsor:"L.N.Schaffrath NeueMedien",sponsor_url:"http://www.schaffrath-neuemedien.de",license:"htmlArea"};
|
||||
InsertAnchor.prototype._lc=function(_5){
|
||||
return HTMLArea._lc(_5,"InsertAnchor");
|
||||
};
|
||||
InsertAnchor.prototype.onGenerate=function(){
|
||||
var _6="IA-style";
|
||||
var _7=this.editor._doc.getElementById(_6);
|
||||
if(_7==null){
|
||||
_7=this.editor._doc.createElement("link");
|
||||
_7.id=_6;
|
||||
_7.rel="stylesheet";
|
||||
_7.href=_editor_url+"plugins/InsertAnchor/insert-anchor.css";
|
||||
this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(_7);
|
||||
}
|
||||
};
|
||||
InsertAnchor.prototype.buttonPress=function(_8){
|
||||
var _9=null;
|
||||
var _a=_8.getSelectedHTML();
|
||||
var _b=_8._getSelection();
|
||||
var _c=_8._createRange(_b);
|
||||
var a=_8._activeElement(_b);
|
||||
if(!(a!=null&&a.tagName.toLowerCase()=="a")){
|
||||
a=_8._getFirstAncestor(_b,"a");
|
||||
}
|
||||
if(a!=null&&a.tagName.toLowerCase()=="a"){
|
||||
_9={name:a.id};
|
||||
}else{
|
||||
_9={name:""};
|
||||
}
|
||||
_8._popupDialog("plugin://InsertAnchor/insert_anchor",function(_e){
|
||||
if(_e){
|
||||
var _f=_e["name"];
|
||||
if(_f==""||_f==null){
|
||||
if(a){
|
||||
var _10=a.innerHTML;
|
||||
a.parentNode.removeChild(a);
|
||||
_8.insertHTML(_10);
|
||||
}
|
||||
return;
|
||||
}
|
||||
try{
|
||||
var doc=_8._doc;
|
||||
if(!a){
|
||||
a=doc.createElement("a");
|
||||
a.id=_f;
|
||||
a.name=_f;
|
||||
a.title=_f;
|
||||
a.className="anchor";
|
||||
a.innerHTML=_a;
|
||||
if(HTMLArea.is_ie){
|
||||
_c.pasteHTML(a.outerHTML);
|
||||
}else{
|
||||
_8.insertNodeAtSelection(a);
|
||||
}
|
||||
}else{
|
||||
a.id=_f;
|
||||
a.name=_f;
|
||||
a.title=_f;
|
||||
a.className="anchor";
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}
|
||||
},_9);
|
||||
};
|
||||
|
||||
// register the toolbar buttons provided by this plugin
|
||||
cfg.registerButton({
|
||||
id : "insert-anchor",
|
||||
tooltip : this._lc("Insert Anchor"),
|
||||
image : editor.imgURL("insert-anchor.gif", "InsertAnchor"),
|
||||
textMode : false,
|
||||
action : function(editor) {
|
||||
self.buttonPress(editor);
|
||||
}
|
||||
});
|
||||
cfg.addToolbarElement("insert-anchor", "createlink", 1);
|
||||
}
|
||||
|
||||
InsertAnchor._pluginInfo = {
|
||||
name : "InsertAnchor",
|
||||
origin : "version: 1.0, by Andre Rabold, MR Printware GmbH, http://www.mr-printware.de",
|
||||
version : "2.0",
|
||||
developer : "Udo Schmal",
|
||||
developer_url : "http://www.schaffrath-neuemedien.de",
|
||||
c_owner : "Udo Schmal",
|
||||
sponsor : "L.N.Schaffrath NeueMedien",
|
||||
sponsor_url : "http://www.schaffrath-neuemedien.de",
|
||||
license : "htmlArea"
|
||||
};
|
||||
|
||||
InsertAnchor.prototype._lc = function(string) {
|
||||
return HTMLArea._lc(string, 'InsertAnchor');
|
||||
};
|
||||
|
||||
InsertAnchor.prototype.onGenerate = function() {
|
||||
var style_id = "IA-style";
|
||||
var style = this.editor._doc.getElementById(style_id);
|
||||
if (style == null) {
|
||||
style = this.editor._doc.createElement("link");
|
||||
style.id = style_id;
|
||||
style.rel = 'stylesheet';
|
||||
style.href = _editor_url + 'plugins/InsertAnchor/insert-anchor.css';
|
||||
this.editor._doc.getElementsByTagName("HEAD")[0].appendChild(style);
|
||||
}
|
||||
};
|
||||
|
||||
InsertAnchor.prototype.buttonPress = function(editor) {
|
||||
var outparam = null;
|
||||
var html = editor.getSelectedHTML();
|
||||
var sel = editor._getSelection();
|
||||
var range = editor._createRange(sel);
|
||||
var a = editor._activeElement(sel);
|
||||
if(!(a != null && a.tagName.toLowerCase() == 'a')) {
|
||||
a = editor._getFirstAncestor(sel, 'a');
|
||||
}
|
||||
if (a != null && a.tagName.toLowerCase() == 'a')
|
||||
outparam = { name : a.id };
|
||||
else
|
||||
outparam = { name : '' };
|
||||
|
||||
editor._popupDialog( "plugin://InsertAnchor/insert_anchor", function( param ) {
|
||||
if ( param ) {
|
||||
var anchor = param["name"];
|
||||
if (anchor == "" || anchor == null) {
|
||||
if (a) {
|
||||
var child = a.innerHTML;
|
||||
a.parentNode.removeChild(a);
|
||||
editor.insertHTML(child);
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var doc = editor._doc;
|
||||
if (!a) {
|
||||
// editor.surroundHTML('<a id="' + anchor + '" name="' + anchor + '" title="' + anchor + '" class="anchor">', '</a>');
|
||||
a = doc.createElement("a");
|
||||
a.id = anchor;
|
||||
a.name = anchor;
|
||||
a.title = anchor;
|
||||
a.className = "anchor";
|
||||
a.innerHTML = html;
|
||||
if (HTMLArea.is_ie) {
|
||||
range.pasteHTML(a.outerHTML);
|
||||
} else {
|
||||
editor.insertNodeAtSelection(a);
|
||||
}
|
||||
} else {
|
||||
a.id = anchor;
|
||||
a.name = anchor;
|
||||
a.title = anchor;
|
||||
a.className = "anchor";
|
||||
}
|
||||
}
|
||||
catch (e) { }
|
||||
}
|
||||
}, outparam);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user