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

@windoc/react

v0.3.14

Published

React bindings for windoc editor

Downloads

2,783

Readme

@windoc/react

React bindings for the Windoc canvas-based document editor. Provides a ready-to-use <Editor /> component with a built-in toolbar, footer, and fully composable architecture.

Installation

yarn add @windoc/react @windoc/core
# or
npm install @windoc/react @windoc/core

Peer Dependencies

{
  "react": ">=18",
  "react-dom": ">=18",
  "lucide-react": ">=0.300.0"
}

Quick Start

import { Editor } from '@windoc/react'
import '@windoc/core/style.css'
import '@windoc/react/style.css'

export default function App() {
  return (
    <Editor
      defaultValue={{ main: [{ value: 'Hello, Windoc!' }] }}
      options={{
        margins: [40, 40, 40, 40],
        placeholder: { data: 'Start typing...' },
      }}
      onReady={(editor) => console.log('Editor ready:', editor)}
      onChange={(data) => console.log('Content changed:', data)}
      className="editor"
      style={{ flex: 1, minHeight: 0, overflow: 'auto' }}
    />
  )
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | defaultValue | EditorData | { main: [] } | Initial document data | | options | EditorOptions | {} | Editor configuration | | onChange | (data: object) => void | — | Content change callback | | onReady | (editor: EditorInstance) => void | — | Editor ready callback | | toolbar | boolean | true | Show built-in toolbar | | footer | boolean | true | Show built-in footer/statusbar | | renderToolbar | ReactNode | — | Custom toolbar replacement | | renderFooter | ReactNode | — | Custom footer replacement | | children | ReactNode | — | Extra content inside EditorProvider | | className | string | 'editor' | CSS class for editor container | | style | CSSProperties | — | Inline style for editor container | | onDrop | (e, editor) => void | — | Drag-and-drop handler |

Composable Architecture

Build your own toolbar or footer by composing individual tool components:

Custom Toolbar

import {
  Editor,
  EditorProvider,
  UndoTool, RedoTool,
  BoldTool, ItalicTool, UnderlineTool,
  FontTool, FontSizeTool,
  LeftAlignTool, CenterAlignTool, RightAlignTool,
  TableTool, ImageTool,
} from '@windoc/react'

function MyToolbar() {
  return (
    <div className="my-toolbar">
      <UndoTool />
      <RedoTool />
      <BoldTool />
      <ItalicTool />
      <UnderlineTool />
      <FontTool />
      <FontSizeTool />
      <LeftAlignTool />
      <CenterAlignTool />
      <RightAlignTool />
      <TableTool />
      <ImageTool />
    </div>
  )
}

export default function App() {
  return (
    <Editor
      toolbar={false}
      renderToolbar={<MyToolbar />}
    />
  )
}

Available Toolbar Tools

| Component | Description | |-----------|-------------| | UndoTool | Undo last action | | RedoTool | Redo last action | | BoldTool | Toggle bold | | ItalicTool | Toggle italic | | UnderlineTool | Toggle underline | | StrikeoutTool | Toggle strikethrough | | ColorTool | Text color picker | | HighlightTool | Background highlight picker | | FontTool | Font family selector | | FontSizeTool | Font size selector | | TitleTool | Heading level selector | | LineHeightTool | Line height selector | | LeftAlignTool | Align left | | CenterAlignTool | Align center | | RightAlignTool | Align right | | JustifyTool | Justify text | | ListTool | Ordered/unordered lists | | TableTool | Insert table | | ImageTool | Insert image | | ColumnTool | Column layout | | SeparatorTool | Horizontal separator | | PageBreakTool | Page break | | WatermarkTool | Watermark settings |

Available Footer Tools

| Component | Description | |-----------|-------------| | CatalogToggleTool | Toggle document catalog/outline | | PageModeTool | Switch page mode | | FooterStatus | Page/word count status | | EditorModeTool | Switch editor mode | | PageScaleMinusTool | Zoom out | | PageScalePercentageTool | Zoom percentage display | | PageScaleAddTool | Zoom in | | PaperSizeTool | Paper size selector | | PaperDirectionTool | Paper orientation | | PaperMarginTool | Paper margin settings | | FullscreenTool | Toggle fullscreen | | EditorOptionTool | Editor options | | WatermarkFooterTool | Watermark toggle |

Hooks

useEditor()

Access the editor instance and selection state from any child component:

import { useEditor } from '@windoc/react'

function MyComponent() {
  const { editorRef, rangeStyle } = useEditor()

  const handleClick = () => {
    editorRef.current?.command.executeBold()
  }

  return (
    <button
      onClick={handleClick}
      className={rangeStyle?.bold ? 'active' : ''}
    >
      Bold
    </button>
  )
}

useFooter()

Access page/document metadata:

import { useFooter } from '@windoc/react'

function StatusBar() {
  const { pageNo, pageSize, wordCount, pageScale } = useFooter()

  return (
    <div>
      Page {pageNo} of {pageSize} | {wordCount} words | {pageScale}%
    </div>
  )
}

Types

import type { EditorInstance, RangeStylePayload, ICatalogItem, IComment } from '@windoc/react'

License

MIT