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 |
| Licença | GPL-2.0-or-later AND BSD-3-Clause |
| 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
$wgCodeEditorEnableCore- To disable the editor on JavaScript and CSS pages in the MediaWiki, User and other core namespaces, set
$wgCodeEditorEnableCore = false;(default is "true")
$wgCodeEditorContentModels- 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 is "true")
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: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |
- Stable extensions/pt
- Extensions with invalid or missing type/pt
- Extensions with unknown license/pt
- Extensions in Wikimedia version control/pt
- EditPage::showEditForm:initial extensions/pt
- EditPage::showReadOnlyForm:initial extensions/pt
- GetPreferences extensions/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 wiki.gg/pt
- Extensions included in WikiForge/pt
- Syntax highlighting extensions/pt
- Scribunto extensions/pt
- Edit extensions/pt
