npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

slate-editor-icons

v0.12.1

Published

icons for slate editors

Downloads

7

Readme

slate-editor-icons NPM version Build Status Dependency Status

icons (quill-icons) for slate editors

Installation

$ npm install --save slate-editor-icons

Icons support

Blocks

  • Icons.blocks.Blockquote (blockquote)
    • icon: Blockquote
    • default slate type: blockquote
  • Icons.blocks.Heading (heading, <h1/>, <h2/> ..., this is a dropdown menu)
    • icon: Header
    • default slate type: h1 - heading1, h2 - heading2, h3 - heading3, h4 - heading4.
  • Icons.blocks.OlList (<ol/> list)
    • icon: ListOrdered
    • default slate type: list-ol
  • Icons.blocks.UlList (<ul/> list)
    • icon: ListBullet
    • default slate type: list-ul

Inlines

  • Icons.inlines.Link (link <a/>)
    • icon: Link
    • default slate type: link

Marks

  • Icons.marks.Bold (<b/>)
    • icon: Bold
    • default slate type: bold
  • Icons.marks.Code (<code/>)
    • icon: Code
    • default slate type: code
  • Icons.marks.Italic (<i/>)
    • icon: Italic
    • default slate type: italic
  • Icons.marks.StrikeThrough (<s/>)
    • icon: Strike
    • default slate type: strikethrough
  • Icons.marks.Underline (<u/>)
    • icon: Underline
    • default slate type: underline

Usage

Every icons in Icons support are React element, you can use it any where you like in your React component as below.

import React from 'react';
import ReactDOM from 'react-dom';
import {Editor, Raw} from 'slate';
import Icons from 'slate-editor-icons';

const initialState = Raw.deserialize({
  nodes: [
    {
      kind: 'block',
      type: 'paragraph',
      nodes: [
        {
          kind: 'text',
          text: 'A line of text in a paragraph.'
        }
      ]
    }
  ]
}, {terse: true});

const icons = [
  // load marks icons
  Icons.marks.Bold,
  Icons.marks.Italic,
  Icons.marks.Underline,
  Icons.marks.Code,
  Icons.marks.StrikeThrough,
  // load inlines icons
  Icons.inlines.Link,
  // load blocks icons
  Icons.blocks.Heading,
  Icons.blocks.Blockquote,
  Icons.blocks.OlList,
  Icons.blocks.UlList
];

class App extends React.Component {
  // Set the initial state when the app is first constructed.
  state = {
    state: initialState
  }

  render() {
    const {state} = this.state;
    const onChange = state => this.setState({state});

    return (
      <div style={{margin: '50px'}}>
        {icons.map((Type, i) => {
          return React.createElement(Type, {
            key: i,
            state: state,
            onChange: onChange
          });
        })}
        <Editor
          state={state}
          onChange={onChange}
        />
      </div>
    );
  }
}

ReactDOM.render(
  <App/>
, document.getElementById('root'));

example: https://github.com/Canner/slate-editor-icons/blob/master/docs/index.js

Props

| props | type | required | default | description | |-----------|----------|--------------|-------------|------------------| | state | object | true | null | slate state | | onChange | func | true | null | onChange function usually state => this.setState({state}) to update slate state | | icon | string | false | every items have it's own icon see icons support | the icon | type | string | false | every items have it's own type see icons support | slate block, inline, mark type.

Start example server

node devServer.js

Maintainer

chilijung

License

MIT © Canner