Extensão:CodeEditor

This page is a translated version of the page Extension:CodeEditor and the translation is 16% complete.
Outdated translations are marked like this.
Esta extensão acompanha o MediaWiki 1.31 ou superior. Logo, não é necessário baixá-la novamente. No entanto, ainda é necessário seguir as outras instruções fornecidas.
Manual de extensões do MediaWiki
CodeEditor
Estado da versão: estável
Descrição Fornece um editor de código com realce de sintaxe para páginas JS, CSS e Lua de sites e usuários, integrado com barra de ferramentas de edição avançada
Autor(es)
  • Brion Vibber
  • Derk-Jan Hartman
  • authors of Ace (ace.c9.io)
Política de
compatibilidade
Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.32+
Modifica o banco
de dados
Não
Licença GPL-2.0-or-later AND BSD-3-Clause
Download
  • $wgCodeEditorEnableCore
Quarterly downloads 238 (Ranked 45th)
Public wikis using 8,385 (Ranked 17th)
Para traduzir a extensão CodeEditor, verifique sua disponibilidade no translatewiki.net
Problemas Tarefas em aberto · Relatar um bug

A extensão CodeEditor estende a barra de ferramentas de edição avançada do WikiEditor com um widget editor Ace, fornecendo alguns recursos úteis para páginas JavaScript de usuário/site, páginas CSS, páginas JSON e quando a extensão Scribunto também está instalada , para páginas LUA, ou seja, páginas no namespace do Module. 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

The WikiEditor extension needs to be installed for this extension to work. Installing the Scribunto extension is optional.
  • Baixe e coloque o(s) arquivo(s) num diretório chamado CodeEditor na sua pasta extensions/.
  • Adicione o seguinte código ao final do seu arquivo LocalSettings.php :
    wfLoadExtension( 'CodeEditor' );
    $wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension
    
  • Configure as required.
  •   Concluído – Navegue à página Special:Version em sua wiki para verificar se a instalação da extensão foi bem sucedida.


Instalação com Vagrant:

  • Se estiver usando o Vagrant , instale com vagrant roles enable codeeditor --provision

Configuração

$wgCodeEditorEnableCore
$wgCodeEditorEnableCore: Atribua true para habilitar o editor em páginas JavaScript e CSS nos namespaces MediaWiki, User e outros do MediaWiki.
$wgScribuntoUseCodeEditor
To disable this extension for Scribunto, i.e. in the module namespace set $wgScribuntoUseCodeEditor = false; (default is "true")
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 jQuery.plugin.textSelection.

License