npm.io
1.2.24 • Published 2d ago

@atlaskit/editor-toolbar-model

Licence
Apache-2.0
Version
1.2.24
Deps
5
Size
50 kB
Vulns
0
Weekly
0

Editor Toolbar Mode

This package enforces a toolbar structure by exposing a simple registry API for components, and providing a react based toolbar model used for rendering an entire toolbar.

Usage

Register toolbar components

import { createComponentRegistry, type RegisterToolbar } from '@atlaskit/editor-toolbar-model';

const registry = createComponentRegistry()

registry.register([
    {
        type: 'toolbar'
        key: 'inline-toolbar'
    } as RegisterToolbar
])

Get all registered components

import { createComponentRegistry } from '@atlaskit/editor-toolbar-model';

const { components } = registry;

console.log(components)

Process all toolbar components

import { ToolbarModel, createComponentRegistry } from '@atlaskit/editor-toolbar-model';


return <ToolbarModel components={registry.components} item={{ type: 'toolbar', key: 'inline-toolbar' }} />