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

tinymce-word-paste-filter

v0.8.0

Published

Standalone filter for pasted MS Word HTML content; extracted from TinyMCE

Downloads

74,512

Readme

TinyMCE Word Paste Filter (standalone)

Standalone filter for pasted MS Word HTML content; extracted from TinyMCE

npm version npm downloads

What?

This project provides a standalone version of the filter function used by TinyMCE to clean up pasted MS Word content.

Why?

TinyMCE has one of the best implementations of Word cleanup around; they have tackled pernicious problems like restoring list items to actual lists when these arrive as <p> tags with a lot of odd styles and bullet characters. However, TinyMCE is no tiny library, and does not export that capability by itself.

This repo extracts just the Word cleanup capability from TinyMCE, export a sole filter function (and its internal dependencies) into a standalone library much smaller (contributes ~50k if you minify your build) than the full TinyMCE (contribrutes at minimum >400k to your project -- with the internal Word clean function not exposed), published on npm as tinymce-word-paste-filter for easy incorporation into other projects.

How?

import wordFilter from 'tinymce-word-paste-filter';

// if you have incoming pasted Word data in your program...
const awfulWordHTML = '...'; // content here

// clean it up in one step
const cleaned = wordFilter(awfulWordHTML); 

Typescript types are included.

Please note that this is intended to be bundled into browser applications; if running in a node environment for some reason, you'll need to have browser / dom globals (document, navigator, etc) available.

See the brief test under ./test/ and its fixtures.

Building from source, testing

TinyMCE's build process is absolutely monstrous... with countless internal dependencies and remapped paths at every level. In order to pull out the minimal functionality here without all that bloat, the build first uses rollup to shake out the main components needed, then transpiles from there with tsc.

Make sure to update the submodule first.

git submodule update
cd tinymce
yarn install
yarn run build

cd ..
yarn install
yarn run build
yarn run test