@musaaj/simpleeditor 0.0.1
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 +148 -0
- package/dist/simpleeditor.css +2 -0
- package/dist/simpleeditor.js +47030 -0
- package/dist/types/builtins/blots/chem/constants.d.ts +4 -0
- package/dist/types/builtins/blots/chem/constants.d.ts.map +1 -0
- package/dist/types/builtins/blots/chem/editor.d.ts +4 -0
- package/dist/types/builtins/blots/chem/editor.d.ts.map +1 -0
- package/dist/types/builtins/blots/chem/element.d.ts +3 -0
- package/dist/types/builtins/blots/chem/element.d.ts.map +1 -0
- package/dist/types/builtins/blots/chem/format.d.ts +3 -0
- package/dist/types/builtins/blots/chem/format.d.ts.map +1 -0
- package/dist/types/builtins/blots/image/constants.d.ts +8 -0
- package/dist/types/builtins/blots/image/constants.d.ts.map +1 -0
- package/dist/types/builtins/blots/image/handlers.d.ts +5 -0
- package/dist/types/builtins/blots/image/handlers.d.ts.map +1 -0
- package/dist/types/builtins/blots/image/picker.d.ts +2 -0
- package/dist/types/builtins/blots/image/picker.d.ts.map +1 -0
- package/dist/types/builtins/blots/image/resize.d.ts +2 -0
- package/dist/types/builtins/blots/image/resize.d.ts.map +1 -0
- package/dist/types/builtins/blots/math/constants.d.ts +5 -0
- package/dist/types/builtins/blots/math/constants.d.ts.map +1 -0
- package/dist/types/builtins/blots/math/field.d.ts +5 -0
- package/dist/types/builtins/blots/math/field.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/actions.d.ts +11 -0
- package/dist/types/builtins/blots/table/actions.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/blot.d.ts +3 -0
- package/dist/types/builtins/blots/table/blot.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/cells.d.ts +3 -0
- package/dist/types/builtins/blots/table/cells.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/handlers.d.ts +3 -0
- package/dist/types/builtins/blots/table/handlers.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/menu.d.ts +5 -0
- package/dist/types/builtins/blots/table/menu.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/resize.d.ts +3 -0
- package/dist/types/builtins/blots/table/resize.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/selection.d.ts +22 -0
- package/dist/types/builtins/blots/table/selection.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/state.d.ts +5 -0
- package/dist/types/builtins/blots/table/state.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/theme.d.ts +21 -0
- package/dist/types/builtins/blots/table/theme.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/toolbar.d.ts +8 -0
- package/dist/types/builtins/blots/table/toolbar.d.ts.map +1 -0
- package/dist/types/builtins/blots/table/types.d.ts +2 -0
- package/dist/types/builtins/blots/table/types.d.ts.map +1 -0
- package/dist/types/config.d.ts +6 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/main.d.ts +7 -0
- package/dist/types/main.d.ts.map +1 -0
- package/dist/types/quill-chem-blot.d.ts +5 -0
- package/dist/types/quill-chem-blot.d.ts.map +1 -0
- package/dist/types/quill-div.d.ts +18 -0
- package/dist/types/quill-div.d.ts.map +1 -0
- package/dist/types/quill-image-blot.d.ts +5 -0
- package/dist/types/quill-image-blot.d.ts.map +1 -0
- package/dist/types/quill-math-blot.d.ts +6 -0
- package/dist/types/quill-math-blot.d.ts.map +1 -0
- package/dist/types/quill-table-blot.d.ts +3 -0
- package/dist/types/quill-table-blot.d.ts.map +1 -0
- package/dist/types/quill-textarea.d.ts +57 -0
- package/dist/types/quill-textarea.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# SimpleEditor
|
|
2
|
+
|
|
3
|
+
SimpleEditor ships two web components powered by Quill:
|
|
4
|
+
|
|
5
|
+
- `<quill-textarea>`: editable rich-text surface with toolbar
|
|
6
|
+
- `<quill-div>`: read-only renderer for exported HTML
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
yarn add simpleeditor
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import "simpleeditor";
|
|
18
|
+
import "simpleeditor/style.css";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<quill-textarea value="<p>Hello world</p>" placeholder="Write..."></quill-textarea>
|
|
23
|
+
<quill-div value="<p>Read only preview</p>"></quill-div>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
### `quill-textarea`
|
|
29
|
+
|
|
30
|
+
Attributes:
|
|
31
|
+
|
|
32
|
+
- `value`
|
|
33
|
+
- `placeholder`
|
|
34
|
+
- `name`
|
|
35
|
+
- `disabled`
|
|
36
|
+
- `readonly`
|
|
37
|
+
|
|
38
|
+
Properties:
|
|
39
|
+
|
|
40
|
+
- `value: string` (clean exported HTML)
|
|
41
|
+
- `textValue: string` (plain text)
|
|
42
|
+
|
|
43
|
+
Events:
|
|
44
|
+
|
|
45
|
+
- `valuechange` (bubbles)
|
|
46
|
+
|
|
47
|
+
### `quill-div`
|
|
48
|
+
|
|
49
|
+
Attributes / properties:
|
|
50
|
+
|
|
51
|
+
- `value`
|
|
52
|
+
|
|
53
|
+
Behavior:
|
|
54
|
+
|
|
55
|
+
- Sanitizes input HTML
|
|
56
|
+
- Renders math/chem/table output
|
|
57
|
+
|
|
58
|
+
## React wrapper
|
|
59
|
+
|
|
60
|
+
Use the wrapper components in `examples/react/quill-components.tsx` to avoid handling custom element refs/events in every screen.
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import "simpleeditor";
|
|
66
|
+
import "simpleeditor/style.css";
|
|
67
|
+
import { QuillTextareaReact, QuillDivReact } from "./quill-components";
|
|
68
|
+
import { useState } from "react";
|
|
69
|
+
|
|
70
|
+
export function EditorDemo() {
|
|
71
|
+
const [html, setHtml] = useState("<p>Hello world</p>");
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<>
|
|
75
|
+
<QuillTextareaReact value={html} onChange={setHtml} placeholder="Write..." />
|
|
76
|
+
<QuillDivReact value={html} />
|
|
77
|
+
</>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Theming
|
|
83
|
+
|
|
84
|
+
All component styles live in `src/style.css` and are exposed via CSS variables (`--qt-*`).
|
|
85
|
+
|
|
86
|
+
Global override:
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
quill-textarea.quill-textarea {
|
|
90
|
+
--qt-toolbar-bg: #101828;
|
|
91
|
+
--qt-toolbar-border: #1f2937;
|
|
92
|
+
--qt-button-bg: #111827;
|
|
93
|
+
--qt-button-color: #e5e7eb;
|
|
94
|
+
--qt-editor-bg: #0b1220;
|
|
95
|
+
--qt-editor-border: #1f2937;
|
|
96
|
+
--qt-text-color: #e2e8f0;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Per-instance override:
|
|
101
|
+
|
|
102
|
+
```html
|
|
103
|
+
<quill-textarea
|
|
104
|
+
style="--qt-editor-bg:#fff; --qt-toolbar-bg:#f8fafc; --qt-button-color:#1f2937;"
|
|
105
|
+
></quill-textarea>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
System dark mode:
|
|
109
|
+
|
|
110
|
+
```css
|
|
111
|
+
@media (prefers-color-scheme: dark) {
|
|
112
|
+
quill-textarea.quill-textarea {
|
|
113
|
+
--qt-modal-bg: #0f172a;
|
|
114
|
+
--qt-modal-text: #e2e8f0;
|
|
115
|
+
--qt-table-ui-bg: #0b1220;
|
|
116
|
+
--qt-table-ui-color: #f1f5f9;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Build and Publish
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
yarn build
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Build output:
|
|
128
|
+
|
|
129
|
+
- `dist/simpleeditor.js`
|
|
130
|
+
- `dist/style.css`
|
|
131
|
+
- `dist/types/*.d.ts`
|
|
132
|
+
|
|
133
|
+
`npm publish` will run build automatically via `prepublishOnly`.
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
yarn dev
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Docs
|
|
142
|
+
|
|
143
|
+
- `docs/overview.md`
|
|
144
|
+
- `docs/web-components.md`
|
|
145
|
+
- `docs/quill-api.md`
|
|
146
|
+
- `docs/blots.md`
|
|
147
|
+
- `docs/export-format.md`
|
|
148
|
+
- `docs/faq.md`
|