How to know if panel is in editing mode?

Hello :slight_smile:
I am creating a Custom Plugin Panel and I need to know when a panel is in editing mode.
Some UI elements of this plugin have to be hidden in editing mode.
I couldn’t find any help in documentation.

  • I’ve read things about AppEvents but I didn’t manage to use it with React.
  • I’ve also tried to use document.location (if it includes “panelEdit”) but it is not updated correctly, there is still one step behind.

Is there any way to retrieve this ?
Thank you very much for your help!

Love Grafana <3

Hello,

You can import urlUtil from @grafana/data and do something like this:

    const params = urlUtil.getUrlSearchParams();
    if (params.editPanel != null) {
        // In edit mode
    }

I used it once in grafana OSS and it should work for plugins too.