hide toolbar and selection on typing (#289)

closes #288
This commit is contained in:
Taly 2018-07-17 17:14:56 +03:00 committed by GitHub
parent 8696b9cab5
commit f951ceddf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 13 deletions

View file

@ -82,6 +82,7 @@
"Proxy": true,
"Symbol": true,
"$": true,
"_": true
"_": true,
"setTimeout": true
}
}
}

View file

@ -3439,13 +3439,14 @@ var BlockEvents = function (_Module) {
break;
case _.keyCodes.DOWN:
case _.keyCodes.RIGHT:
this.arrowRightAndDownPressed();
this.arrowRightAndDown();
break;
case _.keyCodes.UP:
case _.keyCodes.LEFT:
this.arrowLeftAndUpPressed();
this.arrowLeftAndUp();
break;
default:
this.defaultHandler();
break;
}
}
@ -3561,8 +3562,8 @@ var BlockEvents = function (_Module) {
*/
}, {
key: "arrowRightAndDownPressed",
value: function arrowRightAndDownPressed() {
key: "arrowRightAndDown",
value: function arrowRightAndDown() {
this.Editor.Caret.navigateNext();
this.Editor.Toolbar.close();
}
@ -3571,11 +3572,21 @@ var BlockEvents = function (_Module) {
*/
}, {
key: "arrowLeftAndUpPressed",
value: function arrowLeftAndUpPressed() {
key: "arrowLeftAndUp",
value: function arrowLeftAndUp() {
this.Editor.Caret.navigatePrevious();
this.Editor.Toolbar.close();
}
/**
* Default keydown handler
*/
}, {
key: "defaultHandler",
value: function defaultHandler() {
this.Editor.BlockManager.currentBlock.selected = false;
this.Editor.Toolbar.close();
}
}]);
return BlockEvents;

File diff suppressed because one or more lines are too long

View file

@ -29,15 +29,16 @@ export default class BlockEvents extends Module {
case _.keyCodes.DOWN:
case _.keyCodes.RIGHT:
this.arrowRightAndDownPressed();
this.arrowRightAndDown();
break;
case _.keyCodes.UP:
case _.keyCodes.LEFT:
this.arrowLeftAndUpPressed();
this.arrowLeftAndUp();
break;
default:
this.defaultHandler();
break;
}
}
@ -157,7 +158,7 @@ export default class BlockEvents extends Module {
/**
* Handle right and down keyboard keys
*/
private arrowRightAndDownPressed(): void {
private arrowRightAndDown(): void {
this.Editor.Caret.navigateNext();
this.Editor.Toolbar.close();
@ -166,9 +167,18 @@ export default class BlockEvents extends Module {
/**
* Handle left and up keyboard keys
*/
private arrowLeftAndUpPressed(): void {
private arrowLeftAndUp(): void {
this.Editor.Caret.navigatePrevious();
this.Editor.Toolbar.close();
}
/**
* Default keydown handler
*/
private defaultHandler(): void {
this.Editor.BlockManager.currentBlock.selected = false;
this.Editor.Toolbar.close();
}
}