Socket
Socket
Sign inDemoInstall

@slate-editor/font-size-plugin

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slate-editor/font-size-plugin

SlateJS font size mark content editable plugin.


Version published
Weekly downloads
1.3K
increased by11.55%
Maintainers
2
Weekly downloads
 
Created
Source
Nossas Cidades logo Nossas Cidades logo

SlateJS - Font Size Plugin

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

Usage

SlateJS Font Size Plugin
import React, { Component } from 'react'
import FontSizePlugin from 'slate-font-size-plugin'

const plugins = [
  FontSizePlugin()
]

class SlateEditor extends Component {
  onChange(state) {
    this.setState({ state })
  }
  render() {
    return (
      <Editor
        plugins={plugins}
        state={this.state.state}
        onChange={this.onChange.bind(this)}
      />
    )
  }
}
SlateJS Font Size Plugin - Input
import React, { Component } from 'react'
import { FontSizeInput } from 'slate-font-size-plugin'

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

Keyboard Shortcut

PlatformActionShortcut
Apple LogoIncrease+shift+>
Apple LogoDecrease+shift+<
Windows LogoIncreasectrl+shift+>
Windows LogoDecreasectrl+shift+<

API

TargetDescription
FontSizeMarkComponent that holds the html that will wrap the content with font size style.
FontSizeKeyboardShortcutKeyboard shortcut file that manipulates onKeyDown event inside SlateJS.
FontSizeUtilsGeneric file that holds the util common functions.
FontSizeInputInput component that have behaviour to wrap content with font size style.

TODO

  • Make keyboard shortcut accepts customization;
  • Add keyboard shortcut to apply font size to expanded selection;
  • Add keyboard shortcut to remove font size from expanded selection;
  • Add button to apply font size to expanded selection;
  • Add button to remove font size from expanded selection;
  • Add handle to manipulates collapsed selection to remove font size to anchor word;
  • Add behaviour to show which font size have applied to collapsed selection;
  • Add behaviour to show which font size have applied to expanded selection;

FAQs

Package last updated on 20 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc