$ show EASYME-md/client
This repository contains the client-side code for EASYME.md, a web-based markdown editor designed for creating and sharing README files. The application features a split-pane interface with a live markdown preview, a customizable toolbar for applying formatting, and functionality to share documents via a unique URL. Built with React, Redux, and Emotion, it demonstrates a well-structured single-page application with clear separation of concerns. The editor uses a textarea for input and leverages the `text-field-edit` library for precise text manipulations, enabling features like inserting text at the cursor position, wrapping selections, and handling keyboard shortcuts for common markdown syntax. State management is handled by Redux Toolkit with Redux Saga for side effects, such as fetching saved documents from a backend API. The application also supports offline drafting via localStorage and sharing via URL hash compression using `lz-string`. Key components include a dynamic toolbar with buttons for bold, italic, lists, tables, and more, each implemented as isolated, reusable components. The utility modules for URL sharing and draft storage are particularly noteworthy for their potential reuse in other projects. Despite some dependencies being slightly outdated, the codebase remains functional and maintainable.
The LLM identified 2 files worth highlighting for reuse:
This module provides a self-contained utility for compressing and decompressing text to enable sharing application state via URL hash. It uses the lz-string library to efficiently encode and decode text, allowing large amounts of data to be stored in a compact URL. The functions are framework-agnostic and can be easily integrated into any web application needing to share state through the URL.
A simple yet robust wrapper around the browser's localStorage API for saving and retrieving user drafts. It handles common edge cases such as storage unavailability (e.g., in private browsing mode) and quota exceeded errors by failing gracefully. The module exports three functions: loadDraft, saveDraft, and clearDraft, making it easy to persist user-generated content across sessions with minimal setup.