@covalent/code-editor 4.0.0 → 4.1.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -37
- package/covalent-code-editor.d.ts +2 -1
- package/esm2020/covalent-code-editor.mjs +5 -0
- package/esm2020/lib/code-editor.component.mjs +363 -0
- package/esm2020/lib/code-editor.module.mjs +19 -0
- package/esm2020/public_api.mjs +3 -0
- package/fesm2015/covalent-code-editor.mjs +384 -0
- package/fesm2015/covalent-code-editor.mjs.map +1 -0
- package/fesm2020/covalent-code-editor.mjs +384 -0
- package/fesm2020/covalent-code-editor.mjs.map +1 -0
- package/{code-editor.component.d.ts → lib/code-editor.component.d.ts} +16 -18
- package/lib/code-editor.module.d.ts +8 -0
- package/package.json +35 -22
- package/public_api.d.ts +2 -0
- package/bundles/covalent-code-editor.umd.js +0 -1067
- package/bundles/covalent-code-editor.umd.js.map +0 -1
- package/bundles/covalent-code-editor.umd.min.js +0 -16
- package/bundles/covalent-code-editor.umd.min.js.map +0 -1
- package/code-editor.component.scss +0 -18
- package/code-editor.module.d.ts +0 -2
- package/covalent-code-editor.metadata.json +0 -1
- package/esm2015/code-editor.component.js +0 -674
- package/esm2015/code-editor.module.js +0 -19
- package/esm2015/covalent-code-editor.js +0 -10
- package/esm2015/index.js +0 -7
- package/esm2015/public-api.js +0 -8
- package/fesm2015/covalent-code-editor.js +0 -709
- package/fesm2015/covalent-code-editor.js.map +0 -1
- package/index.d.ts +0 -1
- package/public-api.d.ts +0 -2
|
@@ -1,709 +0,0 @@
|
|
|
1
|
-
import { EventEmitter, Component, forwardRef, NgZone, ChangeDetectorRef, ElementRef, ViewChild, Output, Input, NgModule } from '@angular/core';
|
|
2
|
-
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
3
|
-
import { Subject, merge, fromEvent, timer } from 'rxjs';
|
|
4
|
-
import { debounceTime, distinctUntilChanged, takeUntil } from 'rxjs/operators';
|
|
5
|
-
import { editor, languages } from 'monaco-editor/esm/vs/editor/editor.api';
|
|
6
|
-
import { CommonModule } from '@angular/common';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @fileoverview added by tsickle
|
|
10
|
-
* Generated from: code-editor.component.ts
|
|
11
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
12
|
-
*/
|
|
13
|
-
/** @type {?} */
|
|
14
|
-
const noop = (/**
|
|
15
|
-
* @return {?}
|
|
16
|
-
*/
|
|
17
|
-
() => {
|
|
18
|
-
// empty method
|
|
19
|
-
});
|
|
20
|
-
const ɵ0 = noop;
|
|
21
|
-
// counter for ids to allow for multiple editors on one page
|
|
22
|
-
/** @type {?} */
|
|
23
|
-
let uniqueCounter = 0;
|
|
24
|
-
class TdCodeEditorComponent {
|
|
25
|
-
// tslint:disable-next-line:member-ordering
|
|
26
|
-
/**
|
|
27
|
-
* @param {?} zone
|
|
28
|
-
* @param {?} _changeDetectorRef
|
|
29
|
-
* @param {?} _elementRef
|
|
30
|
-
*/
|
|
31
|
-
constructor(zone, _changeDetectorRef, _elementRef) {
|
|
32
|
-
this.zone = zone;
|
|
33
|
-
this._changeDetectorRef = _changeDetectorRef;
|
|
34
|
-
this._elementRef = _elementRef;
|
|
35
|
-
this._destroy = new Subject();
|
|
36
|
-
this._widthSubject = new Subject();
|
|
37
|
-
this._heightSubject = new Subject();
|
|
38
|
-
this._editorStyle = 'width:100%;height:100%;border:1px solid grey;';
|
|
39
|
-
this._value = '';
|
|
40
|
-
this._theme = 'vs';
|
|
41
|
-
this._language = 'javascript';
|
|
42
|
-
this._subject = new Subject();
|
|
43
|
-
this._editorInnerContainer = 'editorInnerContainer' + uniqueCounter++;
|
|
44
|
-
this._fromEditor = false;
|
|
45
|
-
this._componentInitialized = false;
|
|
46
|
-
this._editorOptions = {};
|
|
47
|
-
this._isFullScreen = false;
|
|
48
|
-
this._registeredLanguagesStyles = [];
|
|
49
|
-
/**
|
|
50
|
-
* editorInitialized: function($event)
|
|
51
|
-
* Event emitted when editor is first initialized
|
|
52
|
-
*/
|
|
53
|
-
this.editorInitialized = new EventEmitter();
|
|
54
|
-
/**
|
|
55
|
-
* editorConfigurationChanged: function($event)
|
|
56
|
-
* Event emitted when editor's configuration changes
|
|
57
|
-
*/
|
|
58
|
-
this.editorConfigurationChanged = new EventEmitter();
|
|
59
|
-
/**
|
|
60
|
-
* editorLanguageChanged: function($event)
|
|
61
|
-
* Event emitted when editor's Language changes
|
|
62
|
-
*/
|
|
63
|
-
this.editorLanguageChanged = new EventEmitter();
|
|
64
|
-
/**
|
|
65
|
-
* editorValueChange: function($event)
|
|
66
|
-
* Event emitted any time something changes the editor value
|
|
67
|
-
*/
|
|
68
|
-
this.editorValueChange = new EventEmitter();
|
|
69
|
-
/**
|
|
70
|
-
* The change event notifies you about a change happening in an input field.
|
|
71
|
-
* Since the component is not a native Angular component have to specifiy the event emitter ourself
|
|
72
|
-
*/
|
|
73
|
-
this.change = new EventEmitter();
|
|
74
|
-
/* tslint:disable-next-line */
|
|
75
|
-
this.propagateChange = (/**
|
|
76
|
-
* @param {?} _
|
|
77
|
-
* @return {?}
|
|
78
|
-
*/
|
|
79
|
-
(_) => { });
|
|
80
|
-
this.onTouched = (/**
|
|
81
|
-
* @return {?}
|
|
82
|
-
*/
|
|
83
|
-
() => noop);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* value?: string
|
|
87
|
-
* @param {?} value
|
|
88
|
-
* @return {?}
|
|
89
|
-
*/
|
|
90
|
-
set value(value) {
|
|
91
|
-
if (value === this._value) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
this._value = value;
|
|
95
|
-
if (this._componentInitialized) {
|
|
96
|
-
this.applyValue();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* @return {?}
|
|
101
|
-
*/
|
|
102
|
-
get value() {
|
|
103
|
-
return this._value;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @return {?}
|
|
107
|
-
*/
|
|
108
|
-
applyValue() {
|
|
109
|
-
if (!this._fromEditor) {
|
|
110
|
-
this._editor.setValue(this._value);
|
|
111
|
-
}
|
|
112
|
-
this._fromEditor = false;
|
|
113
|
-
this.propagateChange(this._value);
|
|
114
|
-
this.change.emit();
|
|
115
|
-
this.editorValueChange.emit();
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Implemented as part of ControlValueAccessor.
|
|
119
|
-
* @param {?} value
|
|
120
|
-
* @return {?}
|
|
121
|
-
*/
|
|
122
|
-
writeValue(value) {
|
|
123
|
-
// do not write if null or undefined
|
|
124
|
-
// tslint:disable-next-line
|
|
125
|
-
if (value != undefined) {
|
|
126
|
-
this.value = value;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* @param {?} fn
|
|
131
|
-
* @return {?}
|
|
132
|
-
*/
|
|
133
|
-
registerOnChange(fn) {
|
|
134
|
-
this.propagateChange = fn;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* @param {?} fn
|
|
138
|
-
* @return {?}
|
|
139
|
-
*/
|
|
140
|
-
registerOnTouched(fn) {
|
|
141
|
-
this.onTouched = fn;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* getEditorContent?: function
|
|
145
|
-
* Returns the content within the editor
|
|
146
|
-
* @return {?}
|
|
147
|
-
*/
|
|
148
|
-
getValue() {
|
|
149
|
-
if (this._componentInitialized) {
|
|
150
|
-
setTimeout((/**
|
|
151
|
-
* @return {?}
|
|
152
|
-
*/
|
|
153
|
-
() => {
|
|
154
|
-
this._subject.next(this._value);
|
|
155
|
-
this._subject.complete();
|
|
156
|
-
this._subject = new Subject();
|
|
157
|
-
}));
|
|
158
|
-
return this._subject.asObservable();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* language?: string
|
|
163
|
-
* language used in editor
|
|
164
|
-
* @param {?} language
|
|
165
|
-
* @return {?}
|
|
166
|
-
*/
|
|
167
|
-
set language(language) {
|
|
168
|
-
this._language = language;
|
|
169
|
-
if (this._componentInitialized) {
|
|
170
|
-
this.applyLanguage();
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* @return {?}
|
|
175
|
-
*/
|
|
176
|
-
get language() {
|
|
177
|
-
return this._language;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* @return {?}
|
|
181
|
-
*/
|
|
182
|
-
applyLanguage() {
|
|
183
|
-
if (this._language) {
|
|
184
|
-
editor.setModelLanguage(this._editor.getModel(), this._language);
|
|
185
|
-
this.editorLanguageChanged.emit();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* registerLanguage?: function
|
|
190
|
-
* Registers a custom Language within the editor
|
|
191
|
-
* @param {?} language
|
|
192
|
-
* @return {?}
|
|
193
|
-
*/
|
|
194
|
-
registerLanguage(language) {
|
|
195
|
-
if (this._componentInitialized) {
|
|
196
|
-
for (const provider of language.completionItemProvider) {
|
|
197
|
-
/* tslint:disable-next-line */
|
|
198
|
-
provider.kind = eval(provider.kind);
|
|
199
|
-
}
|
|
200
|
-
for (const monarchTokens of language.monarchTokensProvider) {
|
|
201
|
-
/* tslint:disable-next-line */
|
|
202
|
-
monarchTokens[0] = eval(monarchTokens[0]);
|
|
203
|
-
}
|
|
204
|
-
languages.register({ id: language.id });
|
|
205
|
-
languages.setMonarchTokensProvider(language.id, {
|
|
206
|
-
tokenizer: {
|
|
207
|
-
root: language.monarchTokensProvider,
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
// Define a new theme that constains only rules that match this language
|
|
211
|
-
editor.defineTheme(language.customTheme.id, language.customTheme.theme);
|
|
212
|
-
this._theme = language.customTheme.id;
|
|
213
|
-
languages.registerCompletionItemProvider(language.id, {
|
|
214
|
-
provideCompletionItems: (/**
|
|
215
|
-
* @return {?}
|
|
216
|
-
*/
|
|
217
|
-
() => {
|
|
218
|
-
return language.completionItemProvider;
|
|
219
|
-
}),
|
|
220
|
-
});
|
|
221
|
-
/** @type {?} */
|
|
222
|
-
const css = document.createElement('style');
|
|
223
|
-
css.type = 'text/css';
|
|
224
|
-
css.innerHTML = language.monarchTokensProviderCSS;
|
|
225
|
-
document.body.appendChild(css);
|
|
226
|
-
this.editorConfigurationChanged.emit();
|
|
227
|
-
this._registeredLanguagesStyles = [...this._registeredLanguagesStyles, css];
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* style?: string
|
|
232
|
-
* css style of the editor on the page
|
|
233
|
-
* @param {?} editorStyle
|
|
234
|
-
* @return {?}
|
|
235
|
-
*/
|
|
236
|
-
set editorStyle(editorStyle) {
|
|
237
|
-
this._editorStyle = editorStyle;
|
|
238
|
-
if (this._componentInitialized) {
|
|
239
|
-
this.applyStyle();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* @return {?}
|
|
244
|
-
*/
|
|
245
|
-
get editorStyle() {
|
|
246
|
-
return this._editorStyle;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* @return {?}
|
|
250
|
-
*/
|
|
251
|
-
applyStyle() {
|
|
252
|
-
if (this._editorStyle) {
|
|
253
|
-
/** @type {?} */
|
|
254
|
-
const containerDiv = this._editorContainer.nativeElement;
|
|
255
|
-
containerDiv.setAttribute('style', this._editorStyle);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* theme?: string
|
|
260
|
-
* Theme to be applied to editor
|
|
261
|
-
* @param {?} theme
|
|
262
|
-
* @return {?}
|
|
263
|
-
*/
|
|
264
|
-
set theme(theme) {
|
|
265
|
-
this._theme = theme;
|
|
266
|
-
if (this._componentInitialized) {
|
|
267
|
-
this._editor.updateOptions({ theme });
|
|
268
|
-
this.editorConfigurationChanged.emit();
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* @return {?}
|
|
273
|
-
*/
|
|
274
|
-
get theme() {
|
|
275
|
-
return this._theme;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* fullScreenKeyBinding?: number
|
|
279
|
-
* See here for key bindings https://microsoft.github.io/monaco-editor/api/enums/monaco.keycode.html
|
|
280
|
-
* Sets the KeyCode for shortcutting to Fullscreen mode
|
|
281
|
-
* @param {?} keycode
|
|
282
|
-
* @return {?}
|
|
283
|
-
*/
|
|
284
|
-
set fullScreenKeyBinding(keycode) {
|
|
285
|
-
this._keycode = keycode;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* @return {?}
|
|
289
|
-
*/
|
|
290
|
-
get fullScreenKeyBinding() {
|
|
291
|
-
return this._keycode;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* editorOptions?: object
|
|
295
|
-
* Options used on editor instantiation. Available options listed here:
|
|
296
|
-
* https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.ieditoroptions.html
|
|
297
|
-
* @param {?} editorOptions
|
|
298
|
-
* @return {?}
|
|
299
|
-
*/
|
|
300
|
-
set editorOptions(editorOptions) {
|
|
301
|
-
this._editorOptions = editorOptions;
|
|
302
|
-
if (this._componentInitialized) {
|
|
303
|
-
this._editor.updateOptions(editorOptions);
|
|
304
|
-
this.editorConfigurationChanged.emit();
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* @return {?}
|
|
309
|
-
*/
|
|
310
|
-
get editorOptions() {
|
|
311
|
-
return this._editorOptions;
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* layout method that calls layout method of editor and instructs the editor to remeasure its container
|
|
315
|
-
* @return {?}
|
|
316
|
-
*/
|
|
317
|
-
layout() {
|
|
318
|
-
if (this._componentInitialized) {
|
|
319
|
-
this._editor.layout();
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Returns if in Full Screen Mode or not
|
|
324
|
-
* @return {?}
|
|
325
|
-
*/
|
|
326
|
-
get isFullScreen() {
|
|
327
|
-
return this._isFullScreen;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* @return {?}
|
|
331
|
-
*/
|
|
332
|
-
ngOnInit() {
|
|
333
|
-
/** @type {?} */
|
|
334
|
-
const containerDiv = this._editorContainer.nativeElement;
|
|
335
|
-
containerDiv.id = this._editorInnerContainer;
|
|
336
|
-
this._editor = editor.create(containerDiv, Object.assign({
|
|
337
|
-
value: this._value,
|
|
338
|
-
language: this.language,
|
|
339
|
-
theme: this._theme,
|
|
340
|
-
}, this.editorOptions));
|
|
341
|
-
this._componentInitialized = true;
|
|
342
|
-
setTimeout((/**
|
|
343
|
-
* @return {?}
|
|
344
|
-
*/
|
|
345
|
-
() => {
|
|
346
|
-
this.applyLanguage();
|
|
347
|
-
this._fromEditor = true;
|
|
348
|
-
this.applyValue();
|
|
349
|
-
this.applyStyle();
|
|
350
|
-
this.editorInitialized.emit(this._editor);
|
|
351
|
-
this.editorConfigurationChanged.emit();
|
|
352
|
-
}));
|
|
353
|
-
this._editor.getModel().onDidChangeContent((/**
|
|
354
|
-
* @param {?} e
|
|
355
|
-
* @return {?}
|
|
356
|
-
*/
|
|
357
|
-
(e) => {
|
|
358
|
-
this._fromEditor = true;
|
|
359
|
-
this.writeValue(this._editor.getValue());
|
|
360
|
-
this.layout();
|
|
361
|
-
}));
|
|
362
|
-
this.addFullScreenModeCommand();
|
|
363
|
-
merge(fromEvent(window, 'resize').pipe(debounceTime(100)), this._widthSubject.asObservable().pipe(distinctUntilChanged()), this._heightSubject.asObservable().pipe(distinctUntilChanged()))
|
|
364
|
-
.pipe(takeUntil(this._destroy), debounceTime(100))
|
|
365
|
-
.subscribe((/**
|
|
366
|
-
* @return {?}
|
|
367
|
-
*/
|
|
368
|
-
() => {
|
|
369
|
-
this.layout();
|
|
370
|
-
this._changeDetectorRef.markForCheck();
|
|
371
|
-
}));
|
|
372
|
-
timer(500, 250)
|
|
373
|
-
.pipe(takeUntil(this._destroy))
|
|
374
|
-
.subscribe((/**
|
|
375
|
-
* @return {?}
|
|
376
|
-
*/
|
|
377
|
-
() => {
|
|
378
|
-
if (this._elementRef && this._elementRef.nativeElement) {
|
|
379
|
-
this._widthSubject.next(((/** @type {?} */ (this._elementRef.nativeElement))).getBoundingClientRect().width);
|
|
380
|
-
this._heightSubject.next(((/** @type {?} */ (this._elementRef.nativeElement))).getBoundingClientRect().height);
|
|
381
|
-
}
|
|
382
|
-
}));
|
|
383
|
-
}
|
|
384
|
-
/**
|
|
385
|
-
* @return {?}
|
|
386
|
-
*/
|
|
387
|
-
ngOnDestroy() {
|
|
388
|
-
this._changeDetectorRef.detach();
|
|
389
|
-
this._registeredLanguagesStyles.forEach((/**
|
|
390
|
-
* @param {?} style
|
|
391
|
-
* @return {?}
|
|
392
|
-
*/
|
|
393
|
-
(style) => style.remove()));
|
|
394
|
-
if (this._editor) {
|
|
395
|
-
this._editor.dispose();
|
|
396
|
-
}
|
|
397
|
-
this._destroy.next(true);
|
|
398
|
-
this._destroy.unsubscribe();
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* showFullScreenEditor request for full screen of Code Editor based on its browser type.
|
|
402
|
-
* @return {?}
|
|
403
|
-
*/
|
|
404
|
-
showFullScreenEditor() {
|
|
405
|
-
if (this._componentInitialized) {
|
|
406
|
-
/** @type {?} */
|
|
407
|
-
const codeEditorElement = (/** @type {?} */ (this._editorContainer.nativeElement));
|
|
408
|
-
/** @type {?} */
|
|
409
|
-
const fullScreenMap = {
|
|
410
|
-
// Chrome
|
|
411
|
-
requestFullscreen: (/**
|
|
412
|
-
* @return {?}
|
|
413
|
-
*/
|
|
414
|
-
() => codeEditorElement.requestFullscreen()),
|
|
415
|
-
// Safari
|
|
416
|
-
webkitRequestFullscreen: (/**
|
|
417
|
-
* @return {?}
|
|
418
|
-
*/
|
|
419
|
-
() => ((/** @type {?} */ (codeEditorElement))).webkitRequestFullscreen()),
|
|
420
|
-
// IE
|
|
421
|
-
msRequestFullscreen: (/**
|
|
422
|
-
* @return {?}
|
|
423
|
-
*/
|
|
424
|
-
() => ((/** @type {?} */ (codeEditorElement))).msRequestFullscreen()),
|
|
425
|
-
// Firefox
|
|
426
|
-
mozRequestFullScreen: (/**
|
|
427
|
-
* @return {?}
|
|
428
|
-
*/
|
|
429
|
-
() => ((/** @type {?} */ (codeEditorElement))).mozRequestFullScreen()),
|
|
430
|
-
};
|
|
431
|
-
for (const handler of Object.keys(fullScreenMap)) {
|
|
432
|
-
if (codeEditorElement[handler]) {
|
|
433
|
-
fullScreenMap[handler]();
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
this._isFullScreen = true;
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* exitFullScreenEditor request to exit full screen of Code Editor based on its browser type.
|
|
441
|
-
* @return {?}
|
|
442
|
-
*/
|
|
443
|
-
exitFullScreenEditor() {
|
|
444
|
-
if (this._componentInitialized) {
|
|
445
|
-
/** @type {?} */
|
|
446
|
-
const exitFullScreenMap = {
|
|
447
|
-
// Chrome
|
|
448
|
-
exitFullscreen: (/**
|
|
449
|
-
* @return {?}
|
|
450
|
-
*/
|
|
451
|
-
() => document.exitFullscreen()),
|
|
452
|
-
// Safari
|
|
453
|
-
webkitExitFullscreen: (/**
|
|
454
|
-
* @return {?}
|
|
455
|
-
*/
|
|
456
|
-
() => ((/** @type {?} */ (document))).webkitExitFullscreen()),
|
|
457
|
-
// Firefox
|
|
458
|
-
mozCancelFullScreen: (/**
|
|
459
|
-
* @return {?}
|
|
460
|
-
*/
|
|
461
|
-
() => ((/** @type {?} */ (document))).mozCancelFullScreen()),
|
|
462
|
-
// IE
|
|
463
|
-
msExitFullscreen: (/**
|
|
464
|
-
* @return {?}
|
|
465
|
-
*/
|
|
466
|
-
() => ((/** @type {?} */ (document))).msExitFullscreen()),
|
|
467
|
-
};
|
|
468
|
-
for (const handler of Object.keys(exitFullScreenMap)) {
|
|
469
|
-
if (document[handler]) {
|
|
470
|
-
exitFullScreenMap[handler]();
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
this._isFullScreen = false;
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* addFullScreenModeCommand used to add the fullscreen option to the context menu
|
|
478
|
-
* @private
|
|
479
|
-
* @return {?}
|
|
480
|
-
*/
|
|
481
|
-
addFullScreenModeCommand() {
|
|
482
|
-
this._editor.addAction({
|
|
483
|
-
// An unique identifier of the contributed action.
|
|
484
|
-
id: 'fullScreen',
|
|
485
|
-
// A label of the action that will be presented to the user.
|
|
486
|
-
label: 'Full Screen',
|
|
487
|
-
// An optional array of keybindings for the action.
|
|
488
|
-
contextMenuGroupId: 'navigation',
|
|
489
|
-
keybindings: this._keycode,
|
|
490
|
-
contextMenuOrder: 1.5,
|
|
491
|
-
// Method that will be executed when the action is triggered.
|
|
492
|
-
// @param editor The editor instance is passed in as a convinience
|
|
493
|
-
run: (/**
|
|
494
|
-
* @param {?} ed
|
|
495
|
-
* @return {?}
|
|
496
|
-
*/
|
|
497
|
-
(ed) => {
|
|
498
|
-
this.showFullScreenEditor();
|
|
499
|
-
}),
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
TdCodeEditorComponent.decorators = [
|
|
504
|
-
{ type: Component, args: [{
|
|
505
|
-
selector: 'td-code-editor',
|
|
506
|
-
template: "<div class=\"editorContainer\" #editorContainer></div>\n",
|
|
507
|
-
providers: [
|
|
508
|
-
{
|
|
509
|
-
provide: NG_VALUE_ACCESSOR,
|
|
510
|
-
useExisting: forwardRef((/**
|
|
511
|
-
* @return {?}
|
|
512
|
-
*/
|
|
513
|
-
() => TdCodeEditorComponent)),
|
|
514
|
-
multi: true,
|
|
515
|
-
},
|
|
516
|
-
],
|
|
517
|
-
styles: [":host{display:block;position:relative}:host .editorContainer{bottom:0;left:0;position:absolute;right:0;top:0}::ng-deep .monaco-aria-container{display:none}"]
|
|
518
|
-
}] }
|
|
519
|
-
];
|
|
520
|
-
/** @nocollapse */
|
|
521
|
-
TdCodeEditorComponent.ctorParameters = () => [
|
|
522
|
-
{ type: NgZone },
|
|
523
|
-
{ type: ChangeDetectorRef },
|
|
524
|
-
{ type: ElementRef }
|
|
525
|
-
];
|
|
526
|
-
TdCodeEditorComponent.propDecorators = {
|
|
527
|
-
_editorContainer: [{ type: ViewChild, args: ['editorContainer', { static: true },] }],
|
|
528
|
-
editorInitialized: [{ type: Output }],
|
|
529
|
-
editorConfigurationChanged: [{ type: Output }],
|
|
530
|
-
editorLanguageChanged: [{ type: Output }],
|
|
531
|
-
editorValueChange: [{ type: Output }],
|
|
532
|
-
change: [{ type: Output }],
|
|
533
|
-
value: [{ type: Input, args: ['value',] }],
|
|
534
|
-
language: [{ type: Input, args: ['language',] }],
|
|
535
|
-
editorStyle: [{ type: Input, args: ['editorStyle',] }],
|
|
536
|
-
theme: [{ type: Input, args: ['theme',] }],
|
|
537
|
-
fullScreenKeyBinding: [{ type: Input, args: ['fullScreenKeyBinding',] }],
|
|
538
|
-
editorOptions: [{ type: Input, args: ['editorOptions',] }]
|
|
539
|
-
};
|
|
540
|
-
if (false) {
|
|
541
|
-
/**
|
|
542
|
-
* @type {?}
|
|
543
|
-
* @private
|
|
544
|
-
*/
|
|
545
|
-
TdCodeEditorComponent.prototype._destroy;
|
|
546
|
-
/**
|
|
547
|
-
* @type {?}
|
|
548
|
-
* @private
|
|
549
|
-
*/
|
|
550
|
-
TdCodeEditorComponent.prototype._widthSubject;
|
|
551
|
-
/**
|
|
552
|
-
* @type {?}
|
|
553
|
-
* @private
|
|
554
|
-
*/
|
|
555
|
-
TdCodeEditorComponent.prototype._heightSubject;
|
|
556
|
-
/**
|
|
557
|
-
* @type {?}
|
|
558
|
-
* @private
|
|
559
|
-
*/
|
|
560
|
-
TdCodeEditorComponent.prototype._editorStyle;
|
|
561
|
-
/**
|
|
562
|
-
* @type {?}
|
|
563
|
-
* @private
|
|
564
|
-
*/
|
|
565
|
-
TdCodeEditorComponent.prototype._value;
|
|
566
|
-
/**
|
|
567
|
-
* @type {?}
|
|
568
|
-
* @private
|
|
569
|
-
*/
|
|
570
|
-
TdCodeEditorComponent.prototype._theme;
|
|
571
|
-
/**
|
|
572
|
-
* @type {?}
|
|
573
|
-
* @private
|
|
574
|
-
*/
|
|
575
|
-
TdCodeEditorComponent.prototype._language;
|
|
576
|
-
/**
|
|
577
|
-
* @type {?}
|
|
578
|
-
* @private
|
|
579
|
-
*/
|
|
580
|
-
TdCodeEditorComponent.prototype._subject;
|
|
581
|
-
/**
|
|
582
|
-
* @type {?}
|
|
583
|
-
* @private
|
|
584
|
-
*/
|
|
585
|
-
TdCodeEditorComponent.prototype._editorInnerContainer;
|
|
586
|
-
/**
|
|
587
|
-
* @type {?}
|
|
588
|
-
* @private
|
|
589
|
-
*/
|
|
590
|
-
TdCodeEditorComponent.prototype._editor;
|
|
591
|
-
/**
|
|
592
|
-
* @type {?}
|
|
593
|
-
* @private
|
|
594
|
-
*/
|
|
595
|
-
TdCodeEditorComponent.prototype._fromEditor;
|
|
596
|
-
/**
|
|
597
|
-
* @type {?}
|
|
598
|
-
* @private
|
|
599
|
-
*/
|
|
600
|
-
TdCodeEditorComponent.prototype._componentInitialized;
|
|
601
|
-
/**
|
|
602
|
-
* @type {?}
|
|
603
|
-
* @private
|
|
604
|
-
*/
|
|
605
|
-
TdCodeEditorComponent.prototype._editorOptions;
|
|
606
|
-
/**
|
|
607
|
-
* @type {?}
|
|
608
|
-
* @private
|
|
609
|
-
*/
|
|
610
|
-
TdCodeEditorComponent.prototype._isFullScreen;
|
|
611
|
-
/**
|
|
612
|
-
* @type {?}
|
|
613
|
-
* @private
|
|
614
|
-
*/
|
|
615
|
-
TdCodeEditorComponent.prototype._keycode;
|
|
616
|
-
/**
|
|
617
|
-
* @type {?}
|
|
618
|
-
* @private
|
|
619
|
-
*/
|
|
620
|
-
TdCodeEditorComponent.prototype._registeredLanguagesStyles;
|
|
621
|
-
/** @type {?} */
|
|
622
|
-
TdCodeEditorComponent.prototype._editorContainer;
|
|
623
|
-
/**
|
|
624
|
-
* editorInitialized: function($event)
|
|
625
|
-
* Event emitted when editor is first initialized
|
|
626
|
-
* @type {?}
|
|
627
|
-
*/
|
|
628
|
-
TdCodeEditorComponent.prototype.editorInitialized;
|
|
629
|
-
/**
|
|
630
|
-
* editorConfigurationChanged: function($event)
|
|
631
|
-
* Event emitted when editor's configuration changes
|
|
632
|
-
* @type {?}
|
|
633
|
-
*/
|
|
634
|
-
TdCodeEditorComponent.prototype.editorConfigurationChanged;
|
|
635
|
-
/**
|
|
636
|
-
* editorLanguageChanged: function($event)
|
|
637
|
-
* Event emitted when editor's Language changes
|
|
638
|
-
* @type {?}
|
|
639
|
-
*/
|
|
640
|
-
TdCodeEditorComponent.prototype.editorLanguageChanged;
|
|
641
|
-
/**
|
|
642
|
-
* editorValueChange: function($event)
|
|
643
|
-
* Event emitted any time something changes the editor value
|
|
644
|
-
* @type {?}
|
|
645
|
-
*/
|
|
646
|
-
TdCodeEditorComponent.prototype.editorValueChange;
|
|
647
|
-
/**
|
|
648
|
-
* The change event notifies you about a change happening in an input field.
|
|
649
|
-
* Since the component is not a native Angular component have to specifiy the event emitter ourself
|
|
650
|
-
* @type {?}
|
|
651
|
-
*/
|
|
652
|
-
TdCodeEditorComponent.prototype.change;
|
|
653
|
-
/** @type {?} */
|
|
654
|
-
TdCodeEditorComponent.prototype.propagateChange;
|
|
655
|
-
/** @type {?} */
|
|
656
|
-
TdCodeEditorComponent.prototype.onTouched;
|
|
657
|
-
/**
|
|
658
|
-
* @type {?}
|
|
659
|
-
* @private
|
|
660
|
-
*/
|
|
661
|
-
TdCodeEditorComponent.prototype.zone;
|
|
662
|
-
/**
|
|
663
|
-
* @type {?}
|
|
664
|
-
* @private
|
|
665
|
-
*/
|
|
666
|
-
TdCodeEditorComponent.prototype._changeDetectorRef;
|
|
667
|
-
/**
|
|
668
|
-
* @type {?}
|
|
669
|
-
* @private
|
|
670
|
-
*/
|
|
671
|
-
TdCodeEditorComponent.prototype._elementRef;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* @fileoverview added by tsickle
|
|
676
|
-
* Generated from: code-editor.module.ts
|
|
677
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
678
|
-
*/
|
|
679
|
-
class CovalentCodeEditorModule {
|
|
680
|
-
}
|
|
681
|
-
CovalentCodeEditorModule.decorators = [
|
|
682
|
-
{ type: NgModule, args: [{
|
|
683
|
-
imports: [CommonModule],
|
|
684
|
-
declarations: [TdCodeEditorComponent],
|
|
685
|
-
exports: [TdCodeEditorComponent],
|
|
686
|
-
bootstrap: [TdCodeEditorComponent],
|
|
687
|
-
},] }
|
|
688
|
-
];
|
|
689
|
-
|
|
690
|
-
/**
|
|
691
|
-
* @fileoverview added by tsickle
|
|
692
|
-
* Generated from: public-api.ts
|
|
693
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
694
|
-
*/
|
|
695
|
-
|
|
696
|
-
/**
|
|
697
|
-
* @fileoverview added by tsickle
|
|
698
|
-
* Generated from: index.ts
|
|
699
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
700
|
-
*/
|
|
701
|
-
|
|
702
|
-
/**
|
|
703
|
-
* @fileoverview added by tsickle
|
|
704
|
-
* Generated from: covalent-code-editor.ts
|
|
705
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
706
|
-
*/
|
|
707
|
-
|
|
708
|
-
export { CovalentCodeEditorModule, TdCodeEditorComponent };
|
|
709
|
-
//# sourceMappingURL=covalent-code-editor.js.map
|