1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-13 10:44:02 +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
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": { "devDependencies": {
"slate": "^0.63.0", "slate": "^0.63.0",
"slate-history": "^0.62.0",
"slate-hyperscript": "^0.62.0" "slate-hyperscript": "^0.62.0"
}, },
"peerDependencies": { "peerDependencies": {

View File

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