zoukankan      html  css  js  c++  java
  • 配置FCKeditor

    fckconfig.js为FCKeditor的主配置文件,它位于fckeditor文件下。

    配置FCKeditot一共有三种方法

    一、直接修改主配置文件fckconfi.js文件(一般不采用这种方法)

    二、定义单独的配置文件(只需要写需要修改的配置项,推荐使用这种方法)

      加载自定义的配置文件有两种方法:

      1、在fckeditor.js文件中指定(在fckeditor.js文件中指定,将对所有的FCKeditor有效)

      

    FCKConfig.CustomConfigurationsPath = '/myconfig.js' ;

      2、在调用FCKeditor中指定(在调用FCKeditor中指定,只对当前的实例有效)

     var oFCKeditor = new FCKeditor('FCKeditor1');
     oFCKeditor.Config["CustomConfigurationsPath"]="/myconfig.js"
     oFCKeditor.Create();

      其中要注意的是:开头"/"代表的是站点的路径,因为我们发布以后站点名称还要加上工程名称,实际路径应为"/objectName/myconfig.js"

      

    三、在页面的的调用代码中对FCKeditor的实例进行配置

    配置加载顺序

    一、加载主配置文件fckeditor.js

    二、加载自定义的配置文件(如果有),覆盖相同的配置项

    三、使用对实例的配置覆盖相同的配置项(只对当前实例有效)

    注意事项:

    一、系统会自动侦测并运用适当的界面语言(这是默认的设置,当然也可以修改)

    二、无论什么情况都不能删除主配置文件fckconfig.js

    三、修改配置后要清空浏览器缓存,以免影响结果(或访问时强制刷新也可以,在IE中ctrl+f5是强制刷新,在火狐中shift+ctrl+r是强制刷新)

    一般需要修改的配置

    一、自定义ToolBarSet,去掉一些功能

      1、在配置文件中定义一个自定义的工具集,这个工具集中只包含对外提供的功能

      2、在生成FCKeditor是要指定使用这个工具集

      ['Source'[]每个短语代表一个功能,['-']代表一个分隔符,['/']代表换行符

      myconfig.js源代码:

      

    FCKConfig.ToolbarSets["zwjbbs"] = [
        ['Source','DocProps'],
        ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
        ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'],
        ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
        ['Link','Unlink','Anchor'],
        ['Image','Flash','Table','Rule','Smiley','SpecialChar','PageBreak'],
        '/',
        ['Style','FontFormat','FontName','FontSize'],
        ['TextColor','BGColor'],
        ['FitWindow','ShowBlocks','-','About']        // No comma for the last row.
    ] ;

      fcktest.html源代码:

    <script type="text/javascript">
      var oFCKeditor = new FCKeditor('FCKeditor1');
      oFCKeditor.BasePath="/fckeditor/";
      oFCKeditor.ToolbarSet = "zwjbbs";
      oFCKeditor.Create();
      </script>


      注意一定要指定配置文件

    二、加上几种常用的字体

      myconfig.js源代码:

    FCKConfig.FontNames    = "宋体;楷体_GB2312;黑体;隶书;Times New Raman;Arial";

    三、由于默认回车是一个段落,shift+回车是换行,所以需要修改使回车是换行行为,shift+回车是一个段落

    四、修改编辑区域的样式文件

      //FCKConfig.BasePath代表fckeditor文件夹下editor文件夹,在fck_editorarea.css中修改编辑区域的样式

      fckeditor.js源代码:

    FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ;

    五、更换表情图片

      myconfig.js源代码:

    //更换表情图片
    //表情图片所在的路径是一个文件夹
    FCKConfig.SmileyPath    = FCKConfig.BasePath + 'images/smiley/msn/' ;
    //设置要显示文件中的那些图片
    FCKConfig.SmileyImages    = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ;
    //每行显示的图片数量
    FCKConfig.SmileyColumns = 8 ;
    //窗口的宽度
    FCKConfig.SmileyWindowWidth        = 320 ;
    //窗口的高度
    FCKConfig.SmileyWindowHeight    = 210 ;

      调整窗口为合适的大小:

    根据地址找到窗口所对应的文件

    注释掉dialog.SetAutoSize( true ) ;(作用是根据页面内容的大小修改窗口的大小)

    window.onload = function ()
    {
        // First of all, translate the dialog box texts
        oEditor.FCKLanguageManager.TranslatePage(document) ;
    
        //dialog.SetAutoSize( true ) ;
    }

    并将<body style="overflow: hidden">改为<body style="overflow: auto">

    注意:①要使用UTF-8编码保存配置文件②FCKConfig.BasePath和调用fckeditor所指定的BasePath(FCKeditor.BasePath)不是同一个,其值也不一样。

  • 相关阅读:
    Shared Memory in Windows NT
    Layered Memory Management in Win32
    软件项目管理的75条建议
    Load pdbs when you need it
    Stray pointer 野指针
    About the Rebase and Bind operation in the production of software
    About "Serious Error: No RTTI Data"
    Realizing 4 GB of Address Space[MSDN]
    [bbk4397] 第1集 第一章 AMS介绍
    [bbk3204] 第67集 Chapter 17Monitoring and Detecting Lock Contention(00)
  • 原文地址:https://www.cnblogs.com/zhangwenjing/p/2676169.html
Copyright © 2011-2022 走看看