@raazkhnl/rk-editor-core
v4.6.0
Published
Free open-source headless rich-text Word editor for the web. Built on Tiptap & ProseMirror with first-class DOCX export, true PDF/print, page layout, find & replace, track changes, draggable text boxes, image resize, and Markdown/HTML import-export. Frame
Maintainers
Keywords
Readme
@raazkhnl/rk-editor-core
Headless, framework-agnostic rich-text Word editor engine for the web. Built on Tiptap and ProseMirror — fully MIT-licensed, no paywalled features, no telemetry.
The headless engine for RK Word Editor — a free, open-source Microsoft Word / Google Docs alternative for the web that you can drop into any application: Vanilla JS, React, Vue, Svelte, Angular, Next.js or Web Component.
Why RK Word Editor?
| | RK Word Editor | TinyMCE / Froala | Quill | Lexical |
| --- | :---: | :---: | :---: | :---: |
| MIT, no paid tier | ✅ | ❌ | ✅ | ✅ |
| Real DOCX export with images, tables, lists | ✅ | 💲 paid | ❌ | ❌ |
| True isolated PDF / print pipeline | ✅ | 💲 paid | ❌ | ❌ |
| Page layout (A4/Letter, margins, orientation) | ✅ | 💲 paid | ❌ | ❌ |
| Find & replace with regex | ✅ | 💲 paid | ❌ | ❌ |
| Track changes | ✅ | 💲 paid | ❌ | ❌ |
| Draggable, resizable text boxes | ✅ | ❌ | ❌ | ❌ |
| Image resize handles + drag-and-drop upload | ✅ | ✅ | ❌ | ❌ |
| Headless / framework-agnostic | ✅ | ✅ | ✅ | ✅ |
| Slash commands /heading, /table … | ✅ | ❌ | ❌ | ✅ |
Install
npm install @raazkhnl/rk-editor-coreIf you also want the included Word-style toolbar / menubar / dialogs, install @raazkhnl/rk-editor-ui.
Quick start
import { WordEditor } from '@raazkhnl/rk-editor-core';
const editor = new WordEditor({
element: document.getElementById('editor')!,
initialContent: '<p>Hello, world!</p>',
placeholder: 'Start typing here…',
});
// Format API
editor.format.bold();
editor.format.heading(1);
editor.format.bulletList();
editor.format.insertTable({ rows: 3, cols: 3, withHeaderRow: true });
editor.format.insertTextBox(); // floating, draggable text box
editor.format.setColor('#1d4ed8');
// I/O
await editor.exportDocx('report.docx'); // ✅ Real .docx, opens in Word
editor.printPdf({ pageLayout: { pageSize: 'A4', orientation: 'portrait' }});
editor.exportMarkdown();
editor.exportHtml();
await editor.importFromFile(file); // .docx | .md | .html | .json | .txt
// Collaboration helpers
editor.toggleTrackChanges();
const stop = editor.enableAutoSave('my-doc');
// Stats
editor.getWordCount(); // { words, characters, paragraphs, sentences, pages, readingTimeMinutes }
editor.getTableOfContents(); // [{ level, text, id }]What ships in this package
WordEditorclass — the main façade.CommandManager— high-level format API (bold(),heading(),align(), …).ExportEngine— produces real DOCX with embedded images, hyperlinks, tables, lists (incl. Nepali numbering), task lists, footnotes.toBlob()API for piping the document elsewhere.ImportEngine— DOCX (viamammoth), Markdown (viamarked), HTML, JSON, plain text.PrintEngine— isolated-iframe print → properly paginated PDF via the browser's native dialog. Defaults to A4 portrait.StyleManager,DocumentValidator.- 30+ Tiptap extensions: tables, images with resize handles, multilevel lists, Nepali numbering, footnotes, citations, bibliography, table of contents, math (LaTeX), captions, page breaks, page layout, header/footer, line height, indent, font size, font family, text transform, advanced typography, slash commands (
/heading,/table, …), drag handles, format painter, track changes, find & replace, draggable & resizable text boxes, paste handler, Word keyboard shortcuts, and more.
Framework integrations
// Vanilla
import { WordEditor } from '@raazkhnl/rk-editor-core';
// React
useEffect(() => { const e = new WordEditor({ element: ref.current! }); return () => e.destroy(); }, []);
// Vue
onMounted(() => { editor = new WordEditor({ element: el.value! }); });
// Svelte / Angular / Solid — same pattern: ref → new WordEditor()For a fully-featured drop-in (toolbar + menubar + status bar + outline + dialogs) use @raazkhnl/rk-editor-ui's EditorShell or <rk-word-editor> web component.
Documentation
- Full README on GitHub — examples, theming, API reference
- CHANGELOG
- Issues / Roadmap
License
MIT © RaaZ Khanal. Use it commercially, fork it, vendor it — all without restriction.
