5.0.0-alpha.c75189d0 ⢠Published 8 years ago
@slate-editor/link-plugin v5.0.0-alpha.c75189d0
SlateJS - Link Plugin
The goal of this plugin is to offers an easy handling of SlateJS link node content editable. Providing a simple API and easy usage, basing on concept of plugin-centric by SlateJS framework.
Usage
SlateJS Link Plugin
import React, { Component } from 'react'
import LinkPlugin from 'slate-link-plugin'
const plugins = [
LinkPlugin()
]
class SlateEditor extends Component {
onChange(state) {
this.setState({ state })
}
render() {
return (
<Editor
plugins={plugins}
state={this.state.state}
onChange={this.onChange.bind(this)}
/>
)
}
}SlateJS Link Plugin Button
import React, { Component } from 'react'
import { LinkButton } from 'slate-link-plugin'
class SlateEditor extends Component {
onChange(state) {
this.setState({ state })
}
render() {
return (
<div className="editor--toolbar">
<LinkButton
state={this.state.state}
onChange={this.onChange.bind(this)}
/>
</div>
)
}
}Keyboard Shortcut
| Platform | Shortcut |
|---|---|
| ā + k | |
| ^ + k |
API
| Target | Description |
|---|---|
| LinkNode | Component that holds the html that will wrap the content with link. |
| LinkKeyboardShortcut | Keyboard shortcut file that manipulates onKeyDown event inside SlateJS. |
| LinkUtils | Generic file that holds the util common functions. |
| LinkButton | Button component that have behaviour to wrap content with link. |
TODO
- Make keyboard shortcut accepts customization;
- Add behaviour to catch onPaste command and identify if it is an url and ask if wants to link it;
5.1.0
8 years ago
5.0.0
8 years ago
5.0.0-alpha.9e6f4feb
8 years ago
5.0.0-alpha.f4219f70
8 years ago
5.0.0-alpha.03550d1c
8 years ago
5.0.0-alpha.c75189d0
8 years ago
5.0.0-alpha.19a19572
8 years ago
5.0.0-alpha.f7181996
8 years ago