mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-28 17:39:57 +02:00
Add support for read-only and non-selectable elements (#5374)
* Add `isElementReadOnly` fix delete while selected fix type while selected fix failing test add tests add e2e test linter fixes add changeset * fix yarn build:next * Add `isSelectable`
This commit is contained in:
@@ -30,7 +30,7 @@ export const jsx = createHyperscript({
|
||||
})
|
||||
|
||||
const withTest = editor => {
|
||||
const { isInline, isVoid } = editor
|
||||
const { isInline, isVoid, isElementReadOnly, isSelectable } = editor
|
||||
|
||||
editor.isInline = element => {
|
||||
return element.inline === true ? true : isInline(element)
|
||||
@@ -40,5 +40,13 @@ const withTest = editor => {
|
||||
return element.void === true ? true : isVoid(element)
|
||||
}
|
||||
|
||||
editor.isElementReadOnly = element => {
|
||||
return element.readOnly === true ? true : isElementReadOnly(element)
|
||||
}
|
||||
|
||||
editor.isSelectable = element => {
|
||||
return element.nonSelectable === true ? false : isSelectable(element)
|
||||
}
|
||||
|
||||
return editor
|
||||
}
|
||||
|
Reference in New Issue
Block a user