Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding button to the tool bars #244

Closed
toddgeist opened this issue Dec 13, 2018 · 5 comments
Closed

Adding button to the tool bars #244

toddgeist opened this issue Dec 13, 2018 · 5 comments
Assignees

Comments

@toddgeist
Copy link

Is there a way to add custom buttons to the toolbar?

Meta-Info Value
ExtProjectId JCCMMN-01
Original Estimation ???h
Remaining Estimation ???h
@kvolkovich-sc
Copy link
Contributor

You can add it as new capability in toolbar context.

Example (sorry for formatting):

let newCapabilityHandler = () => console.log('click');

let newCapability = {
    id: 'my-custom-button',
    icon: { svg: 'hello' },
    label: 'My Custom Button',
    shouldBeAvailable: () => true,
    availableInContexts: ['toolbar'],
    handler: newCapabilityHandler
  };
 
<FileNavigator
...
  capabilities={{
  ...connectorNodeV1.capabilities,
  newCapability
}}
/>

I think it should be enough. If not, you can provide some use case and we'll try to solve this issue together.

@toddgeist
Copy link
Author

toddgeist commented Dec 13, 2018

wow this looks nice. :-)

I'll give it try

@kvolkovich-sc
Copy link
Contributor

Tried code above) Sorry, its not working. Please wait for solution ~30m

@kvolkovich-sc
Copy link
Contributor

kvolkovich-sc commented Dec 14, 2018

I added an example (black bold circle).

screen shot 2018-12-14 at 12 48 39 pm

capabilities={(apiOptions, actions) => ([
        ...(window.connectors.nodeV1.capabilities(apiOptions, actions)),
        ({
          id: 'custom-button',
          icon: {
            svg: '<svg viewBox="0 0 120 120" version="1.1"><circle cx="60" cy="60" r="50"></circle></svg>'
          },
          label: 'Custom Button',
          shouldBeAvailable: () => true,
          availableInContexts: ['toolbar'],
          handler: () => alert('Custom button click')
        })
      ])}

https://demo.core.dev.opuscapita.com/filemanager/master/?currentComponentName=FileNavigator&maxContainerWidth=100%25&showSidebar=true

@toddgeist
Copy link
Author

that worked ! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants