Hello Folks,
i already searched the forum but did not find any solution for my problem. Until recently i used an older version of the fck, something 2.1 or so.. now i upgraded the editor and had no problems att all to add custom attibutes to a link. I forgot to mention i am not using the fck editors link dialog box as this would "confuse" my users (the fck is integrated into a cms). So for the older version i wrote a plugin with the following JavaScript-code, that worked perfectly well:
var oEditor = window.opener; var FCK = oEditor.FCK ; var FCKConfig = oEditor.FCKConfig ; var sLnkUrl; //sPageType ist n (normal) oder m (marginal) var sPageType = "n"; //sLinkType ist e (extern) oder i (intern) var sLinkType = "e"; var oRegex = new Object() ; oRegex.UriProtocol = new RegExp('') ; oRegex.UriProtocol.compile( '^(((http|https|ftp|sftp):\/\/))', 'gi' ) ; if (link != null) { sLnkUrl = link; sLinkType = "i"; }else { sLnkUrl =document.forms.link_form.urlkopf.options[document.forms.link_form.urlkopf.selectedIndex].value + document.forms.link_form.txtUrl.value.replace( oRegex.UriProtocol, '' ) ; sLinkType = "e"; } if (sLnkUrl != null && ((sLinkType == "e" && sLnkUrl.length > 11) || sLinkType == "i")) { var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; var linkClassName = (FCKConfig.PageType=='m')?'linkMargin':'link1e'; if ( oLink ) { FCK.Selection.SelectNode( oLink ) ; oEditor.FCKUndo.SaveUndoStep() ; oLink.href = sLnkUrl; } else { oLink = oEditor.FCK.CreateLink( sLnkUrl ) ; } oLink.setAttribute('class', linkClassName, 0) ; // Externe Links in neuem Fenster oeffnen. if (sLinkType == "e") { oLink.target = "_blank"; } if ( oEditor.FCKBrowserInfo.IsIE ){ oLink.setAttribute('className', linkClassName, 0) ; //FCK.SetHTML( FCK.GetHTML(), true ); } oLink.title = "graphicalButtonLink"; window.close(); }
And after the upgrade the following lines are not doing the trick anymore:
oLink.setAttribute('class', linkClassName, 0) ;
oLink.target = "_blank";
oLink.title = "graphicalButtonLink";
Any help would be appreciated as the new version of the fck works so much better otherwise...
Thanks in advance for your help,
Eike