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

subeditor

v0.6.1

Published

An alternative wysiwyg html editor designed for modern and old javascript

Downloads

127

Readme

SubEditor

An alternative wysiwyg html editor designed to bridge the gap between modern and old javascript.

Documentations

subeditor.org

Why SubEditor

This library was first written in 2020 for internal projects, recently rewrite into Typescript. The purpose of SubEditor is to enable old and modern javascript framworks to enbrace a full feature wysiwyg html editor specifically designed with the following features in mind:

  • Drop in replacement for old wysiwyg library with minimum code migrations on both server and client side
  • Stick to real html and dom
  • Available for plain JS and for library like React
  • Expected, customized and normalized behaviors down to every keystroke (by using plugins)
  • Smaller and more clean html output

Features

  • Lightweight, one single bundled file for all scripts, plugins, css and svg (182kb minimized, 44kb minimized & gzipped)
  • All logics and behaviors are written in plugins (inspired by Slatejs)
  • Work with raw selection and range (no browser exeCommand)
  • Full features text, format, table and images
  • Written in Typescript and each plugin is individually tested for quality

Available Plugins

Plugins are a group of event listeners design specifically for alternating contents. Please refer to document plugin section for explaination of each plugin.

  • align: left, right, center, and justify
  • blockquote
  • code
  • color and background color
  • format: h1, h2, h3, h4, h5, h6, paragaph
  • fullscreen
  • horizontal line
  • images (url, upload, directly drop file to content and library) with server side examples
  • indent and outdent
  • url hyperlink
  • ordered list and unordered list
  • paste with clean html
  • remove format
  • table
  • view and edit source
  • text: bold, italic, underline, supscript, and subscript

Install

> npm install subeditor

React Wrapper

> npm install react-subeditor
import SubEditorComponent,{ SubEditor, ChangeEntry, SubEditorEvent, ToolbarItem, SelectionSlimState, SubEditorHTMLElement, SubEditorOption } from 'react-subeditor';

Develop & Unit Test

> git clone https://github.com/ancientec/subeditor
> cd subeditor
> npm install
> npm run build

//open subeditor/tests/index.htm to see all the tests

Usage & Example

<!--quick start in html, minified version is prebuild in dist folder:-->
<script src="dist/subeditor.min.js"></script>
<script>

//can be use on div or textarea
var targetElement = document.querySelector('div#editor');
//or var targetElement = document.querySelector('textarea#content');

//new SubEditor(targetElement, options);
var subeditor = new SubEditor(
      targetElement,  
      {
        onChange : function(change) { changeFn(change);},
        pluginList : ["fullscreen","hr", "color","source","align","text","undo","redo","indent","format","remove_format","link", "paste","list"],
        toolbarList : ["undo","redo","text","format","link","remove_format","indent","outdent","color","backgroundcolor","align","ol","ul","table","hr","source","fullscreen"] 
      });

</script>

Plans

Although it's fairly stable to use this project, I do want to take more time to make it better before making it 1.0:

  • code and document clean up and more organized
  • bug fixes
  • more test coverages
  • more universal or includes more common features

License

MIT