@atlaskit/editor-plugin-media
Version:
Media plugin for @atlaskit/editor-core
27 lines • 852 B
JavaScript
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
import { pluginFactory } from '@atlaskit/editor-common/utils';
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
import reducer from './reducer';
const pluginKey = new PluginKey('mediaPixelResizingPlugin');
const dest = pluginFactory(pluginKey, reducer, {
onSelectionChanged() {
return {
isPixelEditorOpen: false
};
}
});
const createPluginState = dest.createPluginState;
const createCommand = dest.createCommand;
const getPluginState = dest.getPluginState;
export const createPlugin = ({
dispatch
}) => {
return new SafePlugin({
state: createPluginState(dispatch, {
isPixelEditorOpen: false
}),
key: pluginKey
});
};
export { createCommand, getPluginState };