Add keyboard shortcuts for resizing editors
This commit is contained in:
parent
26c56b13a3
commit
55aac46630
|
|
@ -84,6 +84,8 @@ export class Editor {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{ key: "Alt--", run: () => this.changeWidth(-100) },
|
||||||
|
{ key: "Alt-=", run: () => this.changeWidth(100) },
|
||||||
]);
|
]);
|
||||||
this.view = new EditorView({
|
this.view = new EditorView({
|
||||||
doc: file.rootState.val.doc,
|
doc: file.rootState.val.doc,
|
||||||
|
|
@ -128,6 +130,12 @@ export class Editor {
|
||||||
this.view.focus();
|
this.view.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeWidth(increment: number) {
|
||||||
|
const w = parseInt(window.getComputedStyle(this.view.dom).width, 10);
|
||||||
|
this.view.dom.style.width = (w + increment) + 'px';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
if (this.deleteFn) {
|
if (this.deleteFn) {
|
||||||
this.file.removeEditor(this, this.deleteFn);
|
this.file.removeEditor(this, this.deleteFn);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue