QuantStack / jupyterlab-drawio

A standalone embedding of the FOSS drawio / mxgraph package into jupyterlab
BSD 3-Clause "New" or "Revised" License
599 stars 75 forks source link

Theme issue with toolbar buttons #84

Closed hbcarlos closed 3 years ago

hbcarlos commented 3 years ago

Solves #83, #81

Changed undo and redo buttons for testing. We need to create new icons for the rest of the buttons.

This PR tested if is possible to use CommandToolbarButtonsComponent and solves the issue with theme and toolbar buttons.

hbcarlos commented 3 years ago

Added new icons to support themes. Also changed toolbar buttons to use CommandToolbarButtonComponent. This introduces an issue when the state of the command changes the button doesn't get updated (see screencast).

icons

hbcarlos commented 3 years ago

Issue when using CommandToolbarButtonComponent since doesn't have the option actualOnClick. Some mxClient actions create a modal dialog that gets close when pressing outside the dialog, ToolbarButtons trigers the click event on mouse onMouseDown rather than onClick and this opens and close the modal when pressing the button.

Using a ToolbarButtonComponent we can tell the button to trigger the event with the onClick: https://github.com/QuantStack/jupyterlab-drawio/blob/e9260dd47c0f96fe16a0d5906a542e27f1551705/src/toolbar.tsx#L32

Screencast of the issue: click

SylvainCorlay commented 3 years ago

Merged :) Thanks @hbcarlos !