Files
architype/EditorHelp.js

130 lines
2.5 KiB
JavaScript
Raw Normal View History

2019-07-10 21:32:52 +00:00
class EditorHelp extends EditorEntryBase {
constructor(id) {
super(id);
2019-07-10 21:32:52 +00:00
this.elem_.classList.add('help');
this.addLine();
this.addText('Navigation');
this.addLine();
this.addKey('←', '↓', '↑', '→');
this.addLine();
this.addKey('h', 'j', 'k', 'l');
this.addLine();
this.addKey('␛', '', '', '⏎');
this.addLine();
this.addLine();
this.addKey('n');
this.addText('Node ');
this.addKey('g');
this.addText('Group');
this.addLine();
this.addKey('i');
this.addText('Link ');
this.addKey('a');
this.addText('Label');
this.addLine();
this.addKey('?');
this.addText('Help ');
2019-07-10 21:32:52 +00:00
this.addLine();
this.addKey('⇧');
this.addText('+');
this.addKey('n');
this.addText('Node above');
this.addLine();
this.addKey('d');
this.addText('Delete ');
this.addLine();
this.addKey('⇧');
this.addText('+');
this.addKey('d');
2019-07-10 21:42:28 +00:00
this.addText('Del after ');
2019-07-10 23:25:27 +00:00
this.addLine();
this.addKey('␣');
this.addText('Highlight ');
2019-07-11 20:08:29 +00:00
this.addLine();
this.addKey('f');
this.addText('Flip link ');
2019-07-11 22:43:18 +00:00
this.addLine();
this.addKey('u');
this.addText('Undo ');
this.addLine();
this.addKey('⇧');
this.addText('+');
this.addKey('u');
this.addText('Redo ');
2019-07-12 03:37:48 +00:00
this.addLine();
this.addKey('m');
this.addText('Next theme ');
2019-07-12 04:55:02 +00:00
this.addLine();
this.addLine();
2019-07-12 22:10:32 +00:00
this.addLink(
'Tutorial',
'https://github.com/firestuff/architype/blob/master/TUTORIAL.md');
2019-07-12 04:55:02 +00:00
this.addLink(
'GitHub',
'https://github.com/firestuff/architype/blob/master/README.md');
2019-07-10 21:32:52 +00:00
}
addLine() {
this.line_ = document.createElement('div');
this.elem_.appendChild(this.line_);
}
addText(text) {
let elem = document.createElement('span');
elem.classList.add('text');
elem.innerText = text;
this.line_.appendChild(elem);
}
addKey(...symbols) {
for (let symbol of symbols) {
let key = document.createElement('div');
key.classList.add('key');
key.innerText = symbol;
this.line_.appendChild(key);
}
}
2019-07-12 04:55:02 +00:00
addLink(text, href) {
let a = document.createElement('a');
a.href = href;
a.innerText = text;
2019-07-12 22:10:32 +00:00
a.target = '_blank';
2019-07-12 04:55:02 +00:00
this.line_.appendChild(a);
}
2019-07-10 21:32:52 +00:00
afterDomAdd() {
this.elem_.focus();
}
serialize() {
return super.serialize({
2019-07-10 21:32:52 +00:00
type: 'help',
});
2019-07-10 21:32:52 +00:00
}
static unserialize(ser) {
return (new EditorHelp(ser.id)).getElement();
2019-07-10 21:32:52 +00:00
}
}