mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-13 18:53:59 +02:00
This commit is contained in:
committed by
Ian Storm Taylor
parent
54ecb63f9d
commit
698a88a24f
@@ -1032,7 +1032,7 @@ Transforms.unwrapInlineAtRange = (transform, range, properties, options = {}) =>
|
||||
.toList()
|
||||
|
||||
inlines.forEach((inline) => {
|
||||
const parent = document.getParent(inline.key)
|
||||
const parent = transform.state.document.getParent(inline.key)
|
||||
const index = parent.nodes.indexOf(inline)
|
||||
|
||||
inline.nodes.forEach((child, i) => {
|
||||
|
@@ -0,0 +1,18 @@
|
||||
|
||||
export default function (state) {
|
||||
const { document, selection } = state;
|
||||
const texts = document.getTexts();
|
||||
const first = texts.first();
|
||||
const second = texts.last();
|
||||
const range = selection.merge({
|
||||
anchorKey: first.key,
|
||||
anchorOffset: 0,
|
||||
focusKey: second.key,
|
||||
focusOffset: 0
|
||||
});
|
||||
|
||||
return state
|
||||
.transform()
|
||||
.unwrapInlineAtRange(range, 'link')
|
||||
.apply()
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: ""
|
||||
- kind: inline
|
||||
type: link
|
||||
nodes:
|
||||
- kind: text
|
||||
text: Hello
|
||||
- kind: text
|
||||
text: " "
|
||||
- kind: inline
|
||||
type: link
|
||||
nodes:
|
||||
- kind: text
|
||||
text: world!
|
||||
- kind: text
|
||||
text: ""
|
@@ -0,0 +1,7 @@
|
||||
|
||||
nodes:
|
||||
- kind: block
|
||||
type: paragraph
|
||||
nodes:
|
||||
- kind: text
|
||||
text: "Hello world!"
|
Reference in New Issue
Block a user