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

@phuong-tran-redoc/document-engine-core

v0.0.41

Published

Framework-agnostic core library for Document Engine

Downloads

868

Readme

document-engine-core

npm core License

A framework-agnostic document editor core library built on top of Tiptap and ProseMirror. This library provides the foundation for building rich-text editors with custom business logic and extensions.


🎯 Overview

document-engine-core is the heart of the Document Engine system. It contains all the business logic, custom extensions, and editor functionality in a framework-agnostic manner, making it reusable across different frameworks (Angular, React, Vue, etc.).

Key Features

  • Framework-Agnostic: Pure TypeScript implementation, no framework dependencies
  • Business-Focused Extensions:
    • Dynamic Fields: Support for placeholder fields like {{customer_name}}
    • Restricted Editing: Control which parts of documents can be edited
    • Custom Nodes: Business-specific document nodes and marks
  • Built on Proven Technology: Leverages Tiptap and ProseMirror for robust editing
  • JSON-based Data Model: Documents are represented as structured JSON, not raw HTML
  • TypeScript-First: Full type safety and IntelliSense support
  • Extensible Architecture: Easy to add custom extensions and plugins

📦 Installation

⚠️ This is a private package. Please contact an authorized person to install it.

npm install @phuong-tran-redoc/document-engine-core
# or
pnpm add @phuong-tran-redoc/document-engine-core

Peer Dependencies

{
  "@tiptap/core": "^2.x.x",
  "@tiptap/pm": "^2.x.x"
}

🚀 Quick Start

Basic Usage

import { Editor } from '@tiptap/core';
import { DocumentEngineExtensions } from '@phuong-tran-redoc/document-engine-core';

// Create an editor instance with Document Engine extensions
const editor = new Editor({
  element: document.querySelector('#editor'),
  extensions: [...DocumentEngineExtensions],
  content: '<p>Hello World!</p>',
});

Working with Dynamic Fields

import { DynamicFieldExtension } from '@phuong-tran-redoc/document-engine-core';

// Insert a dynamic field
editor.commands.insertDynamicField({
  name: 'customer_name',
  label: 'Customer Name',
});

// Get all dynamic fields in the document
const fields = editor.commands.getDynamicFields();

// Replace field values
editor.commands.replaceDynamicFields({
  customer_name: 'John Doe',
  loan_amount: '50000',
});

Restricted Editing

import { RestrictedEditingExtension } from '@phuong-tran-redoc/document-engine-core';

// Mark a region as editable
editor.commands.setEditableRegion();

// Lock the document (only editable regions can be modified)
editor.commands.lockDocument();

// Unlock the document
editor.commands.unlockDocument();

🏗️ Architecture

document-engine-core/
├── extensions/          # Custom Tiptap extensions
│   ├── dynamic-field/   # Dynamic field support
│   ├── restricted/      # Restricted editing
│   └── ...
├── nodes/              # Custom document nodes
├── marks/              # Custom text marks
├── plugins/            # ProseMirror plugins
├── commands/           # Editor commands
├── utils/              # Utility functions
└── types/              # TypeScript type definitions

📚 Core Extensions

Dynamic Fields Extension

Allows inserting placeholder fields that can be replaced with real data.

Features:

  • Insert fields: {{field_name}}
  • List all fields in document
  • Batch replace field values
  • Custom field styling

Restricted Editing Extension

Controls which parts of the document can be edited.

Features:

  • Mark editable regions
  • Lock/unlock document
  • Visual indicators for editable areas
  • Keyboard navigation between editable regions

Custom Table Extension

Enhanced table support for business documents.

Features:

  • Merge/split cells
  • Add/remove rows and columns
  • Table headers
  • Cell styling

(More extensions to be documented)


🔧 Development

Building

Build the library:

nx build document-engine-core

Testing

Run unit tests:

nx test document-engine-core

Linting

Lint the code:

nx lint document-engine-core

🎨 Framework Wrappers

This core library is designed to be wrapped by framework-specific libraries:


📖 Documentation


🔗 Related Resources


👤 Author

Developed by Duc Phuong (Jack)


📄 License

MIT License

See LICENSE.md for full license text.