@progress/kendo-angular-editor 4.0.0-next.202204121114 → 4.1.0-dev.202205251353
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/bundles/kendo-angular-editor.umd.js +1 -1
- package/common/font-size-item.interface.d.ts +2 -2
- package/common/styles.d.ts +1 -1
- package/editor.component.d.ts +1 -0
- package/esm2015/common/styles.js +76 -50
- package/esm2015/config/commands.js +1 -1
- package/esm2015/editor.component.js +20 -10
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/tools/fontsize/editor-fontsize.component.js +20 -10
- package/fesm2015/kendo-angular-editor.js +112 -66
- package/main.d.ts +1 -1
- package/package.json +17 -19
- package/schematics/ngAdd/index.js +2 -2
- package/tools/fontsize/editor-fontsize.component.d.ts +1 -0
|
@@ -10,10 +10,10 @@ export interface FontSizeItem {
|
|
|
10
10
|
* The value of the [`font-size`](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size) CSS property.
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts-no-run
|
|
13
|
-
* '
|
|
13
|
+
* '4px'
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
size: number;
|
|
16
|
+
size: number | string;
|
|
17
17
|
/**
|
|
18
18
|
* The text for the font size that will be displayed in the drop-down list.
|
|
19
19
|
* @example
|
package/common/styles.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const defaultStyle = "\n html, body {\n margin: 0;\n
|
|
|
9
9
|
/**
|
|
10
10
|
* @hidden
|
|
11
11
|
*/
|
|
12
|
-
export declare const tablesStyles = "\n.ProseMirror .tableWrapper {\n
|
|
12
|
+
export declare const tablesStyles = "\n .ProseMirror .tableWrapper {\n overflow-x: auto;\n margin: 1em 0;\n }\n\n .ProseMirror table {\n margin: 0;\n border-collapse: collapse;\n table-layout: fixed;\n width: 100%;\n overflow: hidden;\n }\n\n .ProseMirror td, .ProseMirror th {\n min-width: 1em;\n border: 1px solid #ddd;\n padding: 3px 5px;\n vertical-align: top;\n box-sizing: border-box;\n position: relative;\n }\n\n .ProseMirror th {\n font-weight: bold;\n text-align: left;\n }\n\n .ProseMirror .column-resize-handle {\n position: absolute;\n right: -2px; top: 0; bottom: 0;\n width: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n }\n\n .ProseMirror.resize-cursor {\n cursor: ew-resize;\n cursor: col-resize;\n }\n\n /* Give selected cells a blue overlay */\n .ProseMirror .selectedCell:after {\n z-index: 2;\n position: absolute;\n content: \"\";\n left: 0; right: 0; top: 0; bottom: 0;\n background: rgba(200, 200, 255, 0.4);\n pointer-events: none;\n }\n\n /* Resizing */\n .k-editor-resize-wrap-element {\n display: inline-block;\n position: relative;\n }\n\n .ProseMirror .row-resize-handle {\n position: absolute;\n right: 0; left: 0; bottom: 0;\n transform: translate(0, 50%);\n height: 4px;\n z-index: 20;\n background-color: #adf;\n pointer-events: none;\n }\n \n .ProseMirror.resize-cursor-vertical {\n cursor: sn-resize;\n cursor: row-resize;\n }\n\n .k-editor-resize-wrap-element table td p,\n .k-editor-resize-wrap-element table th p {\n margin: 0 auto;\n }\n";
|
|
13
13
|
/**
|
|
14
14
|
* @hidden
|
|
15
15
|
*/
|
package/editor.component.d.ts
CHANGED
|
@@ -134,6 +134,7 @@ export declare class EditorComponent implements AfterViewInit, ControlValueAcces
|
|
|
134
134
|
*/
|
|
135
135
|
stateChange: BehaviorSubject<any>;
|
|
136
136
|
get toolbar(): ToolBarComponent;
|
|
137
|
+
get toolbarElement(): ElementRef;
|
|
137
138
|
/**
|
|
138
139
|
* Returns the ProseMirror [EditorView](https://prosemirror.net/docs/ref/#view.EditorView) object
|
|
139
140
|
* that manages the DOM structure that represents an editable document.
|
package/esm2015/common/styles.js
CHANGED
|
@@ -200,56 +200,82 @@ export const defaultStyle = `
|
|
|
200
200
|
* @hidden
|
|
201
201
|
*/
|
|
202
202
|
export const tablesStyles = `
|
|
203
|
-
.ProseMirror .tableWrapper {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.ProseMirror table {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.ProseMirror td, .ProseMirror th {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.ProseMirror th {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.ProseMirror .column-resize-handle {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
.ProseMirror.resize-cursor {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/* Give selected cells a blue overlay */
|
|
245
|
-
.ProseMirror .selectedCell:after {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
203
|
+
.ProseMirror .tableWrapper {
|
|
204
|
+
overflow-x: auto;
|
|
205
|
+
margin: 1em 0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.ProseMirror table {
|
|
209
|
+
margin: 0;
|
|
210
|
+
border-collapse: collapse;
|
|
211
|
+
table-layout: fixed;
|
|
212
|
+
width: 100%;
|
|
213
|
+
overflow: hidden;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.ProseMirror td, .ProseMirror th {
|
|
217
|
+
min-width: 1em;
|
|
218
|
+
border: 1px solid #ddd;
|
|
219
|
+
padding: 3px 5px;
|
|
220
|
+
vertical-align: top;
|
|
221
|
+
box-sizing: border-box;
|
|
222
|
+
position: relative;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.ProseMirror th {
|
|
226
|
+
font-weight: bold;
|
|
227
|
+
text-align: left;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.ProseMirror .column-resize-handle {
|
|
231
|
+
position: absolute;
|
|
232
|
+
right: -2px; top: 0; bottom: 0;
|
|
233
|
+
width: 4px;
|
|
234
|
+
z-index: 20;
|
|
235
|
+
background-color: #adf;
|
|
236
|
+
pointer-events: none;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.ProseMirror.resize-cursor {
|
|
240
|
+
cursor: ew-resize;
|
|
241
|
+
cursor: col-resize;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/* Give selected cells a blue overlay */
|
|
245
|
+
.ProseMirror .selectedCell:after {
|
|
246
|
+
z-index: 2;
|
|
247
|
+
position: absolute;
|
|
248
|
+
content: "";
|
|
249
|
+
left: 0; right: 0; top: 0; bottom: 0;
|
|
250
|
+
background: rgba(200, 200, 255, 0.4);
|
|
251
|
+
pointer-events: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Resizing */
|
|
255
|
+
.k-editor-resize-wrap-element {
|
|
256
|
+
display: inline-block;
|
|
257
|
+
position: relative;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.ProseMirror .row-resize-handle {
|
|
261
|
+
position: absolute;
|
|
262
|
+
right: 0; left: 0; bottom: 0;
|
|
263
|
+
transform: translate(0, 50%);
|
|
264
|
+
height: 4px;
|
|
265
|
+
z-index: 20;
|
|
266
|
+
background-color: #adf;
|
|
267
|
+
pointer-events: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.ProseMirror.resize-cursor-vertical {
|
|
271
|
+
cursor: sn-resize;
|
|
272
|
+
cursor: row-resize;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.k-editor-resize-wrap-element table td p,
|
|
276
|
+
.k-editor-resize-wrap-element table th p {
|
|
277
|
+
margin: 0 auto;
|
|
278
|
+
}
|
|
253
279
|
`;
|
|
254
280
|
/**
|
|
255
281
|
* @hidden
|
|
@@ -12,7 +12,7 @@ const inlineCommand = {
|
|
|
12
12
|
cleanFormatting: (options) => cleanFormatting(options),
|
|
13
13
|
createLink: attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs.value, applyToWord: attrs.applyToWord }),
|
|
14
14
|
fontFamily: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-family', value: attrs.value, applyToWord: attrs.applyToWord }),
|
|
15
|
-
fontSize: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value
|
|
15
|
+
fontSize: attrs => expandToWordWrap(applyInlineStyle, { style: 'font-size', value: attrs.value, applyToWord: attrs.applyToWord }),
|
|
16
16
|
insertFile: attrs => expandToWordWrap(applyLink, { mark: 'link', attrs: attrs, applyToWord: attrs.applyToWord }),
|
|
17
17
|
insertText: text => insertText(text),
|
|
18
18
|
italic: (applyToWord) => expandToWordWrap(toggleInlineFormat, Object.assign(Object.assign({}, italic), { applyToWord })),
|
|
@@ -8,7 +8,7 @@ import { BehaviorSubject, fromEvent, Subject, zip } from 'rxjs';
|
|
|
8
8
|
import { map, filter, take } from 'rxjs/operators';
|
|
9
9
|
import { ToolBarComponent } from '@progress/kendo-angular-toolbar';
|
|
10
10
|
import { hasObservers, isDocumentAvailable, KendoInput } from '@progress/kendo-angular-common';
|
|
11
|
-
import { buildKeymap, buildListKeymap, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, AllSelection, gapCursor, getSelectionText, imageResizing, tableEditing, caretColor } from '@progress/kendo-editor-common';
|
|
11
|
+
import { buildKeymap, buildListKeymap, getHtml, pasteCleanup, sanitize, removeComments, sanitizeClassAttr, sanitizeStyleAttr, removeAttribute, placeholder, EditorView, EditorState, baseKeymap, keymap, history, parseContent, Plugin, PluginKey, TextSelection, Schema, AllSelection, gapCursor, getSelectionText, imageResizing, tableEditing, caretColor, tableResizing } from '@progress/kendo-editor-common';
|
|
12
12
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
13
13
|
import { packageMetadata } from './package-metadata';
|
|
14
14
|
import { schema } from './config/schema';
|
|
@@ -201,7 +201,7 @@ export class EditorComponent {
|
|
|
201
201
|
this.onChangeCallback = (value) => {
|
|
202
202
|
this.changeValue(value);
|
|
203
203
|
};
|
|
204
|
-
this.onTouchedCallback = (_) => { };
|
|
204
|
+
this.onTouchedCallback = (_) => { };
|
|
205
205
|
this.onPaste = (_view, nativeEvent) => {
|
|
206
206
|
this._pasteEvent = nativeEvent;
|
|
207
207
|
return false;
|
|
@@ -382,6 +382,9 @@ export class EditorComponent {
|
|
|
382
382
|
get toolbar() {
|
|
383
383
|
return this.defaultToolbarComponent || this.userToolBarComponent;
|
|
384
384
|
}
|
|
385
|
+
get toolbarElement() {
|
|
386
|
+
return this.defaultToolbar || this.userToolBarElement;
|
|
387
|
+
}
|
|
385
388
|
/**
|
|
386
389
|
* Returns the ProseMirror [EditorView](https://prosemirror.net/docs/ref/#view.EditorView) object
|
|
387
390
|
* that manages the DOM structure that represents an editable document.
|
|
@@ -402,6 +405,7 @@ export class EditorComponent {
|
|
|
402
405
|
this.subs.add(this.toolsService.needsCheck.subscribe(() => this.cdr.markForCheck()));
|
|
403
406
|
}
|
|
404
407
|
ngAfterViewInit() {
|
|
408
|
+
var _a;
|
|
405
409
|
this.afterViewInit.next();
|
|
406
410
|
if (!this.iframe) {
|
|
407
411
|
this.contentAreaLoaded.next();
|
|
@@ -409,6 +413,13 @@ export class EditorComponent {
|
|
|
409
413
|
if (this.resizable) {
|
|
410
414
|
this.normalizeSize();
|
|
411
415
|
}
|
|
416
|
+
// address edge cases for responsive toolbar tools
|
|
417
|
+
// calculations - https://github.com/telerik/kendo-angular/issues/3661
|
|
418
|
+
if ((_a = this.toolbar) === null || _a === void 0 ? void 0 : _a.resizable) {
|
|
419
|
+
this.ngZone.runOutsideAngular(() => {
|
|
420
|
+
setTimeout(() => this.toolbar.onResize(), 70);
|
|
421
|
+
});
|
|
422
|
+
}
|
|
412
423
|
}
|
|
413
424
|
ngOnChanges(changes) {
|
|
414
425
|
if (changes.value && this.view) {
|
|
@@ -659,6 +670,7 @@ export class EditorComponent {
|
|
|
659
670
|
keymap(baseKeymap),
|
|
660
671
|
gapCursor(),
|
|
661
672
|
imageResizing(),
|
|
673
|
+
...tableResizing(),
|
|
662
674
|
tableEditing(),
|
|
663
675
|
caretColor()
|
|
664
676
|
];
|
|
@@ -740,7 +752,7 @@ export class EditorComponent {
|
|
|
740
752
|
}));
|
|
741
753
|
this.subs.add(fromEvent(this.viewMountElement, 'keyup')
|
|
742
754
|
.pipe(map((e) => e.keyCode), filter((code) => code === 121), // F10
|
|
743
|
-
map(() => this.
|
|
755
|
+
map(() => this.toolbarElement))
|
|
744
756
|
.subscribe((toolbar) => toolbar.nativeElement.focus()));
|
|
745
757
|
this.subs.add(fromEvent(this.viewMountElement, 'blur')
|
|
746
758
|
.pipe(filter((event) => !this.viewMountElement.contains(event.relatedTarget)))
|
|
@@ -819,7 +831,7 @@ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
819
831
|
provide: KendoInput,
|
|
820
832
|
useExisting: forwardRef(() => EditorComponent)
|
|
821
833
|
}
|
|
822
|
-
], queries: [{ propertyName: "userToolBarComponent", first: true, predicate: ToolBarComponent, descendants: true }, { propertyName: "userToolBarElement", first: true, predicate: ToolBarComponent, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "dialogContainer", first: true, predicate: ["dialogsContainer"], descendants: true, read: ViewContainerRef
|
|
834
|
+
], queries: [{ propertyName: "userToolBarComponent", first: true, predicate: ToolBarComponent, descendants: true }, { propertyName: "userToolBarElement", first: true, predicate: ToolBarComponent, descendants: true, read: ElementRef }], viewQueries: [{ propertyName: "dialogContainer", first: true, predicate: ["dialogsContainer"], descendants: true, read: ViewContainerRef }, { propertyName: "container", first: true, predicate: ["content"], descendants: true, read: ViewContainerRef }, { propertyName: "defaultToolbar", first: true, predicate: ["defaultToolbar"], descendants: true, read: ElementRef }, { propertyName: "defaultToolbarComponent", first: true, predicate: ["defaultToolbar"], descendants: true, read: ToolBarComponent }], usesOnChanges: true, ngImport: i0, template: `
|
|
823
835
|
<ng-container
|
|
824
836
|
kendoEditorLocalizedMessages
|
|
825
837
|
i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."
|
|
@@ -930,7 +942,6 @@ EditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", versio
|
|
|
930
942
|
deleteTable="Delete table"
|
|
931
943
|
>
|
|
932
944
|
</ng-container>
|
|
933
|
-
|
|
934
945
|
<ng-content select="kendo-toolbar"></ng-content>
|
|
935
946
|
<kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>
|
|
936
947
|
<kendo-toolbar-buttongroup>
|
|
@@ -1103,7 +1114,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1103
1114
|
deleteTable="Delete table"
|
|
1104
1115
|
>
|
|
1105
1116
|
</ng-container>
|
|
1106
|
-
|
|
1107
1117
|
<ng-content select="kendo-toolbar"></ng-content>
|
|
1108
1118
|
<kendo-toolbar [overflow]="true" [tabindex]="readonly ? -1 : 0" *ngIf="!userToolBarElement" #defaultToolbar>
|
|
1109
1119
|
<kendo-toolbar-buttongroup>
|
|
@@ -1224,16 +1234,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1224
1234
|
args: ['style.maxHeight']
|
|
1225
1235
|
}], userToolBarComponent: [{
|
|
1226
1236
|
type: ContentChild,
|
|
1227
|
-
args: [ToolBarComponent
|
|
1237
|
+
args: [ToolBarComponent]
|
|
1228
1238
|
}], userToolBarElement: [{
|
|
1229
1239
|
type: ContentChild,
|
|
1230
|
-
args: [ToolBarComponent, { read: ElementRef
|
|
1240
|
+
args: [ToolBarComponent, { read: ElementRef }]
|
|
1231
1241
|
}], dialogContainer: [{
|
|
1232
1242
|
type: ViewChild,
|
|
1233
|
-
args: ['dialogsContainer', { read: ViewContainerRef
|
|
1243
|
+
args: ['dialogsContainer', { read: ViewContainerRef }]
|
|
1234
1244
|
}], container: [{
|
|
1235
1245
|
type: ViewChild,
|
|
1236
|
-
args: ['content', { read: ViewContainerRef
|
|
1246
|
+
args: ['content', { read: ViewContainerRef }]
|
|
1237
1247
|
}], defaultToolbar: [{
|
|
1238
1248
|
type: ViewChild,
|
|
1239
1249
|
args: ['defaultToolbar', { read: ElementRef, static: false }]
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-editor',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1653486755,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -38,21 +38,31 @@ export class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
38
38
|
*/
|
|
39
39
|
this.valueChange = new EventEmitter();
|
|
40
40
|
this._data = [
|
|
41
|
-
{ text: '8px', size:
|
|
42
|
-
{ text: '10px', size:
|
|
43
|
-
{ text: '12px', size:
|
|
44
|
-
{ text: '14px', size:
|
|
45
|
-
{ text: '18px', size:
|
|
46
|
-
{ text: '24px', size:
|
|
47
|
-
{ text: '36px', size:
|
|
41
|
+
{ text: '8px', size: '8px' },
|
|
42
|
+
{ text: '10px', size: '10px' },
|
|
43
|
+
{ text: '12px', size: '12px' },
|
|
44
|
+
{ text: '14px', size: '14px' },
|
|
45
|
+
{ text: '18px', size: '18px' },
|
|
46
|
+
{ text: '24px', size: '24px' },
|
|
47
|
+
{ text: '36px', size: '36px' }
|
|
48
48
|
];
|
|
49
49
|
this.editor = providerService.editor;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Overrides the default font size list.
|
|
53
|
+
* Numeric values are treated as pixels.
|
|
53
54
|
*/
|
|
54
55
|
set data(sizes) {
|
|
55
|
-
|
|
56
|
+
let normalizedSizes;
|
|
57
|
+
if (sizes) {
|
|
58
|
+
normalizedSizes = sizes.map(s => {
|
|
59
|
+
if (typeof s.size === 'number') {
|
|
60
|
+
return Object.assign(Object.assign({}, s), { size: `${s.size}px` });
|
|
61
|
+
}
|
|
62
|
+
return s;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
this._data = normalizedSizes || this._data;
|
|
56
66
|
}
|
|
57
67
|
get data() {
|
|
58
68
|
return this._data;
|
|
@@ -73,7 +83,7 @@ export class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
73
83
|
this.subs = this.editor.stateChange.subscribe(({ style }) => {
|
|
74
84
|
// remove units(px, em, rem...)
|
|
75
85
|
// string#match returns array
|
|
76
|
-
this.value =
|
|
86
|
+
this.value = getUniqueStyleValues(style.selected, 'font-size') || null;
|
|
77
87
|
this.disabled = style.disabled;
|
|
78
88
|
});
|
|
79
89
|
}
|
|
@@ -84,7 +94,7 @@ export class EditorFontSizeComponent extends ToolBarToolComponent {
|
|
|
84
94
|
if (isPresent(ev)) {
|
|
85
95
|
this.editor.exec('fontSize', ev);
|
|
86
96
|
this.editor.view.focus();
|
|
87
|
-
this.valueChange.emit(this.data.find(d => d.size ===
|
|
97
|
+
this.valueChange.emit(this.data.find(d => d.size === ev));
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
ngOnDestroy() {
|