markdown-wysiwyg-editor 0.3.1 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ## [0.2.3] - 2025-12-18
10
+ ## [0.3.4] - 2026-01-18
11
+
12
+ ### Added
13
+
14
+ - SSG support via `StaticHtmlGenerator`.
15
+
16
+ ## [0.3.3] - 2026-01-18
11
17
 
12
18
  ### Changed
13
19
 
package/README.md CHANGED
@@ -25,24 +25,36 @@ Lightweight Markdown WYSIWYG editor for React, powered by TipTap.
25
25
 
26
26
  ## Installation
27
27
 
28
- This editor is a React component targeting **React 18+ / ReactDOM 18+**.
28
+ > [!WARNING]
29
+ > This package requires **Tailwind CSS v4** or later.
30
+ > It uses v4's CSS-first configuration. If you are using Tailwind v3, you must upgrade.
31
+
32
+ This editor is a React component targeting **React 19+ / ReactDOM 19+**.
29
33
 
30
34
  This package is **Tailwind CSS v4 + shadcn/ui token compatible**. It uses Tailwind utility classes (e.g. `bg-background`, `text-foreground`, `bg-popover`) that are compiled by your host app's Tailwind.
31
35
 
32
36
  ```bash
33
- pnpm add markdown-wysiwyg-editor
37
+ pnpm add markdown-wysiwyg-editor tailwindcss@^4.0.0
34
38
  # or
35
- npm install markdown-wysiwyg-editor
39
+ npm install markdown-wysiwyg-editor tailwindcss@^4.0.0
36
40
  # or
37
- yarn add markdown-wysiwyg-editor
41
+ yarn add markdown-wysiwyg-editor tailwindcss@^4.0.0
38
42
  ```
39
43
 
40
44
  ## Quick Start
41
45
 
42
46
  **⚠️ IMPORTANT**
43
47
 
44
- - **Your app MUST use Tailwind CSS v4** for the editor's utility classes to work.
45
- - **You MUST configure Tailwind to scan this package** (see setup below).
48
+ - **Tailwind CSS v4** is required.
49
+ - **React 19** or later is required.
50
+
51
+ 1. **Import the CSS bundle** in your app's entry point (e.g., `main.tsx`, `App.tsx`, or `index.css`):
52
+
53
+ ```css
54
+ @import "markdown-wysiwyg-editor/dist/bundle.css";
55
+ ```
56
+
57
+ 2. **Use the component**:
46
58
 
47
59
  ```tsx
48
60
  import { useState } from 'react';
@@ -55,51 +67,58 @@ function App() {
55
67
  }
56
68
  ```
57
69
 
58
- ## Essential Setup Steps
70
+ ## CSS Integration Guide
71
+
72
+ Since version 0.3.0, the CSS integration strategy has changed to support Tailwind CSS v4.
73
+
74
+ ### ✅ Recommended: Zero-Config (Pre-built Bundle)
59
75
 
60
- ### 1. Tailwind v4 Configuration (Required)
76
+ Builds are simplified by using the pre-compiled bundle. This file includes:
77
+ - All required Tailwind utilities
78
+ - The default shadcn/ui-compatible theme
79
+ - Core editor styles
80
+ - Dark mode support
61
81
 
62
- Add the following to your project's main CSS file (e.g., `index.css`):
82
+ Just import it once:
83
+
84
+ ```css
85
+ @import "markdown-wysiwyg-editor/dist/bundle.css";
86
+ ```
87
+
88
+ ### 🛠️ Advanced: Custom Tailwind Integration
89
+
90
+ Only use this method if you want to:
91
+ - Share your application's `theme` configuration with the editor.
92
+ - Minimize bundle size by compiling only utilized classes (though the bundle is already optimized).
93
+
94
+ **Requirements:**
95
+ - Tailwind CSS v4 installed in your project.
96
+ - `@tailwindcss/vite` or `@tailwindcss/postcss` configured.
97
+
98
+ In your CSS entry point:
63
99
 
