Modificare il file:
\FckEditor\plugins\nodePath\fckplugin.js
/* * File Name: nodePath\fckPlugin.js * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * Plugin for FCKeditor that shows a status bar with the path to the current selected node. * * version 0.1 12/11/2005 * -initial release, just a nice status bar. * version 0.2 21/03/2006 (Holger Hees) * -extended release, with the ability to select elements from notelist. * version 0.3 20/05/2006 (Holger Hees) * -extended release, multi-editor ability * * * File Authors: * Alfonso MartÃnez de Lizarrondo (Uritec) alfonso -at- uritec dot net * Holger Hees hhees -at- systemconcept dot de */ var statusBars = new Array(); var dwzInstanceNodePath var dwzNodeList = new Array() var StatusBar = function (editorInstance) { var td=document.createElement('TD'); td.id='statusBar'; //td.appendChild(document.createTextNode(" ")); td.innerHTML=' '; //td.style.font='menu'; td.className='nodeLinkTable'; var tr=document.createElement('TR'); tr.appendChild(td); editorInstance.EditingArea.TargetElement.parentNode.parentNode.appendChild(tr); this.Bar = td; this.Instance = editorInstance; } //it should be part of the StatusBar object, but then I can't manage to get the event properly. createStatusBar = function(oStatusBar) { if(FCK.EditMode!=FCK_EDITMODE_WYSIWYG){ oStatusBar.Bar.innerHTML = " " return } dwzInstanceNodePath = oStatusBar.Instance var node; var text=' '; // + FCKSelection.GetType() + " " + new Date(); //Gianluigi dwzNodeList = new Array() //Gianluigi //the selected node (not valid if nothing is selected) node=FCKSelection.GetSelectedElement() if (node) { //Gianluigi i = dwzNodeList.length dwzNodeList[i] = node text=getNodeName(node, i) + text; //Gianluigi } //parent, up to the body node=FCKSelection.GetParentElement(); while (node && node.nodeName && node.nodeName!='BODY') { //Gianluigi i = dwzNodeList.length dwzNodeList[i] = node text=getNodeName(node,i) + text; //Gianluigi node=node.parentNode; } if(dwzNodeList.length>0){ for(x=0;x<dwzNodeList.length;x++){ //alert(dwzNodeList[i]) //alert(dwzNodeList[i].innerHTML) } text += ' <a class="nodeLink" href="javascript:deleteNode()" title="Delete the selected node">< delete ></a>' } //update the text oStatusBar.Bar.innerHTML = text; } //auxiliary function to get the real name of the tag. //It could be further improved. getNodeName = function(oTag, index) { if(!FCKConfig.NodePath || !document.all){ return } var oRealTag; if (!oTag) return ""; //server per il plugin EmbedMovies if(oTag.nodeType.toString()=='9'){return ''} if (oTag.getAttribute('_fckfakelement') ){ oRealTag = FCK.GetRealElement( oTag ) ; }else{ oRealTag=oTag; } var name = "" if(oRealTag.nodeName){ var sTagName=oRealTag.nodeName.toLowerCase(); var name='' + '<a class="nodeLink" href="javascript:selectNode(' + "" + index + "" + ')" >< ' + sTagName + ' ></a> '; } return name; } function updateStatusBar(editorInstance){ if(!FCKConfig.NodePath || !document.all){ return } if(editorInstance.Name){ if(!statusBars[editorInstance.Name]){ statusBars[editorInstance.Name] = new StatusBar(editorInstance); } else{ createStatusBar(statusBars[editorInstance.Name]); } } } FCK.Events.AttachEvent('OnSelectionChange', updateStatusBar ) ; FCK.Events.AttachEvent('OnStatusChange',updateStatusBar); //Gianluigi function deleteNode(){ if(!FCKConfig.NodePath || !document.all){ return } switch(getOnlyNodeName(dwzNodeList[0])){ case "tr": FCKTableHandler.DeleteRows() break case "tbody": var oRange = FCK.EditorDocument.body.createControlRange(); if( oRange ){ oRange.add(dwzNodeList[1]); oRange.select(); } FCK.ExecuteNamedCommand( 'Cut' ) break; case "span": case "p": case "pre": case "address": case "h1": case "h2": case "h3": case "h4": case "h5": case "h6": case "div": case "strong": case "em": case "u": case "strike": case "sub": case "sup": case "li": case "ol": case "font": dwzNodeList[0].outerHTML = dwzNodeList[0].innerHTML break default: FCK.ExecuteNamedCommand( 'Cut' ) } FCK.EditorWindow.focus(); FCK.Events.FireEvent( 'OnSelectionChange' ) ; updateStatusBar(dwzInstanceNodePath) } function selectNode(i_count){ if(!FCKConfig.NodePath || !document.all){ return } alert(i_count) alert(dwzNodeList[i_count]) alert(dwzNodeList[i_count].outerHTML) alert(getOnlyNodeName(dwzNodeList[i_count])) switch( getOnlyNodeName(dwzNodeList[i_count]) ){ case "table": case "img": case "hr": case "embed": case "input": case "textarea": case "select": case "fieldset": case "legend": var oRange = FCK.EditorDocument.body.createControlRange(); if( oRange ){ oRange.add(dwzNodeList[i_count]); oRange.select(); } break; default: alert(i_count) alert(dwzNodeList[i_count]) alert(dwzNodeList[i_count].outerHTML) FCKSelection.SelectNode( dwzNodeList[i_count] ) break; } //updateStatusBar(i) } getOnlyNodeName = function(oTag) { if(!FCKConfig.NodePath || !document.all){ return } var oRealTag; if (!oTag) return ""; if (oTag.getAttribute('_fckfakelement') ) oRealTag = FCK.GetRealElement( oTag ) ; else oRealTag=oTag; var sTagName=oRealTag.nodeName.toLowerCase(); return sTagName; } //Gianluigi
[
Íàçàä
]