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

Add a tab to the "Editor tools" #112

Open
2 tasks
Tracked by #109
josephfusco opened this issue Apr 16, 2024 · 0 comments
Open
2 tasks
Tracked by #109

Add a tab to the "Editor tools" #112

josephfusco opened this issue Apr 16, 2024 · 0 comments
Labels
type: enhancement Improvements to existing functionality

Comments

@josephfusco
Copy link
Member

josephfusco commented Apr 16, 2024

Acceptance Criteria

  • registerEditorToolsTab() exists and is callable by 3rd party plugins
  • Function handles edge cases & invalid input

Technical Details

const { registerEditorToolsTab } = WPGRAPHQL_IDE;

registerEditorToolsTab( 'my-editor-tools-tab', {
  title: 'My Tab',
  label: 'My tab does x, y and z',
  icon: () => {}, // name of icon from supported icon library or custom Icon component
  content: () => {} // callback for the content panel that opens when this tab is active
} );

If we were to use this API for document settings, it might look like this:

const { registerEditorToolsTab } = WPGRAPHQL_IDE;

registerEditorToolsTab( 'document-settings', {
  title: 'Document Settings',
  label: 'Edit settings related to this query document',
  icon: () => <SettingsIcon />,
  content: () => <DocumentSettingsFormOrWhatever />
});

Image

The list of tabs should be maintained in the Redux store, so registering a editor utility tab should modify the list of editor utility tabs in the Redux store. Similar when you call registerBlockType in Gutenberg.

Reference

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvements to existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant