Perpanjangan:CodeEditor
- Not to be confused with CodeMirror.
Status keluaran: stabil |
|
|---|---|
| Deskripsi | Menyediakan editor kode penyorotan sintaks untuk situs & pengguna JS, Halaman CSS dan Lua, terintegrasi dengan toolbar edit lanjut |
| Perancang |
|
| Kebijakan kompatibilitas | Cuplikan dikeluarkan bersamaan dengan MediaWiki. Induk tidak kompatibel dengan versi sebelumnya. |
| Perubahan pangkalan data | Tidak |
|
|
| Unduh | |
| Terjemahkan pengaya CodeEditor jika tersedia di translatewiki.net | |
| Masalah | Tugas terbuka · Laporkan kekutu |
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
Installation
- Unduh dan pindahkan folder
CodeEditoryang diekstrak ke direktoriextensions/Anda.
Pengembang dan penyumbangsih kode sebaiknya memasang pengaya dari Git sebagai gantinya, menggunakan:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
- Tambahkan kode berikut di bawah berkas LocalSettings.php Anda:
wfLoadExtension( 'CodeEditor' ); $wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension
- Configure as required.
Selesai – Telusuri ke Special:Version di wiki Anda untuk memastikan pengayanya berhasil dipasang.
Pemasangan Vagrant:
- Jika menggunakan Vagrant, pasanglah dengan
vagrant roles enable codeeditor --provision
Configuration
$wgCodeEditorEnableCore- To disable the editor on JavaScript and CSS pages in the MediaWiki, User and other core namespaces, set
$wgCodeEditorEnableCore = false;(default istrue)
$wgCodeEditorContentModels- Temporary feature flag to control conflicts with Extension:CodeMirror.
$wgScribuntoUseCodeEditor- To disable this extension for Scribunto, i.e. in the module namespace set
$wgScribuntoUseCodeEditor = false;(default istrue)
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().
License
While this extension is licensed GNU General Public License v2.0 or later (GPL-2.0+) it makes use of the Ace editor software which is licensed BSD 3-clause "New" or "Revised" License (BSD-3-Clause).
See also
- Category:CodeEditorGetPageLanguage extensions – extensions that make use of CodeEditor through the CodeEditorGetPageLanguage hook.
- en:User:Nardog/CodeEditorAssist – a user script to save user preferences across page loads
| Pengaya ini sedang digunakan di salah satu atau lebih proyek Wikimedia. Ini kemungkinan berarti pengaya ini stabil dan bekerja cukup baik untuk digunakan oleh situs web berlalu lintas tinggi. Cari nama pengaya ini di berkas konfigurasi CommonSettings.php dan InitialiseSettings.php Wikimedia untuk melihat di mana ia dipasang. Daftar lengkap pengayakulit yang dipasang di suatu wiki bisa dilihat di halaman Special:Version wiki. |
| Pengaya ini disertakan di wiki farm/hos dan/atau paket berikut: |
- Stable extensions/id
- Extensions with invalid or missing type/id
- EditPage::showEditForm:initial extensions/id
- EditPage::showReadOnlyForm:initial extensions/id
- GetPreferences extensions/id
- GPL licensed extensions/id
- BSD licensed extensions/id
- Extensions in Wikimedia version control/id
- All extensions/id
- Extensions bundled with MediaWiki 1.31/id
- Extensions used on Wikimedia/id
- Extensions included in BlueSpice/id
- Extensions included in Canasta/id
- Extensions available as Debian packages/id
- Extensions included in Fandom/id
- Extensions included in Miraheze/id
- Extensions included in MyWikis/id
- Extensions included in ProWiki/id
- Extensions included in semantic::core/id
- Extensions included in Telepedia/id
- Extensions included in wiki.gg/id
- Syntax highlighting extensions/id
- Scribunto extensions/id
- Edit extensions/id
