axiom-editor 1.0.1 → 1.0.2
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/README.md +127 -0
- package/dist/axiom-editor.cjs +9 -216
- package/dist/axiom-editor.es.js +1180 -38469
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# AxiomEditor
|
|
2
|
+
|
|
3
|
+
A premium, modular narrative architecture block editor built on React, Tiptap, and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
AxiomEditor provides a ready-to-use monolithic editor wrapper while remaining completely modular, allowing developers to construct custom editing layouts by arranging the core providers, toolbars, and canvas elements.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 📝 **Tiptap Core Integration:** Clean, extensible rich-text editing.
|
|
12
|
+
- 🎨 **Themeable Design System:** Easily toggle between dark, light, or custom color schemes using CSS Custom Properties (CSS variables).
|
|
13
|
+
- 🧩 **Modular Architecture:** Arrange toolbars, scroll windows, and modals wherever they fit best in your layout.
|
|
14
|
+
- 🖋️ **Advanced Multi-Color Styling:** Highlight, bold, underline, or strike-through words with custom colors concurrently.
|
|
15
|
+
- 🖼️ **Media Embeds:** Built-in support for YouTube, X (Twitter), Instagram, and inline image uploads.
|
|
16
|
+
- 🤖 **Developer AST Output:** Export and render raw serialized JSON nodes dynamically.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Install the package and its peer dependencies in your React project:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install axiom-editor lucide-react react react-dom
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
Import the editor and its stylesheet, and mount it in your React application:
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import React, { useState } from 'react';
|
|
36
|
+
import { AxiomEditor } from 'axiom-editor';
|
|
37
|
+
import 'axiom-editor/style.css'; // Don't forget to import the CSS!
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
const [content, setContent] = useState('<p>Welcome to AxiomEditor!</p>');
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div style={{ padding: '2rem', background: '#121212' }}>
|
|
44
|
+
<AxiomEditor
|
|
45
|
+
initialContent={content}
|
|
46
|
+
onChange={(json, html) => setContent(html)}
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Custom Theming
|
|
56
|
+
|
|
57
|
+
AxiomEditor is styled using Tailwind classes mapped internally to CSS custom properties. By default, it runs in a sleek dark theme.
|
|
58
|
+
|
|
59
|
+
To change the theme or create your own, simply target the `.axiom-editor-wrapper` selector in your own CSS and override the custom properties:
|
|
60
|
+
|
|
61
|
+
### Example: Light Mode Theme
|
|
62
|
+
```css
|
|
63
|
+
.axiom-editor-wrapper {
|
|
64
|
+
--axiom-bg: #ffffff; /* Editor background */
|
|
65
|
+
--axiom-bg-card: #f4f4f5; /* Dropdown backgrounds */
|
|
66
|
+
--axiom-text: #09090b; /* Main text color */
|
|
67
|
+
--axiom-text-muted: #71717a; /* Subtitles & placeholders */
|
|
68
|
+
--axiom-border: #e4e4e7; /* Borders & dividers */
|
|
69
|
+
--axiom-primary: #ef4444; /* Active highlights & accents */
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Modular UI Composition
|
|
76
|
+
|
|
77
|
+
If you do not want the standard top-toolbar layout, you can arrange the modular components inside the `AxiomEditorProvider` block:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import {
|
|
81
|
+
AxiomEditorProvider,
|
|
82
|
+
AxiomToolbar,
|
|
83
|
+
AxiomContent,
|
|
84
|
+
MediaMenu
|
|
85
|
+
} from 'axiom-editor';
|
|
86
|
+
|
|
87
|
+
function CustomEditor() {
|
|
88
|
+
return (
|
|
89
|
+
<AxiomEditorProvider initialContent="...">
|
|
90
|
+
<div className="my-custom-layout">
|
|
91
|
+
{/* Render editor canvas first, then toolbar on bottom */}
|
|
92
|
+
<AxiomContent />
|
|
93
|
+
<AxiomToolbar />
|
|
94
|
+
<MediaMenu />
|
|
95
|
+
</div>
|
|
96
|
+
</AxiomEditorProvider>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## API Reference
|
|
104
|
+
|
|
105
|
+
### `<AxiomEditor />`
|
|
106
|
+
Out-of-the-box wrapper for ease-of-use.
|
|
107
|
+
- `initialContent`: `string | JSONContent` - Initial document value.
|
|
108
|
+
- `onChange`: `(json: JSONContent, html: string) => void` - Triggers when text changes.
|
|
109
|
+
- `uploadImage`: `(file: File) => Promise<string>` - Async hook for uploading images.
|
|
110
|
+
|
|
111
|
+
### `<AxiomEditorProvider />`
|
|
112
|
+
Manages Tiptap instances and state. Essential for modular composition.
|
|
113
|
+
|
|
114
|
+
### `<AxiomContent />`
|
|
115
|
+
The text editing canvas. Automatically handles text scrolling and caps at 650px.
|
|
116
|
+
|
|
117
|
+
### `<AxiomToolbar />`
|
|
118
|
+
The responsive text formatting and media-insertion toolbar.
|
|
119
|
+
|
|
120
|
+
### `<AxiomJSONRenderer />`
|
|
121
|
+
A fast React component to render serialized Tiptap JSON AST directly to elements.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT © Axiom Editor Team
|