Created
October 9, 2015 15:49
-
-
Save rlivsey/a7ec502b88b7f41c42f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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