@codeauradev/ngx-wind-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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @codeauradev/ngx-wind-editor
|
|
2
2
|
|
|
3
|
-
WYSIWYG HTML editor for Angular 22. The chrome
|
|
3
|
+
WYSIWYG HTML editor for Angular 22. The chrome ships in the component stylesheet, using the same stone and teal palette as Tailwind CSS v4. Dark mode follows a `dark` class on the editor or an ancestor.
|
|
4
4
|
|
|
5
5
|
```html
|
|
6
6
|
<wind-editor [(html)]="html" placeholder="Write something…" />
|
|
@@ -28,15 +28,9 @@ export class Note {
|
|
|
28
28
|
npm install @codeauradev/ngx-wind-editor
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
Peer: `@angular/core` `^22`. Tailwind
|
|
31
|
+
Peer: `@angular/core` `^22`. No extra stylesheet and no Tailwind `@source` entry. Angular adds the component styles when you import `WindEditor`.
|
|
32
32
|
|
|
33
|
-
|
|
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.
|
|
33
|
+
Put `class="dark"` on `<wind-editor>` or an ancestor to switch the toolbar and the document to dark.
|
|
40
34
|
|
|
41
35
|
## Toolbar
|
|
42
36
|
|
|
@@ -73,6 +67,30 @@ The editor reads and writes a fixed subset: `p`, `h1`–`h3`, `blockquote`, `ul`
|
|
|
73
67
|
|
|
74
68
|
Set the model and the editor replaces its document. Edits write back.
|
|
75
69
|
|
|
70
|
+
## Signal forms
|
|
71
|
+
|
|
72
|
+
The editor implements `FormValueControl<string>`. `[formField]` keeps the HTML in sync with the field. `[(html)]` is the same model under its original name.
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import { Component, signal } from '@angular/core';
|
|
76
|
+
import { form, FormField, required } from '@angular/forms/signals';
|
|
77
|
+
import { WindEditor } from '@codeauradev/ngx-wind-editor';
|
|
78
|
+
|
|
79
|
+
@Component({
|
|
80
|
+
selector: 'app-note',
|
|
81
|
+
imports: [FormField, WindEditor],
|
|
82
|
+
template: `<wind-editor [formField]="noteForm.body" />`,
|
|
83
|
+
})
|
|
84
|
+
export class Note {
|
|
85
|
+
private readonly model = signal({ body: '<p></p>' });
|
|
86
|
+
readonly noteForm = form(this.model, (path) => {
|
|
87
|
+
required(path.body);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The field can also push `disabled`, `readonly`, `invalid`, `required`, and `errors`. Leaving the editor marks the field touched. `focus()` focuses the document.
|
|
93
|
+
|
|
76
94
|
## Readonly
|
|
77
95
|
|
|
78
96
|
```html
|