mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-17 20:51:20 +02:00
fix missing return true for before plugin
This commit is contained in:
@@ -244,7 +244,7 @@ function BeforePlugin() {
|
|||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
||||||
if (editor.props.readOnly) return
|
if (editor.props.readOnly) return true
|
||||||
|
|
||||||
const { state } = change
|
const { state } = change
|
||||||
const { nativeEvent } = event
|
const { nativeEvent } = event
|
||||||
@@ -328,7 +328,7 @@ function BeforePlugin() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onKeyDown(event, data, change, editor) {
|
function onKeyDown(event, data, change, editor) {
|
||||||
if (editor.props.readOnly) return
|
if (editor.props.readOnly) return true
|
||||||
|
|
||||||
const { key } = event
|
const { key } = event
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ function BeforePlugin() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onPaste(event, data, change, editor) {
|
function onPaste(event, data, change, editor) {
|
||||||
if (editor.props.readOnly) return
|
if (editor.props.readOnly) return true
|
||||||
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const d = getEventTransfer(event)
|
const d = getEventTransfer(event)
|
||||||
@@ -416,9 +416,9 @@ function BeforePlugin() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function onSelect(event, data, change, editor) {
|
function onSelect(event, data, change, editor) {
|
||||||
if (isCopying) return
|
if (isCopying) return true
|
||||||
if (isComposing) return
|
if (isComposing) return true
|
||||||
if (editor.props.readOnly) return
|
if (editor.props.readOnly) return true
|
||||||
|
|
||||||
const window = getWindow(event.target)
|
const window = getWindow(event.target)
|
||||||
const { state } = change
|
const { state } = change
|
||||||
@@ -433,7 +433,7 @@ function BeforePlugin() {
|
|||||||
// Otherwise, determine the Slate selection from the native one.
|
// Otherwise, determine the Slate selection from the native one.
|
||||||
else {
|
else {
|
||||||
let range = findRange(native, state)
|
let range = findRange(native, state)
|
||||||
if (!range) return
|
if (!range) return true
|
||||||
|
|
||||||
const { anchorKey, anchorOffset, focusKey, focusOffset } = range
|
const { anchorKey, anchorOffset, focusKey, focusOffset } = range
|
||||||
const anchorText = document.getNode(anchorKey)
|
const anchorText = document.getNode(anchorKey)
|
||||||
|
Reference in New Issue
Block a user