Modificare il file:
\FckEditor\plugins\nodePath\fckplugin_old.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. * * * File Author: * Alfonso MartÃnez de Lizarrondo (Uritec) alfonso -at- uritec dot net */ var StatusBar = function (editorInstance) { if(!FCKConfig.NodePath || !document.all){ return } 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); var table = document.createElement('TABLE'); table.appendChild(tr); editorInstance.EditingArea.TargetElement.parentNode.parentNode.appendChild(table); this.Bar = td; this.Instance = editorInstance; /* //Create the status bar var tabla=document.body.firstChild; while (tabla.nodeName!='TABLE') { tabla=tabla.nextSibling } var hijo=tabla.firstChild; while (hijo.nodeName!='TBODY') { hijo=hijo.nextSibling; } tabla.className = "nodeLinkTable" var td=document.createElement('TD'); td.id='statusBar'; td.className = "NodePathCell" // td.appendChild(document.createTextNode(" ")); td.innerHTML=' '; //td.style.font='menu'; var tr=document.createElement('TR'); tr.appendChild(td); hijo.appendChild(tr); this.Bar = td; */ } //it should be part of the StatusBar object, but then I can't manage to get the event properly. updateStatusBar = function() { if(!FCKConfig.NodePath || !document.all){ return } if(FCK.EditMode!=FCK_EDITMODE_WYSIWYG){ oStatusBar.Bar.innerHTML = " " return } var node; var text=' '; // + FCKSelection.GetType() + " " + new Date(); //Gianluigi nodeList = new Array() //Gianluigi //the selected node (not valid if nothing is selected) node=FCKSelection.GetSelectedElement() if (node) { //Gianluigi i = nodeList.length nodeList[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 = nodeList.length nodeList[i] = node text=getNodeName(node,i) + text; //Gianluigi node=node.parentNode; } if(nodeList.length>0){ text += ' <a class="nodeLink" href="javascript:deleteNode()" title="Delete the selected node">< delete ></a>' } //update the text oStatusBar.Bar.innerHTML=text; } //Gianluigi var nodeList function deleteNode(){ if(!FCKConfig.NodePath || !document.all){ return } switch(getOnlyNodeName(nodeList[0])){ case "tr": FCKTableHandler.DeleteRows() break case "tbody": var oRange = FCK.EditorDocument.body.createControlRange(); if( oRange ){ oRange.add(nodeList[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": nodeList[0].outerHTML = nodeList[0].innerHTML break default: FCK.ExecuteNamedCommand( 'Cut' ) } updateStatusBar() } function selectNode(i){ if(!FCKConfig.NodePath || !document.all){ return } switch( getOnlyNodeName(nodeList[i]) ){ 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(nodeList[i]); oRange.select(); } break; default: FCKSelection.SelectNode( nodeList[i] ) break; } //updateStatusBar(i) } //Gianluigi 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; } //auxiliary function to get the real name of the tag. //It could be further improved. //Gianluigi getNodeName = function(oTag, index) { if(!FCKConfig.NodePath || !document.all){ return } var oRealTag; if (!oTag) 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; } var statusBars = new Array(); function updateStatusBar(editorInstance){ if(!statusBars[editorInstance.Name]){ statusBars[editorInstance.Name]=new StatusBar(editorInstance); } else{ createStatusBar(statusBars[editorInstance.Name]); } } //why doesn't work if the function is part of oStatusBar? FCK.Events.AttachEvent( 'OnSelectionChange', updateStatusBar ) ; FCK.Events.AttachEvent('OnStatusChange',updateStatusBar);
[
Íàçàä
]