64
100
  ```css
65
101
  @import "tailwindcss";
66
102
 
67
- /* Scan package source for Tailwind classes */
103
+ /* 1. Scan package source for Tailwind classes */
68
104
  @source "./node_modules/markdown-wysiwyg-editor/dist/*.js";
69
105
 
70
- /* Import package theme (optional - provides default light/dark mode) */
106
+ /* 2. Import package theme (Optional: If you have your own theme, skip this) */
71
107
  @import "markdown-wysiwyg-editor/theme.css";
72
108
 
73
- /* Import editor content styles */
109
+ /* 3. Import core editor styles */
74
110
  @import "markdown-wysiwyg-editor/style.css";
75
111
 
76
- /* Map CSS variables to Tailwind v4 theme */
112
+ /* 4. Ensure your theme defines the required shadcn variables (see below) */
77
113
  @theme {
78
114
  --color-background: hsl(var(--background));
79
115
  --color-foreground: hsl(var(--foreground));
80
- --color-card: hsl(var(--card));
81
- --color-card-foreground: hsl(var(--card-foreground));
82
- --color-popover: hsl(var(--popover));
83
- --color-popover-foreground: hsl(var(--popover-foreground));
84
- --color-primary: hsl(var(--primary));
85
- --color-primary-foreground: hsl(var(--primary-foreground));
86
- --color-secondary: hsl(var(--secondary));
87
- --color-secondary-foreground: hsl(var(--secondary-foreground));
88
- --color-muted: hsl(var(--muted));
89
- --color-muted-foreground: hsl(var(--muted-foreground));
90
- --color-accent: hsl(var(--accent));
91
- --color-accent-foreground: hsl(var(--accent-foreground));
92
- --color-destructive: hsl(var(--destructive));
93
- --color-destructive-foreground: hsl(var(--destructive-foreground));
94
- --color-border: hsl(var(--border));
95
- --color-input: hsl(var(--input));
96
- --color-ring: hsl(var(--ring));
97
-
116
+ /* ... map other variables as needed ... */
98
117
  --variant-dark: .dark &;
99
118
  }
100
119
  ```
101
120
 
102
- ### 2. Theming Options
121
+ ### Theming Options
103
122
 
104
123
  #### Option A: Use Package Default Theme
105
124
 
@@ -161,7 +180,7 @@ The editor expects these shadcn-style CSS variables (HSL triplets without `hsl()
161
180
  | `--ring` | `222.2 84% 4.9%` | Focus ring |
162
181
  | `--radius` | `0.5rem` | Border radius |
163
182
 
164
- ### 3. Dark Mode
183
+ ### Dark Mode
165
184
 
166
185
  Dark mode works automatically when you add the `.dark` class to `<html>` or `<body>`:
167
186
 
@@ -171,9 +190,8 @@ document.documentElement.classList.toggle('dark');
171
190
  ```
172
191
 
173
192
  If you imported `theme.css`, dark mode colors are already defined. Otherwise, define them under `.dark` selector in your CSS.
174
- ```
175
193
 
176
- ### 3. Height and Scroll Configuration
194
+ ### Height and Scroll Configuration
177
195
 
178
196
  The editor needs proper height configuration to enable scrolling. Choose one approach:
179
197
 
@@ -213,7 +231,7 @@ The editor needs proper height configuration to enable scrolling. Choose one app
213
231
  />
214
232
  ```
215
233
 
216
- ### 4. Common Issues and Solutions
234
+ ### Common Issues and Solutions
217
235
 
218
236
  #### Issue: Lists not displaying correctly
219
237
 
@@ -461,13 +479,16 @@ import TextAlign from '@tiptap/extension-text-align';
461
479
 
462
480
  ### Styles not loading
463
481
 
464
- ```tsx
465
- import 'markdown-wysiwyg-editor/style.css';
482
+ ```css
483
+ /* Recommended */
484
+ @import "markdown-wysiwyg-editor/dist/bundle.css";
466
485
  ```
467
486
 
468
487
  Ensure the CSS is imported in your app entry.
469
488
 
470
- If the editor content is styled but the toolbar/buttons are not, Tailwind is not generating the required utility classes. Re-check the Tailwind `content` paths and shadcn-compatible theme tokens.
489
+ If using Custom Integration (Advanced) and the toolbar is unstyled:
490
+ - Verify `@source` is pointing correctly to `node_modules/markdown-wysiwyg-editor/dist/*.js`.
491
+ - Check that your `theme.css` imports or `@theme` configuration are correct.
471
492
 
472
493
  ### "ReferenceError: global is not defined"
473
494