From 6182059dacf854496053fd8a012f170368ae31a2 Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:31:33 +0200 Subject: [PATCH 01/10] fix(nextjs): load editor and preview highlighting styles --- example/nextjs/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example/nextjs/package.json b/example/nextjs/package.json index df5fd5acb..ed70acccc 100644 --- a/example/nextjs/package.json +++ b/example/nextjs/package.json @@ -3,12 +3,14 @@ "version": "4.2.2", "private": true, "scripts": { - "dev": "next dev --turbopack", + "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { + "@uiw/react-md-editor": "^4.2.2", + "@uiw/react-markdown-preview": "^5.2.0", "next": "15.3.1", "react": "^18.0.0", "react-dom": "^18.0.0" From 1f57621960a912e219cb9b785a8a554fe2eb2ad5 Mon Sep 17 00:00:00 2001 From: hiyouwhatsapp <89997383+hiyouwhatsapp@users.noreply.github.com> Date: Tue, 3 Nov 2026 15:31:36 +0200 Subject: [PATCH 02/10] fix(nextjs): load editor and preview highlighting styles --- README.md | 1231 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1230 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d5cdb23df..99fb6196f 120000 --- a/README.md +++ b/README.md @@ -1 +1,1230 @@ -core/README.md \ No newline at end of file +
+ Special thanks to: +
+
+ + + SubList + +
+ + SubList - Bill Reminder & Renewal Alerts + +

+ +
+
+ +
+ Using my app is also a way to support me: +
+ DockLift: Windows, Here + Zipora: Zip/RAR/7Z Unarchiver + Scap: Screenshot & Markup Edit + Screen Test + Deskmark + Keyzer + Vidwall Hub + VidCrop + Vidwall + Mousio Hint + Mousio + Musicer + Audioer + FileSentinel + FocusCursor + Videoer + KeyClicker + DayBar + Iconed + Menuist + Quick RSS + Quick RSS + Web Serve + Copybook Generator + DevTutor for SwiftUI + RegexMate + Time Passage + Iconize Folder + Textsound Saver + Create Custom Symbols + DevHub + Resume Revise + Palette Genius + Symbol Scribe +
+
+ + + +

+ + react-md-editor logo + +

+ +

+ + Buy me a coffee + + + Follow On X + + + Downloads + + + npm bundle size + + + Coverage Status + +
+ + Build & Deploy + + + Open in unpkg + + + Gitee + + + npm version + +

+ + + +A simple markdown editor with preview, implemented with React.js and TypeScript. This React Component aims to provide a simple Markdown editor with syntax highlighting support. This is based on `textarea` encapsulation, so it does not depend on any modern code editors such as Acs, CodeMirror, Monaco etc. + +### Features + +- 📑 Indent line or selected text by pressing tab key, with customizable indentation. +- ♻️ Based on `textarea` encapsulation, does not depend on any modern code editors. +- 🚧 Does not depend on the [`uiw`](https://github.com/uiwjs/uiw) component library. +- 🚘 Automatic list on new lines. +- 😻 GitHub flavored markdown support. +- 🌒 Support dark-mode/night-mode **@v3.11.0+**. +- 💡 Support [next.js](https://github.com/uiwjs/react-md-editor/issues/52#issuecomment-848969341), [Use examples](#support-nextjs) in [next.js](https://nextjs.org/). +- Line/lines duplication (Ctrl+D) and movement (Alt+UpArrow/DownArrow) **@v3.24.0+**. + +### Quick Start + +```bash +npm i @uiw/react-md-editor +``` + +or + +```bash +yarn add @uiw/react-md-editor +``` + +### Using + +[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/markdown-editor-for-react-izdd6?fontsize=14&hidenavigation=1&theme=dark) +[![Open in Github gh-pages](https://img.shields.io/badge/Open%20In-Github%20gh--pages-blue?logo=github)](https://uiwjs.github.io/react-md-editor/) +[![Open in Gitee gh-pages](https://img.shields.io/badge/Open%20In-Gitee%20gh--pages-blue?logo=web)](https://uiw.gitee.io/react-md-editor/) + +```jsx mdx:preview +import React from "react"; +import MDEditor from '@uiw/react-md-editor'; + +export default function App() { + const [value, setValue] = React.useState("**Hello world!!!**"); + return ( +
+ + +
+ ); +} +``` + +### Headless Mode + +The package exposes the necessary utilities to build a headless markdown editor with your own UI. This example creates a simple textarea that supports markdown keyboard shortcuts and correct handling of newlines. + +```jsx mdx:preview +import React from "react"; +import { + handleKeyDown, + shortcuts, + TextAreaCommandOrchestrator, + getCommands, +} from '@uiw/react-md-editor'; + +export default function App() { + const [value, setValue] = React.useState("**Hello world!!!**"); + const textareaRef = React.useRef(null); + const orchestratorRef = React.useRef(null); + + React.useEffect(() => { + if (textareaRef.current) { + orchestratorRef.current = new TextAreaCommandOrchestrator(textareaRef.current); + } + }, []); + + const onKeyDown = (e) => { + handleKeyDown(e, 2, false); + if (orchestratorRef.current) { + shortcuts(e, getCommands(), orchestratorRef.current); + } + }; + + return ( +