Skip to main content
Answered

Add icon to widgetContextMenu

  • April 16, 2020
  • 3 replies
  • 3156 views

Kirill Hazukov
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”.

Best answer by Falk Kühnel

 

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.

3 replies

Falk Kühnel
Forum|alt.badge.img+2
  • Active Contributor
  • 33 replies
  • Answer
  • April 16, 2020

 

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.


Boris Borodyansky
Mironeer
Forum|alt.badge.img+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

 


Kirill Hazukov
  • Author
  • New Here
  • 1 reply
  • April 17, 2020

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