ngx-rich-text-pro 1.0.0 → 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
@@ -174,6 +174,35 @@ You can completely hide the built-in toolbar (`[showToolbar]="false"`) and trigg
174
174
  ></ngx-rich-text-pro>
175
175
  ```
176
176
 
177
+ ### Recipe 3: Social Post Captions with Clean Markdown Output
178
+
179
+ If your backend or post preview system renders markdown (such as LinkedIn, GitHub, or Reddit formatting), set `[outputFormat]="'markdown'"`:
180
+
181
+ ```html
182
+ <ngx-rich-text-pro
183
+ [outputFormat]="'markdown'"
184
+ [exclusiveInlineFormats]="true"
185
+ [hashtagColor]="'#0069FF'"
186
+ [(ngModel)]="captionMarkdown"
187
+ (valueChange)="onCaptionChange($event)"
188
+ ></ngx-rich-text-pro>
189
+ ```
190
+
191
+ **What it produces**:
192
+ - Underline: `__line__`
193
+ - Bold: `**line**`
194
+ - Italic: `*line*`
195
+ - Bullet list: `- item`
196
+ - Numbered list: `1. item`
197
+ - Paragraphs: separated by `\n\n`
198
+ - Hashtags: `#tag`
199
+
200
+ **Mutually Exclusive Inline Formatting (`[exclusiveInlineFormats]="true"` default)**:
201
+ - At any time, only **one** inline effect is applied to text (either bold, either italic, or either underline).
202
+ - Clicking Bold clears Italic and Underline.
203
+ - Prevents messy combined syntax (e.g. `__***text***__`).
204
+ - Cleanly roundtrips between Markdown strings and rich WYSIWYG HTML in the editor.
205
+
177
206
  ---
178
207
 
179
208
  ## 🏷️ Real-Time Hashtag Engine
@@ -378,6 +407,8 @@ editor.setBackgroundColor('#fef08a');
378
407
  | `fontFamilies` | `Array<FontFamilyOption \| string>` | `DEFAULT_FONT_FAMILIES` | Font family options in the toolbar dropdown |
379
408
  | `hashtagColor` | `string` | `'#0069FF'` | Color used for highlighted `#hashtags` |
380
409
  | `highlightHashtags` | `boolean` | `true` | Enable or disable real-time hashtag highlighting |
410
+ | `outputFormat` | `'html' \| 'markdown'` | `'html'` | Format emitted by `[(ngModel)]` / `formControl` / `(valueChange)`. When `'markdown'`, outputs clean markdown syntax (`__underline__`, `**bold**`, `*italic*`, `- list`, `1. list`, `#tag`) |
411
+ | `exclusiveInlineFormats` | `boolean` | `true` | When `true`, enforces mutually exclusive inline formatting (only one of bold, italic, or underline can be active at a time; clicking bold turns off italic and underline) |
381
412
  | `maxCharacters` | `number` | `undefined` | Hard maximum character limit |
382
413
  | `characterCountWarn` | `number` | `undefined` | Threshold to show a warning badge as limit approaches |
383
414
  | `customClass` | `string` | `''` | Custom CSS class applied to host container |
@@ -391,16 +422,17 @@ editor.setBackgroundColor('#fef08a');
391
422
 
392
423
  | Output | Event Type | Description |
393
424
  | :--- | :--- | :--- |
394
- | `valueChange` | `EventEmitter<string>` | Emits updated HTML string on every change |
395
- | `textChange` | `EventEmitter<{ html: string; text: string }>` | Emits both HTML and plain-text representation |
425
+ | `valueChange` | `EventEmitter<string>` | Emits updated value on every change (HTML or Markdown depending on `outputFormat`) |
426
+ | `markdownChange` | `EventEmitter<string>` | Always emits clean Markdown representation |
427
+ | `textChange` | `EventEmitter<{ html: string; text: string; markdown?: string }>` | Emits HTML, plain text, and Markdown representation |
396
428
 
397
429
  ### Callable Public Methods (`#editorRef`)
398
430
 
399
431
  | Method | Parameters | Description |
400
432
  | :--- | :--- | :--- |
401
- | `bold()` | - | Toggles bold on selection |
402
- | `italic()` | - | Toggles italic on selection |
403
- | `underline()` | - | Toggles underline on selection |
433
+ | `bold()` | - | Toggles bold on selection (exclusively clears italic & underline when `exclusiveInlineFormats: true`) |
434
+ | `italic()` | - | Toggles italic on selection (exclusively clears bold & underline when `exclusiveInlineFormats: true`) |
435
+ | `underline()` | - | Toggles underline on selection (exclusively clears bold & italic when `exclusiveInlineFormats: true`) |
404
436
  | `strike()` | - | Toggles strikethrough on selection |
405
437
  | `subscript()` | - | Toggles subscript on selection |
406
438
  | `superscript()` | - | Toggles superscript on selection |
@@ -430,6 +462,7 @@ editor.setBackgroundColor('#fef08a');
430
462
  | `focus()` | - | Focuses the editor content area |
431
463
  | `getHtml()` | - | Returns current HTML content |
432
464
  | `getText()` | - | Returns plain text representation |
465
+ | `getMarkdown()` | - | Returns clean Markdown representation (`__underline__`, `**bold**`, `*italic*`, etc.) |
433
466
  | `isFormatActive(format)` | `format: string` | Checks if a format (`'bold'`, `'italic'`, `'insertOrderedList'`, etc.) is currently active |
434
467
 
435
468
  ### Supported Toolbar Tool Identifiers
@@ -488,38 +521,30 @@ ngx-rich-text-editor {
488
521
 
489
522
  ---
490
523
 
491
- ## 🚀 How to Publish to npm
524
+ ## 🌐 Browser & Platform Support
492
525
 
493
- Ready to publish this package to npm? Follow these simple steps:
526
+ `ngx-rich-text-pro` is thoroughly tested and supported on all modern evergreen browsers and platforms:
527
+ - Google Chrome / Chromium (Desktop & Mobile)
528
+ - Mozilla Firefox (Desktop & Mobile)
529
+ - Apple Safari (macOS & iOS)
530
+ - Microsoft Edge
531
+ - Electron & Progressive Web Apps (PWAs)
494
532
 
495
- ### 1. Login to your npm account
496
- ```bash
497
- npm login
498
- ```
533
+ ---
499
534
 
500
- ### 2. Build the package
501
- ```bash
502
- npm run build:lib
503
- ```
504
- *This compiles the Angular library into standard Angular Package Format (APF) inside the `dist/ngx-rich-text-editor` directory.*
535
+ ## 🤝 Contributing & Issues
505
536
 
506
- ### 3. Verify the package output (Optional)
507
- ```bash
508
- npm run pack:lib
509
- ```
510
- *Creates `ngx-rich-text-pro-1.0.0.tgz` for local inspection.*
537
+ Contributions, feature requests, and bug reports are welcome! If you encounter any issues or have questions, please feel free to open an issue or submit a pull request on GitHub.
511
538
 
512
- ### 4. Publish to npm!
513
- ```bash
514
- cd dist/ngx-rich-text-editor
515
- npm publish --access public
516
- ```
539
+ ---
540
+
541
+ ## 👨‍💻 Author
517
542
 
518
- Your package will immediately be live on **`https://www.npmjs.com/package/ngx-rich-text-pro`**! 🎉
543
+ **Yash Chapani**
519
544
 
520
545
  ---
521
546
 
522
547
  ## 📄 License
523
548
 
524
- MIT License © 2026. Free for commercial and personal use.
549
+ This project is open source and available under the [MIT License](LICENSE). Free for both commercial and personal use.
525
550