我在试着给fckeditor添加一个自定义的功能,代码是从网上找的网上找的代码我不确定是否有问题,我感觉这段代码应该没问题,因为我在自己写
自定义插件或自定义功能的时候,也出现“未知命令名称”或“未知工具栏项目”的提示。大家给解决下,或者提点建议?menu的codeFCKConfig.ToolbarSets["Basic"] = [
   ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About','Format168']
] ;
插件的配置文件FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ;
FCKConfig.Plugins.Add('formatcommands') ;
fckcommands文件夹下的fckplugin.jsvar oFormat168Item = new FCKToolbarButton('Format168', FCKLang.Format168Btn);oFormat168Item.IconPath = FCKPlugins.Items['formatcommands'].Path + 'format168.gif';FCKToolbarItems.RegisterItem('Format168', oFormat168Item);// The object used for all Format168 operations.
var FCKFormat168 = new Object();FCKFormat168 = function(name){
    this.Name = name;
}FCKFormat168.prototype.GetState = function() {
   
    return FCK_TRISTATE_OFF;
}FCKFormat168.prototype.Execute = function(){
    FormatText();
}function FormatText() {
  var oEditor = FCKeditorAPI.GetInstance('FCKeditor1') ;
      if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
    {
  var temps = new Array();
  var sec = oEditor.EditorDocument.selection.createRange();
  var tmpText = sec.text;
  var isPart = tmpText != null && tmpText.trim().length > 0;
isPart = false;
  if (!isPart) {
    var imgs = oEditor.EditorDocument.images;
    if (imgs != null && imgs.length > 0) {
      for (j = 0; j < imgs.length; j++) {
        var t = document.createElement("IMG");
        t.alt = imgs[j].alt;
        t.src = imgs[j].src;
        t.width = imgs[j].width;
        t.height = imgs[j].height;
        t.align = imgs[j].align;
        temps[temps.length] = t;
      }
      var formatImgCount = 0;
      for (j = 0; j < imgs.length;) {
        imgs[j].outerHTML = "#FormatImgID_" + formatImgCount + "#";
        formatImgCount++;
      }
    }
   var html = processFormatText(oEditor.EditorDocument.body.innerText);
    if (temps != null && temps.length > 0) {
      for (j = 0; j < temps.length; j++) {
        var imghtml = "<img src=\"" + temps[j].src + "\" alt=\"" + temps[j].alt + "\" width=\"" + temps[j].width + "\" height=\"" + temps[j].height + "\" align=\"" + temps[j].align + "\">";
        html = html.replace("#FormatImgID_" + j + "#", imghtml);
      }
    }
    oEditor.SetHTML(html);
  } else {
   var html = processFormatText(tmpText);
      sec.pasteHTML(html);
  }
  }
  else
  alert( 'alert' ) ;
}function DBC2SBC(str) {
  var result = '';
  for (var i = 0; i < str.length; i++) {
    code = str.charCodeAt(i);    if (code >= 65281 && code < 65373 && code != 65292 && code != 65306){      result += String.fromCharCode(str.charCodeAt(i) - 65248);
    } else {
      result += str.charAt(i);
    }
  }
  return result;
}function processFormatText(textContext) {
    var text = DBC2SBC(textContext);
    var prefix = "  ";
    var tmps = text.split("\n");
    var html = "";
    for (i = 0; i < tmps.length; i++) {
      var tmp = tmps[i].trim();
      if (tmp.length > 0) {
        html += "<p>  " + tmp + "</p>\n";
      }
    }
  return html;
}String.prototype.trim = function()
{
  return this.replace(/(^[\s ]*)|([\s ]*$)/g, "");
};String.prototype.leftTrim = function()
{
  return this.replace(/(^\s*)/g, "");
};String.prototype.rightTrim = function()
{
  return this.replace(/(\s*$)/g, "");
};
// Register the related command
FCKCommands.RegisterCommand('Format168', new FCKFormat168('Format168'));