1
0
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:
Ravi Lamkoti
2023-01-26 05:05:46 +05:30
committed by GitHub
parent e9c9d9f4db
commit c691bb3aae
46 changed files with 159 additions and 126 deletions

View File

@@ -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) {