Skip to main content

Upgrading to 2.0

Version 2.0 changes how the wheel and touch behave over pan and zoom elements, so that scrolling a page never zooms or moves a diagram by accident. Everything else is new and turned off unless you enable it.

What changed​

Behavior1.x2.0
Plain mouse wheel over an elementZooms the elementScrolls the page and shows a hint
Ctrl (Cmd) + wheel, trackpad pinchZooms the elementZooms the element
One-finger swipe over an element (touch)Pans the elementScrolls the page
Two-finger gesture over an elementPans and zoomsPans and zooms

The defaults behind this are enableWheelZoom: false, enableWheelZoomWithCtrl: true and touchAction: 'pan-x pan-y'.

Keep the 1.x behavior​

docusaurus.config.js
module.exports = {
themeConfig: {
zoom: {
enableWheelZoom: true, // the plain wheel zooms again
touchAction: 'none', // one finger pans again
},
},
};

New in 2.0​

All of these need toolbar.enabled: true.

  • expand.mode: 'modal' opens an element in a full-screen dialog with its own pan and zoom, and the same toolbar as the page. 'inline' (the default) keeps the in-page expand.
  • copy.enabled: true adds a button that copies the source of Mermaid diagrams.
  • The toolbar follows the light and dark theme, is always shown on touch screens, and shows while a button has keyboard focus.

See User Interactions and the Expand and Copy example.