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 🙏

© 2026 – Pkg Stats / Ryan Hefner

texditor

v2.0.9

Published

Texditor is a modern block—based text editor that allows you to export data in JSON format.

Readme

Texditor – Visual Block Editor with Full JSON Export Support

npm version License: MIT

Website

Website / Guide / API /

Русская версия

Сайт / Руководство / API /

Texditor is a modern, visual block editor built with TypeScript. It provides a flexible, modular architecture for creating, editing, and managing structured content. All data is stored and exported in pure JSON format, making it easy to integrate, save, and process content programmatically.


Key Features

  • Visual Block-Based Editing: Easily add, remove, and customize blocks (paragraphs, headings, code, galleries, files, etc.) in a user-friendly interface.
  • Full JSON Export Support: All content is stored and exported as clean, structured JSON, ensuring seamless integration with any backend or database.
  • Flexible Architecture: Support for extensions, tools, and actions to expand functionality.
  • Localization: Built-in multi-language support (English, Russian, and more).
  • History Management: Undo/redo functionality with keyboard shortcut support.
  • Event System: Track changes and execute complex operations with commands.
  • Customization: Configure styles, behavior, and appearance through settings.

Quick Start

Installation

npm install texditor

Basic Setup

Include the styles and initialize the editor:

import 'texditor/styles/theme.css'; // Theme variables
import Texditor from 'texditor';

const editor = new Texditor({
  handle: 'texditor', // Target element ID
});
<div id="texditor"></div>

Advanced Configuration

Configure blocks, tools, extensions, and localization:

import Texditor from 'texditor';
import { Paragraph, H1, H2, H3, H4, H5, H6, List, OrderedList, Code, Gallery, Files } from 'texditor/entities/blocks';
import {
  BoldTool,
  ItalicTool,
  LinkTool,
  ClearFormattingTool,
  SubscriptTool,
  SuperscriptTool,
} from 'texditor/entities/tools';
import { Undo, Redo } from 'texditor/entities/extensions';
import { EnLocale, RuLocale } from 'texditor/locales';

const editor = new Texditor({
  handle: 'texditor',

  // Default content (JSON format)
  content: [{ type: 'p', data: ['Start typing...'] }],

  // Localization
  locale: 'en',
  locales: [
    { code: 'en', data: EnLocale },
    { code: 'ru', data: RuLocale },
  ],

  // Blocks
  blocks: [
    Paragraph,
    H1.setup({ placeholder: 'Heading 1' }),
    H2,
    H3,
    List.setup({ sortable: true }),
    OrderedList,
    Code.setup({ search: true }),
    Gallery.setup({
      mimeTypes: ['image/png', 'image/jpeg'],
      multiple: true,
      ajaxConfig: {
        url: '/upload',
        options: { success: (data) => console.log(data) },
      },
    }),
    Files.setup({
      mimeTypes: ['image/png', 'application/pdf'],
      multiple: false,
    }),
  ],

  // Tools
  tools: [BoldTool, ItalicTool, LinkTool, ClearFormattingTool],

  // Extensions
  extensions: [Undo.setup({ visibleTitle: false }), Redo],

  // Actions
  actions: [CreateAction, ConvertAction, DeleteAction, MoveUpAction, MoveDownAction],

  // UI settings
  extensionsFixed: true,
  extensionVisibleTitle: true,
  autofocus: true,

  // Event handlers
  onReady: (evt) => console.log('Editor is ready!'),
  onChange: (evt) => {
    // Get content as JSON
    const content = evt.instance.save();
    console.log('Content changed (JSON):', content);
  },
});

JSON Output Example

All content is exported as structured JSON, where special characters and nested elements are properly formatted:

[
  {
    "type": "h1",
    "data": ["Welcome to Texditor"]
  },
  {
    "type": "p",
    "data": [
      "This is a paragraph with ",
      { "type": "b", "data": ["bold text"] },
      " and ",
      {
        "type": "a",
        "attr": { "href": "https://example.com" },
        "data": ["a link"]
      },
      "."
    ]
  },
  {
    "type": "code",
    "lang": "javascript",
    "data": ["const greet = () => {\n  console.log('Hello, world!');\n};\n\ngreet();"]
  },
  {
    "type": "gallery",
    "style": "grid",
    "data": [
      {
        "url": "/images/sunset.jpg",
        "type": "image/jpeg",
        "caption": "Beautiful sunset",
        "desc": "A photo of a sunset over the mountains"
      },
      {
        "url": "/images/forest.png",
        "type": "image/png",
        "caption": "Green forest",
        "desc": "A lush forest with tall trees"
      }
    ]
  },
  {
    "type": "ul",
    "data": [
      { "type": "li", "data": ["First item"] },
      {
        "type": "li",
        "data": ["Second item with ", { "type": "b", "data": ["bold text"] }]
      },
      {
        "type": "li",
        "data": [
          "Third item with a ",
          {
            "type": "a",
            "attr": { "href": "https://example.com" },
            "data": ["link"]
          }
        ]
      }
    ]
  },
  {
    "type": "ol",
    "data": [
      { "type": "li", "data": ["Step one"] },
      { "type": "li", "data": ["Step two"] },
      { "type": "li", "data": ["Step three"] }
    ]
  },
  {
    "type": "files",
    "data": [
      {
        "url": "/documents/report.pdf",
        "type": "application/pdf",
        "name": "Annual Report.pdf",
        "size": 2450
      }
    ]
  }
]

License

MIT