1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-05 14:57:25 +02:00

fix: extend forward / backward (#2314)

#### Is this adding or improving a _feature_ or fixing a _bug_?

_bug_

#### What's the new behavior?

Fix behavior for <kbd>shift + left</kbd> and <kbd>shift + right</kbd>. Now they will correctly move forward / backward.

#### How does this change work?

turns out that the hotkey `'left'` would also pick up with a modifier key `'shift+left'` so checking for `Hotkeys.isExtendForward()` needs to come before `Hotkeys.isMoveForward()` and it needs to short circuit with `return true`. Likewise for backward.

#### Have you checked that...?

<!-- 
Please run through this checklist for your pull request: 
-->

* [x] The new code matches the existing patterns and styles.
* [x] The tests pass with `yarn test`.
* [x] The linter passes with `yarn lint`. (Fix errors with `yarn prettier`.)
* [x] The relevant examples still work. (Run examples with `yarn watch`.)

#### Does this fix any issues or need any specific reviewers?

Fixes: #2307 
Reviewers: @ianstormtaylor
This commit is contained in:
Eric Edem
2018-10-24 14:50:20 -07:00
committed by Ian Storm Taylor
parent 416590e1de
commit b1073f5672
3 changed files with 5 additions and 9 deletions

View File

@@ -40,7 +40,7 @@
"html-webpack-template": "^6.1.0", "html-webpack-template": "^6.1.0",
"image-extensions": "^1.1.0", "image-extensions": "^1.1.0",
"immutable": "^3.8.1", "immutable": "^3.8.1",
"is-hotkey": "^0.1.1", "is-hotkey": "^0.1.4",
"is-url": "^1.2.2", "is-url": "^1.2.2",
"jsdom": "^11.5.1", "jsdom": "^11.5.1",
"lerna": "^2.7.1", "lerna": "^2.7.1",

View File

@@ -13,7 +13,7 @@
"lib/" "lib/"
], ],
"dependencies": { "dependencies": {
"is-hotkey": "^0.1.3", "is-hotkey": "0.1.4",
"slate-dev-environment": "^0.2.0" "slate-dev-environment": "^0.2.0"
}, },
"scripts": { "scripts": {

View File

@@ -4500,13 +4500,9 @@ is-glob@^4.0.0:
dependencies: dependencies:
is-extglob "^2.1.1" is-extglob "^2.1.1"
is-hotkey@^0.1.1: is-hotkey@0.1.4, is-hotkey@^0.1.4:
version "0.1.1" version "0.1.4"
resolved "https://registry.yarnpkg.com/is-hotkey/-/is-hotkey-0.1.1.tgz#b279a2fd108391be9aa93c6cb317f50357da549a" resolved "https://registry.yarnpkg.com/is-hotkey/-/is-hotkey-0.1.4.tgz#c34d2c85d6ec8d09a871dcf71931c8067a824c7d"
is-hotkey@^0.1.3:
version "0.1.3"
resolved "https://registry.yarnpkg.com/is-hotkey/-/is-hotkey-0.1.3.tgz#8a129eec16f3941bd4f37191e02b9c3e91950549"
is-in-browser@^1.1.3: is-in-browser@^1.1.3:
version "1.1.3" version "1.1.3"