mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 19:01:54 +02:00
fix link example
This commit is contained in:
@@ -83,7 +83,10 @@ class Links extends React.Component {
|
|||||||
const href = window.prompt('Enter the URL of the link:')
|
const href = window.prompt('Enter the URL of the link:')
|
||||||
state = state
|
state = state
|
||||||
.transform()
|
.transform()
|
||||||
.wrapInline('link', new Map({ href }))
|
.wrapInline({
|
||||||
|
type: 'link',
|
||||||
|
data: { href }
|
||||||
|
})
|
||||||
.collapseToEnd()
|
.collapseToEnd()
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
@@ -95,7 +98,10 @@ class Links extends React.Component {
|
|||||||
.transform()
|
.transform()
|
||||||
.insertText(text)
|
.insertText(text)
|
||||||
.extendBackward(text.length)
|
.extendBackward(text.length)
|
||||||
.wrapInline('link', new Map({ href }))
|
.wrapInline({
|
||||||
|
type: 'link',
|
||||||
|
data: { href }
|
||||||
|
})
|
||||||
.collapseToEnd()
|
.collapseToEnd()
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
@@ -123,7 +129,12 @@ class Links extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return transform
|
return transform
|
||||||
.wrapInline('link', { href: data.text })
|
.wrapInline({
|
||||||
|
type: 'link',
|
||||||
|
data: {
|
||||||
|
href: data.text
|
||||||
|
}
|
||||||
|
})
|
||||||
.collapseToEnd()
|
.collapseToEnd()
|
||||||
.apply()
|
.apply()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user