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

@webkom/lego-editor

v2.6.1

Published

A React editor written in TS with slate.js for lego-webapp

Downloads

239

Readme

lego-editor

Build Status npm (scoped) Dependabot Dependencies

Editor made for lego-webapp written with Slate.js

Installation

  • Add the package

    $ yarn add @webkom/lego-editor
  • Import the component in your project

    import Editor from '@webkom/lego-editor'
    // Add the stylesheet
    import '@webkom/lego-editor/dist/style.css'
    // Also add the stylesheet from react-image-crop
    import 'react-image-crop/dist/ReactCrop.css'
    
    const YourComponent = () => (
      <div>
        <Editor placeholder="Let the words flow!"/>
      </div>
    )

Extending the editor

Lego-editor uses Slate.js version 0.81. You can therefore add any plugins as described in this version of Slate. The <Editor /> component accepts the prop plugins, which takes an array of plugins (plugins: (Editor => Editor)[]).

Props

| name | Type | Default | Description | | ------------- | ------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | value | string | | The editors value/default value | | disabled | Boolean | False | Disables the ability to edit the content | | simple | Boolean | False | Removes the toolbar. | | onChange | string => void | | Handler called when the editor value changes. Takes the serialized value | | onBlur | event => void | | Handler called on blur | | onFocus | event => void | | Handler called on focus | | autoFocus | Boolean | False | Enables autoFocus | | placeholder | string | | A placeholder shown when the editor is empty | | imageUpload | Blob => Promise<Record<string,any>> | | A function for uploading images. Should contain src in the promise object. | | plugins | (Editor => Editor)[] | | An array of plugins to load. The first plugin will be applied first (the last one will override any other plugins) | | domParser | string => HTMLDocument | | Custom function that the deserializer will use to parse the input value to a HTML document. Can be useful for environments where the browser API is not available, like Node.js |

See type definitions for more detailed types

Example app

To test out the editor using the development application:

$ yarn dev

Development

Installing dependencies

$ yarn

Building the module

$ yarn build

Linting & formatting

To run the linter & check formatting

$ yarn lint

Formatting with prettier

$ yarn prettier