Jump to content

Extension:VisualEditor/pl

From mediawiki.org
MediaWiki extensions manual
VisualEditor
Release status: beta
Implementation Page action , Extended syntax , Beta Feature , Skin
Description Allows for editing pages as rich content
Author(s) Alex Monk, Bartosz Dziewoński, C. Scott Ananian, Christian Williams, David Lynch, Ed Sanders, Inez Korczyński, James D. Forrester, Moriel Schottlender, Roan Kattouw, Rob Moen, Subramanya Sastry, Thalia Chan, Timo Tijhof, Trevor Parscal, ...
Latest version continuous updates
Compatibility policy Snapshots releases along with MediaWiki. Master is not backward compatible.
MediaWiki 1.44-alpha
Database changes No
License MIT License
Download
README

  • $wgVisualEditorPluginModules
  • $wgVisualEditorPreloadModules
  • $wgVisualEditorPreferenceModules
  • $wgVisualEditorRestbaseURL
  • $wgVisualEditorFullRestbaseURL
  • $wgVisualEditorSerializationCacheTimeout
  • $wgVisualEditorAvailableNamespaces
  • $wgVisualEditorAvailableContentModels
  • $wgVisualEditorUseChangeTagging
  • $wgVisualEditorEnableWikitext
  • $wgVisualEditorEnableDiffPage
  • $wgVisualEditorEnableDiffPageBetaFeature
  • $wgVisualEditorUseSingleEditTab
  • $wgVisualEditorSingleEditTabSwitchTime
  • $wgVisualEditorTabPosition
  • $wgVisualEditorTabMessages
  • $wgVisualEditorAutoAccountEnable
  • $wgVisualEditorDisableForAnons
  • $wgVisualEditorTransitionDefault
  • $wgVisualEditorShowBetaWelcome
  • $wgVisualEditorNewAccountEnableProportion
  • $wgVisualEditorFeedbackTitle
  • $wgVisualEditorFeedbackAPIURL
  • $wgVisualEditorSkinToolbarScrollOffset
  • $wgVisualEditorBrowserBlacklist
  • $wgVisualEditorEnableTocWidget
  • $wgVisualEditorRebaserURL
Quarterly downloads 722 (Ranked 4th)
Public wikis using 7,436 (Ranked 19th)
Translate the VisualEditor extension
Vagrant role visualeditor
Issues Open tasks · Report a bug

Rozszerzenie VisualEditor pozwala edytować strony z bogatą treścią. Istnieje również jako projekt o tej samej nazwie, która ma na celu stworzenie niezawodnego edytora tekstu sformatowanego dla sieci i dla MediaWiki.

Rozszerzenie VisualEditor odwołuje się do oddzielnej usługi analizatora składni nodeJS bazującej na Parsoid, którą należy zainstalować i włączyć by edytować strony za jej pomocą.

Podręcznik użytkownika

[edit]

Zobacz Help:VisualEditor/User guide.

Ściąganie

[edit]

Dla przeciętnego użytkownika: Jeśli używasz najnowszej stabilnej wersji MediaWiki, musisz pobrać rozszerzenie VisualEditor-MediaWiki ze strony dystrybucji rozszerzeń.

Dla zaawansowanego użytkownika:

Poniższe instrukcje przeznaczone są do pobierania MediaWiki z ostatniej chwili.

cd extensions
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor.git
cd VisualEditor
git submodule update --init

Note Note:

  • Rdzeń VisualEditor-MediaWiki's zawiera najnowszy kod, używany w Wikimedia. Ten kod może być błędny lub niestabilny, ale prawdopodobnie zawiera mniej błędów, a przede wszystkim więcej funkcji, niż stare kompilacje.
  • Rdzeń wymaga kompilacji MediaWiki (w tej chwili, 1.31-wmf.20) i nie będzie działać ze starszymi niż 1.30.0 oficjalnymi wydaniami MediaWiki; w tym celu użyj wersji REL1_30 (command: git clone -b REL1_30 https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor.git).
  • Polecenie git submodule update --init jest niezbędne, gdyż MediaWiki-VisualEditor wymaga jądra VisualEditor jako modułu do pracy. Jeśli nie użyjesz tego polecenia, VisualEditor nie zadziała.

Jeśli nie możesz użyć polecenia git (np. jesteś w instalacji air-gapped), to możesz pobrać snapshot/zajawkę VisualEditor-MediaWiki dla wersji master lub dla wersji Release MediaWiki ze strona ExtensionDistributor. Po uzyskaniu kodu zapisz go w katalogu extensions/VisualEditor w swoim wiki.

Kompatybilność ze skórkami

[edit]
MediaWiki version:
1.28

VisualEditor jest znany jako zgodny z następującymi skórkami:

Inne skórki nie są oficjalnie obsługiwane, jednak edytor powinien współpracować z każdą skórką, która używa wymaganej struktury HTML – zobacz VisualEditor/Skin requirements. Mogą być wówczas konieczne pewne zmiany w arkuszach stylów skórki, by wszystko wyglądało ładnie. Załaduje się z każdą skórką, o ile nie natrafi na niezgodność cech.

Konfigurowanie VisualEditor

[edit]

Skonfiguruj usługę Parsoid

