Skip to content
Snippets Groups Projects
Commit 2ef0403d authored by chris's avatar chris
Browse files

feat: base shortcuts working

parent c06527be
No related branches found
No related tags found
1 merge request!45Develop
......@@ -13,13 +13,12 @@ import {
@injectable()
class ShortCuts {
constructor(config) {
this.schema = config.schema;
this.shortCuts = config.shortCuts;
constructor(plugins, schema) {
this.PmPlugins = plugins;
this.schema = schema;
this.insertBreak = this.insertBreak.bind(this);
this.insertRule = this.insertRule.bind(this);
return keymap(this.createKeyBindings());
}
insertBreak(state, dispatch) {
......@@ -34,6 +33,15 @@ class ShortCuts {
return true;
}
createShortCuts() {
const shortCuts = keymap(this.createKeyBindings());
this.PmPlugins.add("shortcuts", shortCuts);
}
addShortCut() {
/* TODO add shortcut from each package*/
}
createKeyBindings() {
const keys = Object.assign(this.getKeys(), this.shortCuts);
Object.keys(baseKeymap).forEach(key => {
......
......@@ -4,7 +4,20 @@ import ShortCuts from "./ShortCuts";
export default class ShortCutsService extends Service {
name = "ShortCutsService";
boot() {}
boot() {
const shortCuts = this.container.get("ShortCuts");
shortCuts.createShortCuts();
}
register() {}
register() {
const PmPlugins = this.app.PmPlugins;
this.container
.bind("ShortCuts")
.toDynamicValue(() => {
const { schema: { schema } } = this.app;
return new ShortCuts(PmPlugins, schema);
})
.inSingletonScope();
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment