Skip to content

RorriMaesu/OpenWord

Repository files navigation

📝 OpenWord

OpenWord is a professional, high-fidelity, client-side word processor built with React, TypeScript, and Tiptap. It simulates a premium Microsoft Word desktop interface directly in your browser, featuring virtual pagination, dynamic margins, a responsive floating ribbon menu, auto-saving, and dark mode support.

🚀 Use Live or Run Locally

  • ⚡ Launch the App Live: You can use the fully featured word processor directly in your browser with zero setup: Use OpenWord Live on GitHub Pages.
  • 💻 Download & Customize: The project is 100% open-source. You can clone the repository, run it locally, adapt the components, or host it yourself under your own domain.

Live Demo Buy Me A Coffee React Version TypeScript Vite License: MIT

OpenWord Workspace Preview - Light Mode

OpenWord Workspace Preview - Dark Mode


🚀 The Value Proposition: 100% Client-Side & Private

Unlike standard cloud word processors, OpenWord is an offline-first, zero-server application.

  • Privacy-First: Your documents are never uploaded to any external server. All text processing, imports, database updates, and document compilation occur directly in your browser sandbox.
  • No Accounts Needed: Start drafting immediately. Your workspace recovers itself automatically on restart using client-side IndexedDB persistence.

✨ Features Breakdown

📁 Page Layout & Print Precision

  • Virtual A4/Letter Pagination: Visual page breaks that automatically calculate paragraph and node heights in real-time, inserting clean page lines exactly like a physical layout.
  • Zoom-Scaled Margin Ruler: Drag-and-drop margin handles to adjust left and right margins dynamically. The cursor tracking scales mathematically to match your current document zoom level.
  • Dynamic Headers & Footers: Set customized running header and footer text zones that automatically overlay relative to page margins.

🎨 Premium Desktop Aesthetics

  • Auto-Collapsing Ribbon: An interactive ribbon toolbar matching Microsoft Word's layout. It collapses into tabs automatically to maximize vertical reading space and slides open on hover.
  • Direct Title Bar Renaming: Edit the document filename directly inside the Windows-styled Title Bar input.
  • Sidebar Navigation Outline: Auto-updating outline list based on heading tags to navigate large documents quickly.
  • Aesthetic Theme Selector: Seamless light-to-dark canvas transition via the bottom Status Bar.

🤖 Local Offline OpenWord AI

  • Zero-Server Offline Collaboration: Connects directly to a local Ollama instance running Gemma, Llama, Qwen, or other models to assist with drafting, rewriting, and expanding.
  • Dual Document-Editing Modes:
    • Direct Edit Mode (Real-Time): Streams AI edits directly into the document editor in real-time using a cursor-stable block shifter.
    • Proposal Mode (Visual Diff): Streams changes to a sidebar visual diff card (rendered with green/red additions/deletions), allowing you to review edits and click Accept & Apply or Reject before mutating the document.
  • Robust XML Tool Actions: Parses structural document actions (<edit_block>, <insert_block>, <delete_block>) dynamically, supporting arbitrary attribute order, spacing, and quote styles.
  • Hardware and OS Profiler: Detects GPU VRAM and OS details at startup to recommend the most optimal model size (e.g., Gemma 2B for lighter GPUs).
  • Speculative MTP Decoding Toggle: Activates speculative token predictions to accelerate output text stream speeds.

🔒 Client-Side Storage & IO

  • IndexedDB Autosave: Background saving to IndexedDB (v2) with an automatic session recovery dialog on startup.
  • Zero-Server Exports: Export documents directly to Microsoft Word .docx format using client-side XML packaging.
  • Mammoth HTML Importer: Import local document formats directly into the editor canvas.

⚙️ Architecture & Data Flow

OpenWord is designed to decouple Tiptap's rich-text events from our React rendering context for fluid editing performance:

                  +----------------------------------+
                  |       Tiptap/ProseMirror         |
                  +----------------------------------+
                                   |
                         (onUpdate Event / JSON)
                                   v
                  +----------------------------------+
                  |    React DocumentContext State   |
                  +----------------------------------+
                     /                            \
      (Debounced 5s Autosave)             (Debounced 150ms Break)
                   /                                \
                  v                                  v
  +-------------------------------+   +-------------------------------+
  |       IndexedDB Storage       |   |  Virtual Pagination Extension |
  |      (Recoverable Session)    |   |     (DOM Height Measure)      |
  +-------------------------------+   +-------------------------------+

📂 Directory Structure

├── public/                 # Static assets (Favicons, screenshots)
├── src/
│   ├── assets/             # Brand logos and SVGs
│   ├── components/         # Workspace UI layout blocks
│   │   ├── Editor/         # Custom extensions and pagination logic
│   │   ├── Ribbon/         # Toolbar operations (Font, spacing, view)
│   │   ├── Ruler/          # Interactive margin ruler
│   │   ├── Sidebar/        # Document navigation outline
│   │   └── StatusBar/      # Page counter, layout toggles, theme switcher
│   ├── context/            # Global Document layout & editing state
│   ├── styles/             # Harmony CSS variables & dark theme tokens
│   ├── utils/              # Exporters, DB helpers, and file system handlers
│   ├── App.tsx             # Application shell
│   └── main.tsx            # App bootstrapping
├── package.json            # Deployment scripts and dependencies
└── vite.config.ts          # Vite build config & subpath routing

🛠️ Getting Started

Prerequisites

Make sure you have Node.js installed.

Installation

  1. Clone the repository:

    git clone https://github.com/RorriMaesu/OpenWord.git
    cd OpenWord
  2. Install dependencies:

    npm install
  3. Start local development server:

    npm run dev

    Open http://localhost:5173 in your browser.

Building for Production

npm run build

This generates a static website inside the dist/ directory.

🗺️ Roadmap

  • Custom margin presets (Narrow, Moderate, Wide).
  • Full Page-Break rendering inside document export (.docx parser compatibility).
  • Custom page dimensions selector (Letter, Legal, Executive, A4).
  • Advanced keyboard shortcuts helper card.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A premium, offline-first document editor powered by an autonomous local AI agent. Connects to Ollama (Llama/Gemma) to autonomously edit paragraphs, delete blocks, or insert headings directly in the editor with real-time visual diff previews.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages