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 🙏

© 2025 – Pkg Stats / Ryan Hefner

texteditor-lexical

v1.0.23

Published

## Overview

Readme

texteditor-lexical

Overview

texteditor-lexical is a rich-text editor built on top of Lexical. It provides a customizable and lightweight solution for text editing with support for formatting, images, lists, and PDF generation. This editor is designed to be used inside a container with a defined height and will occupy the full width and height of the container.

A rich-text editor built on top of Lexical. This editor provides:

  • A customizable and lightweight solution for text editing.
  • Built-in formatting (bold, italic, underline, etc.).
  • Images (inline insertion, drag & drop, and more).
  • Lists and checklists.

Note: This editor is designed to be used inside a container with a defined height (e.g., a flex container). It will automatically expand to fill the full width and height of its parent container.

Installation

npm install texteditor-lexical

Usage

Import Module

import "texteditor-lexical/dist/style.css";
import { LexicalEditor } from "texteditor-lexical";

Basic Example

import { useCallback, useEffect, useState } from "react";
import React from "react";
import "./App.css";
import LexicalEditor from "@opie-software/template-editor";
import { transformHTML } from "./utils";
import { data } from "./data.ts";

function App() {
  const [initContent, setInitContent] = useState("first content");
  const [loadingAutosave, setLoadingAutosave] = useState(false);
  const [currentContent, setCurrrentContent] = useState("");
  const [dataFromForm, setDataFromForm] = useState(data);

  const handleContentChange = useCallback((newContent: string) => {
    setCurrrentContent(newContent);
    setLoadingAutosave(true);
    setTimeout(() => setLoadingAutosave(false), 2000);
  }, []);

  useEffect(() => {
    setDataFromForm(data);
  }, []);

  return (
    <div className="main-wrapper">
      <div className="main-container">
        <LexicalEditor
          initialContent={initContent}
          onContentChange={handleContentChange}
          toolbarHide={false}
          hideBorder={false}
        />
      </div>
    </div>
  );
}

export default App;

Styling Requirements

The editor should be placed inside a container with a defined height to properly render. It will automatically expand to fill the full width and height of the container.

.main-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
.main-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  align-self: stretch;
  overflow: hidden;
  padding: 20px;
}
.main-container * {
  box-sizing: border-box;
}

Props

| Prop | Type | Default | Description | | ----------------- | -------------------------------------- | ----------- | ---------------------------------------------------------------------------------------- | | initialContent | string (optional) | "" | The initial HTML content of the editor. If not provided, the editor starts empty. | | onContentChange | (content: string) => void (optional) | undefined | Callback triggered every time the editor content updates, providing the current content. | | isAutosaving | boolean | false | If true, shows an autosaving indicator. | | toolbarHide | boolean | false | If true, hides the editor toolbar. | | hideBorder | boolean | false | If true, removes the editor border. |

|

toolbarHide and hideBorder Functionality

  • toolbarHide: If true, the editor's toolbar is hidden.
  • hideBorder: If true, the editor's border is removed.

Storybook

Storybook is included to demonstrate the editor's capabilities.

Running Storybook

npm run storybook

License

MIT License.