UNPKG

@atlaskit/editor-plugin-extension

Version:

editor-plugin-extension plugin for @atlaskit/editor-core

18 lines 713 B
import { bindKeymapWithCommand, escape } from '@atlaskit/editor-common/keymaps'; import { keymap } from '@atlaskit/editor-prosemirror/keymap'; import { clearEditingContext } from '../editor-commands/commands'; import { getPluginState } from './plugin-factory'; export default function keymapPlugin(applyChange) { const list = {}; bindKeymapWithCommand( // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-non-null-assertion escape.common, (state, dispatch) => { const extensionState = getPluginState(state); if (!extensionState.showContextPanel) { return false; } return clearEditingContext(applyChange)(state, dispatch); }, list); return keymap(list); }