[edit]
Bez usługi Parsoid Node.js nie będzie można edytować stron ani zapisywać stron!

Jeśli chcesz mieć możliwość edycji istniejących stron i zapisywania stron za pomocą VisualEditor, potrzebujesz usługi Parsoid, która konwertuje między wikitext i HTML oraz dzięki której VisualEditor wyświetla stronę do edycji.

Aby skonfigurować własną usługę Parsoid postępuj zgodnie z instrukcją instalacji Parsoid przed konfiguracją VisualEditor. Zwróć uwagę na konfigurację Parsoid i Node.js w niestandardowych systemach, takich jak Windows lub Debian.

Below is the non-official compatibility matrix between the VisualEditor on some MediaWiki version and the Parsoid service. In general, if you're running into problems with installation, getting exactly matching versions (VisualEditor, Parsoid, and MediaWiki) should be one of the first things you try, even if this table says that a mismatched set will probably work.

Parsoid →
MediaWiki ↓
0.4.1 0.6.0 0.6.1 0.7.0 0.7.1 0.8.0 0.9.0
compat
0.9.0 0.9.0+ 0.10.0 0.11.0
1.34 X X
1.33 X X
1.32
1.31 - (d) - (d) X X X X X X
1.30 - (d) - (d) X X X X - (b) - (b)
1.29 X X X X X X - (b) - (b)
1.28 X X X X X X - (b) - (b)
1.27 X X X X X - - (b) - (b)
1.26 X X X X X - (c) - (c) -
1.25 - (a) -
1.24 -
1.23 -

Legenda :

X = przetestowany, działający
- = przetestowany, niedziałający

Uwagi :

(a) = non-compatible with 0.6.1 (phabricator:T100681)
(b) = non-compatible with 0.9.0 (mailarchive:wikitech-l/2018-March/089690.html); from the version after 0.9.0 (currently unreleased) there is no more compatibility mode
(c) = very partially, it is possible to add text but not to modify existing text
(d) = issues on images for Parsoid 0.6 + MW 1.30 and probably 1.31 also (Topic:Ufpghq2hidcj3d3w)
0.9 zgodny = zmodyfikowany kod Parsoid (zobacz ten blog) albo konkretna konfiguracja Parsoid (zobacz ten temat)

Node.js and Parsoid compatibility Matrix

[edit]
Parsoid →
Node.js↓
0.4.1 0.6.0 0.6.1 0.7.0 0.7.1 0.8.0 0.8.1 0.9.0 0.10.0 0.11.0
12
10 X X
8
6+ X

Podstawowa konfiguracja dla MediaWiki-VisualEditor

[edit]

Domyślnie MediaWiki-VisualEditor nie jest dostępny dla użytkowników. Aby go udostępnić, należy dodać następujące linie do swoich wikiLocalSettings.php, oczywiście po pobraniu rozszerzenia:

wfLoadExtension( 'VisualEditor' );

// Enable by default for everybody / Włącza domyślnie dla wszystkich
$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Optional: Set VisualEditor as the default for anonymous users / Opcjonalnie: Ustawia VisualEditor jako domyślny dla anonimowych użytkowników
// otherwise they will have to switch to VE / w przeciwnym razie będą musieli przejść na VE komendą
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

// Don't allow users to disable it / Nie zezwala użytkownikom na wyłączanie tego
$wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features / OPCJONALNIE: Włącza eksperymentalne funkcje kodu VisualEditor
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

Zauważ, że możesz to zrobić, zanim zainstalujesz usługę Parsoid node.js by eksperymentować z VE; będzie to oznaczać, że możesz wypróbować edytor w trybie 'tworzenia' na własnej wiki, ale nie będzie wówczas można zapisywać ani edytować istniejących stron.

Inne rozszerzenia, które ładują wtyczki do VE można załadować przed lub po VE, jeśli używasz MediaWiki 1.25 lub później; wtyczki powinny działać w dowolny sposób.

Zmienianie aktywnych przestrzeni nazw

[edit]

Domyślnie VisualEditor jest włączony tylko dla przestrzeni nazw "Główne/Main", "Użytkownik/User", "Plik/File" i "Kategoria/Category". Jednak możliwe jest dodawanie lub usuwanie przestrzeni nazw. Można to zrobić na wiele sposobów, ale zaleca się używanie nazw kanonicznych zdefiniowanych dla odpowiednich przestrzeni nazw. Zauważ, że różni się to od rdzenia/jądra MediaWiki i prawie wszystkich rozszerzeń.

Usuwanie przestrzeni nazw (np. "File")
$wgVisualEditorAvailableNamespaces = [
    "File" => false
];
Dodawanie przestrzeni nazw (np. "Help" i "Extra" która jest niestandardowa)
$wgVisualEditorAvailableNamespaces = [
    "Help" => true,
    "Extra" => true
];
Dodawanie i usuwanie przestrzeni nazw (np. "File" i "Extra" która jest niestandardowa)
$wgVisualEditorAvailableNamespaces = [
    "File" => false,
    "Extra" => true
];

Łączenie z Parsoid

[edit]

Aby VisualEditor mógł skomunikowac się z Parsoid, by określić Twój sposób połączenia z Parsoid, dodaj następujący kod do swojego LocalSettings.php:

$wgVirtualRestConfig['modules']['parsoid'] = array(
    // URL to the Parsoid instance / Adres URL do Parsoid
    // Use port 8142 if you use the Debian package / Użyj portu 8142, jeśli korzystasz z pakietu Debian
    'url' => 'http://localhost:8000',
    // Parsoid "domain", see below (optional) / Parsoid "domena", patrz poniżej (opcjonalnie)
    'domain' => 'localhost',
    // Parsoid "prefix", see below (optional) / Parsoid "prefiks", patrz poniżej (opcjonalnie)
    'prefix' => 'localhost'
);

Jeden serwer Parsoid może obsługiwać wiele wiki. Ustawienie domain Parsoid identyfikuje Twoją konfigurację wiki względem Parsoid. Niezależnie od tego, czy ustawisz domain jawnie lub opcjonalnie, zaakceptuj wartość domyślną. Wartość z $wgVirtualRestConfig musi odpowiadać wartości z config.yaml Parsoidu. Domyślnie jest on przekierowany na host o nazwie $wgCanonicalServer, ale możesz wybrać dowolny ciąg znaków. Starsze wersje Parsoid również używały unikalnego "przedrostka" do identyfikacji serwera; być może będziesz musiał również i tutaj go wymienić.

Parsoid musi być skonfigurowany tak, aby współpracowa z przykładowymi występującymi w config.yaml Parsoidu:

    mwApis:
        - # This is the only required parameter, / Jest to jedyny wymagany parametr,
          # the URL of you MediaWiki API endpoint. / adres URL punktu końcowego MediaWiki API.
          uri: 'http://path/to/my/wiki/api.php'
          domain: 'localhost'
        - # and another MediaWiki / i kolejna MediaWiki
          uri: 'http://path/to/my/otherwiki/api.php'
          domain: 'uniqueidentifier'

Jeśli używasz Parsoid starszego niż 0.6.0, użyjesz linii w localsettings.js Parsoidu:

parsoidConfig.setMwApi({ uri: 'http://path/to/my/wiki/api.php', domain: 'localhost', prefix: 'localhost' });

Ponownie, właściwość "domain" jest opcjonalna w konfiguracji Parsoid; domyślnie jest to nazwa hosta używana w uri właściwość, jeśli nie określono. Właściwość "prefix" można również pominąć, chyba że używasz bardzo starej wersji Parsoid.

Więcej szczegółów - zobacz Parsoid/Setup/pl#Konfiguracja.

Przełączanie pomiędzy edycją Wikitext i VisualEditor
[edit]
Warning Warning: Nie instaluj RESTBase na prywatnym wiki! RESTBase obecnie nie można skonfigurować, by zachować prywatność strony, ale umożliwi publiczny dostęp do wszystkich treści stron.

VisualEditor allows you to switch back and forth between wikitext and visual editing.

However, without a RESTBase server, switching from wikitext to visual editing may result in dirty diffs when saving (non-semantic whitespace changes to wikitext formatting). If you want the ability to switch between wikitext editing and VisualEditor and save your changes without dirty diffs, you must install a RESTBase server. (Prior to T214542, switching without RESTBase was not possible at all.)

If you can't set up RESTBase and dirty diffs are undesirable on your wiki (e.g. your users carefully review all changes), you can disable this feature using $wgVisualEditorAllowLossySwitching=false.

When switching isn't possible and you try to switch from a wikitext editing environment into VisualEditor, your only options are Cancel or Discard my changes and switch; any changes you made will be discarded if you switch.[1]

RESTBase setup for switching
[edit]

To set up your own RESTBase service follow the RESTBase installation instructions. Note that if you were successful setting up the Parsoid service, setting up a RESTBase server is similar because it also runs under Node.js.

For VisualEditor you do not need the configuration section in config.yaml described in the RESTBase configuration section.

Once the RESTBase server is operational, add the following code to your LocalSettings.php:

$wgVirtualRestConfig['modules']['restbase'] = [
  'url' => "http://yourRESTBaseserver.com:7231",
  'domain' => '{domain}',
  'parsoidCompat' => false
];

$wgVisualEditorFullRestbaseURL = 'http://yourRESTBaseserver.com:7231/{domain}/';

gdzie {domain} jest wartością 'domain', którą podałeś w pliku konfiguracji Parsoid (powinieneś go zmienić w konfiguracji). Upewnij się, że port tutaj określony (np. :7231) jest tym samym portem, który podano w konfiguracji RESTBase.

Jeśli nie możesz uzyskać dostępu do portu RESTBase (np.:7231), to możesz ominąć to za pośrednictwem serwera proxy httpd (odniesienie jeśli port Restbase jest zablokowany). Jeśli twoja wiki jest obsługiwana przez HTTPS, RESTBase musi być obsługiwany przez HTTPS; w przeciwnym razie użytkownicy mogliby napotkać błędy "o mieszanej zawartości", a zmiana z wikitekstu dzięki VisualEditor nie działałaby.

Teraz, gdy wprowadzisz zmiany w edytorze wikitekstu, pojawia się okno dialogowe z opcją Switch/Przełącz zamiast Odrzuć moje zmiany i przełącz.

