확장기능:코드 편집기

This page is a translated version of the page Extension:CodeEditor and the translation is 17% complete.
Outdated translations are marked like this.
This extension comes with MediaWiki 1.31 and above. 따라서 다시 다운로드하지 않아도 됩니다. 하지만 여전히 제공되는 별개의 지침을 따라야 합니다.
Not to be confused with CodeMirror .
미디어위키 확장 기능 설명서
CodeEditor
출시 상태: 안정
설명 Provides a syntax-highlighting code editor for site & user JS, CSS and Lua pages, integrating with advanced edit toolbar
만든 이
  • Brooke Vibber
  • Derk-Jan Hartman
  • authors of Ace (ace.c9.io)
호환성 정책 스냅샷은 미디어위키와 함께 릴리스됩니다. Master is not backward compatible.
데이터베이스 변경 아니오
라이선스 GPL-2.0-or-later AND BSD-3-Clause
다운로드
  • $wgCodeEditorEnableCore
Quarterly downloads 124 (Ranked 46th)
Public wikis using 8,385 (Ranked 17th)
CodeEditor 확장 기능 번역 (translatewiki.net에서 가능한 경우)
이슈 미해결 작업 · 버그 보고

The CodeEditor extension extends the WikiEditor advanced editing toolbar with an embedded Ace editor widget, providing some handy features for user/site JavaScript pages, CSS pages, JSON pages, and when extension Scribunto is also installed, for Lua pages, i.e. pages in the Module namespace. 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.)

It provides the following features:

  • syntax highlighting for JavaScript, CSS and Lua
  • auto-indent
  • tab key produces tab indents (since 1.22), soft indents before.
  • indent/unindent selection with Tab ↹/⇧ Shift+Tab ↹ keys
  • syntax validity check for JavaScript
  • Pair-matching for parenthesis, braces and square brackets

설치

The WikiEditor extension needs to be installed for this extension to work. Installing the Scribunto extension is optional.
  • 파일을 다운로드하고 CodeEditor 폴더를 extensions/ 디렉토리에 넣어 주세요.
    개발자와 코딩 기여자는 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
    
  • Configure as required.
  •   완료 – 위키의 ‘Special:Version’에 이동해서, 확장기능이 올바르게 설치된 것을 확인합니다.


Vagrant 설치:

  • Vagrant 를 사용하고 있는 경우에는, vagrant roles enable codeeditor --provision로 설치해주세요

설정

$wgCodeEditorEnableCore
To disable the editor on JavaScript and CSS pages in the MediaWiki, User and other core namespaces, set $wgCodeEditorEnableCore = false; (기본값은 "true")
$wgScribuntoUseCodeEditor
To use this extension for Scribunto, i.e. in the module namespace set $wgScribuntoUseCodeEditor = false; (기본값은 "false")
This configuration parameter is provided by the Scribunto extension and must therefore be added after invoking the CodeEditor as well as the Scribunto extension which also needs to be installed for this to work.

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 module-jquery.textSelection.$.fn.textSelection().

라이선스

See also