@kolkov/angular-editor 2.2.0-beta.0 → 3.0.0-beta.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.
@@ -1,87 +1,87 @@
1
- import { HttpClient, HttpEvent } from '@angular/common/http';
2
- import { Observable } from 'rxjs';
3
- import { CustomClass } from './config';
4
- import * as i0 from "@angular/core";
5
- export interface UploadResponse {
6
- imageUrl: string;
7
- }
8
- export declare class AngularEditorService {
9
- private http;
10
- private doc;
11
- savedSelection: Range | null;
12
- selectedText: string;
13
- uploadUrl: string;
14
- uploadWithCredentials: boolean;
15
- constructor(http: HttpClient, doc: any);
16
- /**
17
- * Executed command from editor header buttons exclude toggleEditorMode
18
- * @param command string from triggerCommand
19
- * @param value
20
- */
21
- executeCommand(command: string, value?: string): void;
22
- /**
23
- * Create URL link
24
- * @param url string from UI prompt
25
- */
26
- createLink(url: string): void;
27
- /**
28
- * insert color either font or background
29
- *
30
- * @param color color to be inserted
31
- * @param where where the color has to be inserted either text/background
32
- */
33
- insertColor(color: string, where: string): void;
34
- /**
35
- * Set font name
36
- * @param fontName string
37
- */
38
- setFontName(fontName: string): void;
39
- /**
40
- * Set font size
41
- * @param fontSize string
42
- */
43
- setFontSize(fontSize: string): void;
44
- /**
45
- * Create raw HTML
46
- * @param html HTML string
47
- */
48
- insertHtml(html: string): void;
49
- /**
50
- * save selection when the editor is focussed out
51
- */
52
- saveSelection: () => void;
53
- /**
54
- * restore selection when the editor is focused in
55
- *
56
- * saved selection when the editor is focused out
57
- */
58
- restoreSelection(): boolean;
59
- /**
60
- * setTimeout used for execute 'saveSelection' method in next event loop iteration
61
- */
62
- executeInNextQueueIteration(callbackFn: (...args: any[]) => any, timeout?: number): void;
63
- /** check any selection is made or not */
64
- private checkSelection;
65
- /**
66
- * Upload file to uploadUrl
67
- * @param file The file
68
- */
69
- uploadImage(file: File): Observable<HttpEvent<UploadResponse>>;
70
- /**
71
- * Insert image with Url
72
- * @param imageUrl The imageUrl.
73
- */
74
- insertImage(imageUrl: string): void;
75
- setDefaultParagraphSeparator(separator: string): void;
76
- createCustomClass(customClass: CustomClass): void;
77
- insertVideo(videoUrl: string): void;
78
- private insertYouTubeVideoTag;
79
- private insertVimeoVideoTag;
80
- nextNode(node: any): any;
81
- getRangeSelectedNodes(range: any, includePartiallySelectedContainers: any): any[];
82
- getSelectedNodes(): any[];
83
- replaceWithOwnChildren(el: any): void;
84
- removeSelectedElements(tagNames: any): void;
85
- static ɵfac: i0.ɵɵFactoryDeclaration<AngularEditorService, never>;
86
- static ɵprov: i0.ɵɵInjectableDeclaration<AngularEditorService>;
87
- }
1
+ import { HttpClient, HttpEvent } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { CustomClass } from './config';
4
+ import * as i0 from "@angular/core";
5
+ export interface UploadResponse {
6
+ imageUrl: string;
7
+ }
8
+ export declare class AngularEditorService {
9
+ private http;
10
+ private doc;
11
+ savedSelection: Range | null;
12
+ selectedText: string;
13
+ uploadUrl: string;
14
+ uploadWithCredentials: boolean;
15
+ constructor(http: HttpClient, doc: any);
16
+ /**
17
+ * Executed command from editor header buttons exclude toggleEditorMode
18
+ * @param command string from triggerCommand
19
+ * @param value
20
+ */
21
+ executeCommand(command: string, value?: string): void;
22
+ /**
23
+ * Create URL link
24
+ * @param url string from UI prompt
25
+ */
26
+ createLink(url: string): void;
27
+ /**
28
+ * insert color either font or background
29
+ *
30
+ * @param color color to be inserted
31
+ * @param where where the color has to be inserted either text/background
32
+ */
33
+ insertColor(color: string, where: string): void;
34
+ /**
35
+ * Set font name
36
+ * @param fontName string
37
+ */
38
+ setFontName(fontName: string): void;
39
+ /**
40
+ * Set font size
41
+ * @param fontSize string
42
+ */
43
+ setFontSize(fontSize: string): void;
44
+ /**
45
+ * Create raw HTML
46
+ * @param html HTML string
47
+ */
48
+ insertHtml(html: string): void;
49
+ /**
50
+ * save selection when the editor is focussed out
51
+ */
52
+ saveSelection: () => void;
53
+ /**
54
+ * restore selection when the editor is focused in
55
+ *
56
+ * saved selection when the editor is focused out
57
+ */
58
+ restoreSelection(): boolean;
59
+ /**
60
+ * setTimeout used for execute 'saveSelection' method in next event loop iteration
61
+ */
62
+ executeInNextQueueIteration(callbackFn: (...args: any[]) => any, timeout?: number): void;
63
+ /** check any selection is made or not */
64
+ private checkSelection;
65
+ /**
66
+ * Upload file to uploadUrl
67
+ * @param file The file
68
+ */
69
+ uploadImage(file: File): Observable<HttpEvent<UploadResponse>>;
70
+ /**
71
+ * Insert image with Url
72
+ * @param imageUrl The imageUrl.
73
+ */
74
+ insertImage(imageUrl: string): void;
75
+ setDefaultParagraphSeparator(separator: string): void;
76
+ createCustomClass(customClass: CustomClass): void;
77
+ insertVideo(videoUrl: string): void;
78
+ private insertYouTubeVideoTag;
79
+ private insertVimeoVideoTag;
80
+ nextNode(node: any): any;
81
+ getRangeSelectedNodes(range: any, includePartiallySelectedContainers: any): any[];
82
+ getSelectedNodes(): any[];
83
+ replaceWithOwnChildren(el: any): void;
84
+ removeSelectedElements(tagNames: any): void;
85
+ static ɵfac: i0.ɵɵFactoryDeclaration<AngularEditorService, never>;
86
+ static ɵprov: i0.ɵɵInjectableDeclaration<AngularEditorService>;
87
+ }
package/lib/config.d.ts CHANGED
@@ -1,39 +1,39 @@
1
- import { UploadResponse } from './angular-editor.service';
2
- import { HttpEvent } from '@angular/common/http';
3
- import { Observable } from 'rxjs';
4
- export interface CustomClass {
5
- name: string;
6
- class: string;
7
- tag?: string;
8
- }
9
- export interface Font {
10
- name: string;
11
- class: string;
12
- }
13
- export interface AngularEditorConfig {
14
- editable?: boolean;
15
- spellcheck?: boolean;
16
- height?: 'auto' | string;
17
- minHeight?: '0' | string;
18
- maxHeight?: 'auto' | string;
19
- width?: 'auto' | string;
20
- minWidth?: '0' | string;
21
- translate?: 'yes' | 'now' | string;
22
- enableToolbar?: boolean;
23
- showToolbar?: boolean;
24
- placeholder?: string;
25
- defaultParagraphSeparator?: string;
26
- defaultFontName?: string;
27
- defaultFontSize?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | string;
28
- uploadUrl?: string;
29
- upload?: (file: File) => Observable<HttpEvent<UploadResponse>>;
30
- uploadWithCredentials?: boolean;
31
- fonts?: Font[];
32
- customClasses?: CustomClass[];
33
- sanitize?: boolean;
34
- toolbarPosition?: 'top' | 'bottom';
35
- outline?: boolean;
36
- toolbarHiddenButtons?: string[][];
37
- rawPaste?: boolean;
38
- }
39
- export declare const angularEditorConfig: AngularEditorConfig;
1
+ import { UploadResponse } from './angular-editor.service';
2
+ import { HttpEvent } from '@angular/common/http';
3
+ import { Observable } from 'rxjs';
4
+ export interface CustomClass {
5
+ name: string;
6
+ class: string;
7
+ tag?: string;
8
+ }
9
+ export interface Font {
10
+ name: string;
11
+ class: string;
12
+ }
13
+ export interface AngularEditorConfig {
14
+ editable?: boolean;
15
+ spellcheck?: boolean;
16
+ height?: 'auto' | string;
17
+ minHeight?: '0' | string;
18
+ maxHeight?: 'auto' | string;
19
+ width?: 'auto' | string;
20
+ minWidth?: '0' | string;
21
+ translate?: 'yes' | 'now' | string;
22
+ enableToolbar?: boolean;
23
+ showToolbar?: boolean;
24
+ placeholder?: string;
25
+ defaultParagraphSeparator?: string;
26
+ defaultFontName?: string;
27
+ defaultFontSize?: '1' | '2' | '3' | '4' | '5' | '6' | '7' | string;
28
+ uploadUrl?: string;
29
+ upload?: (file: File) => Observable<HttpEvent<UploadResponse>>;
30
+ uploadWithCredentials?: boolean;
31
+ fonts?: Font[];
32
+ customClasses?: CustomClass[];
33
+ sanitize?: boolean;
34
+ toolbarPosition?: 'top' | 'bottom';
35
+ outline?: boolean;
36
+ toolbarHiddenButtons?: string[][];
37
+ rawPaste?: boolean;
38
+ }
39
+ export declare const angularEditorConfig: AngularEditorConfig;
package/lib/utils.d.ts CHANGED
@@ -1 +1 @@
1
- export declare function isDefined(value: any): boolean;
1
+ export declare function isDefined(value: any): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkov/angular-editor",
3
- "version": "2.2.0-beta.0",
3
+ "version": "3.0.0-beta.1",
4
4
  "description": "A simple native WYSIWYG editor for Angular 8+, 13+. Rich Text editor component for Angular.",
5
5
  "author": "Andrey Kolkov <a.kolkov@gmail.com>",
6
6
  "repository": "https://github.com/kolkov/angular-editor",
@@ -10,8 +10,8 @@
10
10
  "url": "https://github.com/kolkov/angular-editor/issues"
11
11
  },
12
12
  "peerDependencies": {
13
- "@angular/common": ">=14",
14
- "@angular/core": ">=14"
13
+ "@angular/common": ">=13",
14
+ "@angular/core": ">=13"
15
15
  },
16
16
  "dependencies": {
17
17
  "tslib": "^2.3.0"
@@ -32,13 +32,13 @@
32
32
  "esm2020": "esm2020/kolkov-angular-editor.mjs",
33
33
  "fesm2020": "fesm2020/kolkov-angular-editor.mjs",
34
34
  "fesm2015": "fesm2015/kolkov-angular-editor.mjs",
35
- "typings": "index.d.ts",
35
+ "typings": "kolkov-angular-editor.d.ts",
36
36
  "exports": {
37
37
  "./package.json": {
38
38
  "default": "./package.json"
39
39
  },
40
40
  ".": {
41
- "types": "./index.d.ts",
41
+ "types": "./kolkov-angular-editor.d.ts",
42
42
  "esm2020": "./esm2020/kolkov-angular-editor.mjs",
43
43
  "es2020": "./fesm2020/kolkov-angular-editor.mjs",
44
44
  "es2015": "./fesm2015/kolkov-angular-editor.mjs",
package/public-api.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from './lib/angular-editor.service';
2
- export * from './lib/angular-editor.component';
3
- export * from './lib/ae-button/ae-button.component';
4
- export * from './lib/ae-toolbar-set/ae-toolbar-set.component';
5
- export * from './lib/ae-select/ae-select.component';
6
- export * from './lib/angular-editor-toolbar.component';
7
- export * from './lib/angular-editor.module';
8
- export { AngularEditorConfig, CustomClass } from './lib/config';
1
+ export * from './lib/angular-editor.service';
2
+ export * from './lib/angular-editor.component';
3
+ export * from './lib/ae-button/ae-button.component';
4
+ export * from './lib/ae-toolbar-set/ae-toolbar-set.component';
5
+ export * from './lib/ae-select/ae-select.component';
6
+ export * from './lib/angular-editor-toolbar.component';
7
+ export * from './lib/angular-editor.module';
8
+ export { AngularEditorConfig, CustomClass } from './lib/config';
@@ -0,0 +1,290 @@
1
+ a {
2
+ cursor: pointer;
3
+ }
4
+
5
+ .angular-editor-textarea {
6
+ min-height: 150px;
7
+ overflow: auto;
8
+ margin-top: 5px;
9
+ resize: vertical;
10
+ &:after {
11
+ content:"";
12
+ position: absolute;
13
+ bottom: 0;
14
+ right:0;
15
+ display:block;
16
+ width:8px;
17
+ height:8px;
18
+ cursor: nwse-resize;
19
+ background-color: rgba(255,255,255,0.5)
20
+ }
21
+ }
22
+
23
+ .angular-editor-toolbar {
24
+ font: 100 14px/15px Roboto, Arial, sans-serif;
25
+ background-color: #f5f5f5;
26
+ font-size: 0.8rem;
27
+ padding: 0.2rem;
28
+ border: 1px solid #ddd;
29
+ display: flex;
30
+ flex-wrap: wrap;
31
+ gap: 4px;
32
+
33
+ .angular-editor-toolbar-set {
34
+ display: flex;
35
+ gap: 1px;
36
+ width: fit-content;
37
+ vertical-align: baseline;
38
+ .angular-editor-button {
39
+ background-color: white;
40
+ vertical-align: middle;
41
+ border: 1px solid #ddd;
42
+ padding: 0.4rem;
43
+ float: left;
44
+ width: 2rem;
45
+ height: 2rem;
46
+
47
+ &:hover {
48
+ cursor: pointer;
49
+ background-color: #f1f1f1;
50
+ transition: 0.2s ease;
51
+ }
52
+
53
+ &:focus,
54
+ &.focus {
55
+ outline: 0;
56
+ }
57
+
58
+ &:disabled {
59
+ background-color: #f5f5f5;
60
+ pointer-events: none;
61
+ cursor: not-allowed;
62
+
63
+ > .color-label {
64
+ pointer-events: none;
65
+ cursor: not-allowed;
66
+
67
+ &.foreground {
68
+ :after {
69
+ background: #555555;
70
+ }
71
+ }
72
+
73
+ &.background {
74
+ background: #555555;
75
+ }
76
+ }
77
+ }
78
+
79
+ &.active {
80
+ background: #fff5b9;
81
+
82
+ &:hover {
83
+ background-color: #fffa98;
84
+ }
85
+ }
86
+ }
87
+
88
+ select {
89
+ font-size: 11px;
90
+ width: 90px;
91
+ vertical-align: middle;
92
+ background-color: transparent;
93
+ border: 0.5px solid rgba(255, 255, 255, 0);
94
+ border-radius: 5px;
95
+ outline: none;
96
+ padding: 0.4rem;
97
+ cursor: pointer;
98
+ }
99
+
100
+ .select-heading {
101
+ display: inline-block;
102
+ width: 90px;
103
+ @supports not( -moz-appearance:none ) {
104
+ optgroup {
105
+ font-size: 12px;
106
+ background-color: #f4f4f4;
107
+ padding: 5px;
108
+ }
109
+ option {
110
+ border: 1px solid;
111
+ background-color: white;
112
+ }
113
+ .default {
114
+ font-size: 16px;
115
+ }
116
+ .h1 {
117
+ font-size: 24px;
118
+ }
119
+ .h2 {
120
+ font-size: 20px;
121
+ }
122
+ .h3 {
123
+ font-size: 16px;
124
+ }
125
+ .h4 {
126
+ font-size: 15px;
127
+ }
128
+ .h5 {
129
+ font-size: 14px;
130
+ }
131
+ .h6 {
132
+ font-size: 13px;
133
+ }
134
+ .div {
135
+ font-size: 12px;
136
+ }
137
+ .pre {
138
+ font-size: 12px;
139
+ }
140
+ }
141
+
142
+ &:disabled {
143
+ background-color: #f5f5f5;
144
+ pointer-events: none;
145
+ cursor: not-allowed;
146
+ }
147
+
148
+ &:hover {
149
+ cursor: pointer;
150
+ background-color: #f1f1f1;
151
+ transition: 0.2s ease;
152
+ }
153
+ }
154
+
155
+ .select-font {
156
+ display: inline-block;
157
+ width: 90px;
158
+ @supports not( -moz-appearance:none ) {
159
+ optgroup {
160
+ font-size: 12px;
161
+ background-color: #f4f4f4;
162
+ padding: 5px;
163
+ }
164
+ option {
165
+ border: 1px solid;
166
+ background-color: white;
167
+ }
168
+ }
169
+
170
+ &:disabled {
171
+ background-color: #f5f5f5;
172
+ pointer-events: none;
173
+ cursor: not-allowed;
174
+ }
175
+
176
+ &:hover {
177
+ cursor: pointer;
178
+ background-color: #f1f1f1;
179
+ transition: 0.2s ease;
180
+ }
181
+ }
182
+
183
+ .select-font-size {
184
+ display: inline-block;
185
+ width: 50px;
186
+ @supports not( -moz-appearance:none ) {
187
+ optgroup {
188
+ font-size: 12px;
189
+ background-color: #f4f4f4;
190
+ padding: 5px;
191
+ }
192
+ option {
193
+ border: 1px solid;
194
+ background-color: white;
195
+ }
196
+ .size1 {
197
+ font-size: 10px;
198
+ }
199
+ .size2 {
200
+ font-size: 12px;
201
+ }
202
+ .size3 {
203
+ font-size: 14px;
204
+ }
205
+ .size4 {
206
+ font-size: 16px;
207
+ }
208
+ .size5 {
209
+ font-size: 18px;
210
+ }
211
+ .size6 {
212
+ font-size: 20px;
213
+ }
214
+ .size7 {
215
+ font-size: 22px;
216
+ }
217
+ }
218
+
219
+ &:disabled {
220
+ background-color: #f5f5f5;
221
+ pointer-events: none;
222
+ cursor: not-allowed;
223
+ }
224
+
225
+ &:hover {
226
+ cursor: pointer;
227
+ background-color: #f1f1f1;
228
+ transition: 0.2s ease;
229
+ }
230
+ }
231
+
232
+ .select-custom-style {
233
+ display: inline-block;
234
+ width: 90px;
235
+ @supports not( -moz-appearance:none ) {
236
+ optgroup {
237
+ font-size: 12px;
238
+ background-color: #f4f4f4;
239
+ padding: 5px;
240
+ }
241
+ option {
242
+ border: 1px solid;
243
+ background-color: white;
244
+ }
245
+ }
246
+
247
+ &:disabled {
248
+ background-color: #f5f5f5;
249
+ pointer-events: none;
250
+ cursor: not-allowed;
251
+ }
252
+
253
+ &:hover {
254
+ cursor: pointer;
255
+ background-color: #f1f1f1;
256
+ transition: 0.2s ease;
257
+ }
258
+ }
259
+
260
+ .color-label {
261
+ position: relative;
262
+ cursor: pointer;
263
+ }
264
+
265
+ .background {
266
+ font-size: smaller;
267
+ background: #1b1b1b;
268
+ color: white;
269
+ padding: 3px;
270
+ }
271
+
272
+ .foreground {
273
+ :after {
274
+ position: absolute;
275
+ content: "";
276
+ left: -1px;
277
+ top: auto;
278
+ bottom: -3px;
279
+ right: auto;
280
+ width: 15px;
281
+ height: 2px;
282
+ z-index: 0;
283
+ background: #1b1b1b;
284
+ }
285
+ }
286
+ }
287
+ .angular-editor-toolbar-set:not([style*="display:none"]):not([style*="display: none"]){
288
+ //display: inline-block;
289
+ }
290
+ }