W przypadku, gdy obsługujesz wiki poprzez https, standardowa procedura w 2018 roku, musi służyć RESTbase via https podobnie jak Parsoid też, aby tego uniknąć błędy mieszanych zawartości. Tutaj dostępna jest zwięzła i łatwa do zrozumienia dyskusja. Nie zapomnij wymieszać następujących elementów dokumentacji. Pamiętaj także, aby nie zapomnieć dostosować numerów portów podczas korzystania z stunnela.
Servers with multiple virtual sites
[edit]

If Apache2 is configured with multiple virtual sites, Parsoid is (in standard configuration) only able to access the default site. To check for this problem, run curl '[http://your-wiki-base-url]/api.php' on the server.

If the response starts with:

<!DOCTYPE html><html lang="en-GB" dir="ltr" class="client-nojs"><head><meta charset="UTF-8" /><title>MediaWiki API help - ['''''Name of your wiki''''']</title>

then you don't have the problem, but if it doesn't, you may need to configure a host alias that Parsoid can use:

Look at the apache2 configuration file for the virtual server hosting the wiki, near the top of the file there should be a line like:

<VirtualHost *:80>

If the '*' is present, then the alias can be to localhost, if there is an IP address replacing the '*' then the alias must be to that IP address.

In the same file add a line:

ServerAlias my_wiki_alias

In the hosts file of the server (/etc/hosts on Ubuntu), add a route for my_wiki_alias, either for 127.0.0.1 (if the apache2 virtual server configuration had the '*' above, else to the IP address from the apache2 virtual server configuration.

Finally, in the Parsoid localsettings.js file, find the parsoidConfig.setMwApi setting, and set it to:

parsoidConfig.setMwApi({
  uri: 'http://my_wiki_alias:80/path-to-my-wiki/api.php',
  domain: '/* my Parsoid "domain" matching the value in LocalSettings.php */',
  prefix: '/* my Parsoid "prefix" matching the value in LocalSettings.php */'
});

Reload the network config, apache config, and Parsoid config, and retest the curl command above.

The same method works for multiple wikis hosted on multiple virtual servers on a host (use a different alias and add a parsoidConfig.setMwApi setting for each wiki).

Linking with Parsoid in private wikis
[edit]
Warning Warning: All current options have significant, serious security implications. Think carefully before applying any of these hacks. The best option right now is to provide Parsoid over HTTPS. In the future this will be properly integrated with MediaWiki and special measures will not be needed.

Try one of these three options:

Forwarding cookies to Parsoid
[edit]
Warning Warning: ONLY enable this on private wikis and ONLY IF you understand the SECURITY IMPLICATIONS of sending Cookie headers to Parsoid over HTTP! (but see the HTTPS section below)
// This feature requires a non-locking session store. The default session store will not work and
// will cause deadlocks (connection timeouts from Parsoid) when trying to use this feature. Only required for MediaWiki 1.26.x and earlier!
$wgSessionsInObjectCache = true;

// Forward users' Cookie: headers to Parsoid. Required for private wikis (login required to read).
// If the wiki is not private (i.e. $wgGroupPermissions['*']['read'] is true) this configuration
// variable will be ignored.
//
// WARNING: ONLY enable this on private wikis and ONLY IF you understand the SECURITY IMPLICATIONS
// of sending Cookie headers to Parsoid over HTTP. For security reasons, it is strongly recommended
// that $wgVirtualRestConfig['modules']['parsoid']['url'] be pointed to localhost if this setting is enabled.
$wgVirtualRestConfig['modules']['parsoid']['forwardCookies'] = true;
[edit]

Alternatywą do powyższego podejścia jest wyraźne nadanie uprawnień do odczytu dla żądań z serwera Parsoid. Istnieją dwa sugerowane rozwiązania:

Note Note: Zastąp 127.0.0.1 w obu przykładowych rozwiązaniach z adresem IP serwera, na którym działa Parsoid. Należy to oczywiście zrobić tylko wtedy, gdy serwer Parsoid znajduje się w 'zaufanej' sieci.

1) Używając rozszerzenia NetworkAuth

Przekazywanie plików cookie (and the enabling of $wgSessionsInObjectCache and the forwardCookies property) can be avoided by adding a user (which may be called parsoid) to the wiki and then add the NetworkAuth extension to the wiki with the configuration in "LocalSettings.php" file:

require_once "$IP/extensions/NetworkAuth/NetworkAuth.php";
$wgNetworkAuthUsers[] = [
	'iprange' => [ '127.0.0.1' ],
	'user'    => 'parsoid'
];

Where the IP address matches that of the Parsoid server and the user matches the one you added to the wiki.

2) Bypass how permissions are set
Warning Warning: This will allow your private wiki to be readable over the Parsoid port. You should ensure that the Parsoid port is closed to outside traffic.

After your settings for $wgGroupPermissions add the following to your "LocalSettings.php":

if ( !isset( $_SERVER['REMOTE_ADDR'] ) OR $_SERVER['REMOTE_ADDR'] == '127.0.0.1'	) {
	$wgGroupPermissions['*']['read'] = true;
	$wgGroupPermissions['*']['edit'] = true;
}

Where the IP address matches that of the Parsoid server. Solution as mentioned in: explicitly remove restrictions for Parsoid by IP address.

