1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-09-09 06:30:40 +02:00

revert #4455 / #4512; fix triple-click by unhanging range with void (#4588)

* revert #4455 / #4512; fix triple-click by unhanging range with void

* added changeset
This commit is contained in:
Jake Donham
2021-10-11 05:15:04 -07:00
committed by GitHub
parent 8e02c65184
commit ae65ae5f71
4 changed files with 25 additions and 63 deletions

View File

@@ -93,6 +93,7 @@ const Image = ({ attributes, children, element }) => {
const focused = useFocused()
return (
<div {...attributes}>
{children}
<div contentEditable={false}>
<img
src={element.url}
@@ -104,7 +105,6 @@ const Image = ({ attributes, children, element }) => {
`}
/>
</div>
{children}
</div>
)
}

View File

@@ -93,7 +93,11 @@ const toggleMark = (editor, format) => {
}
const isBlockActive = (editor, format) => {
const { selection } = editor
if (!selection) return false
const [match] = Editor.nodes(editor, {
at: Editor.unhangRange(editor, selection),
match: n =>
!Editor.isEditor(n) && SlateElement.isElement(n) && n.type === format,
})