i2group / notebook-sdk

Create plug-ins that expand and enhance the functionality of the i2 Notebook web client by using the i2 Notebook SDK. The SDK is comprised of documentation, tools, and sample code.
https://i2group.github.io/notebook-sdk/
MIT License
4 stars 1 forks source link

Tool view command icon #19

Closed chriiisiscoding closed 1 month ago

chriiisiscoding commented 1 month ago

We defined a basic tool view command icon like so:

  const toggle = api.commands.createToolViewToggleCommand(
    {
      id: "a5c92695-5811-472e-998a-48fe41195e42",
      name: "Our plugin",
      icon: {
        type: "inlineSvg",
        svg: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="4" /></svg>',
      }, ...

We would like to show a icon instead of a box (rect) or a circle. Is there an icon library that we can access? Or is there a way to bring in icons from elsewhere?

Anthony-Johnson-i2 commented 1 month ago

Hi @chriiisiscoding

I had a chat with development who gave the following information:

We do not supply an icon or image library but you can use your own as shown below.

You can see here that inlineSvg is not the only possible type.

commands.IIcon type

For example:

{
  id: "xxxx",
  name: "Our plugin"
  icon: {
    type: "imageUrl"
    src: "http://url-to-image.png"
  }
}

src is equivalent to the same attribute in <img src="url-to-image.png" />

Cheers

chriiisiscoding commented 1 month ago

Thank you! We will give this a shot.

Anthony-Johnson-i2 commented 1 month ago

Did this work for you @chriiisiscoding ?

chriiisiscoding commented 1 month ago

Yes, thank you!