Skip to content

Instantly share code, notes, and snippets.

@rlivsey
Created October 9, 2015 15:49
Show Gist options
  • Save rlivsey/a7ec502b88b7f41c42f8 to your computer and use it in GitHub Desktop.
Save rlivsey/a7ec502b88b7f41c42f8 to your computer and use it in GitHub Desktop.
import ContentKitEditorComponent from 'ember-content-kit/components/content-kit-editor/component';
export default ContentKitEditorComponent.extend({
classNames: "custom",
setupEditor() {
const editor = this.get("editor");
editor.registerKeyCommand({
modifier: 1, // CMD
str: 'O',
run: () => {
console.log("CMD+O pressed");
}
});
},
// can't just do this on didInsertElement
// as the editor is re-created each time mobiledoc changes
// so we need to re-add handlers each time that happens
didRender() {
this._super();
const editor = this.get("editor");
if (this._myLastEditor !== editor) {
this._myLastEditor = editor;
this.setupEditor();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment