@progress/kendo-angular-editor 21.4.1 → 22.0.0-develop.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/fesm2022/progress-kendo-angular-editor.mjs +196 -196
- package/localization/messages.d.ts +1 -1
- package/package.json +20 -28
- package/schematics/ngAdd/index.js +4 -4
- package/tools/shared/editor-command-base.d.ts +1 -1
- package/esm2022/common/active-marks.mjs +0 -5
- package/esm2022/common/apply-to-word-options.mjs +0 -5
- package/esm2022/common/commands.mjs +0 -5
- package/esm2022/common/css-settings.interface.mjs +0 -5
- package/esm2022/common/direction.mjs +0 -5
- package/esm2022/common/error-messages.mjs +0 -16
- package/esm2022/common/font-family-item.interface.mjs +0 -5
- package/esm2022/common/font-size-item.interface.mjs +0 -5
- package/esm2022/common/format-item.interface.mjs +0 -5
- package/esm2022/common/image-data.interface.mjs +0 -5
- package/esm2022/common/link-data.interface.mjs +0 -5
- package/esm2022/common/paste-cleanup-settings.mjs +0 -5
- package/esm2022/common/plugins-function.mjs +0 -5
- package/esm2022/common/predicate.mjs +0 -5
- package/esm2022/common/provider.service.mjs +0 -17
- package/esm2022/common/resizable-options.interface.mjs +0 -5
- package/esm2022/common/styles.mjs +0 -306
- package/esm2022/common/table-data.interface.mjs +0 -5
- package/esm2022/config/command-icons.mjs +0 -93
- package/esm2022/config/commands.mjs +0 -62
- package/esm2022/config/schema.mjs +0 -22
- package/esm2022/config/semantic-nodes.mjs +0 -27
- package/esm2022/config/table-commands.mjs +0 -14
- package/esm2022/config/utils.mjs +0 -96
- package/esm2022/dialogs/colorpicker-dialog.component.mjs +0 -140
- package/esm2022/dialogs/file-link-dialog.component.mjs +0 -252
- package/esm2022/dialogs/font-family-dialog.component.mjs +0 -115
- package/esm2022/dialogs/font-size-dialog.component.mjs +0 -115
- package/esm2022/dialogs/format-dialog.component.mjs +0 -114
- package/esm2022/dialogs/image-dialog.component.mjs +0 -230
- package/esm2022/dialogs/insert-table-dialog.component.mjs +0 -79
- package/esm2022/dialogs/source-dialog.component.mjs +0 -112
- package/esm2022/directives.mjs +0 -95
- package/esm2022/editor-toolbar-state.mjs +0 -280
- package/esm2022/editor.component.mjs +0 -1319
- package/esm2022/editor.module.mjs +0 -89
- package/esm2022/index.mjs +0 -64
- package/esm2022/localization/custom-messages.component.mjs +0 -53
- package/esm2022/localization/editor-localization.service.mjs +0 -31
- package/esm2022/localization/localized-messages.directive.mjs +0 -35
- package/esm2022/localization/messages.mjs +0 -364
- package/esm2022/package-metadata.mjs +0 -16
- package/esm2022/preventable-events/paste-event.mjs +0 -32
- package/esm2022/preventable-events/preventable-event.mjs +0 -25
- package/esm2022/progress-kendo-angular-editor.mjs +0 -8
- package/esm2022/tools/alignment/editor-align-center-button.directive.mjs +0 -42
- package/esm2022/tools/alignment/editor-align-justify-button.directive.mjs +0 -42
- package/esm2022/tools/alignment/editor-align-left-button.directive.mjs +0 -42
- package/esm2022/tools/alignment/editor-align-right-button.directive.mjs +0 -42
- package/esm2022/tools/blockquote/editor-blockquote-button.directive.mjs +0 -40
- package/esm2022/tools/colorpicker/editor-back-color.directive.mjs +0 -41
- package/esm2022/tools/colorpicker/editor-colorpicker.component.mjs +0 -377
- package/esm2022/tools/colorpicker/editor-fore-color.directive.mjs +0 -37
- package/esm2022/tools/editor-clean-formatting-button.directive.mjs +0 -41
- package/esm2022/tools/fontfamily/editor-fontfamily-dropdownlist.component.mjs +0 -109
- package/esm2022/tools/fontfamily/editor-fontfamily.component.mjs +0 -297
- package/esm2022/tools/fontsize/editor-fontsize-dropdownlist.component.mjs +0 -98
- package/esm2022/tools/fontsize/editor-fontsize.component.mjs +0 -305
- package/esm2022/tools/format/editor-format-dropdownlist.component.mjs +0 -182
- package/esm2022/tools/format/editor-format.component.mjs +0 -283
- package/esm2022/tools/history/editor-redo-button.directive.mjs +0 -42
- package/esm2022/tools/history/editor-undo-button.directive.mjs +0 -42
- package/esm2022/tools/image/editor-insert-image-button.directive.mjs +0 -41
- package/esm2022/tools/indentation/editor-indent-button.directive.mjs +0 -41
- package/esm2022/tools/indentation/editor-outdent-button.directive.mjs +0 -41
- package/esm2022/tools/link/editor-create-link-button.directive.mjs +0 -41
- package/esm2022/tools/link/editor-insert-file-button.directive.mjs +0 -40
- package/esm2022/tools/link/editor-unlink-button.directive.mjs +0 -41
- package/esm2022/tools/list/editor-insert-ordered-list-button.directive.mjs +0 -41
- package/esm2022/tools/list/editor-insert-unordered-list-button.directive.mjs +0 -42
- package/esm2022/tools/print/editor-print-button.directive.mjs +0 -62
- package/esm2022/tools/select-all/select-all-button.directive.mjs +0 -45
- package/esm2022/tools/shared/dropdown-tool.directive.mjs +0 -40
- package/esm2022/tools/shared/editor-command-base.mjs +0 -78
- package/esm2022/tools/shared/editor-command-button.mjs +0 -37
- package/esm2022/tools/shared/editor-command-dialog.mjs +0 -33
- package/esm2022/tools/source/editor-view-source-button.directive.mjs +0 -41
- package/esm2022/tools/tables/editor-add-column-after-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-add-column-before-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-add-row-after-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-add-row-before-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-delete-column-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-delete-row-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-delete-table-button.directive.mjs +0 -42
- package/esm2022/tools/tables/editor-insert-table-button.component.mjs +0 -307
- package/esm2022/tools/tables/editor-merge-cells-button.directive.mjs +0 -44
- package/esm2022/tools/tables/editor-split-cell-button.directive.mjs +0 -44
- package/esm2022/tools/tables/popup-table-grid.component.mjs +0 -117
- package/esm2022/tools/tools.service.mjs +0 -22
- package/esm2022/tools/typographical-emphasis/editor-bold-button.directive.mjs +0 -42
- package/esm2022/tools/typographical-emphasis/editor-italic-button.directive.mjs +0 -42
- package/esm2022/tools/typographical-emphasis/editor-strikethrough-button.directive.mjs +0 -42
- package/esm2022/tools/typographical-emphasis/editor-subscript-button.directive.mjs +0 -42
- package/esm2022/tools/typographical-emphasis/editor-superscript-button.directive.mjs +0 -42
- package/esm2022/tools/typographical-emphasis/editor-underline-button.directive.mjs +0 -42
- package/esm2022/util.mjs +0 -130
|
@@ -1,1319 +0,0 @@
|
|
|
1
|
-
/**-----------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
3
|
-
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
-
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { Component, HostBinding, ViewChild, ContentChild, ViewContainerRef, Output, ElementRef, EventEmitter, forwardRef, Input, ChangeDetectorRef, NgZone, isDevMode, Renderer2 } from '@angular/core';
|
|
6
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
7
|
-
import { BehaviorSubject, fromEvent, Subject, zip } from 'rxjs';
|
|
8
|
-
import { map, filter, take } from 'rxjs/operators';
|
|
9
|
-
import { ToolBarButtonComponent, ToolBarButtonGroupComponent, ToolBarComponent } from '@progress/kendo-angular-toolbar';
|
|
10
|
-
import { DialogService } from '@progress/kendo-angular-dialog';
|
|
11
|
-
import { guid, hasObservers, isDocumentAvailable, KendoInput, shouldShowValidationUI, getLicenseMessage, WatermarkOverlayComponent, Keys } from '@progress/kendo-angular-common';
|
|
12
|
-
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, cspFix } from '@progress/kendo-editor-common';
|
|
13
|
-
import { validatePackage } from '@progress/kendo-licensing';
|
|
14
|
-
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
15
|
-
import { packageMetadata } from './package-metadata';
|
|
16
|
-
import { schema } from './config/schema';
|
|
17
|
-
import { editorCommands } from './config/commands';
|
|
18
|
-
import { getToolbarState, initialToolBarState, disabledToolBarState } from './editor-toolbar-state';
|
|
19
|
-
import { removeEmptyEntries, conditionallyExecute, isPresent } from './util';
|
|
20
|
-
import { SourceDialogComponent } from './dialogs/source-dialog.component';
|
|
21
|
-
import { ImageDialogComponent } from './dialogs/image-dialog.component';
|
|
22
|
-
import { FileLinkDialogComponent } from './dialogs/file-link-dialog.component';
|
|
23
|
-
import { EditorLocalizationService } from './localization/editor-localization.service';
|
|
24
|
-
import { defaultStyle, tablesStyles, rtlStyles } from './common/styles';
|
|
25
|
-
import { EditorErrorMessages } from './common/error-messages';
|
|
26
|
-
import { ProviderService } from './common/provider.service';
|
|
27
|
-
import { EditorToolsService } from './tools/tools.service';
|
|
28
|
-
import { EditorPasteEvent } from './preventable-events/paste-event';
|
|
29
|
-
import { EditorInsertImageButtonDirective } from './tools/image/editor-insert-image-button.directive';
|
|
30
|
-
import { EditorUnlinkButtonDirective } from './tools/link/editor-unlink-button.directive';
|
|
31
|
-
import { EditorCreateLinkButtonDirective } from './tools/link/editor-create-link-button.directive';
|
|
32
|
-
import { EditorOutdentButtonDirective } from './tools/indentation/editor-outdent-button.directive';
|
|
33
|
-
import { EditorIndentButtonDirective } from './tools/indentation/editor-indent-button.directive';
|
|
34
|
-
import { EditorInsertOrderedListButtonDirective } from './tools/list/editor-insert-ordered-list-button.directive';
|
|
35
|
-
import { EditorInsertUnorderedListButtonDirective } from './tools/list/editor-insert-unordered-list-button.directive';
|
|
36
|
-
import { EditorAlignJustifyButtonDirective } from './tools/alignment/editor-align-justify-button.directive';
|
|
37
|
-
import { EditorAlignRightButtonDirective } from './tools/alignment/editor-align-right-button.directive';
|
|
38
|
-
import { EditorAlignCenterButtonDirective } from './tools/alignment/editor-align-center-button.directive';
|
|
39
|
-
import { EditorAlignLeftButtonDirective } from './tools/alignment/editor-align-left-button.directive';
|
|
40
|
-
import { EditorFormatComponent } from './tools/format/editor-format.component';
|
|
41
|
-
import { EditorUnderlineButtonDirective } from './tools/typographical-emphasis/editor-underline-button.directive';
|
|
42
|
-
import { EditorItalicButtonDirective } from './tools/typographical-emphasis/editor-italic-button.directive';
|
|
43
|
-
import { EditorBoldButtonDirective } from './tools/typographical-emphasis/editor-bold-button.directive';
|
|
44
|
-
import { LocalizedMessagesDirective } from './localization/localized-messages.directive';
|
|
45
|
-
import * as i0 from "@angular/core";
|
|
46
|
-
import * as i1 from "@progress/kendo-angular-dialog";
|
|
47
|
-
import * as i2 from "@progress/kendo-angular-l10n";
|
|
48
|
-
import * as i3 from "./common/provider.service";
|
|
49
|
-
import * as i4 from "./tools/tools.service";
|
|
50
|
-
const EMPTY_PARAGRAPH = '<p></p>';
|
|
51
|
-
const defaultPasteCleanupSettings = {
|
|
52
|
-
convertMsLists: false,
|
|
53
|
-
removeAttributes: [],
|
|
54
|
-
removeHtmlComments: false,
|
|
55
|
-
removeInvalidHTML: true,
|
|
56
|
-
removeMsClasses: false,
|
|
57
|
-
removeMsStyles: false,
|
|
58
|
-
stripTags: []
|
|
59
|
-
};
|
|
60
|
-
const removeCommentsIf = conditionallyExecute(removeComments);
|
|
61
|
-
const removeInvalidHTMLIf = conditionallyExecute(sanitize);
|
|
62
|
-
const getPasteCleanupAttributes = (config) => {
|
|
63
|
-
if (config.removeAttributes === 'all') {
|
|
64
|
-
return { '*': removeAttribute };
|
|
65
|
-
}
|
|
66
|
-
const initial = removeEmptyEntries({
|
|
67
|
-
style: config.removeMsStyles ? sanitizeStyleAttr : undefined,
|
|
68
|
-
class: config.removeMsClasses ? sanitizeClassAttr : undefined
|
|
69
|
-
});
|
|
70
|
-
return config.removeAttributes.reduce((acc, curr) => ({ ...acc, [curr]: removeAttribute }), initial);
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Represents the [Kendo UI Editor component for Angular]({% slug overview_editor %}).
|
|
74
|
-
*
|
|
75
|
-
* Use the Editor to create and edit rich text content in your Angular applications.
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* ```html
|
|
79
|
-
* <kendo-editor [(value)]="editorValue"></kendo-editor>
|
|
80
|
-
* ```
|
|
81
|
-
* @remarks
|
|
82
|
-
* Supported children components are: {@link CustomMessagesComponent}, {@link ToolBarComponent}.
|
|
83
|
-
*/
|
|
84
|
-
export class EditorComponent {
|
|
85
|
-
dialogService;
|
|
86
|
-
localization;
|
|
87
|
-
cdr;
|
|
88
|
-
ngZone;
|
|
89
|
-
element;
|
|
90
|
-
providerService;
|
|
91
|
-
toolsService;
|
|
92
|
-
renderer;
|
|
93
|
-
/**
|
|
94
|
-
* Sets the value of the Editor ([see example](slug:overview_editor)).
|
|
95
|
-
* Use this property to update the Editor content programmatically.
|
|
96
|
-
*/
|
|
97
|
-
set value(value) {
|
|
98
|
-
this.changeValue(value);
|
|
99
|
-
}
|
|
100
|
-
get value() {
|
|
101
|
-
if (this.trOnChange) {
|
|
102
|
-
return this.htmlOnChange;
|
|
103
|
-
}
|
|
104
|
-
const value = this._view ? this.getSource() : this._value;
|
|
105
|
-
if (value === EMPTY_PARAGRAPH) {
|
|
106
|
-
return this._value ? '' : this._value;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
return value;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Sets the disabled state of the component. To disable the Editor in reactive forms, see [Forms Support](slug:formssupport_editor#toc-managing-the-editor-disabled-state-in-reactive-forms).
|
|
114
|
-
*/
|
|
115
|
-
set disabled(value) {
|
|
116
|
-
this._disabled = value || false;
|
|
117
|
-
if (this._view) {
|
|
118
|
-
this._view.updateState(this._view.state);
|
|
119
|
-
}
|
|
120
|
-
if (this._disabled) {
|
|
121
|
-
this.readonly = false;
|
|
122
|
-
}
|
|
123
|
-
if (this._disabled || this._readonly) {
|
|
124
|
-
this.stateChange.next(disabledToolBarState);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
this.stateChange.next(initialToolBarState);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
get disabled() {
|
|
131
|
-
return this._disabled;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Sets the read-only state of the component.
|
|
135
|
-
*
|
|
136
|
-
* When `true`, users cannot edit the content.
|
|
137
|
-
* @default false
|
|
138
|
-
*/
|
|
139
|
-
set readonly(value) {
|
|
140
|
-
this._readonly = value || false;
|
|
141
|
-
if (this._view) {
|
|
142
|
-
// remove DOM selection
|
|
143
|
-
let win;
|
|
144
|
-
if (this.iframe) {
|
|
145
|
-
win = this.container.element.nativeElement.contentWindow;
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
win = window;
|
|
149
|
-
}
|
|
150
|
-
const focusedNode = win.getSelection().focusNode;
|
|
151
|
-
if (this._view.dom.contains(focusedNode)) {
|
|
152
|
-
win.getSelection().removeAllRanges();
|
|
153
|
-
}
|
|
154
|
-
// remove ProseMirror selection
|
|
155
|
-
const doc = this._view.state.doc;
|
|
156
|
-
const tr = this._view.state.tr.setSelection(TextSelection.create(doc, 1));
|
|
157
|
-
this._view.dispatch(tr);
|
|
158
|
-
}
|
|
159
|
-
if (this._readonly) {
|
|
160
|
-
if (this.toolbar) {
|
|
161
|
-
this.toolbar.tabindex = -1;
|
|
162
|
-
}
|
|
163
|
-
this.stateChange.next(disabledToolBarState);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
if (this.toolbar) {
|
|
167
|
-
this.toolbar.tabindex = 0;
|
|
168
|
-
}
|
|
169
|
-
this.stateChange.next(initialToolBarState);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
get readonly() {
|
|
173
|
-
return this._readonly;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* If set to `false`, the Editor runs in non-encapsulated style mode.
|
|
177
|
-
* The Editor content inherits styles from the page.
|
|
178
|
-
* @default true
|
|
179
|
-
*/
|
|
180
|
-
iframe = true;
|
|
181
|
-
/**
|
|
182
|
-
* Applies custom CSS styles to the Editor in iframe mode.
|
|
183
|
-
* Use this property to provide additional CSS for the Editor content.
|
|
184
|
-
*/
|
|
185
|
-
set iframeCss(settings) {
|
|
186
|
-
this._iframeCss = Object.assign(this._iframeCss, settings);
|
|
187
|
-
}
|
|
188
|
-
get iframeCss() {
|
|
189
|
-
return this._iframeCss;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* When set to `true` or an `ApplyToWordOptions` object, emphasis or inline style commands apply to the whole word at the cursor.
|
|
193
|
-
* @default false
|
|
194
|
-
*/
|
|
195
|
-
applyToWord = false;
|
|
196
|
-
/**
|
|
197
|
-
* Provides a custom schema for the Editor ([see example]({% slug schema_editor %})).
|
|
198
|
-
*/
|
|
199
|
-
set schema(value) {
|
|
200
|
-
if (isDevMode) {
|
|
201
|
-
if (!(value instanceof Schema)) {
|
|
202
|
-
throw new Error(EditorErrorMessages.schemaType);
|
|
203
|
-
}
|
|
204
|
-
if (this._view) {
|
|
205
|
-
throw new Error(EditorErrorMessages.setSchemaOnce);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
this._schema = value;
|
|
209
|
-
}
|
|
210
|
-
get schema() {
|
|
211
|
-
return this._schema;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Defines a function to customize the plugins used by the Editor.
|
|
215
|
-
* The function receives the default plugins and returns the plugins to use ([see example]({% slug plugins_editor %})).
|
|
216
|
-
*/
|
|
217
|
-
set plugins(fn) {
|
|
218
|
-
if (isDevMode) {
|
|
219
|
-
if (typeof fn !== 'function') {
|
|
220
|
-
throw new Error(EditorErrorMessages.pluginsCallbackType(fn));
|
|
221
|
-
}
|
|
222
|
-
if (this._view) {
|
|
223
|
-
throw new Error(EditorErrorMessages.setPluginsOnce);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
this._plugins = fn;
|
|
227
|
-
}
|
|
228
|
-
get plugins() {
|
|
229
|
-
return this._plugins;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Sets the hint text displayed when the Editor is empty.
|
|
233
|
-
* Use this property to provide guidance to users.
|
|
234
|
-
*/
|
|
235
|
-
set placeholder(value) {
|
|
236
|
-
if (isDevMode && this._view) {
|
|
237
|
-
throw new Error(EditorErrorMessages.setPlaceHolderOnce);
|
|
238
|
-
}
|
|
239
|
-
this._placeholder = value;
|
|
240
|
-
}
|
|
241
|
-
get placeholder() {
|
|
242
|
-
return this._placeholder;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Controls whitespace handling in the Editor content.
|
|
246
|
-
* Set to `true` to preserve whitespace and normalize newlines to spaces.
|
|
247
|
-
* Set to `'full'` to preserve all whitespace.
|
|
248
|
-
* @default false
|
|
249
|
-
*/
|
|
250
|
-
preserveWhitespace = false;
|
|
251
|
-
/**
|
|
252
|
-
* Configures how pasted content is cleaned before it is added to the Editor ([see example]({% slug paste_cleanup %})).
|
|
253
|
-
* Use this property to remove unwanted HTML, styles, or attributes from pasted content.
|
|
254
|
-
*/
|
|
255
|
-
pasteCleanupSettings;
|
|
256
|
-
/**
|
|
257
|
-
* Determines whether the Editor can be resized ([see example](slug:resizing_editor#toc-resizing-the-editor)).
|
|
258
|
-
* Set to `true` or provide an object with resizing options.
|
|
259
|
-
* @default false
|
|
260
|
-
*/
|
|
261
|
-
resizable = false;
|
|
262
|
-
/**
|
|
263
|
-
* Fires when the Editor value changes due to user interaction.
|
|
264
|
-
* This event does not fire when the value changes programmatically through `ngModel` or form bindings
|
|
265
|
-
* ([see example](slug:events_editor)).
|
|
266
|
-
*/
|
|
267
|
-
valueChange = new EventEmitter();
|
|
268
|
-
/**
|
|
269
|
-
* Fires when the Editor content area receives focus ([see example](slug:events_editor)).
|
|
270
|
-
*/
|
|
271
|
-
onFocus = new EventEmitter();
|
|
272
|
-
/**
|
|
273
|
-
* Fires when the user paste content into the Editor ([see example](slug:events_editor)).
|
|
274
|
-
* This event is preventable. If you cancel it, the Editor content does not change.
|
|
275
|
-
*/
|
|
276
|
-
paste = new EventEmitter();
|
|
277
|
-
/**
|
|
278
|
-
* Fires when the Editor content area is blurred ([see example](slug:events_editor)).
|
|
279
|
-
*/
|
|
280
|
-
onBlur = new EventEmitter();
|
|
281
|
-
hostClass = true;
|
|
282
|
-
get resizableClass() {
|
|
283
|
-
return !!this.resizable;
|
|
284
|
-
}
|
|
285
|
-
get isDisabled() {
|
|
286
|
-
return this.disabled;
|
|
287
|
-
}
|
|
288
|
-
get isReadonly() {
|
|
289
|
-
return this.readonly;
|
|
290
|
-
}
|
|
291
|
-
get dir() {
|
|
292
|
-
return this.direction;
|
|
293
|
-
}
|
|
294
|
-
get ariaDisabled() {
|
|
295
|
-
return this.disabled;
|
|
296
|
-
}
|
|
297
|
-
get minWidth() {
|
|
298
|
-
const resizableOptions = this.resizable;
|
|
299
|
-
return resizableOptions.minWidth ? resizableOptions.minWidth + 'px' : undefined;
|
|
300
|
-
}
|
|
301
|
-
get maxWidth() {
|
|
302
|
-
const resizableOptions = this.resizable;
|
|
303
|
-
return resizableOptions.maxWidth ? resizableOptions.maxWidth + 'px' : undefined;
|
|
304
|
-
}
|
|
305
|
-
get minHeight() {
|
|
306
|
-
const resizableOptions = this.resizable;
|
|
307
|
-
return resizableOptions.minHeight ? resizableOptions.minHeight + 'px' : undefined;
|
|
308
|
-
}
|
|
309
|
-
get maxHeight() {
|
|
310
|
-
const resizableOptions = this.resizable;
|
|
311
|
-
return resizableOptions.maxHeight ? resizableOptions.maxHeight + 'px' : undefined;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* @hidden
|
|
315
|
-
*/
|
|
316
|
-
stateChange = new BehaviorSubject(initialToolBarState);
|
|
317
|
-
/**
|
|
318
|
-
* @hidden
|
|
319
|
-
*/
|
|
320
|
-
showLicenseWatermark = false;
|
|
321
|
-
/**
|
|
322
|
-
* @hidden
|
|
323
|
-
*/
|
|
324
|
-
licenseMessage;
|
|
325
|
-
get toolbar() {
|
|
326
|
-
return this.defaultToolbarComponent || this.userToolBarComponent;
|
|
327
|
-
}
|
|
328
|
-
get toolbarElement() {
|
|
329
|
-
return this.defaultToolbar || this.userToolBarElement;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Returns the ProseMirror [EditorView](https://prosemirror.net/docs/ref/#view.EditorView) object.
|
|
333
|
-
* Use this property to access the underlying `EditorView` instance.
|
|
334
|
-
*/
|
|
335
|
-
get view() {
|
|
336
|
-
return this._view;
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Returns the text currently selected in the Editor ([see example]({% slug selection_editor %}#toc-retrieve-the-selected-text)).
|
|
340
|
-
*/
|
|
341
|
-
get selectionText() {
|
|
342
|
-
return this._view && this._view.state ? getSelectionText(this._view.state) : '';
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* @hidden
|
|
346
|
-
*/
|
|
347
|
-
valueModified = new Subject();
|
|
348
|
-
userToolBarComponent;
|
|
349
|
-
userToolBarElement;
|
|
350
|
-
dialogContainer;
|
|
351
|
-
// Use `ViewContainerRef` instead of `ElementRef` because the dialog expects `ViewContainerRef`.
|
|
352
|
-
container;
|
|
353
|
-
direction;
|
|
354
|
-
viewMountElement;
|
|
355
|
-
/**
|
|
356
|
-
* @hidden
|
|
357
|
-
*/
|
|
358
|
-
focusChangedProgrammatically;
|
|
359
|
-
/**
|
|
360
|
-
* @hidden
|
|
361
|
-
*/
|
|
362
|
-
shouldEmitFocus;
|
|
363
|
-
/**
|
|
364
|
-
* @hidden
|
|
365
|
-
*/
|
|
366
|
-
focusableId = `k-editor-${guid()}`;
|
|
367
|
-
defaultToolbar;
|
|
368
|
-
defaultToolbarComponent;
|
|
369
|
-
subs;
|
|
370
|
-
_view;
|
|
371
|
-
_value;
|
|
372
|
-
_disabled;
|
|
373
|
-
_readonly = false;
|
|
374
|
-
_schema;
|
|
375
|
-
_plugins;
|
|
376
|
-
_placeholder = '';
|
|
377
|
-
_styleObserver;
|
|
378
|
-
trOnChange;
|
|
379
|
-
htmlOnChange;
|
|
380
|
-
inForm = false;
|
|
381
|
-
_pasteEvent;
|
|
382
|
-
_iframeCss = { keepBuiltInCss: true };
|
|
383
|
-
afterViewInit = new Subject();
|
|
384
|
-
contentAreaLoaded = new Subject();
|
|
385
|
-
constructor(dialogService, localization, cdr, ngZone, element, providerService, toolsService, renderer) {
|
|
386
|
-
this.dialogService = dialogService;
|
|
387
|
-
this.localization = localization;
|
|
388
|
-
this.cdr = cdr;
|
|
389
|
-
this.ngZone = ngZone;
|
|
390
|
-
this.element = element;
|
|
391
|
-
this.providerService = providerService;
|
|
392
|
-
this.toolsService = toolsService;
|
|
393
|
-
this.renderer = renderer;
|
|
394
|
-
const isValid = validatePackage(packageMetadata);
|
|
395
|
-
this.licenseMessage = getLicenseMessage(packageMetadata);
|
|
396
|
-
this.showLicenseWatermark = shouldShowValidationUI(isValid);
|
|
397
|
-
this.providerService.editor = this;
|
|
398
|
-
this.direction = localization.rtl ? 'rtl' : 'ltr';
|
|
399
|
-
// https://stackoverflow.com/questions/56572483/chrome-is-synchronously-handling-iframe-loading-whereas-firefox-handles-it-asyn
|
|
400
|
-
this.subs = zip(this.afterViewInit.asObservable(), this.contentAreaLoaded.asObservable()).subscribe(() => this.initialize());
|
|
401
|
-
}
|
|
402
|
-
ngOnInit() {
|
|
403
|
-
this.subs.add(this.localization.changes.subscribe(({ rtl }) => {
|
|
404
|
-
this.direction = rtl ? 'rtl' : 'ltr';
|
|
405
|
-
}));
|
|
406
|
-
this.subs.add(this.toolsService.needsCheck.subscribe(() => this.cdr.markForCheck()));
|
|
407
|
-
}
|
|
408
|
-
ngAfterViewInit() {
|
|
409
|
-
if (!isDocumentAvailable()) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
this.afterViewInit.next(undefined);
|
|
413
|
-
if (!this.iframe) {
|
|
414
|
-
this.contentAreaLoaded.next(undefined);
|
|
415
|
-
}
|
|
416
|
-
if (this.resizable) {
|
|
417
|
-
this.normalizeSize();
|
|
418
|
-
}
|
|
419
|
-
if (this.userToolBarComponent) {
|
|
420
|
-
this.renderer.addClass(this.userToolBarComponent.element.nativeElement, 'k-editor-toolbar');
|
|
421
|
-
}
|
|
422
|
-
if (this.toolbar.overflow) {
|
|
423
|
-
this.toolbar.onResize();
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
ngOnChanges(changes) {
|
|
427
|
-
if (changes['value'] && this.view) {
|
|
428
|
-
this.changeValue(changes['value'].currentValue);
|
|
429
|
-
}
|
|
430
|
-
if (changes['iframe'] && !changes['iframe'].isFirstChange()) {
|
|
431
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => this.initialize());
|
|
432
|
-
}
|
|
433
|
-
if (changes['resizable'] && !changes['resizable'].isFirstChange()) {
|
|
434
|
-
this.normalizeSize();
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* @hidden
|
|
439
|
-
*/
|
|
440
|
-
setDisabledState(isDisabled) {
|
|
441
|
-
this.disabled = isDisabled;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* @hidden
|
|
445
|
-
*/
|
|
446
|
-
iframeOnLoad() {
|
|
447
|
-
this.contentAreaLoaded.next(undefined);
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Executes a command on the currently selected text
|
|
451
|
-
* ([more information and example]({% slug toolbartools_editor %}#toc-associating-toolbar-tools-with-editor-commands)).
|
|
452
|
-
*
|
|
453
|
-
* @param {EditorCommand} commandName - The command that will be executed.
|
|
454
|
-
* @param {any} attr - Optional parameters for the command.
|
|
455
|
-
*/
|
|
456
|
-
exec(commandName, attr) {
|
|
457
|
-
// normalizes setHTML attributes
|
|
458
|
-
if (commandName === 'setHTML' && typeof attr === 'string') {
|
|
459
|
-
attr = {
|
|
460
|
-
content: attr,
|
|
461
|
-
parseOptions: {
|
|
462
|
-
preserveWhitespace: this.preserveWhitespace
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
else if (['fontFamily', 'fontSize', 'foreColor', 'backColor', 'createLink'].some(name => name === commandName)) {
|
|
467
|
-
attr = {
|
|
468
|
-
value: attr,
|
|
469
|
-
applyToWord: this.applyToWord
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
// Finds a command and applies the attributes.
|
|
473
|
-
const command = editorCommands[commandName](attr);
|
|
474
|
-
// Executes a ProseMirror command.
|
|
475
|
-
command(this._view.state, this._view.dispatch, this._view);
|
|
476
|
-
}
|
|
477
|
-
/**
|
|
478
|
-
* Opens a dialog.
|
|
479
|
-
* @param {DialogCommand} dialogName - The name of the dialog that will open.
|
|
480
|
-
*/
|
|
481
|
-
openDialog(dialogName) {
|
|
482
|
-
const editorDialogs = {
|
|
483
|
-
createLink: {
|
|
484
|
-
content: FileLinkDialogComponent,
|
|
485
|
-
width: 400
|
|
486
|
-
},
|
|
487
|
-
insertFile: {
|
|
488
|
-
content: FileLinkDialogComponent,
|
|
489
|
-
width: 400
|
|
490
|
-
},
|
|
491
|
-
insertImage: {
|
|
492
|
-
content: ImageDialogComponent,
|
|
493
|
-
width: 400
|
|
494
|
-
},
|
|
495
|
-
viewSource: {
|
|
496
|
-
content: SourceDialogComponent,
|
|
497
|
-
height: 400,
|
|
498
|
-
width: 500
|
|
499
|
-
}
|
|
500
|
-
// tableWizard: {
|
|
501
|
-
// content: TableWizardDialogComponent
|
|
502
|
-
// }
|
|
503
|
-
};
|
|
504
|
-
const dialog = Object.assign({ appendTo: this.dialogContainer, autoFocusedElement: '.k-input-inner' }, editorDialogs[dialogName]);
|
|
505
|
-
this.toolbar.toggle(false);
|
|
506
|
-
const dialogContent = this.dialogService.open(dialog).content.instance;
|
|
507
|
-
this.renderer.addClass(dialogContent.dialog.dialog.instance.wrapper.nativeElement.querySelector('.k-window'), 'k-editor-window');
|
|
508
|
-
if (dialogName === 'createLink' || dialogName === 'insertFile') {
|
|
509
|
-
dialogContent.command = dialogName;
|
|
510
|
-
}
|
|
511
|
-
dialogContent.editor = this;
|
|
512
|
-
dialogContent.setData(this._view.state, { applyToWord: this.applyToWord });
|
|
513
|
-
}
|
|
514
|
-
/**
|
|
515
|
-
* Manually focus the Editor.
|
|
516
|
-
*/
|
|
517
|
-
focus() {
|
|
518
|
-
this.focusChangedProgrammatically = true;
|
|
519
|
-
this._view.dom.focus();
|
|
520
|
-
this.focusChangedProgrammatically = false;
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Manually blur the Editor.
|
|
524
|
-
*/
|
|
525
|
-
blur() {
|
|
526
|
-
this.focusChangedProgrammatically = true;
|
|
527
|
-
this._view.dom.blur();
|
|
528
|
-
this.focusChangedProgrammatically = false;
|
|
529
|
-
}
|
|
530
|
-
/**
|
|
531
|
-
* @hidden
|
|
532
|
-
*/
|
|
533
|
-
getSource() {
|
|
534
|
-
return getHtml(this._view.state);
|
|
535
|
-
}
|
|
536
|
-
ngOnDestroy() {
|
|
537
|
-
if (this.subs) {
|
|
538
|
-
this.subs.unsubscribe();
|
|
539
|
-
}
|
|
540
|
-
if (this._styleObserver) {
|
|
541
|
-
this._styleObserver.disconnect();
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
/**
|
|
545
|
-
* @hidden
|
|
546
|
-
*/
|
|
547
|
-
writeValue(value) {
|
|
548
|
-
this.inForm = true;
|
|
549
|
-
// To avoid confusion, non-existent values are always undefined.
|
|
550
|
-
this.value = value === null ? undefined : value;
|
|
551
|
-
}
|
|
552
|
-
/**
|
|
553
|
-
* @hidden
|
|
554
|
-
*/
|
|
555
|
-
registerOnChange(fn) {
|
|
556
|
-
this.onChangeCallback = fn;
|
|
557
|
-
}
|
|
558
|
-
/**
|
|
559
|
-
* @hidden
|
|
560
|
-
*/
|
|
561
|
-
registerOnTouched(fn) {
|
|
562
|
-
this.onTouchedCallback = fn;
|
|
563
|
-
}
|
|
564
|
-
/**
|
|
565
|
-
* @hidden
|
|
566
|
-
* Used by the TextBoxContainer to determine if the component is empty.
|
|
567
|
-
*/
|
|
568
|
-
isEmpty() {
|
|
569
|
-
return false;
|
|
570
|
-
}
|
|
571
|
-
initialize() {
|
|
572
|
-
if (!isDocumentAvailable()) {
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
const currentSchema = this.schema || schema;
|
|
576
|
-
const containerNativeElement = this.container.element.nativeElement;
|
|
577
|
-
const contentNode = parseContent((this.value || '').trim(), currentSchema, { preserveWhitespace: this.preserveWhitespace });
|
|
578
|
-
if (this.iframe) {
|
|
579
|
-
const iframeDoc = containerNativeElement.contentDocument;
|
|
580
|
-
const meta = iframeDoc.createElement('meta');
|
|
581
|
-
meta.setAttribute('charset', 'utf-8');
|
|
582
|
-
iframeDoc.head.appendChild(meta);
|
|
583
|
-
const isCssPathSet = Boolean(this.iframeCss.path);
|
|
584
|
-
const isCssContentSet = Boolean(this.iframeCss.content);
|
|
585
|
-
const allStyles = `
|
|
586
|
-
${tablesStyles}
|
|
587
|
-
${this.iframeCss.keepBuiltInCss ? defaultStyle : ''}
|
|
588
|
-
${this.dir === 'rtl' ? rtlStyles : ''}
|
|
589
|
-
${isCssContentSet ? this.iframeCss.content : ''}
|
|
590
|
-
`;
|
|
591
|
-
const styleEl = iframeDoc.createElement('style');
|
|
592
|
-
styleEl.appendChild(iframeDoc.createTextNode(allStyles));
|
|
593
|
-
iframeDoc.head.appendChild(styleEl);
|
|
594
|
-
if (isCssPathSet) {
|
|
595
|
-
const linkEl = iframeDoc.createElement('link');
|
|
596
|
-
linkEl.rel = 'stylesheet';
|
|
597
|
-
linkEl.href = this.iframeCss.path;
|
|
598
|
-
iframeDoc.head.appendChild(linkEl);
|
|
599
|
-
}
|
|
600
|
-
const element = iframeDoc.createElement('div');
|
|
601
|
-
this.renderer.addClass(element, 'k-content');
|
|
602
|
-
this.renderer.setAttribute(element, 'id', this.focusableId);
|
|
603
|
-
this.renderer.setAttribute(element, 'role', 'textbox');
|
|
604
|
-
iframeDoc.body.appendChild(element);
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
const element = document.createElement('div');
|
|
608
|
-
this.renderer.setAttribute(element, 'id', this.focusableId);
|
|
609
|
-
this.renderer.setAttribute(element, 'role', 'textbox');
|
|
610
|
-
containerNativeElement.appendChild(element);
|
|
611
|
-
}
|
|
612
|
-
const defaultPlugins = [
|
|
613
|
-
new Plugin({
|
|
614
|
-
key: new PluginKey('editor-tabindex'),
|
|
615
|
-
props: {
|
|
616
|
-
attributes: () => ({
|
|
617
|
-
// set tabindex when contenteditable is false, so that the content area can be selected
|
|
618
|
-
tabIndex: this.readonly ? '0' : ''
|
|
619
|
-
})
|
|
620
|
-
}
|
|
621
|
-
}),
|
|
622
|
-
new Plugin({
|
|
623
|
-
key: new PluginKey('toolbar-tools-update'),
|
|
624
|
-
view: () => ({
|
|
625
|
-
update: editorView => {
|
|
626
|
-
if (!this.disabled) {
|
|
627
|
-
this.ngZone.run(() => {
|
|
628
|
-
this.stateChange.next(this.readonly ? disabledToolBarState : getToolbarState(editorView.state, { applyToWord: this.applyToWord }));
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
})
|
|
633
|
-
}),
|
|
634
|
-
history(),
|
|
635
|
-
keymap(buildListKeymap(currentSchema)),
|
|
636
|
-
keymap(buildKeymap(currentSchema, { applyToWord: this.applyToWord })),
|
|
637
|
-
keymap(baseKeymap),
|
|
638
|
-
gapCursor(),
|
|
639
|
-
imageResizing(),
|
|
640
|
-
...tableResizing(),
|
|
641
|
-
tableEditing(),
|
|
642
|
-
caretColor(),
|
|
643
|
-
cspFix()
|
|
644
|
-
];
|
|
645
|
-
if (this.placeholder) {
|
|
646
|
-
defaultPlugins.push(placeholder(this.placeholder));
|
|
647
|
-
}
|
|
648
|
-
const state = EditorState.create({
|
|
649
|
-
schema: currentSchema,
|
|
650
|
-
doc: contentNode,
|
|
651
|
-
plugins: isPresent(this.plugins) ? this.plugins(defaultPlugins) : defaultPlugins
|
|
652
|
-
});
|
|
653
|
-
if (this.iframe) {
|
|
654
|
-
this.viewMountElement = containerNativeElement.contentDocument.querySelector('div');
|
|
655
|
-
}
|
|
656
|
-
else {
|
|
657
|
-
this.viewMountElement = containerNativeElement.querySelector('div');
|
|
658
|
-
}
|
|
659
|
-
this.ngZone.runOutsideAngular(() => {
|
|
660
|
-
this._view = new EditorView({ mount: this.viewMountElement }, {
|
|
661
|
-
state,
|
|
662
|
-
editable: () => !this.readonly,
|
|
663
|
-
dispatchTransaction: this.dispatchTransaction,
|
|
664
|
-
transformPastedHTML: this.transformPastedHTML,
|
|
665
|
-
transformPastedText: this.transformPastedText,
|
|
666
|
-
handleDOMEvents: {
|
|
667
|
-
paste: this.onPaste
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
if (this._view) {
|
|
672
|
-
let containerElement;
|
|
673
|
-
const contentAreaClasslist = this.element.nativeElement.querySelector('.k-editor-content').classList;
|
|
674
|
-
if (this.iframe) {
|
|
675
|
-
containerElement = this.container.element.nativeElement.contentDocument;
|
|
676
|
-
}
|
|
677
|
-
else {
|
|
678
|
-
containerElement = this.container.element.nativeElement;
|
|
679
|
-
}
|
|
680
|
-
const proseMirror = containerElement.querySelector('.ProseMirror');
|
|
681
|
-
proseMirror.style = "'height: 100%; width: 100%; box-sizing: border-box; outline: none; overflow: auto;'";
|
|
682
|
-
this.subs.add(fromEvent(containerElement, 'focusin')
|
|
683
|
-
.subscribe((e) => {
|
|
684
|
-
if (this.readonly) {
|
|
685
|
-
contentAreaClasslist.add('k-focus');
|
|
686
|
-
}
|
|
687
|
-
if (!this.focusChangedProgrammatically || this.shouldEmitFocus) {
|
|
688
|
-
const relatedTarget = e.relatedTarget;
|
|
689
|
-
const isActiveColorButton = relatedTarget && relatedTarget.classList.contains('k-colorpicker');
|
|
690
|
-
if (!isActiveColorButton || this.shouldEmitFocus) {
|
|
691
|
-
this.ngZone.run(() => this.onFocus.emit());
|
|
692
|
-
}
|
|
693
|
-
this.shouldEmitFocus = false;
|
|
694
|
-
}
|
|
695
|
-
}));
|
|
696
|
-
this.subs.add(fromEvent(containerElement, 'focusout')
|
|
697
|
-
.subscribe((e) => {
|
|
698
|
-
if (this.readonly) {
|
|
699
|
-
contentAreaClasslist.remove('k-focus');
|
|
700
|
-
}
|
|
701
|
-
if (!this.focusChangedProgrammatically) {
|
|
702
|
-
const relatedTarget = e.relatedTarget;
|
|
703
|
-
const isActiveColorButton = relatedTarget && relatedTarget.classList.contains('k-colorpicker');
|
|
704
|
-
if (!isActiveColorButton) {
|
|
705
|
-
this.ngZone.run(() => this.onBlur.emit());
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
}));
|
|
709
|
-
}
|
|
710
|
-
this.subs.add(this.stateChange.subscribe(() => {
|
|
711
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
712
|
-
if (this.userToolBarComponent) {
|
|
713
|
-
this.userToolBarComponent.cdr.detectChanges();
|
|
714
|
-
}
|
|
715
|
-
else {
|
|
716
|
-
this.cdr.detectChanges();
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
}));
|
|
720
|
-
this.subs.add(this.valueModified.subscribe((value) => {
|
|
721
|
-
this.onChangeCallback(value);
|
|
722
|
-
this.valueChange.emit(value);
|
|
723
|
-
this.cdr.markForCheck();
|
|
724
|
-
}));
|
|
725
|
-
this.subs.add(fromEvent(this.viewMountElement, 'keyup')
|
|
726
|
-
.pipe(map((e) => e.code), filter((code) => code === Keys.F10), map(() => this.toolbarElement))
|
|
727
|
-
.subscribe((toolbar) => toolbar.nativeElement.focus()));
|
|
728
|
-
this.subs.add(fromEvent(this.viewMountElement, 'blur')
|
|
729
|
-
.pipe(filter((event) => !this.viewMountElement.contains(event.relatedTarget)))
|
|
730
|
-
.subscribe(() => this.onTouchedCallback()));
|
|
731
|
-
}
|
|
732
|
-
dispatchTransaction = (tr) => {
|
|
733
|
-
const docChanged = tr.docChanged;
|
|
734
|
-
if (this.disabled || (this.readonly && docChanged)) {
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
if (docChanged) {
|
|
738
|
-
const doc = tr.doc;
|
|
739
|
-
const html = getHtml({ doc });
|
|
740
|
-
this.trOnChange = tr;
|
|
741
|
-
this.htmlOnChange = html;
|
|
742
|
-
this.ngZone.run(() => {
|
|
743
|
-
this.valueModified.next(html === EMPTY_PARAGRAPH ? '' : html);
|
|
744
|
-
});
|
|
745
|
-
}
|
|
746
|
-
if (!docChanged || this.inForm) {
|
|
747
|
-
this.view.updateState(this.view.state.apply(tr));
|
|
748
|
-
this.trOnChange = null;
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
transformPastedContent = (dirtyHtml, plainText) => {
|
|
752
|
-
if (plainText) {
|
|
753
|
-
return this.dispatchPasteEvent(dirtyHtml, dirtyHtml);
|
|
754
|
-
}
|
|
755
|
-
const pasteCleanupSettings = { ...defaultPasteCleanupSettings, ...this.pasteCleanupSettings };
|
|
756
|
-
const clean = pasteCleanup(removeInvalidHTMLIf(pasteCleanupSettings.removeInvalidHTML)(dirtyHtml), {
|
|
757
|
-
convertMsLists: pasteCleanupSettings.convertMsLists,
|
|
758
|
-
stripTags: pasteCleanupSettings.stripTags.join('|'),
|
|
759
|
-
attributes: getPasteCleanupAttributes(pasteCleanupSettings),
|
|
760
|
-
});
|
|
761
|
-
return this.dispatchPasteEvent(dirtyHtml, removeCommentsIf(pasteCleanupSettings.removeHtmlComments)(clean));
|
|
762
|
-
};
|
|
763
|
-
transformPastedHTML = (html) => this.transformPastedContent(html);
|
|
764
|
-
transformPastedText = (html) => this.transformPastedContent(html, true);
|
|
765
|
-
changeValue = (value) => {
|
|
766
|
-
const prev = this._value;
|
|
767
|
-
this._value = value;
|
|
768
|
-
if (!this._view) {
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
if (this.htmlOnChange === value && this.trOnChange) {
|
|
772
|
-
this.view.updateState(this.view.state.apply(this.trOnChange));
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
const newValue = (prev || '') !== (value || '');
|
|
776
|
-
const formReset = (this.inForm && !value);
|
|
777
|
-
if (newValue || formReset) {
|
|
778
|
-
const iframeContentWindowNotPresent = this.iframe && !this.container.element.nativeElement.contentWindow;
|
|
779
|
-
if (iframeContentWindowNotPresent) {
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
const state = this.view.state;
|
|
783
|
-
const nextDoc = parseContent(value || '', state.schema, { preserveWhitespace: this.preserveWhitespace });
|
|
784
|
-
const tr = state.tr
|
|
785
|
-
.setSelection(new AllSelection(state.doc))
|
|
786
|
-
.replaceSelectionWith(nextDoc);
|
|
787
|
-
this.view.updateState(state.apply(tr));
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
this.trOnChange = null;
|
|
791
|
-
this.htmlOnChange = null;
|
|
792
|
-
};
|
|
793
|
-
onChangeCallback = (value) => {
|
|
794
|
-
this.changeValue(value);
|
|
795
|
-
};
|
|
796
|
-
normalizeSize() {
|
|
797
|
-
if (typeof this.resizable === 'object' && !this._styleObserver) {
|
|
798
|
-
const element = this.element.nativeElement;
|
|
799
|
-
this._styleObserver = new MutationObserver(() => {
|
|
800
|
-
this.ngZone.runOutsideAngular(() => this.normalizeProperties(element));
|
|
801
|
-
});
|
|
802
|
-
this._styleObserver.observe(element, { attributeFilter: ['style'] });
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
normalizeProperties(element) {
|
|
806
|
-
const props = Object.keys(this.resizable);
|
|
807
|
-
const pixelWidth = parseInt(element.style.width, 10);
|
|
808
|
-
const pixelHeight = parseInt(element.style.height, 10);
|
|
809
|
-
const resizable = this.resizable;
|
|
810
|
-
props.forEach(prop => {
|
|
811
|
-
const isMinProp = prop.startsWith('min');
|
|
812
|
-
const isMaxProp = !isMinProp;
|
|
813
|
-
const isWidthProp = prop.endsWith('Width');
|
|
814
|
-
const isHeightProp = !isWidthProp;
|
|
815
|
-
if (isMinProp && isWidthProp) {
|
|
816
|
-
if (pixelWidth < resizable.minWidth) {
|
|
817
|
-
element.style.width = resizable.minWidth + 'px';
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
else if (isMinProp && isHeightProp) {
|
|
821
|
-
if (pixelHeight < resizable.minHeight) {
|
|
822
|
-
element.style.height = resizable.minHeight + 'px';
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
else if (isMaxProp && isWidthProp) {
|
|
826
|
-
if (pixelWidth > resizable.maxWidth) {
|
|
827
|
-
element.style.width = resizable.maxWidth + 'px';
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
else if (pixelHeight > resizable.maxHeight) {
|
|
831
|
-
element.style.height = resizable.maxHeight + 'px';
|
|
832
|
-
}
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
onTouchedCallback = (_) => { };
|
|
836
|
-
onPaste = (_view, nativeEvent) => {
|
|
837
|
-
this._pasteEvent = nativeEvent;
|
|
838
|
-
return false;
|
|
839
|
-
};
|
|
840
|
-
dispatchPasteEvent(originalContent, cleanContent) {
|
|
841
|
-
if (hasObservers(this.paste)) {
|
|
842
|
-
if (!this.iframe) {
|
|
843
|
-
this._pasteEvent.stopImmediatePropagation();
|
|
844
|
-
}
|
|
845
|
-
const event = new EditorPasteEvent(cleanContent, originalContent, this._pasteEvent);
|
|
846
|
-
this.ngZone.run(() => this.paste.emit(event));
|
|
847
|
-
return event.isDefaultPrevented() ? '' : event.cleanedHtml;
|
|
848
|
-
}
|
|
849
|
-
return cleanContent;
|
|
850
|
-
}
|
|
851
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: EditorComponent, deps: [{ token: i1.DialogService }, { token: i2.LocalizationService }, { token: i0.ChangeDetectorRef }, { token: i0.NgZone }, { token: i0.ElementRef }, { token: i3.ProviderService }, { token: i4.EditorToolsService }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
|
852
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: EditorComponent, isStandalone: true, selector: "kendo-editor", inputs: { value: "value", disabled: "disabled", readonly: "readonly", iframe: "iframe", iframeCss: "iframeCss", applyToWord: "applyToWord", schema: "schema", plugins: "plugins", placeholder: "placeholder", preserveWhitespace: "preserveWhitespace", pasteCleanupSettings: "pasteCleanupSettings", resizable: "resizable" }, outputs: { valueChange: "valueChange", onFocus: "focus", paste: "paste", onBlur: "blur" }, host: { properties: { "class.k-editor": "this.hostClass", "class.k-editor-resizable": "this.resizableClass", "class.k-disabled": "this.isDisabled", "class.k-readonly": "this.isReadonly", "attr.dir": "this.dir", "attr.ariaDisabled": "this.ariaDisabled", "style.minWidth": "this.minWidth", "style.maxWidth": "this.maxWidth", "style.minHeight": "this.minHeight", "style.maxHeight": "this.maxHeight" } }, providers: [
|
|
853
|
-
EditorLocalizationService,
|
|
854
|
-
ProviderService,
|
|
855
|
-
EditorToolsService,
|
|
856
|
-
{
|
|
857
|
-
provide: LocalizationService,
|
|
858
|
-
useExisting: EditorLocalizationService
|
|
859
|
-
},
|
|
860
|
-
{
|
|
861
|
-
provide: L10N_PREFIX,
|
|
862
|
-
useValue: 'kendo.editor'
|
|
863
|
-
},
|
|
864
|
-
{
|
|
865
|
-
provide: NG_VALUE_ACCESSOR,
|
|
866
|
-
useExisting: forwardRef(() => EditorComponent),
|
|
867
|
-
multi: true
|
|
868
|
-
},
|
|
869
|
-
{
|
|
870
|
-
provide: KendoInput,
|
|
871
|
-
useExisting: forwardRef(() => EditorComponent)
|
|
872
|
-
}
|
|
873
|
-
], 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: `
|
|
874
|
-
<ng-container
|
|
875
|
-
kendoEditorLocalizedMessages
|
|
876
|
-
i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."
|
|
877
|
-
alignCenter="Center text"
|
|
878
|
-
i18n-alignJustify="kendo.editor.alignJustify|The title of the tool that justifies text both left and right."
|
|
879
|
-
alignJustify="Justify"
|
|
880
|
-
i18n-alignLeft="kendo.editor.alignLeft|The title of the tool that aligns text on the left."
|
|
881
|
-
alignLeft="Align text left"
|
|
882
|
-
i18n-alignRight="kendo.editor.alignRight|The title of the tool that aligns text on the right."
|
|
883
|
-
alignRight="Align text right"
|
|
884
|
-
i18n-backColor="kendo.editor.backColor|The title of the tool that changes the text background color."
|
|
885
|
-
backColor="Background color"
|
|
886
|
-
i18n-blockquote="kendo.editor.blockquote|The title of the tool that wraps an element in a blockquote"
|
|
887
|
-
blockquote="Quotation"
|
|
888
|
-
i18n-bold="kendo.editor.bold|The title of the tool that makes text bold."
|
|
889
|
-
bold="Bold"
|
|
890
|
-
i18n-cleanFormatting="kendo.editor.cleanFormatting|The title of the Clean Formatting tool."
|
|
891
|
-
cleanFormatting="Clean formatting"
|
|
892
|
-
i18n-createLink="kendo.editor.createLink|The title of the tool that creates hyperlinks."
|
|
893
|
-
createLink="Insert link"
|
|
894
|
-
i18n-dialogApply="kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs."
|
|
895
|
-
dialogApply="Apply"
|
|
896
|
-
i18n-dialogCancel="kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs."
|
|
897
|
-
dialogCancel="Cancel"
|
|
898
|
-
i18n-dialogInsert="kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs."
|
|
899
|
-
dialogInsert="Insert"
|
|
900
|
-
i18n-dialogUpdate="kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs."
|
|
901
|
-
dialogUpdate="Update"
|
|
902
|
-
i18n-fileText="kendo.editor.fileText|The caption for the file text in the insertFile dialog."
|
|
903
|
-
fileText="Text"
|
|
904
|
-
i18n-fileTitle="kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog."
|
|
905
|
-
fileTitle="Title"
|
|
906
|
-
i18n-fileWebAddress="kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog."
|
|
907
|
-
fileWebAddress="Web address"
|
|
908
|
-
i18n-fontFamily="kendo.editor.fontFamily|The title of the tool that changes the text font."
|
|
909
|
-
fontFamily="Select font family"
|
|
910
|
-
i18n-fontSize="kendo.editor.fontSize|The title of the tool that changes the text size."
|
|
911
|
-
fontSize="Select font size"
|
|
912
|
-
i18n-foreColor="kendo.editor.foreColor|The title of the tool that changes the text color."
|
|
913
|
-
foreColor="Color"
|
|
914
|
-
i18n-format="kendo.editor.format|The title of the tool that lets users choose block formats."
|
|
915
|
-
format="Format"
|
|
916
|
-
i18n-imageAltText="kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog."
|
|
917
|
-
imageAltText="Alternate text"
|
|
918
|
-
i18n-imageHeight="kendo.editor.imageHeight|The caption for the image height in the insertImage dialog."
|
|
919
|
-
imageHeight="Height (px)"
|
|
920
|
-
i18n-imageWebAddress="kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog."
|
|
921
|
-
imageWebAddress="Web address"
|
|
922
|
-
i18n-imageWidth="kendo.editor.imageWidth|The caption for the image width in the insertImage dialog."
|
|
923
|
-
imageWidth="Width (px)"
|
|
924
|
-
i18n-indent="kendo.editor.indent|The title of the tool that indents the content."
|
|
925
|
-
indent="Indent"
|
|
926
|
-
i18n-insertFile="kendo.editor.insertFile|The title of the tool that inserts links to files."
|
|
927
|
-
insertFile="Insert file"
|
|
928
|
-
i18n-insertImage="kendo.editor.insertImage|The title of the tool that inserts images."
|
|
929
|
-
insertImage="Insert image"
|
|
930
|
-
i18n-insertOrderedList="kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list."
|
|
931
|
-
insertOrderedList="Insert ordered list"
|
|
932
|
-
i18n-insertUnorderedList="kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list."
|
|
933
|
-
insertUnorderedList="Insert unordered list"
|
|
934
|
-
i18n-italic="kendo.editor.italic|The title of the tool that makes text italicized."
|
|
935
|
-
italic="Italic"
|
|
936
|
-
i18n-linkOpenInNewWindow="kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog."
|
|
937
|
-
linkOpenInNewWindow="Open link in new window"
|
|
938
|
-
i18n-linkText="kendo.editor.linkText|The caption for the link text in the createLink dialog."
|
|
939
|
-
linkText="Text"
|
|
940
|
-
i18n-linkTitle="kendo.editor.linkTitle|The caption for the link title in the createLink dialog."
|
|
941
|
-
linkTitle="Title"
|
|
942
|
-
i18n-linkWebAddress="kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog."
|
|
943
|
-
linkWebAddress="Web address"
|
|
944
|
-
i18n-outdent="kendo.editor.outdent|The title of the tool that outdents the content."
|
|
945
|
-
outdent="Outdent"
|
|
946
|
-
i18n-print="kendo.editor.print|The title of the print tool."
|
|
947
|
-
print="Print"
|
|
948
|
-
i18n-redo="kendo.editor.redo|The title of the tool that undos the last action."
|
|
949
|
-
redo="Redo"
|
|
950
|
-
i18n-selectAll="kendo.editor.selectAll|The title of the tool that selects all content."
|
|
951
|
-
selectAll="Select All"
|
|
952
|
-
i18n-strikethrough="kendo.editor.strikethrough|The title of the tool that strikes through text."
|
|
953
|
-
strikethrough="Strikethrough"
|
|
954
|
-
i18n-subscript="kendo.editor.subscript|The title of the tool that makes text subscript."
|
|
955
|
-
subscript="Subscript"
|
|
956
|
-
i18n-superscript="kendo.editor.superscript|The title of the tool that makes text superscript."
|
|
957
|
-
superscript="Superscript"
|
|
958
|
-
i18n-underline="kendo.editor.underline|The title of the tool that underlines text."
|
|
959
|
-
underline="Underline"
|
|
960
|
-
i18n-unlink="kendo.editor.unlink|The title of the tool that removes hyperlinks."
|
|
961
|
-
unlink="Remove Link"
|
|
962
|
-
i18n-undo="kendo.editor.undo|The title of the tool that undos the last action."
|
|
963
|
-
undo="Undo"
|
|
964
|
-
i18n-viewSource="kendo.editor.viewSource|The title of the tool that shows the editor value as HTML."
|
|
965
|
-
viewSource="View source"
|
|
966
|
-
i18n-insertTable="kendo.editor.insertTable|The title of the tool that inserts table."
|
|
967
|
-
insertTable="Insert Table"
|
|
968
|
-
i18n-insertTableHint="kendo.editor.insertTableHint|The caption for the hint in the insert table tool."
|
|
969
|
-
insertTableHint="Create a {rows} {x} {columns} table"
|
|
970
|
-
i18n-addColumnBefore="kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column."
|
|
971
|
-
addColumnBefore="Add column before"
|
|
972
|
-
i18n-addColumnAfter="kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column."
|
|
973
|
-
addColumnAfter="Add column after"
|
|
974
|
-
i18n-addRowBefore="kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row."
|
|
975
|
-
addRowBefore="Add row before"
|
|
976
|
-
i18n-addRowAfter="kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row."
|
|
977
|
-
addRowAfter="Add row after"
|
|
978
|
-
i18n-mergeCells="kendo.editor.mergeCells|The title of the tool that merges the currently selected cells."
|
|
979
|
-
mergeCells="Merge cells"
|
|
980
|
-
i18n-splitCell="kendo.editor.splitCell|The title of the tool that splits the currently selected cell."
|
|
981
|
-
splitCell="Split cell"
|
|
982
|
-
i18n-deleteColumn="kendo.editor.deleteColumn|The title of the tool that deletes a table column."
|
|
983
|
-
deleteColumn="Delete column"
|
|
984
|
-
i18n-deleteRow="kendo.editor.deleteRow|The title of the tool that deletes a table row."
|
|
985
|
-
deleteRow="Delete row"
|
|
986
|
-
i18n-deleteTable="kendo.editor.deleteTable|The title of the tool that deletes a table."
|
|
987
|
-
deleteTable="Delete table"
|
|
988
|
-
>
|
|
989
|
-
</ng-container>
|
|
990
|
-
<ng-content select="kendo-toolbar"></ng-content>
|
|
991
|
-
@if (!userToolBarElement) {
|
|
992
|
-
<kendo-toolbar
|
|
993
|
-
#defaultToolbar
|
|
994
|
-
class="k-editor-toolbar"
|
|
995
|
-
[overflow]="true"
|
|
996
|
-
[tabindex]="readonly ? -1 : 0"
|
|
997
|
-
>
|
|
998
|
-
<kendo-toolbar-buttongroup>
|
|
999
|
-
<kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>
|
|
1000
|
-
<kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>
|
|
1001
|
-
<kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>
|
|
1002
|
-
</kendo-toolbar-buttongroup>
|
|
1003
|
-
<kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>
|
|
1004
|
-
<kendo-toolbar-buttongroup>
|
|
1005
|
-
<kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>
|
|
1006
|
-
<kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>
|
|
1007
|
-
<kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>
|
|
1008
|
-
<kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>
|
|
1009
|
-
</kendo-toolbar-buttongroup>
|
|
1010
|
-
<kendo-toolbar-buttongroup>
|
|
1011
|
-
<kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>
|
|
1012
|
-
<kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>
|
|
1013
|
-
<kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>
|
|
1014
|
-
<kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>
|
|
1015
|
-
</kendo-toolbar-buttongroup>
|
|
1016
|
-
<kendo-toolbar-buttongroup>
|
|
1017
|
-
<kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>
|
|
1018
|
-
<kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>
|
|
1019
|
-
</kendo-toolbar-buttongroup>
|
|
1020
|
-
<kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>
|
|
1021
|
-
</kendo-toolbar>
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
|
-
@if (!iframe) {
|
|
1025
|
-
<div #content [attr.dir]="direction" class="k-editor-content"></div>
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
@if (iframe) {
|
|
1029
|
-
<div class="k-editor-content">
|
|
1030
|
-
<iframe #content srcdoc="<!DOCTYPE html>" role="none" frameborder="0" class="k-iframe" [style.width.%]="100" [style.height.%]="100" [style.display]="'block'" (load)="iframeOnLoad()"></iframe>
|
|
1031
|
-
</div>
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
<ng-container #dialogsContainer></ng-container>
|
|
1035
|
-
|
|
1036
|
-
@if (showLicenseWatermark) {
|
|
1037
|
-
<div kendoWatermarkOverlay [licenseMessage]="licenseMessage"></div>
|
|
1038
|
-
}
|
|
1039
|
-
`, isInline: true, dependencies: [{ kind: "directive", type: LocalizedMessagesDirective, selector: "[kendoEditorLocalizedMessages]" }, { kind: "component", type: ToolBarComponent, selector: "kendo-toolbar", inputs: ["overflow", "resizable", "popupSettings", "fillMode", "tabindex", "size", "tabIndex", "showIcon", "showText"], outputs: ["open", "close"], exportAs: ["kendoToolBar"] }, { kind: "component", type: ToolBarButtonGroupComponent, selector: "kendo-toolbar-buttongroup", inputs: ["disabled", "fillMode", "selection", "width", "look"], exportAs: ["kendoToolBarButtonGroup"] }, { kind: "component", type: ToolBarButtonComponent, selector: "kendo-toolbar-button", inputs: ["showText", "showIcon", "text", "style", "className", "title", "disabled", "toggleable", "look", "togglable", "selected", "fillMode", "rounded", "themeColor", "icon", "iconClass", "svgIcon", "imageUrl"], outputs: ["click", "pointerdown", "selectedChange"], exportAs: ["kendoToolBarButton"] }, { kind: "directive", type: EditorBoldButtonDirective, selector: "kendo-toolbar-button[kendoEditorBoldButton]" }, { kind: "directive", type: EditorItalicButtonDirective, selector: "kendo-toolbar-button[kendoEditorItalicButton]" }, { kind: "directive", type: EditorUnderlineButtonDirective, selector: "kendo-toolbar-button[kendoEditorUnderlineButton]" }, { kind: "component", type: EditorFormatComponent, selector: "kendo-toolbar-dropdownlist[kendoEditorFormat]", inputs: ["data"], outputs: ["valueChange"] }, { kind: "directive", type: EditorAlignLeftButtonDirective, selector: "kendo-toolbar-button[kendoEditorAlignLeftButton]" }, { kind: "directive", type: EditorAlignCenterButtonDirective, selector: "kendo-toolbar-button[kendoEditorAlignCenterButton]" }, { kind: "directive", type: EditorAlignRightButtonDirective, selector: "kendo-toolbar-button[kendoEditorAlignRightButton]" }, { kind: "directive", type: EditorAlignJustifyButtonDirective, selector: "kendo-toolbar-button[kendoEditorAlignJustifyButton]" }, { kind: "directive", type: EditorInsertUnorderedListButtonDirective, selector: "kendo-toolbar-button[kendoEditorInsertUnorderedListButton]" }, { kind: "directive", type: EditorInsertOrderedListButtonDirective, selector: "kendo-toolbar-button[kendoEditorInsertOrderedListButton]" }, { kind: "directive", type: EditorIndentButtonDirective, selector: "kendo-toolbar-button[kendoEditorIndentButton]" }, { kind: "directive", type: EditorOutdentButtonDirective, selector: "kendo-toolbar-button[kendoEditorOutdentButton]" }, { kind: "directive", type: EditorCreateLinkButtonDirective, selector: "kendo-toolbar-button[kendoEditorCreateLinkButton]" }, { kind: "directive", type: EditorUnlinkButtonDirective, selector: "kendo-toolbar-button[kendoEditorUnlinkButton]" }, { kind: "directive", type: EditorInsertImageButtonDirective, selector: "kendo-toolbar-button[kendoEditorInsertImageButton]" }, { kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }] });
|
|
1040
|
-
}
|
|
1041
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: EditorComponent, decorators: [{
|
|
1042
|
-
type: Component,
|
|
1043
|
-
args: [{
|
|
1044
|
-
selector: 'kendo-editor',
|
|
1045
|
-
providers: [
|
|
1046
|
-
EditorLocalizationService,
|
|
1047
|
-
ProviderService,
|
|
1048
|
-
EditorToolsService,
|
|
1049
|
-
{
|
|
1050
|
-
provide: LocalizationService,
|
|
1051
|
-
useExisting: EditorLocalizationService
|
|
1052
|
-
},
|
|
1053
|
-
{
|
|
1054
|
-
provide: L10N_PREFIX,
|
|
1055
|
-
useValue: 'kendo.editor'
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
provide: NG_VALUE_ACCESSOR,
|
|
1059
|
-
useExisting: forwardRef(() => EditorComponent),
|
|
1060
|
-
multi: true
|
|
1061
|
-
},
|
|
1062
|
-
{
|
|
1063
|
-
provide: KendoInput,
|
|
1064
|
-
useExisting: forwardRef(() => EditorComponent)
|
|
1065
|
-
}
|
|
1066
|
-
],
|
|
1067
|
-
template: `
|
|
1068
|
-
<ng-container
|
|
1069
|
-
kendoEditorLocalizedMessages
|
|
1070
|
-
i18n-alignCenter="kendo.editor.alignCenter|The title of the tool that aligns text in the center."
|
|
1071
|
-
alignCenter="Center text"
|
|
1072
|
-
i18n-alignJustify="kendo.editor.alignJustify|The title of the tool that justifies text both left and right."
|
|
1073
|
-
alignJustify="Justify"
|
|
1074
|
-
i18n-alignLeft="kendo.editor.alignLeft|The title of the tool that aligns text on the left."
|
|
1075
|
-
alignLeft="Align text left"
|
|
1076
|
-
i18n-alignRight="kendo.editor.alignRight|The title of the tool that aligns text on the right."
|
|
1077
|
-
alignRight="Align text right"
|
|
1078
|
-
i18n-backColor="kendo.editor.backColor|The title of the tool that changes the text background color."
|
|
1079
|
-
backColor="Background color"
|
|
1080
|
-
i18n-blockquote="kendo.editor.blockquote|The title of the tool that wraps an element in a blockquote"
|
|
1081
|
-
blockquote="Quotation"
|
|
1082
|
-
i18n-bold="kendo.editor.bold|The title of the tool that makes text bold."
|
|
1083
|
-
bold="Bold"
|
|
1084
|
-
i18n-cleanFormatting="kendo.editor.cleanFormatting|The title of the Clean Formatting tool."
|
|
1085
|
-
cleanFormatting="Clean formatting"
|
|
1086
|
-
i18n-createLink="kendo.editor.createLink|The title of the tool that creates hyperlinks."
|
|
1087
|
-
createLink="Insert link"
|
|
1088
|
-
i18n-dialogApply="kendo.editor.dialogApply|The label of the **Apply** button in all editor dialogs."
|
|
1089
|
-
dialogApply="Apply"
|
|
1090
|
-
i18n-dialogCancel="kendo.editor.dialogCancel|The label of the **Cancel** button in all editor dialogs."
|
|
1091
|
-
dialogCancel="Cancel"
|
|
1092
|
-
i18n-dialogInsert="kendo.editor.dialogInsert|The label of the **Insert** button in all editor dialogs."
|
|
1093
|
-
dialogInsert="Insert"
|
|
1094
|
-
i18n-dialogUpdate="kendo.editor.dialogUpdate|The label of the **Update** button in all editor dialogs."
|
|
1095
|
-
dialogUpdate="Update"
|
|
1096
|
-
i18n-fileText="kendo.editor.fileText|The caption for the file text in the insertFile dialog."
|
|
1097
|
-
fileText="Text"
|
|
1098
|
-
i18n-fileTitle="kendo.editor.fileTitle|The caption for the file Title in the insertFile dialog."
|
|
1099
|
-
fileTitle="Title"
|
|
1100
|
-
i18n-fileWebAddress="kendo.editor.fileWebAddress|The caption for the file URL in the insertFile dialog."
|
|
1101
|
-
fileWebAddress="Web address"
|
|
1102
|
-
i18n-fontFamily="kendo.editor.fontFamily|The title of the tool that changes the text font."
|
|
1103
|
-
fontFamily="Select font family"
|
|
1104
|
-
i18n-fontSize="kendo.editor.fontSize|The title of the tool that changes the text size."
|
|
1105
|
-
fontSize="Select font size"
|
|
1106
|
-
i18n-foreColor="kendo.editor.foreColor|The title of the tool that changes the text color."
|
|
1107
|
-
foreColor="Color"
|
|
1108
|
-
i18n-format="kendo.editor.format|The title of the tool that lets users choose block formats."
|
|
1109
|
-
format="Format"
|
|
1110
|
-
i18n-imageAltText="kendo.editor.imageAltText|The caption for the image alternate text in the insertImage dialog."
|
|
1111
|
-
imageAltText="Alternate text"
|
|
1112
|
-
i18n-imageHeight="kendo.editor.imageHeight|The caption for the image height in the insertImage dialog."
|
|
1113
|
-
imageHeight="Height (px)"
|
|
1114
|
-
i18n-imageWebAddress="kendo.editor.imageWebAddress|The caption for the image URL in the insertImage dialog."
|
|
1115
|
-
imageWebAddress="Web address"
|
|
1116
|
-
i18n-imageWidth="kendo.editor.imageWidth|The caption for the image width in the insertImage dialog."
|
|
1117
|
-
imageWidth="Width (px)"
|
|
1118
|
-
i18n-indent="kendo.editor.indent|The title of the tool that indents the content."
|
|
1119
|
-
indent="Indent"
|
|
1120
|
-
i18n-insertFile="kendo.editor.insertFile|The title of the tool that inserts links to files."
|
|
1121
|
-
insertFile="Insert file"
|
|
1122
|
-
i18n-insertImage="kendo.editor.insertImage|The title of the tool that inserts images."
|
|
1123
|
-
insertImage="Insert image"
|
|
1124
|
-
i18n-insertOrderedList="kendo.editor.insertOrderedList|The title of the tool that inserts an ordered list."
|
|
1125
|
-
insertOrderedList="Insert ordered list"
|
|
1126
|
-
i18n-insertUnorderedList="kendo.editor.insertUnorderedList|The title of the tool that inserts an unordered list."
|
|
1127
|
-
insertUnorderedList="Insert unordered list"
|
|
1128
|
-
i18n-italic="kendo.editor.italic|The title of the tool that makes text italicized."
|
|
1129
|
-
italic="Italic"
|
|
1130
|
-
i18n-linkOpenInNewWindow="kendo.editor.linkOpenInNewWindow|The caption for the checkbox for opening the link in a new window in the createLink dialog."
|
|
1131
|
-
linkOpenInNewWindow="Open link in new window"
|
|
1132
|
-
i18n-linkText="kendo.editor.linkText|The caption for the link text in the createLink dialog."
|
|
1133
|
-
linkText="Text"
|
|
1134
|
-
i18n-linkTitle="kendo.editor.linkTitle|The caption for the link title in the createLink dialog."
|
|
1135
|
-
linkTitle="Title"
|
|
1136
|
-
i18n-linkWebAddress="kendo.editor.linkWebAddress|The caption for the URL in the createLink dialog."
|
|
1137
|
-
linkWebAddress="Web address"
|
|
1138
|
-
i18n-outdent="kendo.editor.outdent|The title of the tool that outdents the content."
|
|
1139
|
-
outdent="Outdent"
|
|
1140
|
-
i18n-print="kendo.editor.print|The title of the print tool."
|
|
1141
|
-
print="Print"
|
|
1142
|
-
i18n-redo="kendo.editor.redo|The title of the tool that undos the last action."
|
|
1143
|
-
redo="Redo"
|
|
1144
|
-
i18n-selectAll="kendo.editor.selectAll|The title of the tool that selects all content."
|
|
1145
|
-
selectAll="Select All"
|
|
1146
|
-
i18n-strikethrough="kendo.editor.strikethrough|The title of the tool that strikes through text."
|
|
1147
|
-
strikethrough="Strikethrough"
|
|
1148
|
-
i18n-subscript="kendo.editor.subscript|The title of the tool that makes text subscript."
|
|
1149
|
-
subscript="Subscript"
|
|
1150
|
-
i18n-superscript="kendo.editor.superscript|The title of the tool that makes text superscript."
|
|
1151
|
-
superscript="Superscript"
|
|
1152
|
-
i18n-underline="kendo.editor.underline|The title of the tool that underlines text."
|
|
1153
|
-
underline="Underline"
|
|
1154
|
-
i18n-unlink="kendo.editor.unlink|The title of the tool that removes hyperlinks."
|
|
1155
|
-
unlink="Remove Link"
|
|
1156
|
-
i18n-undo="kendo.editor.undo|The title of the tool that undos the last action."
|
|
1157
|
-
undo="Undo"
|
|
1158
|
-
i18n-viewSource="kendo.editor.viewSource|The title of the tool that shows the editor value as HTML."
|
|
1159
|
-
viewSource="View source"
|
|
1160
|
-
i18n-insertTable="kendo.editor.insertTable|The title of the tool that inserts table."
|
|
1161
|
-
insertTable="Insert Table"
|
|
1162
|
-
i18n-insertTableHint="kendo.editor.insertTableHint|The caption for the hint in the insert table tool."
|
|
1163
|
-
insertTableHint="Create a {rows} {x} {columns} table"
|
|
1164
|
-
i18n-addColumnBefore="kendo.editor.addColumnBefore|The title of the tool that adds new column before currently selected column."
|
|
1165
|
-
addColumnBefore="Add column before"
|
|
1166
|
-
i18n-addColumnAfter="kendo.editor.addColumnAfter|The title of the tool that adds new column after currently selected column."
|
|
1167
|
-
addColumnAfter="Add column after"
|
|
1168
|
-
i18n-addRowBefore="kendo.editor.addRowBefore|The title of the tool that adds new row before currently selected row."
|
|
1169
|
-
addRowBefore="Add row before"
|
|
1170
|
-
i18n-addRowAfter="kendo.editor.addRowAfter|The title of the tool that adds new row after currently selected row."
|
|
1171
|
-
addRowAfter="Add row after"
|
|
1172
|
-
i18n-mergeCells="kendo.editor.mergeCells|The title of the tool that merges the currently selected cells."
|
|
1173
|
-
mergeCells="Merge cells"
|
|
1174
|
-
i18n-splitCell="kendo.editor.splitCell|The title of the tool that splits the currently selected cell."
|
|
1175
|
-
splitCell="Split cell"
|
|
1176
|
-
i18n-deleteColumn="kendo.editor.deleteColumn|The title of the tool that deletes a table column."
|
|
1177
|
-
deleteColumn="Delete column"
|
|
1178
|
-
i18n-deleteRow="kendo.editor.deleteRow|The title of the tool that deletes a table row."
|
|
1179
|
-
deleteRow="Delete row"
|
|
1180
|
-
i18n-deleteTable="kendo.editor.deleteTable|The title of the tool that deletes a table."
|
|
1181
|
-
deleteTable="Delete table"
|
|
1182
|
-
>
|
|
1183
|
-
</ng-container>
|
|
1184
|
-
<ng-content select="kendo-toolbar"></ng-content>
|
|
1185
|
-
@if (!userToolBarElement) {
|
|
1186
|
-
<kendo-toolbar
|
|
1187
|
-
#defaultToolbar
|
|
1188
|
-
class="k-editor-toolbar"
|
|
1189
|
-
[overflow]="true"
|
|
1190
|
-
[tabindex]="readonly ? -1 : 0"
|
|
1191
|
-
>
|
|
1192
|
-
<kendo-toolbar-buttongroup>
|
|
1193
|
-
<kendo-toolbar-button kendoEditorBoldButton></kendo-toolbar-button>
|
|
1194
|
-
<kendo-toolbar-button kendoEditorItalicButton></kendo-toolbar-button>
|
|
1195
|
-
<kendo-toolbar-button kendoEditorUnderlineButton></kendo-toolbar-button>
|
|
1196
|
-
</kendo-toolbar-buttongroup>
|
|
1197
|
-
<kendo-toolbar-dropdownlist kendoEditorFormat></kendo-toolbar-dropdownlist>
|
|
1198
|
-
<kendo-toolbar-buttongroup>
|
|
1199
|
-
<kendo-toolbar-button kendoEditorAlignLeftButton></kendo-toolbar-button>
|
|
1200
|
-
<kendo-toolbar-button kendoEditorAlignCenterButton></kendo-toolbar-button>
|
|
1201
|
-
<kendo-toolbar-button kendoEditorAlignRightButton></kendo-toolbar-button>
|
|
1202
|
-
<kendo-toolbar-button kendoEditorAlignJustifyButton></kendo-toolbar-button>
|
|
1203
|
-
</kendo-toolbar-buttongroup>
|
|
1204
|
-
<kendo-toolbar-buttongroup>
|
|
1205
|
-
<kendo-toolbar-button kendoEditorInsertUnorderedListButton></kendo-toolbar-button>
|
|
1206
|
-
<kendo-toolbar-button kendoEditorInsertOrderedListButton></kendo-toolbar-button>
|
|
1207
|
-
<kendo-toolbar-button kendoEditorIndentButton></kendo-toolbar-button>
|
|
1208
|
-
<kendo-toolbar-button kendoEditorOutdentButton></kendo-toolbar-button>
|
|
1209
|
-
</kendo-toolbar-buttongroup>
|
|
1210
|
-
<kendo-toolbar-buttongroup>
|
|
1211
|
-
<kendo-toolbar-button kendoEditorCreateLinkButton></kendo-toolbar-button>
|
|
1212
|
-
<kendo-toolbar-button kendoEditorUnlinkButton></kendo-toolbar-button>
|
|
1213
|
-
</kendo-toolbar-buttongroup>
|
|
1214
|
-
<kendo-toolbar-button kendoEditorInsertImageButton></kendo-toolbar-button>
|
|
1215
|
-
</kendo-toolbar>
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
@if (!iframe) {
|
|
1219
|
-
<div #content [attr.dir]="direction" class="k-editor-content"></div>
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
@if (iframe) {
|
|
1223
|
-
<div class="k-editor-content">
|
|
1224
|
-
<iframe #content srcdoc="<!DOCTYPE html>" role="none" frameborder="0" class="k-iframe" [style.width.%]="100" [style.height.%]="100" [style.display]="'block'" (load)="iframeOnLoad()"></iframe>
|
|
1225
|
-
</div>
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
<ng-container #dialogsContainer></ng-container>
|
|
1229
|
-
|
|
1230
|
-
@if (showLicenseWatermark) {
|
|
1231
|
-
<div kendoWatermarkOverlay [licenseMessage]="licenseMessage"></div>
|
|
1232
|
-
}
|
|
1233
|
-
`,
|
|
1234
|
-
standalone: true,
|
|
1235
|
-
imports: [LocalizedMessagesDirective, ToolBarComponent, ToolBarButtonGroupComponent, ToolBarButtonComponent, EditorBoldButtonDirective, EditorItalicButtonDirective, EditorUnderlineButtonDirective, EditorFormatComponent, EditorAlignLeftButtonDirective, EditorAlignCenterButtonDirective, EditorAlignRightButtonDirective, EditorAlignJustifyButtonDirective, EditorInsertUnorderedListButtonDirective, EditorInsertOrderedListButtonDirective, EditorIndentButtonDirective, EditorOutdentButtonDirective, EditorCreateLinkButtonDirective, EditorUnlinkButtonDirective, EditorInsertImageButtonDirective, WatermarkOverlayComponent]
|
|
1236
|
-
}]
|
|
1237
|
-
}], ctorParameters: () => [{ type: i1.DialogService }, { type: i2.LocalizationService }, { type: i0.ChangeDetectorRef }, { type: i0.NgZone }, { type: i0.ElementRef }, { type: i3.ProviderService }, { type: i4.EditorToolsService }, { type: i0.Renderer2 }], propDecorators: { value: [{
|
|
1238
|
-
type: Input
|
|
1239
|
-
}], disabled: [{
|
|
1240
|
-
type: Input
|
|
1241
|
-
}], readonly: [{
|
|
1242
|
-
type: Input
|
|
1243
|
-
}], iframe: [{
|
|
1244
|
-
type: Input
|
|
1245
|
-
}], iframeCss: [{
|
|
1246
|
-
type: Input
|
|
1247
|
-
}], applyToWord: [{
|
|
1248
|
-
type: Input
|
|
1249
|
-
}], schema: [{
|
|
1250
|
-
type: Input
|
|
1251
|
-
}], plugins: [{
|
|
1252
|
-
type: Input
|
|
1253
|
-
}], placeholder: [{
|
|
1254
|
-
type: Input
|
|
1255
|
-
}], preserveWhitespace: [{
|
|
1256
|
-
type: Input
|
|
1257
|
-
}], pasteCleanupSettings: [{
|
|
1258
|
-
type: Input
|
|
1259
|
-
}], resizable: [{
|
|
1260
|
-
type: Input
|
|
1261
|
-
}], valueChange: [{
|
|
1262
|
-
type: Output
|
|
1263
|
-
}], onFocus: [{
|
|
1264
|
-
type: Output,
|
|
1265
|
-
args: ['focus']
|
|
1266
|
-
}], paste: [{
|
|
1267
|
-
type: Output
|
|
1268
|
-
}], onBlur: [{
|
|
1269
|
-
type: Output,
|
|
1270
|
-
args: ['blur']
|
|
1271
|
-
}], hostClass: [{
|
|
1272
|
-
type: HostBinding,
|
|
1273
|
-
args: ['class.k-editor']
|
|
1274
|
-
}], resizableClass: [{
|
|
1275
|
-
type: HostBinding,
|
|
1276
|
-
args: ['class.k-editor-resizable']
|
|
1277
|
-
}], isDisabled: [{
|
|
1278
|
-
type: HostBinding,
|
|
1279
|
-
args: ['class.k-disabled']
|
|
1280
|
-
}], isReadonly: [{
|
|
1281
|
-
type: HostBinding,
|
|
1282
|
-
args: ['class.k-readonly']
|
|
1283
|
-
}], dir: [{
|
|
1284
|
-
type: HostBinding,
|
|
1285
|
-
args: ['attr.dir']
|
|
1286
|
-
}], ariaDisabled: [{
|
|
1287
|
-
type: HostBinding,
|
|
1288
|
-
args: ['attr.ariaDisabled']
|
|
1289
|
-
}], minWidth: [{
|
|
1290
|
-
type: HostBinding,
|
|
1291
|
-
args: ['style.minWidth']
|
|
1292
|
-
}], maxWidth: [{
|
|
1293
|
-
type: HostBinding,
|
|
1294
|
-
args: ['style.maxWidth']
|
|
1295
|
-
}], minHeight: [{
|
|
1296
|
-
type: HostBinding,
|
|
1297
|
-
args: ['style.minHeight']
|
|
1298
|
-
}], maxHeight: [{
|
|
1299
|
-
type: HostBinding,
|
|
1300
|
-
args: ['style.maxHeight']
|
|
1301
|
-
}], userToolBarComponent: [{
|
|
1302
|
-
type: ContentChild,
|
|
1303
|
-
args: [ToolBarComponent]
|
|
1304
|
-
}], userToolBarElement: [{
|
|
1305
|
-
type: ContentChild,
|
|
1306
|
-
args: [ToolBarComponent, { read: ElementRef }]
|
|
1307
|
-
}], dialogContainer: [{
|
|
1308
|
-
type: ViewChild,
|
|
1309
|
-
args: ['dialogsContainer', { read: ViewContainerRef }]
|
|
1310
|
-
}], container: [{
|
|
1311
|
-
type: ViewChild,
|
|
1312
|
-
args: ['content', { read: ViewContainerRef }]
|
|
1313
|
-
}], defaultToolbar: [{
|
|
1314
|
-
type: ViewChild,
|
|
1315
|
-
args: ['defaultToolbar', { read: ElementRef, static: false }]
|
|
1316
|
-
}], defaultToolbarComponent: [{
|
|
1317
|
-
type: ViewChild,
|
|
1318
|
-
args: ['defaultToolbar', { read: ToolBarComponent, static: false }]
|
|
1319
|
-
}] } });
|