MediaWiki-Docker/Extension/VisualEditor

From mediawiki.org

This page instructs you to install Extension:VisualEditor inside MediaWiki-Docker. All commands should be run in the directory where you installed MediaWiki. All mentioned files are also located there.

Install MediaWiki-Docker[edit]

Follow the Quickstart instructions at MediaWiki-Docker page. Once MediaWiki is running and available at http://localhost:8080, then continue with instructions on this page.

Clone the repository and its dependencies[edit]

git clone "https://gerrit.wikimedia.org/r/mediawiki/skins/Vector" skins/Vector

git clone "https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor" extensions/VisualEditor

cd extensions/VisualEditor
git submodule update --init

Modify LocalSettings.php[edit]

If not already there, add this to the end of LocalSettings.php.

wfLoadSkin( 'Vector' );
wfLoadExtension( 'VisualEditor' );

$PARSOID_INSTALL_DIR = 'vendor/wikimedia/parsoid'; # bundled copy
#$PARSOID_INSTALL_DIR = '/my/path/to/git/checkout/of/Parsoid';

// For developers: ensure Parsoid is executed from $PARSOID_INSTALL_DIR,
// (not the version included in mediawiki-core by default)
// Must occur *before* wfLoadExtension()
if ( $PARSOID_INSTALL_DIR !== 'vendor/wikimedia/parsoid' ) {
    // AutoLoader::registerNamespaces was added in MW 1.39
    AutoLoader::registerNamespaces( [
        // Keep this in sync with the "autoload" clause in
        // $PARSOID_INSTALL_DIR/composer.json
        'Wikimedia\\Parsoid\\' => "$PARSOID_INSTALL_DIR/src",
    ] );
}

wfLoadExtension( 'Parsoid', "$PARSOID_INSTALL_DIR/extension.json" );

# Manually configure Parsoid
$wgVisualEditorParsoidAutoConfig = false;
$wgParsoidSettings = [
    'useSelser' => true,
    'rtTestMode' => false,
    'linting' => false,
];
$wgVirtualRestConfig['modules']['parsoid'] = [
    'url' => 'http://host.docker.internal:8080' . $wgScriptPath . '/rest.php',
];

On linux you may need to replace the last line with Docker's internal IP, i.e.

$wgVirtualRestConfig['modules']['parsoid'] = [
    'url' => 'http://172.17.0.1:8080' . $wgScriptPath . '/rest.php',
];

Run maintenance scripts[edit]

docker compose exec mediawiki php maintenance/run.php update.php