Answered

Add icon to widgetContextMenu

  • 16 April 2020
  • 3 replies
  • 3142 views

Hi everyone! How i can add an application icon to the widgetContextMenu? By looking at the documentation, i tried the following code: miro.onReady(() => {
  miro.initialize({
    extensionPoints: {
      widgetContextMenu: {
        title: 'Hi',
        svgIcon: "<circle cx=\"12\" cy=\"12\" r=\"9\"></circle>",
      }
    }
  })
})

but in console i get the following error

However, I can do it in bottomBar if I replace “widgetContextMenu” with “BottomBar”.

icon

Best answer by Falk Kühnel 16 April 2020, 22:40

View original

3 replies

Userlevel 4
Badge +1

And here’s an example app done by Pavol using such feature, might also be helpful: https://github.com/pavoltanuska/miro-estimate/blob/master/public/index.html#L21-L39

 

Userlevel 2
Badge +2

 

function run() {
miro.initialize({
extensionPoints: {
getWidgetMenuItems: (widgets) => {
return Promise.resolve({
tooltip: 'Hi',
svgIcon: icon24,
onClick: (widgets) => {
console.log('onClick', widgets)
}
})
}
}
})
}

miro.onReady(run)

Try this. Sorry for the formatting, dont get it to work.

Excellent, this is what I needed, thanks a lot!

Reply