allwiki首页  
天下维客 你可以修改的网络知识库
首页最近更改优秀条目专题展示电脑科技词典软件学习网络知识电脑安全明星时尚天下百科
 

MediaWiki扩展:FCKeditor

天下维客,你可以修改的网络知识库

Jump to: navigation, search

本文取自元维基,欢迎共同翻译、整理与大家共享,促进中文wiki发展^_^

Template:If
Type: Editor and parser extension
Maturity: experimental
MediaWiki: 1.6.5
Version: fck/mw-extension May 2006
Last Update: 16-05-2006
Description: using the FCKeditor for editing wiki pages
MediaWiki extensions



目录

功能介绍

This is an experimental approach.

  • It may lead to security and technical problems as well as data corruption.
  • It is certainly not recommended to install the extension on a wiki in a production environment.
  • Use a fresh test installation (fresh database name, fresh wiki name, fresh subdirectories) instead.
  • Have a look at the WYSIWYM editor article, in which advantages and disadvantages of such tools in the framework of Wikis are studied thoroughly.

This experiment provides:

  • a semi WYSIWYG editor concept;
  • full WYSIWYG text and table formatting including font and background colors;
  • wiki syntax for links ([[PageTitle]]), category links, images links ([[Image:ImageTitle]]) and extensions like <math> ... </math> or private extensions <your_extension> ... </your_extension>;
  • table of contents, section editing, ...
  • The editor is activated on a per page basis for those pages having the token __USE_EDITOR__ (see <a href="/wiki/FCKeditor#Screen_shots" title="FCKeditor">Screen shots</a>) on it.
The token remains visible when you edit the page; it can be added with standard wiki techniques and removed with the WYSIWYG editor.

更新记录

  • update: mediawiki version 1.6.2, fckeditor version 2.2 Mafs 20:15, 10 April 2006 (UTC)
  • patch free, true extension version published Mafs 09:48, 14 May 2006 (UTC)
    • small fix in FCKeditor.php Mafs 16:17, 15 May 2006 (UTC)

不足与Bug

  • The text is stored as HTML in the database
  • Removal of unwanted, hidden text properties can be hard job in some cases.
  • Using Netscape 7.1 browser, you cannot use the "browser page-back" navigation function beyond a page, where the WYSIWYG editor was invoked for page editing.
  • Paste function (pasting clipboard content) seems to be prohibited - at least when using Netscape 7.1 browser.
  • "Show preview" function does not work properly.
  • Templates will work if they do only contain wiki syntax.

将 FCKeditor 整合到 mediawiki 1.6.x 版本中

在 mediawiki 1.6.1、1.6.5 版/ FCKeditor 2.2 版下测试通过。

安装 FCKeditor

  1. Get the FCKeditor from http://www.fckeditor.nethttp://www.fckeditor.net 下载FCKeditor
Put the package into the subdirectory /FCKeditor of your mediawiki installation. 在mediawiki安装文件夹中建立名为/FCKeditor这个文件夹,把下载之后的文件解压缩放置在你/FCKeditor 文件夹中
Add the section  在/FCKeditor/fckconfig.js这个文件中,添加以下代码。

FCKConfig.ToolbarSets["Wiki"] = [
	['Source','-','Save','NewPage','-'],
	['Cut','Copy','Paste','PasteText','PasteWord','-','Print'],
	['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
	['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
	['OrderedList','UnorderedList','-','Outdent','Indent'],
	['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
	['Link','Unlink','Anchor'],
	['Image','Table','Rule','Smiley','SpecialChar','PageBreak','UniversalKey'],
	['Style','FontFormat','FontName','FontSize'],
	['TextColor','BGColor'],
	['About']
];

to file /FCKeditor/fckconfig.js. Some tools of the fckeditor are disabled.

(For enabling the FCKeditor's built in file browser and upload function see FCKeditor Developer's Guide at the bottom of the page. In this case set "$wgFCKEditorAllow_img_tags = true;" (LocalSettings.php) see below. Note that you completely bypass all security checks of the mediawiki software for uploaded files when using this feature.)

Finally check your FCKeditor installation: 最后,检查你的FCKeditor插件安装

  1. browse to www.yourserver.org/yourwikidir/FCKeditor/_samples/default.html. 在浏览器中输入以上的地址(记住修改成自己网站的地址)
You should see something like: 你可以看到以下内容

Should you encounter troubles, consult the FCKeditor help pages. 如果有问题,请参看FCKeditor help pages

Extension FCKeditor.php

Put the extension code which can be found on this page FCKeditor/extension as FCKeditor.php into the extensions directory of your mediawiki installation.

新建一个空白php文件,命名为FCKeditor.php,把FCKeditor/extension 中的代码复制到该文件中,将该文件保存到mediawiki安装文件夹中的extensions文件夹下。

LocalSettings.php

Add these lines at the end of file LocalSettings.php. 将以下代码添加到文件LocalSettings.php中最后的?>前


/* Installing this extension may lead to security and technical problems 
 * as well as data corruption.
 */
require_once("extensions/FCKeditor.php");

$wgFCKUseEditor          = false;      // When set to 'true' the FCKeditor is the default editor.
$wgFCKEditorDir          = "FCKeditor";
$wgFCKEditorToken        = "__USE_EDITOR__";  
$wgFCKEditorToolbarSet   = "Wiki";
$wgFCKEditorHeight       = "600";
$wgFCKEditorAllow_a_tags      = false; // <a> </a>
$wgFCKEditorAllow_img_tags    = false; // <img />
$wgFCKexcludedNamespaces = array();    // eg. "8" for disabling the editor within the MediaWiki namespace.

Done.

Next, open a new page for editing and add the token " __use_editor__ ". Save the page. Click again on "edit" and you should see the FCKeditor. In any case keep the warnings in mind when using this extension.

接下来,打开一个新的待编辑条目,添加以下字段 __use_editor__ ,保存该页面,再点击“编辑”,你就可以看到FCKeditor!!!




=== Screen shots ===Image:Example.jpgImage:Example.jpgImage:Example.jpgImage:Example.jpg<math>Insert formula here</math>Insert non-formatted text here

normal view
Enlarge
normal view
edit view
Enlarge
edit view

相关链接

原文参见: FCKeditor

Personal tools
工具
金银币拍卖 金币拍卖预展  金银币网店 熊猫金银币 生肖金银币