FCKeditor插件问题

FCKeditor Plugin Issues

本文关键字:问题 插件 FCKeditor      更新时间:2023-09-26

我是一个完全的初学者,正在尝试为FCKeditor开发,所以请耐心等待。我的任务是开发一个自定义插件,允许用户浏览用户上传的特定图像集。本质上,用户首先附加图像,然后使用FCKeditor插入这些图像。

所以我有我的插件目录:

  • fckplugin.js
  • img.png(用于工具栏按钮)

我正在寻找一些关于自定义文件浏览器策略的帮助(让我们称之为mybrowser.asp)

1) mybrowser.asp应该在插件目录中吗?它是动态的,只适用于网站的一个特定区域。

2) 我应该如何将查询字符串传递给mybrowser.asp?

3) 开发FCKeditor插件还有其他建议吗?有什么插件示例可能对我有用吗?

EDIT:传递到插件页面的查询字符串将与主机页面上的查询字符串完全相同。(这是一个非常特殊的插件,只能在一个地方使用)

除非您计划支持多种语言,否则不需要lang目录。但即便如此,我还是会先让插件用一种语言工作。

我可能会把mybrowser.asp放在插件目录中。

以下是fckplugin.js的一些代码,可以帮助您入门。

// Register the related command. 
// RegisterCommand takes the following arguments: CommandName, DialogCommand 
// FCKDialogCommand takes the following arguments: CommandName, 
//    Dialog Title, Path to HTML file, Width, Height
FCKCommands.RegisterCommand( 
    'MyBrowser', 
    new FCKDialogCommand( 
        'My Browser', 
        'Select An Image',
        FCKPlugins.Items['MyBrowser'].Path + 'mybrowser.asp',
        500,
        250) 
);
// Create the toolbar button. 
// FCKToolbarButton takes the following arguments: CommandName, Button Caption 
var button = new FCKToolbarButton( 'MyBrowser', 'Select An Image' ) ; 
button.IconPath = FCKPlugins.Items['MyBrowser'].Path + 'img.png' ; 
FCKToolbarItems.RegisterItem( 'MyBrowser', button ) ; 

编辑:我还没有对此进行测试,但您应该能够通过执行以下操作来附加querystring。

        'Select An Image',
        FCKPlugins.Items['MyBrowser'].Path + 'mybrowser.asp' + window.top.location.search,
        500, 

您可能不需要编写自己的文件浏览器,因为该功能是内置的。如果您检查fckconfig.js文件并搜索var _FileBrowserLanguage,您可以指定您的服务器语言,并且它有望使用editor->filemanager->connectors文件夹中的等效文件。

如果你满怀希望地查看文档,那将有望让你走上正轨。