@atlaskit/editor-plugin-table
Version:
Table plugin for the @atlaskit/editor
34 lines (29 loc) • 2.08 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.tableSelectionKeymapPlugin = tableSelectionKeymapPlugin;
var _keymaps = require("@atlaskit/editor-common/keymaps");
var _keymap = require("@atlaskit/editor-prosemirror/keymap");
var _selection = require("./commands/selection");
function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
var _pluginInjectionApi$a;
var list = {};
var editorSelectionAPI = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.selection;
var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
// Ignored via go/ees005
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, (0, _selection.arrowRightFromTable)(editorSelectionAPI)(), list);
// Ignored via go/ees005
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(0, _keymaps.bindKeymapWithCommand)(_keymaps.moveLeft.common, (0, _selection.arrowLeftFromTable)(editorSelectionAPI)(), list);
(0, _keymaps.bindKeymapArrayWithCommand)(_keymaps.selectColumn, (0, _selection.selectColumns)(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
(0, _keymaps.bindKeymapArrayWithCommand)(_keymaps.selectRow, (0, _selection.selectRows)(editorSelectionAPI, ariaNotifyPlugin, getIntl)(true), list);
// Ignored via go/ees005
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(0, _keymaps.bindKeymapWithCommand)(_keymaps.shiftArrowUp.common, (0, _selection.shiftArrowUpFromTable)(editorSelectionAPI)(), list);
// Ignored via go/ees005
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(0, _keymaps.bindKeymapWithCommand)(_keymaps.selectTable.common, (0, _selection.modASelectTable)(editorSelectionAPI)(), list);
return (0, _keymap.keymap)(list);
}