@stackch/angular-richtext-editor 1.1.0
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 +139 -0
- package/fesm2022/stackch-angular-richtext-editor.mjs +2125 -0
- package/fesm2022/stackch-angular-richtext-editor.mjs.map +1 -0
- package/index.d.ts +248 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<div align="right">
|
|
2
|
+
|
|
3
|
+
Localized docs: see repository root — English, Deutsch, Français, Italiano.
|
|
4
|
+
|
|
5
|
+
</div>
|
|
6
|
+
|
|
7
|
+
# @stackch/angular-richtext-editor
|
|
8
|
+
|
|
9
|
+
Lightweight Angular 20 standalone rich text editor with a reusable toolbar and built‑in i18n.
|
|
10
|
+
|
|
11
|
+
- Range/Selection API for bold/italic/underline (minimal execCommand fallback)
|
|
12
|
+
- Undo/Redo with HTML snapshots and selection restore
|
|
13
|
+
- Clean HTML (removes empty spans/styles)
|
|
14
|
+
- Toolbar component exported for reuse
|
|
15
|
+
- i18n with English defaults and predefined DE/FR/IT bundles
|
|
16
|
+
|
|
17
|
+
## Changelog (English)
|
|
18
|
+
|
|
19
|
+
- 1.0.3 (2025-10-11)
|
|
20
|
+
- Docs: Add inline changelog in README (npm page), remove link to private GitHub
|
|
21
|
+
- 1.0.2 (2025-10-11)
|
|
22
|
+
- Docs: Add Yarn installation examples in README (npm page)
|
|
23
|
+
- 1.0.1 (2025-10-11)
|
|
24
|
+
- Package metadata: English description (no code changes)
|
|
25
|
+
- 1.0.0 (2025-10-11)
|
|
26
|
+
- Initial public release
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# npm
|
|
32
|
+
npm install @stackch/angular-richtext-editor
|
|
33
|
+
|
|
34
|
+
# Yarn (Berry/Classic)
|
|
35
|
+
yarn add @stackch/angular-richtext-editor
|
|
36
|
+
|
|
37
|
+
# Optional: pin to a specific version
|
|
38
|
+
npm install @stackch/angular-richtext-editor@1.1.0
|
|
39
|
+
yarn add @stackch/angular-richtext-editor@1.1.0
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Import the standalone component and bind to a FormControl:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { Component } from '@angular/core';
|
|
48
|
+
import { ReactiveFormsModule, FormControl } from '@angular/forms';
|
|
49
|
+
import { StackchRichtextEditor } from '@stackch/angular-richtext-editor';
|
|
50
|
+
|
|
51
|
+
@Component({
|
|
52
|
+
standalone: true,
|
|
53
|
+
imports: [ReactiveFormsModule, StackchRichtextEditor],
|
|
54
|
+
template: `
|
|
55
|
+
<stackch-richtext-editor
|
|
56
|
+
[showToolbar]="true"
|
|
57
|
+
[fonts]="['Arial, sans-serif', 'Georgia, serif']"
|
|
58
|
+
[fontSizes]="[12, 14, 16, 20, 24]"
|
|
59
|
+
[minHeight]="180"
|
|
60
|
+
[maxHeight]="400"
|
|
61
|
+
[formControl]="content">
|
|
62
|
+
</stackch-richtext-editor>
|
|
63
|
+
|
|
64
|
+
<pre>{{ content.value }}</pre>
|
|
65
|
+
`
|
|
66
|
+
})
|
|
67
|
+
export class DemoComponent {
|
|
68
|
+
content = new FormControl<string | null>('');
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Inputs:
|
|
73
|
+
- `placeholder: string` – placeholder text
|
|
74
|
+
- `showToolbar: boolean` – show toolbar (default: true)
|
|
75
|
+
- `fonts: string[]` – font family list
|
|
76
|
+
- `fontSizes: number[]` – font sizes (px)
|
|
77
|
+
- `height?: number` – fixed height
|
|
78
|
+
- `minHeight: number` – min height (px)
|
|
79
|
+
- `maxHeight?: number` – max height (px)
|
|
80
|
+
- `disabled: boolean` – disabled state
|
|
81
|
+
|
|
82
|
+
Outputs:
|
|
83
|
+
- `valueChange: string` – emitted HTML on changes
|
|
84
|
+
|
|
85
|
+
Note: The component implements `ControlValueAccessor` and works with `formControl`/`ngModel`.
|
|
86
|
+
|
|
87
|
+
## i18n
|
|
88
|
+
|
|
89
|
+
English is the default. Use `config.i18n` for partial overrides or import predefined bundles.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
import { STACKCH_RTE_I18N_DE, STACKCH_RTE_I18N_FR, STACKCH_RTE_I18N_IT } from '@stackch/angular-richtext-editor';
|
|
93
|
+
|
|
94
|
+
cfg = {
|
|
95
|
+
// i18n: undefined, // English defaults
|
|
96
|
+
// i18n: STACKCH_RTE_I18N_DE,
|
|
97
|
+
// i18n: STACKCH_RTE_I18N_FR,
|
|
98
|
+
// i18n: STACKCH_RTE_I18N_IT,
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Customize a few strings:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
cfg = { i18n: { boldTitle: 'Strong', colorsTitle: 'Palette' } };
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Development
|
|
109
|
+
|
|
110
|
+
Build the library:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
ng build stackch-richtext-editor
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Run tests:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
ng test stackch-richtext-editor
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Publish to npm
|
|
123
|
+
|
|
124
|
+
1) Bump version in `projects/stackch-richtext-editor/package.json`
|
|
125
|
+
|
|
126
|
+
2) Build the library:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
ng build stackch-richtext-editor
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
3) Publish from the dist folder:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
cd dist/stackch-richtext-editor
|
|
136
|
+
npm publish --access public
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
For localized documentation (DE/FR/IT), see the repository README files.
|