Integrate FCKeditor to MediaWiki: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
將「所見即所得」({{Acronym | acronym= WYSIWYG | def= What You See Is What You Get}})的線上編輯器[http://www.fckeditor.net/ FCKeditor]整合至[[MediaWikiInstallRecord|MediaWiki]]。([http://mediawiki.fckeditor.net/index.php/Sandbox 線上Sandbox/Demo])
將「所見即所得」({{Acronym | acronym= WYSIWYG | def= What You See Is What You Get}})的線上編輯器[http://www.fckeditor.net/ FCKeditor]([http://ckeditor.com/ CKEditor])整合至[[MediaWikiInstallRecord|MediaWiki]]。([http://mediawiki.fckeditor.net/index.php/Sandbox 線上Sandbox/Demo])


{{Right| hedding=[[MediaWiki extensions|MediaWiki Extension]] | text=
{{Right| hedding=[[MediaWiki extensions|MediaWiki Extension]] | text=
* http://favico.collection.googlepages.com/fckeditor.net.favicon.png [http://mediawiki.fckeditor.net/index.php/Main_Page FCKeditor extension] Revision 1043
* http://sites.google.com/site/favicocollection/fckeditor.net.favicon.png [http://mediawiki.fckeditor.net/index.php/Main_Page FCKeditor] 2.6.6 ([http://svn.fckeditor.net/MediaWiki/trunk/ svn])
* http://favico.collection.googlepages.com/mediawiki.org.favicon.png [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] 1.10.0+
* http://sites.google.com/site/favicocollection/mediawiki.org.favicon.png [http://www.mediawiki.org/wiki/MediaWiki MediaWiki] 1.16.0
* 測試環境: [http://www.apachefriends.org/en/xampp.html XAMPP] for Windows v1.6.2 }}
* 測試環境: [http://www.wampserver.com/en/ WampServer] 2.0i for Windows }}




== 安裝步驟 ==
== 安裝步驟 ==
* 從開發網頁下載[http://mediawiki.fckeditor.net/index.php/FCKeditor_integration_guide FCKeditor extension]([http://mediawiki.fckeditor.net/nightly/svn/mediawiki_fckeditor_ext_N.tar.gz 直接下載])。
* 從開發網頁下載[http://mediawiki.fckeditor.net/ FCKeditor extension]([http://mediawiki.fckeditor.net/nightly/svn/mediawiki_fckeditor_ext_N.zip 直接下載])。
* 解壓縮後放置到 {MediaWiki}/extensions/FCKeditor 檔案結構為
* 解壓縮後放置到 {MediaWiki}/extensions/FCKeditor 檔案結構為
<pre>
<pre>
Line 14: Line 14:
|- extensions/
|- extensions/
   |- FCKeditor/
   |- FCKeditor/
      |- css/
      |- fckeditor/
      |- plugins/
       |- FCKeditor.php  
       |- FCKeditor.php  
       |- ...
       |- ...
</pre>
</pre>
* 為了與MediaWiki更好的整合,需要從開發網頁[http://svn.fckeditor.net/MediaWiki/trunk/ 檔案庫]({{Acronym | acronym= SVN | def= Subversion}})下載幾個額外修改過的檔案(這意味著更新MediaWiki時,需額外修改這些檔案)。覆蓋這些檔案之前,記得先備份原始檔案。
 
** 必要的: includes/EditPage.php ([http://svn.fckeditor.net/MediaWiki/trunk/includes/EditPage.php 按右鍵,另存檔案])  - 讓編輯介面的預覽可以正確顯示
* 由於PHP 5.3環境差異,請修改{MediaWiki}/extensions/FCKeditor/FCKeditor.body.php 否則將出現錯誤「Detected bug in an extension! Hook FCKeditor_MediaWiki::onCustomEditor failed to return a value; should return true to continue hook processing or false to abort.」而無法編輯。
** 必要的: includes/Parser.php ([http://svn.fckeditor.net/MediaWiki/trunk/includes/Parser.php (没有此文件,请加入谢谢)按右鍵,另存檔案])  - 可以正確內容與空格(leading space)
** 非必要的: includes/SpecialPreferences.php ([http://svn.fckeditor.net/MediaWiki/trunk/includes/SpecialPreferences.php 按右鍵,另存檔案]) - 在MediaWiki的「我的參數設置」(my preferences)增加一個Rich Editor標籤,提供FCKeditor的選項設置。沒有修改這個檔案的話,會改成在「雜項」(Misc)標籤顯示(註: MediaWiki 1.10.0測試時,發生錯誤。不過官方網頁顯示的支援版本是MediaWiki 1.10.1...)。
: 檔案結構為
<pre>
<pre>
{MediaWiki}/
原:
|- includes/
public function onCustomEditor (&$article, &$user){
  |- EditPage.php
 
  |- Parser.php
修改后:
  |- SpecialPreferences.php
public function onCustomEditor($article, $user) {
  |- ...
</pre>
</pre>
* 修改{MediaWiki}/LocalSettings.php,在頁尾加入
* 修改{MediaWiki}/LocalSettings.php,在頁尾加入
<pre>
<pre>
  require_once( "extensions/FCKeditor/FCKeditor.php" );
  require_once("$IP/extensions/FCKeditor/FCKeditor.php");
$wgUseAjax = 'true';
</pre>
</pre>


Line 46: Line 42:
** 站內連結: 直接輸入部分的頁面名稱,會自動執行live search
** 站內連結: 直接輸入部分的頁面名稱,會自動執行live search
* 嵌入圖片: ok
* 嵌入圖片: ok
* [[Image:Icon exclaim.gif| ]] 頁內錨點(anchor): ''有問題''。
* 頁內錨點(anchor): ok
** 儲存後變成<nowiki>[[]]</nowiki>,可以作為輸入站內連結語法的替代方案。 (註: 官方Demo也有相同問題)
* 註腳的參考資料(reference): ok。  
* 註腳的參考資料(reference): ok。  
** 需額外安裝[[MediaWiki footnotes|Cite擴充套件]] [http://www.mediawiki.org/wiki/Extension:Cite]
** 需額外安裝[[MediaWiki footnotes|Cite擴充套件]] [http://www.mediawiki.org/wiki/Extension:Cite]
** 輸入參考資料後,'''切換到Wikitext檢視的模式''',在頁尾標記 <nowiki><references /> </nowiki>顯示註腳文字的位置,可以順利顯示註腳。如果不切換到Wikitext的模式,變成顯示<nowiki><references /> </nowiki>文字。 (註: 官方Demo測試ok)
 
* [[Image:Icon exclaim.gif| ]] 數學式的顯示(Formula / TeX markup): ''有問題?''。
 
** 需安裝額外相關擴充套件(詳[[TeX implementation on Windows]])。
** 編輯輸入TeX markup,預覽區顯示的是<nowiki><math>(\frac{x^5}{y^7})</math></nowiki> 可以正常顯示數學式的圖形,但是儲存後變成<nowiki>[[Image:|(\frac{x^5}{y^9})]]</nowiki>,反而造成顯示問題。 (註: '''官方Demo測試ok''',可以順利顯示數學式。)


== 參考資料 ==
== 參考資料 ==
* [http://mediawiki.fckeditor.net/index.php/FCKeditor_integration_guide FCKeditor integration guide - MediaWiki+FCKeditor]
* [http://mediawiki.fckeditor.net/index.php/FCKeditor_integration_guide FCKeditor integration guide - MediaWiki+FCKeditor]
* 另一整合方式: [http://www.mediawiki.org/wiki/Extension:FCKeditor_%28by_Mafs%29 FCKeditor extension by Mafs]([http://www.allwiki.com/wiki/MediaWiki%E6%89%A9%E5%B1%95%EF%BC%9AFCKeditor Allwiki]說明) ''未測試''
* 另一整合方式: [http://www.mediawiki.org/wiki/Extension:FCKeditor_%28by_Mafs%29 FCKeditor extension by Mafs]([http://www.allwiki.com/wiki/MediaWiki%E6%89%A9%E5%B1%95%EF%BC%9AFCKeditor Allwiki]說明) ''未測試''
* [http://www.mwusers.com/forums/showthread.php?12362-FCKEditor-error FCKEditor error]


其他支援文件
其他支援文件

Revision as of 00:18, 8 November 2010

將「所見即所得」(WYSIWYG)的線上編輯器FCKeditor(CKEditor)整合至MediaWiki。(線上Sandbox/Demo)

MediaWiki Extension



安裝步驟

{MediaWiki}/
|- extensions/
   |- FCKeditor/
      |- FCKeditor.php 
      |- ...
  • 由於PHP 5.3環境差異,請修改{MediaWiki}/extensions/FCKeditor/FCKeditor.body.php 否則將出現錯誤「Detected bug in an extension! Hook FCKeditor_MediaWiki::onCustomEditor failed to return a value; should return true to continue hook processing or false to abort.」而無法編輯。
 原:
 public function onCustomEditor (&$article, &$user){

 修改后:
 public function onCustomEditor($article, $user) {


  • 修改{MediaWiki}/LocalSettings.php,在頁尾加入
 require_once("$IP/extensions/FCKeditor/FCKeditor.php");
 $wgUseAjax = 'true';

測試結果

  • Good.gif 可以從所見即所得的HTML預覽介面,切換成檢視Wiki語法(Wikitext)的模式,保留原始語法。
  • 文字樣式的修改: ok
    • 粗體、斜體、層級改為標題、項目標號、縮排等可以順利修改
  • 表格: ok
  • 連結: 可以加入外部以及內部連結
    • 站內連結: 直接輸入部分的頁面名稱,會自動執行live search
  • 嵌入圖片: ok
  • 頁內錨點(anchor): ok
  • 註腳的參考資料(reference): ok。


參考資料

其他支援文件