mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-21 14:41:23 +02:00
Added fix for OPT-UP and OPT-DOWN on Firefox
This commit is contained in:
@@ -530,7 +530,7 @@ function Plugin(options = {}) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onKeyDownUp(e, data, state) {
|
function onKeyDownUp(e, data, state) {
|
||||||
if (!IS_MAC || data.isCtrl || !data.isAlt || !data.isShift) return
|
if (!IS_MAC || data.isCtrl || !data.isAlt) return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const {selection, document, focusBlock} = state
|
const {selection, document, focusBlock} = state
|
||||||
const isStart = selection.hasFocusAtStartOf(focusBlock)
|
const isStart = selection.hasFocusAtStartOf(focusBlock)
|
||||||
@@ -539,7 +539,7 @@ function Plugin(options = {}) {
|
|||||||
const selectText = selectBlock.getTextAtOffset(0)
|
const selectText = selectBlock.getTextAtOffset(0)
|
||||||
return state
|
return state
|
||||||
.transform()
|
.transform()
|
||||||
.extendToStartOf(selectText)
|
[data.isShift ? 'extendToStartOf' : 'collapseToStartOf'](selectText)
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ function Plugin(options = {}) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onKeyDownDown(e, data, state) {
|
function onKeyDownDown(e, data, state) {
|
||||||
if (!IS_MAC || data.isCtrl || !data.isAlt || !data.isShift) return
|
if (!IS_MAC || data.isCtrl || !data.isAlt) return
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
const {selection, document, focusBlock} = state
|
const {selection, document, focusBlock} = state
|
||||||
const isEnd = selection.hasFocusAtEndOf(focusBlock)
|
const isEnd = selection.hasFocusAtEndOf(focusBlock)
|
||||||
@@ -570,7 +570,7 @@ function Plugin(options = {}) {
|
|||||||
const selectText = selectBlock.getTextAtOffset(selectBlock.length)
|
const selectText = selectBlock.getTextAtOffset(selectBlock.length)
|
||||||
return state
|
return state
|
||||||
.transform()
|
.transform()
|
||||||
.extendToEndOf(selectText)
|
[data.isShift ? 'extendToEndOf' : 'collapseToEndOf'](selectText)
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user