mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 19:01:54 +02:00
fix: isVoid, isBlock, isInline types (#5254)
* fix: isVoid, isBlock, isInline types * fix: remove isElement check with isEditor
This commit is contained in:
@@ -50,7 +50,7 @@ const MarkdownShortcutsExample = () => {
|
||||
|
||||
const blockEntry = Editor.above(editor, {
|
||||
at: path,
|
||||
match: n => Editor.isBlock(editor, n),
|
||||
match: n => SlateElement.isElement(n) && Editor.isBlock(editor, n),
|
||||
})
|
||||
if (!blockEntry) {
|
||||
return false
|
||||
@@ -88,7 +88,7 @@ const withShortcuts = editor => {
|
||||
if (text.endsWith(' ') && selection && Range.isCollapsed(selection)) {
|
||||
const { anchor } = selection
|
||||
const block = Editor.above(editor, {
|
||||
match: n => Editor.isBlock(editor, n),
|
||||
match: n => SlateElement.isElement(n) && Editor.isBlock(editor, n),
|
||||
})
|
||||
const path = block ? block[1] : []
|
||||
const start = Editor.start(editor, path)
|
||||
@@ -107,7 +107,7 @@ const withShortcuts = editor => {
|
||||
type,
|
||||
}
|
||||
Transforms.setNodes<SlateElement>(editor, newProperties, {
|
||||
match: n => Editor.isBlock(editor, n),
|
||||
match: n => SlateElement.isElement(n) && Editor.isBlock(editor, n),
|
||||
})
|
||||
|
||||
if (type === 'list-item') {
|
||||
@@ -135,7 +135,7 @@ const withShortcuts = editor => {
|
||||
|
||||
if (selection && Range.isCollapsed(selection)) {
|
||||
const match = Editor.above(editor, {
|
||||
match: n => Editor.isBlock(editor, n),
|
||||
match: n => SlateElement.isElement(n) && Editor.isBlock(editor, n),
|
||||
})
|
||||
|
||||
if (match) {
|
||||
|
Reference in New Issue
Block a user