5.0.0-alpha.03550d1c • Published 8 years ago

@slate-editor/italic-plugin v5.0.0-alpha.03550d1c

Weekly downloads
235
License
MIT
Repository
github
Last release
8 years ago

SlateJS - Italic Plugin

The goal of this plugin is to offers an easy handling of SlateJS italic mark node content editable. Providing a simple API and easy usage, basing on concept of plugin-centric by SlateJS framework.

Usage

SlateJS Italic Plugin

import React, { Component } from 'react'
import ItalicPlugin from 'slate-italic-plugin'

const plugins = [
  ItalicPlugin()
]

class SlateEditor extends Component {
  onChange(state) {
    this.setState({ state })
  }
  render() {
    return (
      <Editor
        plugins={plugins}
        state={this.state.state}
        onChange={this.onChange.bind(this)}
      />
    )
  }
}

SlateJS Italic Plugin Button

import React, { Component } from 'react'
import { ItalicButton } from 'slate-italic-plugin'

class SlateEditor extends Component {
  onChange(state) {
    this.setState({ state })
  }
  render() {
    return (
      <div className="editor--toolbar">
        <ItalicButton
          state={this.state.state}
          onChange={this.onChange.bind(this)}
        />
      </div>
    )
  }
}

Keyboard Shortcut

PlatformShortcut
Apple Logo+i
Windows Logo^+i

API

TargetDescription
ItalicMarkComponent that holds the html that will wrap the content with italic style.
ItalicKeyboardShortcutKeyboard shortcut file that manipulates onKeyDown event inside SlateJS.
ItalicUtilsGeneric file that holds the util common functions.
ItalicButtonButton component that have behaviour to wrap content with italic style.

TODO

  • Make keyboard shortcut accepts customization