Migration

Since the new middleware completely replaces the old blackbox, it should be migrated to the new version. This can easily happen during the installation, for this only an environment variable must be set during the installation of the package.

Changes in comparison with the blackbox

At first glance, not much has changed compared to the black box. However, a closer look reveals many differences:

  • A hook system which allows to intervene in all relevant places via JavaScript.
  • Validation of entities (also when XSDs are used)
  • Transformation of entities so that they can be used as plain text / elements in the editor, but are saved as entities.
  • Parameters of the API are validated
  • Detailed logging on different levels
  • Complete refactoring of the code so that the middleware runs even more reliably
  • Possibility of temporary formatting (If the RawEditor is used)

Automatic migration

The middleware contains a script that updates the old configuration xeblackbox.config.js to the new configuration xemiddleware.config.mjs.

cd /path/to/config/folder # Should contain the package.json and xeblackbox.config.js
XEDITOR_MIDDLEWARE_AUTOUPGRADE=true npm install @xeditor/middleware

or by using the script itself:

cd /path/to/config/folder # Should contain the package.json and xeblackbox.config.js
node ./node_modules/@xeditor/middleware/scripts/migrate_from_xeblackbox.js