@firestitch/text-editor 9.0.1 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,31 +1,31 @@
1
- import { EventEmitter, OnInit, ElementRef } from '@angular/core';
2
- import { ControlValueAccessor } from '@angular/forms';
3
- import { EditorComponent } from 'ngx-monaco-editor';
4
- import { FsTextEditorConfig } from '../../interfaces/config.interface';
5
- export declare class FsTextEditorComponent implements OnInit, ControlValueAccessor {
6
- private _element;
7
- config: FsTextEditorConfig;
8
- scrollable: boolean;
9
- init: EventEmitter<any>;
10
- blur: EventEmitter<any>;
11
- _editorContainer: EditorComponent;
12
- defaultConfig: FsTextEditorConfig;
13
- onChange: (_: any) => void;
14
- onTouched: () => void;
15
- get monaco(): any;
16
- constructor(_element: ElementRef);
17
- readonly LINE_HEIGHT = 18;
18
- private _editorRef;
19
- private _value;
20
- ngOnInit(): void;
21
- get value(): string;
22
- onEditorInit(event: any): void;
23
- writeValue(value: any): void;
24
- changed(e: any): void;
25
- registerOnChange(fn: any): void;
26
- registerOnTouched(fn: any): void;
27
- private _initEditor;
28
- private _updateEditorHeight;
29
- updateLayout(): void;
30
- private _disableScroll;
31
- }
1
+ import { EventEmitter, OnInit, ElementRef } from '@angular/core';
2
+ import { ControlValueAccessor } from '@angular/forms';
3
+ import { EditorComponent } from 'ngx-monaco-editor';
4
+ import { FsTextEditorConfig } from '../../interfaces/config.interface';
5
+ export declare class FsTextEditorComponent implements OnInit, ControlValueAccessor {
6
+ private _element;
7
+ config: FsTextEditorConfig;
8
+ scrollable: boolean;
9
+ init: EventEmitter<any>;
10
+ blur: EventEmitter<any>;
11
+ _editorContainer: EditorComponent;
12
+ defaultConfig: FsTextEditorConfig;
13
+ onChange: (_: any) => void;
14
+ onTouched: () => void;
15
+ get monaco(): any;
16
+ constructor(_element: ElementRef);
17
+ readonly LINE_HEIGHT = 18;
18
+ private _editorRef;
19
+ private _value;
20
+ ngOnInit(): void;
21
+ get value(): string;
22
+ onEditorInit(event: any): void;
23
+ writeValue(value: any): void;
24
+ changed(e: any): void;
25
+ registerOnChange(fn: any): void;
26
+ registerOnTouched(fn: any): void;
27
+ private _initEditor;
28
+ private _updateEditorHeight;
29
+ updateLayout(): void;
30
+ private _disableScroll;
31
+ }
@@ -1,2 +1,2 @@
1
- export declare class FsTextEditorModule {
2
- }
1
+ export declare class FsTextEditorModule {
2
+ }
@@ -1,4 +1,4 @@
1
- import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
2
- export interface FsTextEditorConfig extends IStandaloneEditorConstructionOptions {
3
- autoHeight?: boolean;
4
- }
1
+ import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions;
2
+ export interface FsTextEditorConfig extends IStandaloneEditorConstructionOptions {
3
+ autoHeight?: boolean;
4
+ }
@@ -1,400 +1,180 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('ngx-monaco-editor')) :
3
3
  typeof define === 'function' && define.amd ? define('@firestitch/text-editor', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'ngx-monaco-editor'], factory) :
