Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import ContentKitEditorComponent from 'ember-content-kit/components/content-kit-editor/component';
  2.  
  3. export default ContentKitEditorComponent.extend({
  4. classNames: "custom",
  5.  
  6. setupEditor() {
  7. const editor = this.get("editor");
  8.  
  9. editor.registerKeyCommand({
  10. modifier: 1, // CMD
  11. str: 'O',
  12. run: () => {
  13. console.log("CMD+O pressed");
  14. }
  15. });
  16. },
  17.  
  18. // can't just do this on didInsertElement
  19. // as the editor is re-created each time mobiledoc changes
  20. // so we need to re-add handlers each time that happens
  21. didRender() {
  22. this._super();
  23. const editor = this.get("editor");
  24. if (this._myLastEditor !== editor) {
  25. this._myLastEditor = editor;
  26. this.setupEditor();
  27. }
  28. }
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement