$ show kindsoft/kindeditor
KindEditor is a client-side, WYSIWYG HTML editor library written in vanilla JavaScript. It replaces standard <textarea> elements with a rich text editing interface featuring a toolbar, iframe-based design mode, undo/redo stack, and a plugin system for extensibility. The architecture is built around custom DOM abstractions (KNode, KRange) that normalize cross-browser differences (IE6+, Firefox, WebKit, Opera), a widget system (KWidget, KDialog, KMenu) for UI components, and a built-in event system. The editor supports image/table/link insertion, multi-image Flash upload (SWFUpload), HTML sanitization, and MS Word paste cleanup -- all configurable through a central options object. Despite its full feature set and well-documented API, the project has been explicitly abandoned by its maintainers as stated in the README, with no upgrades planned. The codebase is heavily weighted toward legacy browser workarounds, uses an outdated build system (Grunt 0.4.1), bundles deprecated third-party libraries (SWFUpload, Firebug Lite, QUnit v1.x), and exhibits security risks (eval usage in JSON parsing). It remains functional for modern browsers but carries significant technical debt, making it unsuitable for new projects without heavy modernization.
The LLM identified 3 files worth highlighting for reuse:
Contains pure-function utilities for HTML cleaning and formatting: _formatHtml performs recursive whitelist-based tag filtering and attribute normalization, _clearMsWord strips Microsoft Word cruft (styles, comments, invalid markup), and _formatUrl resolves relative to absolute URLs or applies protocol prefixes. These functions operate on raw HTML strings without DOM dependencies, making them directly extractable into any JavaScript project needing robust HTML sanitization.
Implements KRange, an independent wrapper around DOM Range/Selection that normalizes cross-browser differences. Provides methods for selecting nodes, collapsing, enclosing, extracting contents, and creating bookmarks (serializable markers for undo/redo). The class is self-contained and thoroughly unit-tested (over 200 assertions), demonstrating careful boundary coverage. Can be extracted as a shared DOM range utility for rich text applications.
Defines KUploadButton, a reusable widget that handles file uploads using a transparent iframe fallback for browsers without XMLHttpRequest Level 2 support. Encapsulates form construction, iframe communication, progress simulation, and callback management. The component depends only on KWidget and KNode (both internal but structurally simple) and can be repurposed as a standalone upload button for legacy file upload scenarios.