add help window, accessible via `?`
[apps/outliner/.git] / src / client.ts
index d9bb682279dee4c58e00b751ce1cf2fda4845487..c02d2b78bcd67e6bf867a9aaaba548534a41bd28 100644 (file)
@@ -2,6 +2,7 @@ import { Outline, RawOutline } from './outline';
 import { Cursor } from './cursor';
 import keyboardJS from 'keyboardjs';
 import * as rawOutline from './test-data.json';
+import {showHelp} from 'help';
 
 let outlineData = rawOutline;
 if(localStorage.getItem('activeOutline')) {
@@ -21,6 +22,13 @@ function outliner() {
   return document.querySelector('#outliner');
 }
 
+document.getElementById('display-help').addEventListener('click', e => {
+  e.preventDefault();
+  e.stopPropagation();
+
+  showHelp();
+});
+
 // move down
 keyboardJS.withContext('navigation', () => {
   keyboardJS.bind('j', e => {
@@ -50,6 +58,11 @@ keyboardJS.withContext('navigation', () => {
     }
   });
 
+
+  keyboardJS.bind('shift + /', e => {
+    showHelp();
+  });
+
   keyboardJS.bind('k', e => {
     // move cursor up
     // if shift key is held, swap the node with its previous sibling