@codeauradev/ngx-wind-editor 0.0.0-stage → 1.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/LICENSE +21 -0
- package/README.md +89 -2
- package/fesm2022/codeauradev-ngx-wind-editor.mjs +2596 -0
- package/fesm2022/codeauradev-ngx-wind-editor.mjs.map +1 -0
- package/ngx-wind-editor.css +184 -0
- package/package.json +46 -4
- package/types/codeauradev-ngx-wind-editor.d.ts +270 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ngx-wind-editor contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @codeauradev/ngx-wind-editor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
WYSIWYG HTML editor for Angular 22. The chrome is Tailwind CSS v4, and it follows a `dark` class on an ancestor for dark mode.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<wind-editor [(html)]="html" placeholder="Write something…" />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Component, signal } from '@angular/core';
|
|
11
|
+
import { WindEditor } from '@codeauradev/ngx-wind-editor';
|
|
12
|
+
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'app-note',
|
|
15
|
+
imports: [WindEditor],
|
|
16
|
+
template: `<wind-editor [(html)]="html" />`,
|
|
17
|
+
})
|
|
18
|
+
export class Note {
|
|
19
|
+
readonly html = signal('<p>Start writing.</p>');
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`[(html)]` is the serialized document.
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @codeauradev/ngx-wind-editor
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Peer: `@angular/core` `^22`. Tailwind CSS v4 is optional and styles the toolbar.
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
@import "tailwindcss";
|
|
35
|
+
@source "../node_modules/@codeauradev/ngx-wind-editor";
|
|
36
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`@source` lets Tailwind see the utility classes in the component. Document typography and the placeholder ship in the component stylesheet, so the page still reads if you skip Tailwind. Put `class="dark"` on an ancestor to switch the document to dark.
|
|
40
|
+
|
|
41
|
+
## Toolbar
|
|
42
|
+
|
|
43
|
+
`toolbar` picks which buttons appear. A preset name, or a list of ids in the order you want:
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<wind-editor [(html)]="html" toolbar="writing" />
|
|
47
|
+
<wind-editor [(html)]="html" [toolbar]="['bold', 'italic', 'link', 'bullet']" />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Preset | Buttons |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `full` | Every button. This is the default. |
|
|
53
|
+
| `writing` | Paragraph, headings, bold, italic, link, lists, quote, undo, redo |
|
|
54
|
+
| `basic` | Bold, italic, underline, strike, link, lists, undo, redo |
|
|
55
|
+
| `minimal` | Bold, italic, link |
|
|
56
|
+
|
|
57
|
+
Ids: `paragraph`, `h1`, `h2`, `bold`, `italic`, `underline`, `strike`, `code`, `link`, `bullet`, `ordered`, `quote`, `codeblock`, `rule`, `image`, `clear`, `undo`, `redo`, `source`. Unknown ids are ignored. `[showToolbar]="false"` hides the bar entirely.
|
|
58
|
+
|
|
59
|
+
`/` at the start of an empty block opens the block menu. Arrow keys move, Enter applies, Escape cancels. In a code block, Enter inserts a newline and Ctrl/Cmd+Enter starts a paragraph under it.
|
|
60
|
+
|
|
61
|
+
| Shortcut | Action |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| Mod+B / I / U / E | Bold, italic, underline, inline code |
|
|
64
|
+
| Mod+Shift+X | Strikethrough |
|
|
65
|
+
| Mod+K | Link |
|
|
66
|
+
| Mod+Z / Mod+Shift+Z | Undo / redo |
|
|
67
|
+
|
|
68
|
+
Mod is Cmd on macOS and Ctrl elsewhere.
|
|
69
|
+
|
|
70
|
+
## HTML
|
|
71
|
+
|
|
72
|
+
The editor reads and writes a fixed subset: `p`, `h1`–`h3`, `blockquote`, `ul`, `ol`, `li`, `pre`, `code`, `strong`, `em`, `u`, `s`, `a`, `br`, `hr`, `img`. `javascript:` URLs are dropped. Lists are flat.
|
|
73
|
+
|
|
74
|
+
Set the model and the editor replaces its document. Edits write back.
|
|
75
|
+
|
|
76
|
+
## Readonly
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<wind-editor [html]="published" [readonly]="true" [showToolbar]="false" />
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Build this package
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm install
|
|
86
|
+
npm test
|
|
87
|
+
npm run build
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Publish `dist/`. It is an Angular Package Format build (partial compilation).
|