Parsoid over HTTPS
[edit]

By default, Parsoid only supports HTTP connections. However, it's easy to provide HTTPS Parsoid by using Stunnel, a utility which offers SSL wrapping for arbitrary sockets. Most Unix distributions have 'stunnel' or 'stunnel4' package available from the repository. First install stunnel:

sudo apt install stunnel

Then you need a config file for stunnel. It resides under /etc/stunnel/*.conf, so create it here with the editor you like, e.g. nano:

sudo nano /etc/stunnel/parsoid.conf

Give the file similar content like this:

cert = /etc/ssl/my_certs/parsoid.crt
key = /etc/ssl/my_keys/mykey.key
CAfile = /etc/ssl/my_ca/ca.crt

[parsoid]
accept  = 8143
connect = 8142

First you define the path to the ssl-keys used for your server. Then you give the service a name you like in brackets. It is only to know what this config shall do and to separate different configs in the same file. After the key accept you write the port number for the public incoming connection, which is ssl-ciphered. After the connect key write the intern port number, to which stunnel should route the traffic from the accept-port, but without ssl. At this port your parsoid-server is listen. If you use the Parsoid/Developer Setup use port number 8000, otherwise 8142 is standard port.

If you are using Let's Encrypt, you can use the following (replacing `<domain>` with the primary URL you have the certificate for):

cert = /etc/letsencrypt/live/<domain>/fullchain.pem
key = /etc/letsencrypt/live/<domain>/privkey.pem

[parsoid]
accept  = 8143
connect = 8142

This example use its own subdomain for parsoid and secured it with letsencrypt.

The stunnel config-file is ready now, but you need two more things to activate the configuration:

First enable stunnel to work after reboot. Therefore change 'ENABLED' to 1 in the file /etc/default/stunnel4

sudo nano /etc/default/stunnel4
ENABLED=1

Second, if you dont want to reboot now, you have to start the service. For Ubuntu 14.x use

sudo /etc/init.d/stunnel4 restart

For Ubuntu 16.x the command changed to

sudo systemctl restart stunnel4.service

To test configuration you can check in your browser, if the parsoid-server is answering over the ssl-connection. (e.g. write in the adress-line of your browser: 'https://parsoid.mydomain.com:8143'). If the answer is „Welcome to the Parsoid web service.“ then congratulation - you have successfull secured your parsoid installation. One step remaining: Once this is working, you have to use the appropriate URL (e.g. 'https://parsoid.mydomain.com:8143') in your MediaWiki configuration for VisualEditor. Note the change from http to https and the port-number you set under accept in stunnel-configuration-file.

If you do not like to create an extra subdomain for parsoid like here, you can also use an existing subdomain (e.g. [wiki] if it's listed in your .crt file and then the appropriate URL will become: https://wiki.mydomain.com:8143).

  • You cannot use this type of configuration with Parsoid accessible via 'localhost', because the certificate chain for localhost, which will almost certainly be self-signed, will fail validation. You must use a proper hostname for Parsoid server, with appropriately issued and signed SSL certificate.
  • You might enable SSL tunnels for stunnel. See e.g. for Debian /etc/default/stunnel4

Setting up such a configuration allows you to avoid the security implications of transmitting parsoid cookies in cleartext.

Producing and installing SSL certificates is beyond the scope of this document. Read more about stunnel:

Parsoid on Windows and other systems

[edit]

It is particularly complicated and time consuming to set up VisualEditor with Parsoid in non-standard systems, like those running Windows or non-standard Linux - those difficulties might even prevent the successful installation of VisualEditor for some people on some platforms:

Setting VisualEditor up on shared hosting

[edit]

See VisualEditor/Installation on a shared host

Quick configuration guide

[edit]
Feature Beta Features opt-in state Enabled for all to opt-in Enabled for all to opt-out Enabled for all without opt-out
Visual mode Out-of-the box.
$wgDefaultUserOptions['visualeditor-autodisable'] = true;
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgDefaultUserOptions['visualeditor-enable'] = 1;
$wgHiddenPrefs[] = 'visualeditor-enable';
Wikitext mode
$wgVisualEditorEnableWikitextBetaFeature = true;
$wgVisualEditorEnableWikitext = true;
$wgVisualEditorEnableWikitext = true;
$wgDefaultUserOptions['visualeditor-newwikitext'] = 1;
$wgVisualEditorEnableWikitext = true;
$wgDefaultUserOptions['visualeditor-newwikitext'] = 1;
$wgHiddenPrefs[] = 'visualeditor-newwikitext';
Single edit tab Not a supported configuration.
$wgVisualEditorUseSingleEditTab = true;
$wgDefaultUserOptions['visualeditor-tabs'] = 'multi-tab';
$wgVisualEditorUseSingleEditTab = true;
Default edit tab will be to remember the last editor, and open with the wikitext editor for first edit; if you want it to be the visual editor, also add:
$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
$wgVisualEditorUseSingleEditTab = true;
$wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
$wgHiddenPrefs[] = 'visualeditor-tabs';
Visual diffs on history pages
$wgVisualEditorEnableDiffPageBetaFeature = true;
Configuration not currently supported. Configuration not currently supported.
$wgVisualEditorEnableDiffPage = true;

Complete list of configuration options

[edit]

Each configuration option is shown without the $wgVisualEditor prefix for brevity; replace the '…' when using.

Option Default value Useful for… Documentation
…PluginModules
[]
Extension developers Array of ResourceLoader module names (strings) that should be loaded when VisualEditor is loaded. Other extensions that extend VisualEditor should add to this array.
Warning Warning: When removing a module on a production site (e.g. Wikimedia), first remove it from this array, wait for the change to propagate, and only then remove the module code and module registration. Otherwise there may be a period of time during which VisualEditor depends on a module that no/ longer exists.
…PreloadModules
[
    "site",
    "user"
]
Extension developers Array of ResourceLoader module names (strings) that should be loaded before VisualEditor is loaded. Other extensions that extend VisualEditor and need to set up their environment before loading should add to this array.
Warning Warning: When removing a module on a production site (e.g. Wikimedia), first remove it from this array, wait for the change to propagate, and only then remove the module code and module registration. Otherwise there may be a period of time during which VisualEditor depends on a module that no/ longer exists.
…PreferenceModules
{
	"visualeditor-enable-experimental": "ext.visualEditor.experimental"
}
Extension developers Associative array of ResourceLoader module names (strings) that should be loaded when VisualEditor is loaded if the current user has a preference set. Other extensions that extend VisualEditor should add to this array if they want their addition to be opt-in or opt-out. Keys are preference names, values are ResourceLoader module names.

Remember to also set defaults in $wgDefaultUserOptions!

…ParsoidAutoConfig
true
Sysadmins Enables auto-configuration of the bundled version of the Parsoid REST API. Set to false if you have an unusual Parsoid configuration and want to manually configure it.
…RestbaseURL
false
Sysadmins URL to use to access the main RESTbase call. The page name will be appended directly to this value, so this needs to be set to something like 'https://en.wikipedia.org/api/rest_v1/page/html/' including the trailing slash.

If this is set, the page HTML will be requested from RESTbase. If this is not set, the page HTML will be requested from the API, which will send an HTTP request to Parsoid or to RESTbase if available.

…FullRestbaseURL
false
Sysadmins URL to use to access the rest of RESTbase. The page name will be appended directly to this value, so this needs to be set to something like 'https://en.wikipedia.org/api/rest_' excluding the trailing slash.
…AllowLossySwitching
true
Sysadmins Whether to allow switching from wikitext to visual editor even if doing so may cause dirty diffs. See § Switching between Wikitext Editing and VisualEditor.
…SerializationCacheTimeout
3600
Sysadmins Serialization cache timeout, in seconds
…AvailableNamespaces
[
    "User" => true,
    "File" => true,
    "Category" => true,
    "_merge_strategy" => "array_plus"
]
Sysadmins Namespaces in which to enable VisualEditor (mapped from namespace canonical name to a boolean flag), on top of $wgContentNamespaces.
…AvailableContentModels
[
    "wikitext" => "article",
    "_merge_strategy" => "array_plus"
]
Extension developers Content models in which to enable VisualEditor (mapped from content model name to a boolean flag).
…UseChangeTagging
true
Sysadmins Whether to put a change tag on every edit made with VisualEditor.
…EnableWikitext
false
Sysadmins Whether to enable the wikitext source mode inside VisualEditor.
…EnableDiffPage
false
Sysadmins Whether to enable the visual diff function on the history special page.
…EnableDiffPageBetaFeature
false
Sysadmins Whether to allow users to enable the visual diff function on the history special page as a beta feature.
…EnableVisualSectionEditing
false
Sysadmins Whether to allow users to enable the section editing.
…UseSingleEditTab
false
Sysadmins Whether to use only one edit tab, switching back and forth, or add a dedicated VisualEditor edit tab next to the existing one.
…SingleEditTabSwitchTime
20160101000000
Sysadmins From what timestamp to warn existing editors that the installation has switched from two edit tabs to one. In general you should ignore this.
…TabPosition
'before'
Sysadmins If showing two edit tabs, where to put the VisualEditor edit tab in relation to the system (or WikiEditor) one:
  • 'before': put it right before the old edit tab
  • 'after': put it right after the old edit tab
…TabMessages
{
	"edit": null,
	"editsource": "visualeditor-ca-editsource",
	"create": null,
	"createsource": "visualeditor-ca-createsource",
	"editlocaldescriptionsource": "visualeditor-ca-editlocaldescriptionsource",
	"createlocaldescriptionsource": "visualeditor-ca-createlocaldescriptionsource",
	"editsection": null,
	"editsectionsource": "visualeditor-ca-editsource-section"
}
Sysadmins Configuration of what messages to use for the various kinds of edit tab users can see, if showing two edit tabs:

'edit' – i18n message key to use for the VisualEditor edit tab; if null, the default edit tab caption will be used; the 'visualeditor-ca-ve-edit' message is available for this.

'editsource' – i18n message key to use for the old edit tab; if null, the tab's caption will not be changed

'create' – i18n message key to use for the VisualEditor create tab; if null, the default create tab caption will be used; the 'visualeditor-ca-ve-create' message is available for this

'createsource' – i18n message key to use for the old create tab; if null, the tab's caption will not be changed

'editlocaldescriptionsource' – i18n message key to use for the old edit tab on pages for files in foreign repos; if null, tab's caption will not be changed

'createlocaldescriptionsource' – i18n message key to use for the old create tab on pages for files in foreign repos; if null, tab's caption will not be changed

'editsection' – i18n message key to use for the VisualEditor section edit link; if null, the default edit section link caption will be used

'editsectionsource' – i18n message key to use for the source section edit link; if null, the link's caption will not be changed

…AutoAccountEnable
false
Sysadmins Whether to enable VisualEditor for every new account.

This allows you to keep the 'visualeditor-enable' preference disabled by default, but still have VisualEditor available for new logged-in users (by setting this to true).

…DisableForAnons
false
Sysadmins Whether to disable VisualEditor for non-logged-in users

This allows you to enable the 'visualeditor-enable' preference by default, but still disable VisualEditor for logged-out users (by setting this to true).

…TransitionDefault
false
Sysadmins For wikis planning to use the 'visualeditor-betatempdisable' preference to auto-opt-out existing users whilst enabling by default for all existing users, whether to start recording explicit opt-outs against implicit ones.
…ShowBetaWelcome
true
Sysadmins Whether to show the "welcome to the beta" dialog the first time a user uses VisualEditor
…NewAccountEnableProportion
false
Sysadmins running user analytics Whether to enable VisualEditor for a proportion (Egyptian fraction) of all new accounts based on userID.
…FeedbackTitle
false
Sysadmins Whether to enable the MediaWiki feedback tool inside the help menu of VisualEditor. If enabled, the title of the page at which to point the MediaWiki feedback tool.
…FeedbackAPIURL
false
Sysadmins If set, the API of the remote wiki at which to point the MediaWiki feedback tool.
…SkinToolbarScrollOffset
[]
Skin developers An array of skin names mapped to pixel values to which to set the toolbar scroll offsets.
1.35+:

…BrowserUnsupportedList

<1.35:

…BrowserBlacklist

{
	"firefox": [
		[
			"<=",
			11
		]
	],
	"safari": [
		[
			"<=",
			6
		]
	],
	"opera": [
		[
			"<",
			12
		]
	]
}
VisualEditor developers List of browsers with which VisualEditor is incompatible. See jquery.Client for specification. If the user's browser is matched, VisualEditor will refuse to load.

Firefox – There is a wikilink corruption ([[./]]) bug in Firefox 14 and below (T52720) which prevent wider availability.

Safari – Older versions of Safari suffered from corruption issues from various old browser plugins.

Opera – Below version 12, Opera was untested, and as its user base is almost non-existent anyway it's blocked.

Internet Explorer – At or below version 9, there are various incompatibilities in layout and feature support. Versions 10 and 11 should work correctly.

Not listed independently, because it's inherited from MediaWiki itself, Android at 3.x and below "support" CE but don't trigger keyboard input or have other issues, making it useless for users.

…EnableTocWidget
false
VisualEditor developers Whether to enable the (currently experimental) Table Of Contents widget
…RebaserURL
false
VisualEditor developers URL to use to access the experimental rebaser technology. If false, the technology isn't loaded.

Old configuration parameters

[edit]
Warning Warning: These parameters are no longer used in recent versions of VisualEditor; they are documented here for compatibility purposes with the proposed upgrade paths.

As above, each configuration option is shown without the $wgVisualEditor prefix for brevity.

Option MW versions Default value Documentation
…Namespaces 1.22–1.25
  • 1.22 (PHP config):
    $wgContentNamespaces
    
  • 1.23-1.25 (PHP config):
    array_merge( $wgContentNamespaces, array( NS_USER ) )
    
  • 1.25 (extension.json):
    []
    
List of namespaces IDs where is the VisualEditor is activated.

This parameter has been essentially replaced by …AvailableNamespaces from 1.26.

…SupportedSkins 1.22–1.28
[
	"vector",
	"apex",
	"monobook",
	"minerva",
	"blueprint"
]
List of skins VisualEditor integration supports. If the user's skin is not matched, VisualEditor will refuse to load.

This is replaced by a dynamical check of the requirements (T161373).

[edit]

See also Upload dialog § Configuration (for wiki sysadmins) for information about configuring the drag-and-drop/copy&paste functionality for uploading media files through VisualEditor.

Integration of "2017 wikitext editor"

[edit]

Since release branch "REL1_29" (MediaWiki 1.29 and later) it is also possible to activate the so called "2017 wikitext editor". To enable it, follow the instructions for Wikitext mode in the § Quick configuration guide.

Enabling wikitext syntax highlighting

It is also possible to enable wikitext syntax highlighting for the "2017 wikitext editor". To do this you have to additionally install the Extension:CodeMirror extension.

Rich template forms

[edit]

Extension:TemplateData allows the addition of template information, making templates easier to insert with the VisualEditor

Improved citation tool

[edit]

Citations can be improved by configuring the citation tool , and also by setting up Citoid .

Troubleshooting

[edit]
All templates appear as puzzle icons instead of displaying its contents
Check Topic:V6tbh7vonvg3mzl9
Docker: Error contacting the Parsoid/RESTBase server (curl error: 7)
Ensure that the mediawiki container name does not equal to the domain the wiki is running on. If both names are equal, the api will try to connect to the domain the wiki is running on, but only receive the local ip of the container. This will cause errors when ssl is enabled.
Error contacting the Parsoid/RESTBase server: http-bad-status
  • When editing subpages on Apache, AllowEncodedSlashes NoDecode must be added in the VirtualHost section of the wiki (T268953).
  • On a private wiki, see "parsoidserver-http-bad-status: 401", below
Error contacting the Parsoid/RESTBase server (HTTP 400)
An unresolved error for some users. (https://www.mediawiki.org/wiki/Topic:Wc5hugtg7besmcb2)
Error contacting the Parsoid/RESTBase server (HTTP 403)
Caused by the 'writeapi' right being revoked (or not granted). Check your LocalSettings.php and remove any overrides for this right. (T265043)
Error contacting the Parsoid/RESTBase server (HTTP 404)
Possible reasons for this problem:
  • Caused by ModSecurity (or possibly another WAF). Request your hosting service provider to whitelist the security rules that were being triggered by your site.
  • When the web server is Apache, AllowEncodedSlashes NoDecode must be added in the VirtualHost section of the wiki (T261921).
  • Possibly Parsoid is not loaded when using default configuration (local Parsoid, no RestBase). Add to LocalSettings.php: wfLoadExtension( 'Parsoid', 'vendor/wikimedia/parsoid/extension.json' );.
  • Caused by VisualEditor for MW 1.35 and later due to insufficient rewrite rules in case of non-standard short URLs (TT270376). See webserver for the solution.
Error contacting the Parsoid/RESTBase server (HTTP 500) when saving page with accented character in title, on Windows/IIS
IIS expects URLs to be encoded using legacy single-byte encodings, but MediaWiki uses UTF-8. Follow these instructions to resolve this: https://support.microsoft.com/en-us/help/2277918/fix-a-php-application-that-depends-on-the-request-uri-server-variable (T269673)
Error contacting the Parsoid/RESTBase server (HTTP 500) when trying to edit an existing page with VisualEditor
Persisting in MW 1.35.x . See T270377
Error loading data from server: HTTP 500. Would you like to retry?
Possible reasons for this problem:
  • On new installs, "curl", "php5-curl", or "php7.0-curl" (or other package appropriate to your PHP version) is not installed on the server.
  • setMwApi uri is set incorrectly with e.g. https instead of http.
  • Bad rewrite rules in the apache configuration that would cause API failures.
  • The SSL/TLS certificates are expired.
  • When directory $wgTmpDirectory (for example "/tmp") has not write permissions.
  • When running Windows Authentication with Apache, you would need to white-list 127.0.0.1 in your Apache conf, as Apache doesn't have read access.
    <Directory "D:/Wiki/htdocs">
        ...
    
        Allow from 127.0.0.1
        Satisfy Any
    </Directory>
    
No visible error (Appears to load forever)
Check the parsoid log file, and consult Parsoid/Troubleshooting .
parsoidserver-http-bad-status: 401
Caused by read or edit restrictions (aka 'private wiki'). If you've set up a private wiki and don't want to use cookie forwarding, you can explicitly remove restrictions for Parsoid by IP address. (See Topic:Vv35plp6g16qno0s and the ticket: MW 1.35.0 "Error contacting the Parsoid/RESTBase server: http-bad-status" on a private wiki)
parsoidserver-http-curl-error: couldn't connect to host.
Parsoid is not running, or $wgVirtualRestConfig['modules']['parsoid']['url'] is not set correctly
parsoidserver-http-curl-error: Failed to connect to ....: Permission denied.
Can be caused by a cURL request on a Security-Enhanced Linux (SELinux, like CentOS) to a non standard port like 8000 in the example configuration above, see http://www.akashif.co.uk/php/curl-error-7-failed-to-connect-to-permission-denied and https://www.centos.org/forums/viewtopic.php?f=47&t=53223&p=225372#p225372
parsoidserver-http-not-acceptable: 406
Caused by Parsoid 0.9 enforcing clients to return a 1.6.0 and greater HTML version string in the header. This most likely affects Debian users as they are using slightly older MediaWiki versions with MediaWiki's Parsoid APT repository. This can be fixed by either downgrading to 0.8 (not easy as 0.8 no longer exists in the repository) or by editing /usr/lib/parsoid/src/lib/config/ParsoidConfig.js so that ParsoidConfig.prototype.strictAcceptCheck = false;. The latter will be overwritten on any package upgrade, so it is up to the administrator to lock the package and keep on top of updates manually.
parsoidserver-http-not-found: 404 (or timeout)
Caused by wrong path to MediaWiki API endpoint. Set correct url to the right path to api.php in Parsoid's localsettings.js config file. If you have set up following the recommendations, your API path would be "http://localhost/w/api.php". Add this API path to "localsettings.js" like "parsoidConfig.setMwApi({uri: 'http://localhost/w/api.php' });".

References

[edit]

Development documentation

[edit]
  • VisualEditor/Gadgets - non formal guide for hacking VisualEditor. Includes code snippets and other information useful to gadget authors (and other custom JS devs).
  • API Documentation - information on some VisualEditor JS classes.