Extension:CodeEditor

From mediawiki.org
This page is a translated version of the page Extension:CodeEditor and the translation is 59% complete.
この拡張機能は MediaWiki 1.31 以降に同梱されています。 そのため再度ダウンロードする必要はありません。 しかし、提供されているその他の手順に従う必要はあります。
Not to be confused with CodeMirror .
MediaWiki 拡張機能マニュアル
CodeEditor
リリースの状態: 安定
説明 サイトや利用者のJavaScript、CSS、Luaページ用、構文強調コードエディターを提供します。これは高機能編集ツールバーに統合されたものです。
作者
  • Brooke Vibber
  • Derk-Jan Hartman
  • authors of Ace (ace.c9.io)
互換性の方針 MediaWiki とともにリリースされるスナップショット。 master には後方互換性がありません。
MediaWiki >= 1.42.0
データベースの変更 いいえ
ライセンス GPL-2.0-or-later AND BSD-3-Clause
ダウンロード
  • $wgCodeEditorEnableCore
Quarterly downloads 187 (Ranked 35th)
Public wikis using 8,385 (Ranked 17th)
translatewiki.net で翻訳を利用できる場合は、CodeEditor 拡張機能の翻訳にご協力ください
問題点 未解決のタスク · バグを報告

CodeEditor拡張機能はWikiEditor高機能編集ツールバーを埋め込み、Ace エディター ウィジェットで拡張して、利用者やサイトがJavaScript、CSS、JSONのページを編集するときに便利な機能を提供します。そして拡張機能Scribunto もインストールされている場合はLuaページ、すなわちModule名前空間のページに対していくつかの便利な機能を提供します。 The code editor does not show on regular wiki pages, i.e. wiki pages with the "wikitext" content model. (See Extension:CodeMirror for syntax highlighting of wikitext when using the source editor.)

以下の機能を提供します:

  • JavaScript・CSS・Luaのための構文ハイライト
  • オートインデント
  • tab key produces tab indents (since 1.22), soft indents before.
  • Tab ↹/⇧ Shift+Tab ↹ によってインデントを下げたり戻したりできます
  • JavaScriptの構文を検査します。
  • Pair-matching for parenthesis, braces and square brackets

インストール

この拡張機能は、WikiEditor拡張機能が必要です。 任意でScribunto拡張機能もインストールしてください。
  • ダウンロードして、ファイルをextensions/フォルダー内のCodeEditorという名前のディレクトリ内に配置します。
    開発者とコード寄稿者は、上記の代わりに以下を使用してGitからインストールします:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
  • 以下のコードを LocalSettings.php ファイルの末尾に追加します:
    wfLoadExtension( 'CodeEditor' );
    $wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension
    
  • 必要に応じて設定します。
  • Yes 完了 – ウィキの「Special:Version」に移動して、拡張機能が正しくインストールされたことを確認します。


Vagrantでのインストール:

  • Vagrant を使用している場合は、vagrant roles enable codeeditor --provisionでインストールしてください。

設定

$wgCodeEditorEnableCore
MediaWiki、利用者、その他のコア名前空間で JavaScript と CSSのエディターを無効にするには、$wgCodeEditorEnableCore = false; を設定します (既定値は true)。
$wgScribuntoUseCodeEditor
To disable this extension for Scribunto, i.e. in the module namespace set $wgScribuntoUseCodeEditor = false; (default is "true")
このパラメータはScribuntoを使用して動くため、CodeEditor起動後に追加する必要があります。

JavaScript

It is possible to change the configuration of the ACE editor, by hooking into the MediaWiki JS hook (i.e. mw.hook( 'codeEditor.configure' ).add( ... )). The argument passed to your hook will be an ACE EditSession object.

If you need to interact with the contents of a CodeEditor instance, use jQueryPlugins.textSelection().

ライセンス

関連項目