@flogeez/angular-tiptap-editor 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 FloGeez
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 ADDED
@@ -0,0 +1,281 @@
1
+ # NgxTiptapEditor
2
+
3
+ A modern, customizable rich-text editor for Angular applications, built with Tiptap and featuring complete internationalization support.
4
+
5
+ ## 🚀 Features
6
+
7
+ - **Modern Angular**: Built with Angular 19+ and standalone components
8
+ - **Rich Text Editing**: Powered by Tiptap with extensive formatting options
9
+ - **Internationalization**: Full i18n support (English & French) with auto-detection
10
+ - **Customizable**: Highly configurable toolbar, bubble menus, and slash commands
11
+ - **Image Support**: Advanced image handling with resizing and compression
12
+ - **Height Control**: Configurable editor height with scrolling
13
+ - **TypeScript**: Full TypeScript support with strict typing
14
+ - **Accessibility**: Built with accessibility best practices
15
+
16
+ ## 📦 Installation
17
+
18
+ ```bash
19
+ npm install angular-tiptap-editor
20
+ ```
21
+
22
+ ### CSS Styles
23
+
24
+ Add the required CSS to your `angular.json` file in the `styles` array:
25
+
26
+ ```json
27
+ {
28
+ "styles": [
29
+ ...
30
+ "node_modules/angular-tiptap-editor/src/lib/styles/index.css",
31
+ ...
32
+ ]
33
+ }
34
+ ```
35
+
36
+ ## 🎯 Quick Start
37
+
38
+ ### 1. Basic Usage
39
+
40
+ ```typescript
41
+ import { Component } from "@angular/core";
42
+ import { NgxTiptapEditorComponent } from "angular-tiptap-editor";
43
+
44
+ @Component({
45
+ selector: "app-example",
46
+ standalone: true,
47
+ imports: [NgxTiptapEditorComponent],
48
+ template: `
49
+ <ngx-tiptap-editor
50
+ [content]="content"
51
+ (contentChange)="onContentChange($event)"
52
+ />
53
+ `,
54
+ })
55
+ export class ExampleComponent {
56
+ content = "<p>Hello <strong>World</strong>!</p>";
57
+
58
+ onContentChange(newContent: string) {
59
+ this.content = newContent;
60
+ console.log("Content updated:", newContent);
61
+ }
62
+ }
63
+ ```
64
+
65
+ ### 2. With Custom Configuration
66
+
67
+ ```typescript
68
+ import { Component } from "@angular/core";
69
+ import { NgxTiptapEditorComponent } from "angular-tiptap-editor";
70
+
71
+ @Component({
72
+ selector: "app-advanced",
73
+ standalone: true,
74
+ imports: [NgxTiptapEditorComponent],
75
+ template: `
76
+ <ngx-tiptap-editor
77
+ [content]="content"
78
+ [toolbar]="toolbarConfig"
79
+ [bubbleMenu]="bubbleMenuConfig"
80
+ [locale]="'en'"
81
+ [height]="400"
82
+ [showCharacterCount]="true"
83
+ (contentChange)="onContentChange($event)"
84
+ />
85
+ `,
86
+ })
87
+ export class AdvancedComponent {
88
+ content = "<h1>Welcome!</h1><p>Start editing...</p>";
89
+
90
+ toolbarConfig = {
91
+ bold: true,
92
+ italic: true,
93
+ underline: true,
94
+ heading1: true,
95
+ heading2: true,
96
+ bulletList: true,
97
+ orderedList: true,
98
+ link: true,
99
+ image: true,
100
+ };
101
+
102
+ bubbleMenuConfig = {
103
+ bold: true,
104
+ italic: true,
105
+ underline: true,
106
+ link: true,
107
+ };
108
+
109
+ onContentChange(newContent: string) {
110
+ this.content = newContent;
111
+ }
112
+ }
113
+ ```
114
+
115
+ ### 3. With Form Integration
116
+
117
+ ```typescript
118
+ import { Component } from "@angular/core";
119
+ import { FormControl, ReactiveFormsModule } from "@angular/forms";
120
+ import { NgxTiptapEditorComponent } from "angular-tiptap-editor";
121
+
122
+ @Component({
123
+ selector: "app-form",
124
+ standalone: true,
125
+ imports: [NgxTiptapEditorComponent, ReactiveFormsModule],
126
+ template: `
127
+ <form>
128
+ <ngx-tiptap-editor
129
+ [formControl]="contentControl"
130
+ placeholder="Enter your content here..."
131
+ />
132
+ <button type="submit">Submit</button>
133
+ </form>
134
+ `,
135
+ })
136
+ export class FormComponent {
137
+ contentControl = new FormControl("<p>Initial content</p>");
138
+ }
139
+ ```
140
+
141
+ ## 🎨 Demo
142
+
143
+ ### 🌐 Live Demo
144
+
145
+ Try the interactive demo online: **[https://flogeez.github.io/angular-tiptap-editor/](https://flogeez.github.io/angular-tiptap-editor/)**
146
+
147
+ ### 🖥️ Run Locally
148
+
149
+ ```bash
150
+ git clone https://github.com/FloGeez/angular-tiptap-editor.git
151
+ cd angular-tiptap-editor
152
+ npm install
153
+ npm start
154
+ ```
155
+
156
+ Open [http://localhost:4200](http://localhost:4200) to view the demo.
157
+
158
+ ## 📖 Documentation
159
+
160
+ ### API Reference
161
+
162
+ #### Inputs
163
+
164
+ | Input | Type | Default | Description |
165
+ | -------------------- | ------------------ | ------------------- | -------------------------- |
166
+ | `content` | `string` | `""` | Initial HTML content |
167
+ | `placeholder` | `string` | `"Start typing..."` | Placeholder text |
168
+ | `locale` | `'en' \| 'fr'` | Auto-detect | Editor language |
169
+ | `editable` | `boolean` | `true` | Whether editor is editable |
170
+ | `height` | `number` | `undefined` | Fixed height in pixels |
171
+ | `maxHeight` | `number` | `undefined` | Maximum height in pixels |
172
+ | `minHeight` | `number` | `200` | Minimum height in pixels |
173
+ | `showToolbar` | `boolean` | `true` | Show toolbar |
174
+ | `showBubbleMenu` | `boolean` | `true` | Show bubble menu |
175
+ | `showCharacterCount` | `boolean` | `true` | Show character counter |
176
+ | `toolbar` | `ToolbarConfig` | All enabled | Toolbar configuration |
177
+ | `bubbleMenu` | `BubbleMenuConfig` | All enabled | Bubble menu configuration |
178
+
179
+ #### Outputs
180
+
181
+ | Output | Type | Description |
182
+ | --------------- | ----------------- | ------------------------------- |
183
+ | `contentChange` | `string` | Emitted when content changes |
184
+ | `editorCreated` | `Editor` | Emitted when editor is created |
185
+ | `editorFocus` | `{editor, event}` | Emitted when editor gains focus |
186
+ | `editorBlur` | `{editor, event}` | Emitted when editor loses focus |
187
+
188
+ ### Configuration Examples
189
+
190
+ ```typescript
191
+ // Minimal toolbar
192
+ const minimalToolbar = {
193
+ bold: true,
194
+ italic: true,
195
+ bulletList: true,
196
+ };
197
+
198
+ // Full toolbar
199
+ const fullToolbar = {
200
+ bold: true,
201
+ italic: true,
202
+ underline: true,
203
+ strike: true,
204
+ code: true,
205
+ heading1: true,
206
+ heading2: true,
207
+ heading3: true,
208
+ bulletList: true,
209
+ orderedList: true,
210
+ blockquote: true,
211
+ link: true,
212
+ image: true,
213
+ horizontalRule: true,
214
+ undo: true,
215
+ redo: true,
216
+ };
217
+ ```
218
+
219
+ ## 🌍 Internationalization
220
+
221
+ The editor supports English and French with automatic browser language detection:
222
+
223
+ ```typescript
224
+ // Force English
225
+ <ngx-tiptap-editor [locale]="'en'" />
226
+
227
+ // Force French
228
+ <ngx-tiptap-editor [locale]="'fr'" />
229
+
230
+ // Auto-detect (default)
231
+ <ngx-tiptap-editor />
232
+ ```
233
+
234
+ ## 🔧 Development
235
+
236
+ ### Build Library
237
+
238
+ ```bash
239
+ npm run build:lib
240
+ ```
241
+
242
+ ### Watch Mode (Development)
243
+
244
+ ```bash
245
+ npm run dev
246
+ ```
247
+
248
+ This runs the library in watch mode and starts the demo application.
249
+
250
+ ### Available Scripts
251
+
252
+ - `npm start` - Start demo application
253
+ - `npm run build` - Build demo application
254
+ - `npm run build:lib` - Build library
255
+ - `npm run watch:lib` - Watch library changes
256
+ - `npm run dev` - Development mode (watch + serve)
257
+
258
+ ## 📝 License
259
+
260
+ MIT License - see [LICENSE](LICENSE) file for details.
261
+
262
+ ## 🤝 Contributing
263
+
264
+ Contributions are welcome! Please feel free to submit a Pull Request.
265
+
266
+ ## 📞 Support
267
+
268
+ - 🐛 [Report Issues](https://github.com/flogeez/ngx-tiptap-editor/issues)
269
+ - 💡 [Feature Requests](https://github.com/flogeez/ngx-tiptap-editor/issues)
270
+ - 📖 [Documentation](https://github.com/flogeez/ngx-tiptap-editor#readme)
271
+
272
+ ## 🔗 Links
273
+
274
+ - 🎮 [Live Demo](https://flogeez.github.io/angular-tiptap-editor/)
275
+ - 📖 [Tiptap Documentation](https://tiptap.dev/)
276
+ - 🅰️ [Angular Documentation](https://angular.dev/)
277
+ - 📦 [NPM Package](https://www.npmjs.com/package/angular-tiptap-editor)
278
+
279
+ ---
280
+
281
+ Made with ❤️ by [FloGeez](https://github.com/FloGeez)