@tmdjr/ngx-editor-js2 20.0.14 → 20.1.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/README.md CHANGED
@@ -6,7 +6,7 @@ DEMO: [https://ba5ik7.github.io/ngx-editorjs2](https://ba5ik7.github.io/ngx-edit
6
6
  Ngx-EditorJs2 is an Angular-based, highly extensible block-style editor inspired by Editor.js. It allows users to create and manage rich text content using a variety of customizable blocks while leveraging Angular's reactive capabilities.
7
7
 
8
8
  ### Supports
9
- - Angular 19+
9
+ - Angular 20+
10
10
  - For legacy Angular support, use [ngx-editorjs](https://github.com/Ba5ik7/ngx-editorjs)
11
11
 
12
12
  ## Features
@@ -23,6 +23,17 @@ To install Ngx-EditorJs2, run:
23
23
  npm install @tmdjr/ngx-editor-js2
24
24
  ```
25
25
 
26
+ ### Adding via Angular CLI (Recommended)
27
+
28
+ To quickly set up Ngx-EditorJs2 with optional blocks, use Angular's `ng add` command:
29
+
30
+ ```sh
31
+ ng add @tmdjr/ngx-editor-js2
32
+ ```
33
+
34
+ This command will prompt you to select optional blocks and will handle the installation, configuration updates to `angular.json`, global styles, and your application's configuration (`app.config.ts`).
35
+
36
+
26
37
  ## Usage
27
38
  Import the Component into your Angular Standalone Component:
28
39
 
@@ -43,34 +54,6 @@ import { NgxEditorJs2Component } from '@tmdjr/ngx-editor-js2';
43
54
  ```
44
55
  - Implementation found in the [Demo Src](https://github.com/Ba5ik7/ngx-editor-js2-blocks/blob/main/projects/demo/src/app/app.component.ts)
45
56
 
46
- Css is required for the editor to function properly. Add the following to your global styles:
47
-
48
- ```css
49
- // ! I Need to fix this!!
50
- // The consumer should not have to incude this in their styles.scss
51
- .cdk-drag-preview {
52
- color: var(--mat-sys-on-secondary-container);
53
- background-color: var(--mat-sys-secondary-container);
54
- border-radius: 8px;
55
- box-sizing: border-box;
56
- overflow: visible;
57
- box-shadow: var(--mat-sys-level4);
58
-
59
- & *:not(toolbar) {
60
- padding: 0 !important;
61
- margin: 0 !important;
62
- }
63
- }
64
-
65
- .cdk-drag-placeholder {
66
- opacity: 0;
67
- }
68
-
69
- .cdk-drag-animating {
70
- transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);
71
- }
72
- ```
73
-
74
57
 
75
58
  ## API
76
59
  ### **Inputs**
@@ -155,7 +138,43 @@ Embed syntax-highlighted code snippets using CodeMirror.
155
138
 
156
139
  ---
157
140
 
158
- For more details and documentation, visit the official repository.
141
+ ### 🌐 MFE Loader Block
142
+ Dynamically load and embed micro-frontends using Module Federation.
143
+
144
+ - **Component:** `NgxEditorJs2MfeLoaderComponent`
145
+ - **Install:**
146
+ ```sh
147
+ npm install @tmdjr/ngx-editor-js2-mfe-loader
148
+ ```
149
+ - **Package:** [@tmdjr/ngx-editor-js2-mfe-loader](https://www.npmjs.com/package/@tmdjr/ngx-editor-js2-mfe-loader)
150
+
151
+ ---
152
+
153
+ ### 🧩 MermaidJS Block
154
+ Embed interactive Mermaid diagrams for flowcharts, graphs, and more.
155
+
156
+ - **Component:** `NgxEditorJs2MermaidjsComponent`
157
+ - **Install:**
158
+ ```sh
159
+ npm install @tmdjr/ngx-editor-js2-mermaidjs
160
+ ```
161
+ - **Package:** [@tmdjr/ngx-editor-js2-mermaidjs](https://www.npmjs.com/package/@tmdjr/ngx-editor-js2-mermaidjs)
162
+
163
+ ---
164
+
165
+ ### 🧐 Pop Quiz Block
166
+ Create engaging quizzes within your content for interactive learning.
167
+
168
+ - **Component:** `NgxEditorJs2PopQuizComponent`
169
+ - **Install:**
170
+ ```sh
171
+ npm install @tmdjr/ngx-editor-js2-pop-quiz
172
+ ```
173
+ - **Package:** [@tmdjr/ngx-editor-js2-pop-quiz](https://www.npmjs.com/package/@tmdjr/ngx-editor-js2-pop-quiz)
174
+
175
+ ---
176
+
177
+ For more details and documentation, visit the [official repository](https://github.com/Ba5ik7/ngx-editor-js2-blocks).
159
178
 
160
179
 
161
180
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmdjr/ngx-editor-js2",
3
- "version": "20.0.14",
3
+ "version": "20.1.1",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "peerDependencies": {
6
6
  "@angular/animations": "^20.0.4",
@@ -4,78 +4,188 @@ import { BehaviorSubject, lastValueFrom, Observable, tap } from 'rxjs';
4
4
 
5
5
  export const TEST_DATA: NgxEditorJsBlock[] = [
6
6
  {
7
- blockId: 'n177d7',
7
+ blockId: 'iovlbzgosf',
8
8
  sortIndex: 0,
9
- componentInstanceName: 'NgxEditorJs2BlockquotesComponent',
10
- savedAction: 'display-large',
11
- dataClean:
12
- '`Design is not just what it looks like and feels like. Design is how it works.',
9
+ componentInstanceName: 'HeaderBlockComponent',
10
+ savedAction: 'h1',
11
+ dataClean: '🚀 Ready to Explore?',
13
12
  },
14
13
  {
15
- blockId: 'n177dsd',
14
+ blockId: '6ldk3i',
16
15
  sortIndex: 1,
17
- componentInstanceName: 'NgxEditorJs2ImageComponent',
18
- savedAction: 'stretch',
16
+ componentInstanceName: 'ParagraphBlockComponent',
17
+ savedAction: 'large',
19
18
  dataClean:
20
- '{"url":"https://res.cloudinary.com/dowdpiikk/image/upload/w_650,q_auto:best,f_auto/v1709445782/lnyst5aqppuin8wt73ci.webp","title":"test"}',
19
+ 'This demo showcases the core concept of Ngx-EditorJs2 — a flexible, block-based content editor built with Angular. Each section of content is a self-contained block that can be rearranged via drag and drop, making it easy to structure and reorganize complex content visually.<div><br></div><div>Blocks aren’t just static — they can be configured through block-specific settings. For example, the Header block allows you to choose between multiple heading levels (H1–H6), and the Image block supports captions and alignment settings.</div><div><br></div><div>In addition, when selecting text within blocks that support inline formatting, a contextual inline toolbar appears. This toolbar enables quick formatting actions such as <b>bold</b>, <i>italic</i>, and text alignment (left, center, right) — allowing for a more expressive and intuitive editing experience.</div><div><br></div><div>Use this page to explore how each block behaves, how they can be customized, and how the editor adapts to your content needs in a modular and scalable way.</div>',
21
20
  },
22
21
  {
23
- blockId: 'iovlbzgosf',
22
+ blockId: 'pkm1k',
24
23
  sortIndex: 2,
25
24
  componentInstanceName: 'HeaderBlockComponent',
26
- savedAction: 'h1',
27
- dataClean: 'Prerequisites',
25
+ savedAction: 'h3',
26
+ dataClean: '✍️ Paragraph + Header',
28
27
  },
29
28
  {
30
- blockId: '8u3uiij5vyj',
29
+ blockId: 'wpg67v',
31
30
  sortIndex: 3,
32
31
  componentInstanceName: 'ParagraphBlockComponent',
33
32
  savedAction: 'large',
34
33
  dataClean:
35
- '<ul><li><a href="https://www.typescriptlang.org/">TypeScript</a> and HTML5 programming</li><li>Angular app-design fundamentals, as described in <a href="https://angular.io/guide/architecture">Angular Concepts</a><br></li><li>The basics of <a href="https://angular.io/guide/architecture-components#template-syntax">Angular template syntax</a><br></li></ul>',
34
+ 'The bread and butter of any editor. Use paragraphs for flowing content, and headers to create structure and hierarchy. <b>Clear</b>. <i>Clean</i>. <u>Essential</u>.',
36
35
  },
37
36
  {
38
- blockId: 'bu23hwyltss',
37
+ blockId: '8u3uiij5vyj',
39
38
  sortIndex: 4,
40
39
  componentInstanceName: 'ParagraphBlockComponent',
41
40
  savedAction: 'large',
42
41
  dataClean:
43
- 'Evaluation of a template expression should have no visible side effects. Use the syntax for template expressions to help avoid side effects. In general, the correct syntax prevents you from assigning a value to anything in a property binding expression. The syntax also prevents you from using increment and decrement operators.',
42
+ '<ul><li><a href="https://www.typescriptlang.org/">TypeScript</a> and HTML5 programming</li><li>Angular app-design fundamentals, as described in <a href="https://angular.io/guide/architecture">Angular Concepts</a><br></li><li>The basics of <a href="https://angular.io/guide/architecture-components#template-syntax">Angular template syntax</a><br></li></ul>',
44
43
  },
45
44
  {
46
- blockId: 'uapf2',
45
+ blockId: '2rdtwb',
47
46
  sortIndex: 5,
48
- componentInstanceName: 'NgxEditorJs2MermaidjsComponent',
49
- savedAction: 'center',
50
- dataClean:
51
- 'flowchart TD\n A[Christmas] -->|Get money| B(Go shopping)\n B --> C{Let me think}\n C -->|One| D[Laptop]\n C -->|Two| E[Hello World iPhone]\n C -->|Three| F[fa:fa-car Car]',
47
+ componentInstanceName: 'ParagraphBlockComponent',
48
+ savedAction: 'medium',
49
+ dataClean: '',
52
50
  },
53
51
  {
54
- blockId: 'bu23hwyltsww',
52
+ blockId: '8w37us',
55
53
  sortIndex: 6,
54
+ componentInstanceName: 'HeaderBlockComponent',
55
+ savedAction: 'h3',
56
+ dataClean: '💡 Quote',
57
+ },
58
+ {
59
+ blockId: '31tbry',
60
+ sortIndex: 7,
56
61
  componentInstanceName: 'ParagraphBlockComponent',
57
- savedAction: 'small',
62
+ savedAction: 'large',
58
63
  dataClean:
59
- 'Material Design uses color to create accessible, personal color schemes that communicate your products hierarchy, state, and brand. See Material Designs Color System page to learn more about its use and purpose.',
64
+ 'Craft your favorite inspiration, callouts, or even markdown-style blockquotes using the Quote block.',
65
+ },
66
+ {
67
+ blockId: 'n177d7',
68
+ sortIndex: 8,
69
+ componentInstanceName: 'NgxEditorJs2BlockquotesComponent',
70
+ savedAction: 'display-large',
71
+ dataClean:
72
+ '“A quote block is like a spotlight — simple, elegant, and perfect for making a point.”',
73
+ },
74
+ {
75
+ blockId: 'dq5uat',
76
+ sortIndex: 9,
77
+ componentInstanceName: 'ParagraphBlockComponent',
78
+ savedAction: 'medium',
79
+ dataClean: '',
80
+ },
81
+ {
82
+ blockId: 'mq9i9m',
83
+ sortIndex: 10,
84
+ componentInstanceName: 'HeaderBlockComponent',
85
+ savedAction: 'h3',
86
+ dataClean: '📷 Image Block',
87
+ },
88
+ {
89
+ blockId: '4xkw3s',
90
+ sortIndex: 11,
91
+ componentInstanceName: 'ParagraphBlockComponent',
92
+ savedAction: 'large',
93
+ dataClean:
94
+ 'A picture says a thousand words. The Image block supports captions and even alignment options to make your visuals shine.',
95
+ },
96
+ {
97
+ blockId: 'n177dsd',
98
+ sortIndex: 12,
99
+ componentInstanceName: 'NgxEditorJs2ImageComponent',
100
+ savedAction: 'stretch',
101
+ dataClean:
102
+ '{"url":"https://res.cloudinary.com/dowdpiikk/image/upload/w_650,q_auto:best,f_auto/v1709445782/lnyst5aqppuin8wt73ci.webp","title":"test"}',
103
+ },
104
+ {
105
+ blockId: 'gt9e9s',
106
+ sortIndex: 13,
107
+ componentInstanceName: 'ParagraphBlockComponent',
108
+ savedAction: 'medium',
109
+ dataClean: '',
110
+ },
111
+ {
112
+ blockId: 'b3t74',
113
+ sortIndex: 14,
114
+ componentInstanceName: 'HeaderBlockComponent',
115
+ savedAction: 'h3',
116
+ dataClean: '🎨 CodeMirror Block',
117
+ },
118
+ {
119
+ blockId: '9qls1d',
120
+ sortIndex: 15,
121
+ componentInstanceName: 'ParagraphBlockComponent',
122
+ savedAction: 'large',
123
+ dataClean:
124
+ 'Embed rich, theme-able code editors right inside your documents. Great for live code samples or collaborative coding.',
60
125
  },
61
126
  {
62
127
  blockId: 'asdfasdf',
63
- sortIndex: 7,
128
+ sortIndex: 16,
64
129
  componentInstanceName: 'NgxEditorJs2CodemirrorComponent',
65
130
  savedAction: 'text/typescript',
66
131
  dataClean:
67
132
  "export class SimpleFormGroup {\n form = new FormGroup({\n first: new FormControl('Nancy', Validators.minLength(2)),\n last: new FormControl('Drew'),\n });\n\n get first(): any {\n return this.form.get('first');\n }\n\n onSubmit(): void {\n console.log(this.form.value); // {first: 'Nancy', last: 'Drew'}\n }\n\n setValue() {\n this.form.setValue({first: 'Carson', last: 'Drew'});\n }\n}",
68
133
  },
69
134
  {
70
- blockId: 'l13u3k',
71
- sortIndex: 8,
135
+ blockId: 'hduds',
136
+ sortIndex: 17,
137
+ componentInstanceName: 'ParagraphBlockComponent',
138
+ savedAction: 'medium',
139
+ dataClean: '',
140
+ },
141
+ {
142
+ blockId: '8npajb',
143
+ sortIndex: 18,
72
144
  componentInstanceName: 'HeaderBlockComponent',
73
- savedAction: 'h1',
74
- dataClean: 'New way of learning...',
145
+ savedAction: 'h3',
146
+ dataClean: '🔥 Mermaid.js Block',
147
+ },
148
+ {
149
+ blockId: 'su45ai',
150
+ sortIndex: 19,
151
+ componentInstanceName: 'ParagraphBlockComponent',
152
+ savedAction: 'large',
153
+ dataClean:
154
+ 'Need to include a flowchart, sequence diagram, or Gantt chart? The Mermaid.js block brings technical diagrams to life using simple syntax.',
155
+ },
156
+ {
157
+ blockId: 'uapf2',
158
+ sortIndex: 20,
159
+ componentInstanceName: 'NgxEditorJs2MermaidjsComponent',
160
+ savedAction: 'center',
161
+ dataClean:
162
+ 'flowchart TD\n A[Christmas] -->|Get money| B(Go shopping)\n B --> C{Let me think}\n C -->|One| D[Laptop]\n C -->|Two| E[Hello World iPhone]\n C -->|Three| F[fa:fa-car Car]',
163
+ },
164
+ {
165
+ blockId: 'y3r4xs',
166
+ sortIndex: 21,
167
+ componentInstanceName: 'ParagraphBlockComponent',
168
+ savedAction: 'medium',
169
+ dataClean: '<div><br></div>',
170
+ },
171
+ {
172
+ blockId: 'q5m0u',
173
+ sortIndex: 22,
174
+ componentInstanceName: 'HeaderBlockComponent',
175
+ savedAction: 'h3',
176
+ dataClean: '🧠 Pop Quiz Block',
177
+ },
178
+ {
179
+ blockId: 'ubo23s',
180
+ sortIndex: 23,
181
+ componentInstanceName: 'ParagraphBlockComponent',
182
+ savedAction: 'large',
183
+ dataClean:
184
+ 'Test your knowledge or embed interactive quiz questions inline with your content. Great for workshops, tutorials, or even just friendly challenges.',
75
185
  },
76
186
  {
77
187
  blockId: '9bqhk',
78
- sortIndex: 9,
188
+ sortIndex: 24,
79
189
  componentInstanceName: 'NgxEditorJs2PopQuizComponent',
80
190
  savedAction: 'display-large',
81
191
  dataClean: