Index: openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertAnchor/insert-anchor.js
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertAnchor/insert-anchor.js,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertAnchor/insert-anchor.js 24 Nov 2007 15:35:40 -0000 1.3
+++ openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/InsertAnchor/insert-anchor.js 13 May 2008 18:53:52 -0000 1.4
@@ -1,89 +1,84 @@
-function InsertAnchor(editor) {
- this.editor = editor;
- var cfg = editor.config;
- var self = this;
-
- // 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 Xinha._lc(string, 'InsertAnchor');
-};
-
-InsertAnchor.prototype.onGenerate = function() {
- this.editor.addEditorStylesheet(_editor_url + 'plugins/InsertAnchor/insert-anchor.css');
-};
-
-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 = doc.createElement("a");
- a.id = anchor;
- a.name = anchor;
- a.title = anchor;
- a.className = "anchor";
- a.innerHTML = html;
- if (Xinha.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);
-};
+/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
+/* This file is part of version 0.95 released Mon, 12 May 2008 17:33:15 +0200 */
+/* The URL of the most recent version of this file is http://svn.xinha.webfactional.com/trunk/plugins/InsertAnchor/insert-anchor.js */
+function InsertAnchor(_1){
+this.editor=_1;
+var _2=_1.config;
+var _3=this;
+this.placeholderImg="
";
+_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 Xinha._lc(_5,"InsertAnchor");
+};
+InsertAnchor.prototype.onGenerate=function(){
+this.editor.addEditorStylesheet(Xinha.getPluginDir("InsertAnchor")+"/insert-anchor.css");
+};
+InsertAnchor.prototype.inwardHtml=function(_6){
+_6=_6.replace(/(]*class="anchor"[^>]*>)/g,"$1"+this.placeholderImg);
+return _6;
+};
+InsertAnchor.prototype.outwardHtml=function(_7){
+_7=_7.replace(/(
]*class="?IA_placeholder"?[^>]*>)/ig,"");
+return _7;
+};
+InsertAnchor.prototype.buttonPress=function(_8){
+var _9=null;
+var _a=_8.getSelectedHTML();
+var _b=_8._getSelection();
+var _c=_8._createRange(_b);
+var _d=this;
+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(_f){
+if(_f){
+var _10=_f["name"];
+if(_10==""||_10==null){
+if(a){
+var _11=_d.outwardHtml(a.innerHTML);
+a.parentNode.removeChild(a);
+_8.insertHTML(_11);
+}
+return;
+}
+try{
+var doc=_8._doc;
+if(!a){
+a=doc.createElement("a");
+a.id=_10;
+a.name=_10;
+a.title=_10;
+a.className="anchor";
+a.innerHTML=_d.placeholderImg;
+if(_a){
+a.innerHTML+=_a;
+}
+if(Xinha.is_ie){
+_c.pasteHTML(a.outerHTML);
+}else{
+_8.insertNodeAtSelection(a);
+}
+}else{
+a.id=_10;
+a.name=_10;
+a.title=_10;
+a.className="anchor";
+}
+}
+catch(e){
+}
+}
+},_9);
+};
+