1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-04-16 03:12:48 +02:00

Don't import slate-history in slate-react (#4266)

This commit is contained in:
Andrew Herron 2021-06-02 04:22:54 +10:00 committed by GitHub
parent a7e3a18187
commit 411e5a193b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -0,0 +1,5 @@
---
'slate-react': patch
---
Removed accidental bundling of `slate-history` inside `slate-react`

View File

@ -25,7 +25,6 @@
},
"devDependencies": {
"slate": "^0.63.0",
"slate-history": "^0.62.0",
"slate-hyperscript": "^0.62.0"
},
"peerDependencies": {

View File

@ -10,7 +10,6 @@ import {
Path,
} from 'slate'
import getDirection from 'direction'
import { HistoryEditor } from 'slate-history'
import throttle from 'lodash/throttle'
import scrollIntoView from 'scroll-into-view-if-needed'
@ -865,9 +864,10 @@ export const Editable = (props: EditableProps) => {
// hotkeys ourselves. (2019/11/06)
if (Hotkeys.isRedo(nativeEvent)) {
event.preventDefault()
const maybeHistoryEditor: any = editor
if (HistoryEditor.isHistoryEditor(editor)) {
editor.redo()
if (typeof maybeHistoryEditor.redo === 'function') {
maybeHistoryEditor.redo()
}
return
@ -875,9 +875,10 @@ export const Editable = (props: EditableProps) => {
if (Hotkeys.isUndo(nativeEvent)) {
event.preventDefault()
const maybeHistoryEditor: any = editor
if (HistoryEditor.isHistoryEditor(editor)) {
editor.undo()
if (typeof maybeHistoryEditor.undo === 'function') {
maybeHistoryEditor.undo()
}
return