mariovaldez.net
http://www.mariovaldez.net/webapps/forums/

Link Insertion
http://www.mariovaldez.net/webapps/forums/viewtopic.php?f=2&t=25
Page 1 of 1

Author:  iPsymon [ 16 May 2003, 15:01 ]
Post subject:  Link Insertion

I wanted to make it so that when users click on a link that a new window will open, so I added this to editor.php

Code:
case "A": {
          cm_newlink = prompt (cm_linkprompt, "");
          if (cm_newlink) {
            document.all("edittextarea").focus();    
            document.execCommand("CreateLink", false, cm_newlink);

// Added by Mark Coudriet - Date: May 16, 2003
// Insert target to open a new window
var eLink;
var aTag = document.all.tags("A"); 
 if (aTag != null) {   
  for (var i = aTag.length - 1; i >= 0; i--) {   
   if (aTag[i].href == cm_newlink) {           
    eLink = aTag[i];        
   }    
  } 
 }
eLink.target = "_new";
// End Modified

}
break;
}


Maybe this is something that you might like to add?

Best Regards,
Mark Coudriet

Author:  iPsymon [ 19 May 2003, 09:53 ]
Post subject:  Added feature

Here is the same code as above, but with the link tracking feature added!

Code:
case "A": {
   cm_newlink = prompt (cm_linkprompt, "");
   if (cm_newlink) {
      document.all("edittextarea").focus();
      document.execCommand("CreateLink", false, cm_newlink);
         
      // Added by Mark Coudriet - Date: May 16, 2003
      // Insert target to open a new window
      var eLink; 
      var aTag = document.all.tags("A"); 
         if (aTag != null) {   
            for (var i = aTag.length - 1; i >= 0; i--) {   
               if (aTag[i].href == cm_newlink) {        
                  eLink = aTag[i];        
               }    
            } 
         }
         eLink.target = "_new";
         
        // Mark Coudriet - Date: May 19, 2003
       // Added link tracking to HTML editor
       var replaceTxt = new RegExp("http", "gi");
       eLink.href = eLink.href.replace(replaceTxt, "redir.php?cm_elink=http");
       // End Added
             
   // End Added
   }
break;
}


Hope this is useful! =]

Mark

Author:  mvaldez [ 22 May 2003, 01:50 ]
Post subject:  Inserting links...

Psymon:

Hi. Good ideas. Actually, bug fixes.

In the latest 0.6.0-beta3 the editor ask you if the link will be opened in a new window or not. Also, the URLs are now fixed according to the type (http, ftp, mailto, local file) to use the redir or the getfile facility. Also, now you don't have to select text before inserting the URL. (This is more important with the Mozilla version).

In a future version it will display a form to enter data in a more elegant way.

Regards,

Mario A. Valdez-Ramirez.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/