Extensão: CodeEditor
- Não confundir com CodeMirror.
Estado de lançamento: estável |
|
|---|---|
| Descrição | Proporciona um editor de código de destaque de sintaxe para as páginas JS, CSS e Lua de para o site e utilizador, integrando-se com a barra de ferramentas de edição avançada |
| Autor(es) |
|
| Política de compatibilidade | Lançamentos de capturas de ecrã em conjunto com o MediaWiki. Original não é compatível com as versões anteriores. |
| Alterações à base de dados | Não |
|
|
| Transferência | |
| Traduza a extensão CodeEditor se esta estiver disponível em translatewiki.net | |
| Problemas | Tarefas em aberto · Reportar um erro |
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 Extensão: 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
Instalação
- Exporte e coloque o ficheiro, ou ficheiros, num diretório chamado
CodeEditor, na sua pastaextensions/.
Developers and code contributors should install the extension from Git instead, using:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeEditor
- Acrescente o seguinte código ao fundo do ficheiro $LocalSettings:
wfLoadExtension( 'CodeEditor' ); $wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension
- Configure conforme necessário.
Pronto – Na página especial Special:Version da sua wiki verifique se a extensão foi instalada.
Vagrant installation:
- Se estiver a utilizar Vagrant, instale com
vagrant roles enable codeeditor --provision
Configuração
$wgCodeEditorEnabledModes- Temporary feature flag to control conflicts with Extensão: 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().
Licença
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).
Consultar também
- 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
| Este extensão está a ser utilizado em um ou mais projetos da Wikimedia. Isso provavelmente significa que a extensão é estável e funciona bem o suficiente para ser usada por esses sites de alto tráfego. Procure o nome desta extensão nos arquivos de configuração CommonSettings.php e InitialiseSettings.php da Wikimedia para ver onde está instalado. Uma lista completa das extensões instaladas em um determinado wiki pode ser vista na página Special:Version do wiki. |
| This extension is included in the following wiki farms/hosts and/or packages: |
- Stable extensions/pt
- Extensions with invalid or missing type/pt
- EditPage::showEditForm:initial extensions/pt
- EditPage::showReadOnlyForm:initial extensions/pt
- GetPreferences extensions/pt
- GPL licensed extensions/pt
- BSD licensed extensions/pt
- Extensions in Wikimedia version control/pt
- All extensions/pt
- Extensions bundled with MediaWiki 1.31/pt
- Extensions used on Wikimedia/pt
- Extensions included in BlueSpice/pt
- Extensions included in Canasta/pt
- Extensions available as Debian packages/pt
- Extensions included in Fandom/pt
- Extensions included in Miraheze/pt
- Extensions included in MyWikis/pt
- Extensions included in ProWiki/pt
- Extensions included in semantic::core/pt
- Extensions included in Telepedia/pt
- Extensions included in Weird Gloop/pt
- Extensions included in wiki.gg/pt
- Syntax highlighting extensions/pt
- Scribunto extensions/pt
- Edit extensions/pt