4
- (global = global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch['text-editor'] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ngxMonacoEditor));
5
- }(this, (function (exports, core, common, forms, ngxMonacoEditor) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.firestitch = global.firestitch || {}, global.firestitch["text-editor"] = {}), global.ng.core, global.ng.common, global.ng.forms, global.ngxMonacoEditor));
5
+ })(this, (function (exports, core, common, forms, ngxMonacoEditor) { 'use strict';
6
6
 
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
-
23
- var extendStatics = function(d, b) {
24
- extendStatics = Object.setPrototypeOf ||
25
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
26
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
27
- return extendStatics(d, b);
28
- };
29
-
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
-
36
- var __assign = function() {
37
- __assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
41
- }
42
- return t;
43
- };
44
- return __assign.apply(this, arguments);
45
- };
46
-
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
50
- t[p] = s[p];
51
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
52
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
53
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
54
- t[p[i]] = s[p[i]];
55
- }
56
- return t;
57
- }
58
-
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
62
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
63
- return c > 3 && r && Object.defineProperty(target, key, r), r;
64
- }
65
-
66
- function __param(paramIndex, decorator) {
67
- return function (target, key) { decorator(target, key, paramIndex); }
68
- }
69
-
70
- function __metadata(metadataKey, metadataValue) {
71
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
72
- }
73
-
74
- function __awaiter(thisArg, _arguments, P, generator) {
75
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
76
- return new (P || (P = Promise))(function (resolve, reject) {
77
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
78
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
79
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
80
- step((generator = generator.apply(thisArg, _arguments || [])).next());
81
- });
82
- }
83
-
84
- function __generator(thisArg, body) {
85
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
86
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
87
- function verb(n) { return function (v) { return step([n, v]); }; }
88
- function step(op) {
89
- if (f) throw new TypeError("Generator is already executing.");
90
- while (_) try {
91
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
92
- if (y = 0, t) op = [op[0] & 2, t.value];
93
- switch (op[0]) {
94
- case 0: case 1: t = op; break;
95
- case 4: _.label++; return { value: op[1], done: false };
96
- case 5: _.label++; y = op[1]; op = [0]; continue;
97
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
100
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
101
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
102
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
103
- if (t[2]) _.ops.pop();
104
- _.trys.pop(); continue;
105
- }
106
- op = body.call(thisArg, _);
107
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
108
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
109
- }
110
- }
111
-
112
- function __exportStar(m, exports) {
113
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
114
- }
115
-
116
- function __values(o) {
117
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
118
- if (m) return m.call(o);
119
- if (o && typeof o.length === "number") return {
120
- next: function () {
121
- if (o && i >= o.length) o = void 0;
122
- return { value: o && o[i++], done: !o };
123
- }
124
- };
125
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
126
- }
127
-
128
- function __read(o, n) {
129
- var m = typeof Symbol === "function" && o[Symbol.iterator];
130
- if (!m) return o;
131
- var i = m.call(o), r, ar = [], e;
132
- try {
133
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
134
- }
135
- catch (error) { e = { error: error }; }
136
- finally {
137
- try {
138
- if (r && !r.done && (m = i["return"])) m.call(i);
139
- }
140
- finally { if (e) throw e.error; }
141
- }
142
- return ar;
143
- }
144
-
145
- function __spread() {
146
- for (var ar = [], i = 0; i < arguments.length; i++)
147
- ar = ar.concat(__read(arguments[i]));
148
- return ar;
149
- }
150
-
151
- function __spreadArrays() {
152
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
153
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
154
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
155
- r[k] = a[j];
156
- return r;
157
- };
158
-
159
- function __await(v) {
160
- return this instanceof __await ? (this.v = v, this) : new __await(v);
161
- }
162
-
163
- function __asyncGenerator(thisArg, _arguments, generator) {
164
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
165
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
166
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
167
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
168
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
169
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
170
- function fulfill(value) { resume("next", value); }
171
- function reject(value) { resume("throw", value); }
172
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
173
- }
174
-
175
- function __asyncDelegator(o) {
176
- var i, p;
177
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
178
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
179
- }
180
-
181
- function __asyncValues(o) {
182
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
183
- var m = o[Symbol.asyncIterator], i;
184
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
185
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
186
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
187
- }
188
-
189
- function __makeTemplateObject(cooked, raw) {
190
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
191
- return cooked;
192
- };
193
-
194
- function __importStar(mod) {
195
- if (mod && mod.__esModule) return mod;
196
- var result = {};
197
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
198
- result.default = mod;
199
- return result;
200
- }
201
-
202
- function __importDefault(mod) {
203
- return (mod && mod.__esModule) ? mod : { default: mod };
204
- }
205
-
206
- function __classPrivateFieldGet(receiver, privateMap) {
207
- if (!privateMap.has(receiver)) {
208
- throw new TypeError("attempted to get private field on non-instance");
209
- }
210
- return privateMap.get(receiver);
211
- }
212
-
213
- function __classPrivateFieldSet(receiver, privateMap, value) {
214
- if (!privateMap.has(receiver)) {
215
- throw new TypeError("attempted to set private field on non-instance");
216
- }
217
- privateMap.set(receiver, value);
218
- return value;
219
- }
220
-
221
- var FsTextEditorComponent = /** @class */ (function () {
222
- function FsTextEditorComponent(_element) {
223
- this._element = _element;
224
- this.config = {};
225
- this.scrollable = false;
226
- this.init = new core.EventEmitter();
227
- this.blur = new core.EventEmitter();
228
- this.defaultConfig = {
229
- minimap: {
230
- enabled: false
231
- },
232
- theme: 'vs-dark',
233
- automaticLayout: false,
234
- scrollBeyondLastLine: false,
235
- autoHeight: true,
236
- scrollbar: {
237
- vertical: 'hidden'
238
- },
239
- hideCursorInOverviewRuler: true
240
- };
241
- this.onChange = function (_) { };
242
- this.onTouched = function () { };
243
- this.LINE_HEIGHT = 18;
244
- this._value = '';
245
- }
246
- FsTextEditorComponent_1 = FsTextEditorComponent;
247
- Object.defineProperty(FsTextEditorComponent.prototype, "monaco", {
248
- get: function () {
249
- return window.monaco;
250
- },
251
- enumerable: true,
252
- configurable: true
253
- });
254
- ;
255
- ;
256
- FsTextEditorComponent.prototype.ngOnInit = function () {
257
- if (this.config) {
258
- this.config = Object.assign({}, this.defaultConfig, this.config);
259
- }
260
- };
261
- Object.defineProperty(FsTextEditorComponent.prototype, "value", {
262
- get: function () {
263
- return this._value;
264
- },
265
- enumerable: true,
266
- configurable: true
267
- });
268
- FsTextEditorComponent.prototype.onEditorInit = function (event) {
269
- var _this = this;
270
- // Timeout allows the content to fully load to and calculate height
271
- setTimeout(function () {
272
- _this._editorRef = event;
273
- _this._initEditor();
274
- _this.init.next(event);
275
- if (!_this.scrollable) {
276
- _this._disableScroll();
277
- }
278
- });
279
- };
280
- FsTextEditorComponent.prototype.writeValue = function (value) {
281
- this._value = value || '';
282
- };
283
- FsTextEditorComponent.prototype.changed = function (e) {
284
- this._value = e;
285
- this.onChange(e);
286
- };
287
- FsTextEditorComponent.prototype.registerOnChange = function (fn) {
288
- this.onChange = fn;
289
- };
290
- FsTextEditorComponent.prototype.registerOnTouched = function (fn) {
291
- this.onTouched = fn;
292
- };
293
- FsTextEditorComponent.prototype._initEditor = function () {
294
- var _this = this;
295
- if (this._editorRef && this.config.autoHeight) {
296
- this._updateEditorHeight();
297
- this._editorRef.onDidChangeModelContent(function (e) {
298
- _this._updateEditorHeight();
299
- });
300
- this._editorRef.onDidBlurEditorText(function () {
301
- _this.blur.next();
302
- });
303
- }
304
- };
305
- FsTextEditorComponent.prototype._updateEditorHeight = function () {
306
- var editorDomNode = this._editorRef.getDomNode();
307
- if (!editorDomNode) {
308
- return;
309
- }
310
- var container = editorDomNode.getElementsByClassName('view-lines')[0];
311
- var lineHeight = container.firstChild
312
- ? container.firstChild.offsetHeight
313
- : this.LINE_HEIGHT;
314
- var editorModel = this._editorRef.getModel();
315
- if (!editorModel) {
316
- return;
317
- }
318
- var nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
319
- // set the height and redo layout
320
- editorDomNode.style.height = nextHeight + 'px';
321
- this.updateLayout();
322
- };
323
- FsTextEditorComponent.prototype.updateLayout = function () {
324
- this._editorRef.layout();
325
- };
326
- FsTextEditorComponent.prototype._disableScroll = function () {
327
- var node = this._editorRef.getDomNode();
328
- node.addEventListener('wheel', function (e) {
329
- e.stopPropagation();
330
- }, true);
331
- };
332
- var FsTextEditorComponent_1;
333
- FsTextEditorComponent.ctorParameters = function () { return [
334
- { type: core.ElementRef }
335
- ]; };
336
- __decorate([
337
- core.Input(),
338
- __metadata("design:type", Object)
339
- ], FsTextEditorComponent.prototype, "config", void 0);
340
- __decorate([
341
- core.Input(),
342
- __metadata("design:type", Object)
343
- ], FsTextEditorComponent.prototype, "scrollable", void 0);
344
- __decorate([
345
- core.Output(),
346
- __metadata("design:type", Object)
347
- ], FsTextEditorComponent.prototype, "init", void 0);
348
- __decorate([
349
- core.Output(),
350
- __metadata("design:type", Object)
351
- ], FsTextEditorComponent.prototype, "blur", void 0);
352
- __decorate([
353
- core.ViewChild(ngxMonacoEditor.EditorComponent, { static: true }),
354
- __metadata("design:type", ngxMonacoEditor.EditorComponent)
355
- ], FsTextEditorComponent.prototype, "_editorContainer", void 0);
356
- FsTextEditorComponent = FsTextEditorComponent_1 = __decorate([
357
- core.Component({
358
- selector: 'fs-text-editor',
359
- template: "<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n",
360
- providers: [{
361
- provide: forms.NG_VALUE_ACCESSOR,
362
- useExisting: core.forwardRef(function () { return FsTextEditorComponent_1; }),
363
- multi: true
364
- }],
365
- styles: [":host ngx-monaco-editor{height:100%!important}:host ::ng-deep .decorationsOverviewRuler{display:none}:host ::ng-deep .margin,:host ::ng-deep .monaco-editor-background{top:0!important}"]
366
- }),
367
- __metadata("design:paramtypes", [core.ElementRef])
368
- ], FsTextEditorComponent);
369
- return FsTextEditorComponent;
7
+ var FsTextEditorComponent = /** @class */ (function () {
8
+ function FsTextEditorComponent(_element) {
9
+ this._element = _element;
10
+ this.config = {};
11
+ this.scrollable = false;
12
+ this.init = new core.EventEmitter();
13
+ this.blur = new core.EventEmitter();
14
+ this.defaultConfig = {
15
+ minimap: {
16
+ enabled: false
17
+ },
18
+ theme: 'vs-dark',
19
+ automaticLayout: false,
20
+ scrollBeyondLastLine: false,
21
+ autoHeight: true,
22
+ scrollbar: {
23
+ vertical: 'hidden'
24
+ },
25
+ hideCursorInOverviewRuler: true
26
+ };
27
+ this.onChange = function (_) { };
28
+ this.onTouched = function () { };
29
+ this.LINE_HEIGHT = 18;
30
+ this._value = '';
31
+ }
32
+ Object.defineProperty(FsTextEditorComponent.prototype, "monaco", {
33
+ get: function () {
34
+ return window.monaco;
35
+ },
36
+ enumerable: false,
37
+ configurable: true
38
+ });
39
+ ;
40
+ ;
41
+ FsTextEditorComponent.prototype.ngOnInit = function () {
42
+ if (this.config) {
43
+ this.config = Object.assign({}, this.defaultConfig, this.config);
44
+ }
45
+ };
46
+ Object.defineProperty(FsTextEditorComponent.prototype, "value", {
47
+ get: function () {
48
+ return this._value;
49
+ },
50
+ enumerable: false,
51
+ configurable: true
52
+ });
53
+ FsTextEditorComponent.prototype.onEditorInit = function (event) {
54
+ var _this = this;
55
+ // Timeout allows the content to fully load to and calculate height
56
+ setTimeout(function () {
57
+ _this._editorRef = event;
58
+ _this._initEditor();
59
+ _this.init.next(event);
60
+ if (!_this.scrollable) {
61
+ _this._disableScroll();
62
+ }
63
+ });
64
+ };
65
+ FsTextEditorComponent.prototype.writeValue = function (value) {
66
+ this._value = value || '';
67
+ };
68
+ FsTextEditorComponent.prototype.changed = function (e) {
69
+ if (this._value !== e) {
70
+ this._value = e;
71
+ this.onChange(e);
72
+ }
73
+ };
74
+ FsTextEditorComponent.prototype.registerOnChange = function (fn) {
75
+ this.onChange = fn;
76
+ };
77
+ FsTextEditorComponent.prototype.registerOnTouched = function (fn) {
78
+ this.onTouched = fn;
79
+ };
80
+ FsTextEditorComponent.prototype._initEditor = function () {
81
+ var _this = this;
82
+ if (this._editorRef && this.config.autoHeight) {
83
+ this._updateEditorHeight();
84
+ this._editorRef.onDidChangeModelContent(function (e) {
85
+ _this._updateEditorHeight();
86
+ });
87
+ this._editorRef.onDidBlurEditorText(function () {
88
+ _this.blur.next();
89
+ });
90
+ }
91
+ };
92
+ FsTextEditorComponent.prototype._updateEditorHeight = function () {
93
+ var editorDomNode = this._editorRef.getDomNode();
94
+ if (!editorDomNode) {
95
+ return;
96
+ }
97
+ var container = editorDomNode.getElementsByClassName('view-lines')[0];
98
+ var lineHeight = container.firstChild
99
+ ? container.firstChild.offsetHeight
100
+ : this.LINE_HEIGHT;
101
+ var editorModel = this._editorRef.getModel();
102
+ if (!editorModel) {
103
+ return;
104
+ }
105
+ var nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
106
+ // set the height and redo layout
107
+ editorDomNode.style.height = nextHeight + 'px';
108
+ this.updateLayout();
109
+ };
110
+ FsTextEditorComponent.prototype.updateLayout = function () {
111
+ this._editorRef.layout();
112
+ };
113
+ FsTextEditorComponent.prototype._disableScroll = function () {
114
+ var node = this._editorRef.getDomNode();
115
+ node.addEventListener('wheel', function (e) {
116
+ e.stopPropagation();
117
+ }, true);
118
+ };
119
+ return FsTextEditorComponent;
370
120
  }());
121
+ FsTextEditorComponent.decorators = [
122
+ { type: core.Component, args: [{
123
+ selector: 'fs-text-editor',
124
+ template: "<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n",
125
+ providers: [{
126
+ provide: forms.NG_VALUE_ACCESSOR,
127
+ useExisting: core.forwardRef(function () { return FsTextEditorComponent; }),
128
+ multi: true
129
+ }],
130
+ styles: [":host ngx-monaco-editor{height:100%!important}:host ::ng-deep .decorationsOverviewRuler{display:none}:host ::ng-deep .margin,:host ::ng-deep .monaco-editor-background{top:0px!important}\n"]
131
+ },] }
132
+ ];
133
+ FsTextEditorComponent.ctorParameters = function () { return [
134
+ { type: core.ElementRef }
135
+ ]; };
136
+ FsTextEditorComponent.propDecorators = {
137
+ config: [{ type: core.Input }],
138
+ scrollable: [{ type: core.Input }],
139
+ init: [{ type: core.Output }],
140
+ blur: [{ type: core.Output }],
141
+ _editorContainer: [{ type: core.ViewChild, args: [ngxMonacoEditor.EditorComponent, { static: true },] }]
142
+ };
371
143
 
372
- var FsTextEditorModule = /** @class */ (function () {
373
- function FsTextEditorModule() {
374
- }
375
- FsTextEditorModule = __decorate([
376
- core.NgModule({
377
- imports: [
378
- common.CommonModule,
379
- ngxMonacoEditor.MonacoEditorModule,
380
- forms.FormsModule,
381
- ],
382
- exports: [
383
- FsTextEditorComponent,
384
- ],
385
- entryComponents: [],
386
- declarations: [
387
- FsTextEditorComponent,
388
- ]
389
- })
390
- ], FsTextEditorModule);
391
- return FsTextEditorModule;
144
+ var FsTextEditorModule = /** @class */ (function () {
145
+ function FsTextEditorModule() {
146
+ }
147
+ return FsTextEditorModule;
392
148
  }());
149
+ FsTextEditorModule.decorators = [
150
+ { type: core.NgModule, args: [{
151
+ imports: [
152
+ common.CommonModule,
153
+ ngxMonacoEditor.MonacoEditorModule,
154
+ forms.FormsModule,
155
+ ],
156
+ exports: [
157
+ FsTextEditorComponent,
158
+ ],
159
+ entryComponents: [],
160
+ declarations: [
161
+ FsTextEditorComponent,
162
+ ]
163
+ },] }
164
+ ];
165
+
166
+ /*
167
+ * Public API Surface of fs-menu
168
+ */
169
+
170
+ /**
171
+ * Generated bundle index. Do not edit.
172
+ */
393
173
 
174
+ exports.FsTextEditorComponent = FsTextEditorComponent;
394
175
  exports.FsTextEditorModule = FsTextEditorModule;
395
- exports.ɵa = FsTextEditorComponent;
396
176
 
397
177
  Object.defineProperty(exports, '__esModule', { value: true });
398
178
 
399
- })));
179
+ }));
400
180
  //# sourceMappingURL=firestitch-text-editor.umd.js.map