@atlaskit/editor-plugin-width
Version:
Width plugin for @atlaskit/editor-core
28 lines • 835 B
JavaScript
import { createPlugin } from './pm-plugins/main';
import { pluginKey } from './pm-plugins/plugin-key';
import { useResizeWidthObserver } from './ui/hooks/useResizeWidthObserver';
/**
* Width plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
* from `@atlaskit/editor-core`.
*/
export var widthPlugin = function widthPlugin() {
return {
name: 'width',
pmPlugins: function pmPlugins() {
return [{
name: 'width',
plugin: function plugin(_ref) {
var dispatch = _ref.dispatch;
return createPlugin(dispatch);
}
}];
},
getSharedState: function getSharedState(editorState) {
if (!editorState) {
return undefined;
}
return pluginKey.getState(editorState);
},
usePluginHook: useResizeWidthObserver
};
};