1
0
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:
Ian Storm Taylor
2016-08-02 10:33:02 -07:00
parent 197515e096
commit 0eea98d4a9

View File

@@ -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()
} }