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

@pubpub/editor

v7.3.0-beta.7

Published

PubPub Collaborative Editor

Downloads

36

Readme

PubPub Editor

A stand alone, extensible WSIWYG editor based on ProseMirror.

Usage

npm install @pubpub/editor
import Editor from '@pubpub/editor';

const component = (props)=> {
    return ( 
        <Editor
            /* customNodes: Object of custom nodes. To remove default node,
            override. For example, { image: null, header: null } */
            customNodes={{}}

            /* customMarks: Object of custom marks. To remove default mark,
            override. For example, { strong: null } */
            customMarks={{}}

            /* An object of custom plugins, with key=pluginName and
            value=function. All customPlugins values should be a function,
            which is passed schema and props - and returns a Plugin or
            array of Plugins */
            customPlugins={{}}

            /* An object with nodeName keys and values of objects of
            overriding options. For example:
            nodeOptions = { image: { linkToSrc: false } } */
            nodeOptions={{}}   

            /* An object with needed collaborative properties */   
            collaborativeOptions={{}}

            /* A function that will be called on every editor
            change (cursor and content). Passes up an editorChangeObject
            which is useful for building the interfaces around the editor.
            Also fired on editor initialization. */
            onChange={(changeObject)=>{}}

            /* A function that will be called when the editor 
            fails due to an invalid step, firebase error, or 
            other transaction error. */
            onError={(err)=>{}}

            /* A editor JSON document. */
            initialContent={{}}

            /* A string to show when the editor is empty. */
            placeholder=""

            /* A boolean that will prevent edits to the document when true. */
            isReadOnly={false}

            /* An array of highlights to be shown with the highlights plugin */
            highlights={[]}

            /* A function for finding highlight content when pasted. Used by
            the highlightQuote plugin */
            getHighlightContent={(from, to)=>{}}

            /* A function that will be called for every click within the
            editor */
            handleSingleClick={(view, pos, node, nodePos, event, direct)=>{}}

            /* A function that will be called for every double click within
            the editor */
            handleDoubleClick={(view, pos, node, nodePos, event, direct)=>{}}
        />
    );
}

onChange

{
    /* The current editor view. */
    view: {},

    /* The active selection. */
    selection: {},

    /* The bounding box for the active selection. */
    selectionBoundingBox: {},

    /* The text, prefix, and suffix of the current selection */
    selectedText: {},

    /* If the active selection is of a NodeView, provide the selected node. */
    selectedNode: {},

    /* If the active selection is of a NodeView, provide a function to update the selected node. */
    /* The updateNode function expects an object of attrs as its sole input */
    updateNode: (attrs)=>{},

    /* If the active selection is of a NodeView, provide a function to change the selected node. */
    changeNode: (nodeType, attrs, content)=>{},

    /* The full list of available node insert functions. */
    /* Each insert function expect an object of attrs as */
    /* its sole input. */
    insertFunctions: {},

    /* The full list of menu items, their status, and their click handler. */
    menuItems: [],

    /* The full list of decorations and their bounding boxes */
    decorations: [],

    /* The list of shortcut keys and the text following them. */
    /* Useful for inline insert menus and autocompletes. */
    shortcutValues: {},

    /* activeLink is useful for displaying a link editing interface. */
    activeLink: {},

    /* A boolean indicating whether the collaborative document has fully loaded. */
    /* Will remain false if the collaborative functionality is not used. */
    isCollabLoaded: false

}

Development

To Install and run Storybook

npm install
npm start

Menus

Menus for this editor are to be built by whatever external tool is wrapping the component. Menu buttons should use the following to prevent focus loss:

onMouseDown={(evt)=> {
    evt.preventDefault();
}}