@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,174 +1,160 @@
1
- import { __decorate, __metadata } from 'tslib';
2
- import { EventEmitter, ElementRef, Input, Output, ViewChild, Component, forwardRef, NgModule } from '@angular/core';
1
+ import { EventEmitter, Component, forwardRef, ElementRef, Input, Output, ViewChild, NgModule } from '@angular/core';
3
2
  import { CommonModule } from '@angular/common';
4
3
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
5
4
  import { EditorComponent, MonacoEditorModule } from 'ngx-monaco-editor';
6
5
 
7
- var FsTextEditorComponent_1;
8
- let FsTextEditorComponent = FsTextEditorComponent_1 = class FsTextEditorComponent {
9
- constructor(_element) {
10
- this._element = _element;
11
- this.config = {};
12
- this.scrollable = false;
13
- this.init = new EventEmitter();
14
- this.blur = new EventEmitter();
15
- this.defaultConfig = {
16
- minimap: {
17
- enabled: false
18
- },
19
- theme: 'vs-dark',
20
- automaticLayout: false,
21
- scrollBeyondLastLine: false,
22
- autoHeight: true,
23
- scrollbar: {
24
- vertical: 'hidden'
25
- },
26
- hideCursorInOverviewRuler: true
27
- };
28
- this.onChange = (_) => { };
29
- this.onTouched = () => { };
30
- this.LINE_HEIGHT = 18;
31
- this._value = '';
32
- }
33
- get monaco() {
34
- return window.monaco;
35
- }
36
- ;
37
- ;
38
- ngOnInit() {
39
- if (this.config) {
40
- this.config = Object.assign({}, this.defaultConfig, this.config);
41
- }
42
- }
43
- get value() {
44
- return this._value;
45
- }
46
- onEditorInit(event) {
47
- // Timeout allows the content to fully load to and calculate height
48
- setTimeout(() => {
49
- this._editorRef = event;
50
- this._initEditor();
51
- this.init.next(event);
52
- if (!this.scrollable) {
53
- this._disableScroll();
54
- }
55
- });
56
- }
57
- writeValue(value) {
58
- this._value = value || '';
59
- }
60
- changed(e) {
61
- this._value = e;
62
- this.onChange(e);
63
- }
64
- registerOnChange(fn) {
65
- this.onChange = fn;
66
- }
67
- registerOnTouched(fn) {
68
- this.onTouched = fn;
69
- }
70
- _initEditor() {
71
- if (this._editorRef && this.config.autoHeight) {
72
- this._updateEditorHeight();
73
- this._editorRef.onDidChangeModelContent((e) => {
74
- this._updateEditorHeight();
75
- });
76
- this._editorRef.onDidBlurEditorText(() => {
77
- this.blur.next();
78
- });
79
- }
80
- }
81
- _updateEditorHeight() {
82
- const editorDomNode = this._editorRef.getDomNode();
83
- if (!editorDomNode) {
84
- return;
85
- }
86
- const container = editorDomNode.getElementsByClassName('view-lines')[0];
87
- const lineHeight = container.firstChild
88
- ? container.firstChild.offsetHeight
89
- : this.LINE_HEIGHT;
90
- const editorModel = this._editorRef.getModel();
91
- if (!editorModel) {
92
- return;
93
- }
94
- const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
95
- // set the height and redo layout
96
- editorDomNode.style.height = nextHeight + 'px';
97
- this.updateLayout();
98
- }
99
- updateLayout() {
100
- this._editorRef.layout();
101
- }
102
- _disableScroll() {
103
- const node = this._editorRef.getDomNode();
104
- node.addEventListener('wheel', (e) => {
105
- e.stopPropagation();
106
- }, true);
107
- }
108
- };
109
- FsTextEditorComponent.ctorParameters = () => [
110
- { type: ElementRef }
111
- ];
112
- __decorate([
113
- Input(),
114
- __metadata("design:type", Object)
115
- ], FsTextEditorComponent.prototype, "config", void 0);
116
- __decorate([
117
- Input(),
118
- __metadata("design:type", Object)
119
- ], FsTextEditorComponent.prototype, "scrollable", void 0);
120
- __decorate([
121
- Output(),
122
- __metadata("design:type", Object)
123
- ], FsTextEditorComponent.prototype, "init", void 0);
124
- __decorate([
125
- Output(),
126
- __metadata("design:type", Object)
127
- ], FsTextEditorComponent.prototype, "blur", void 0);
128
- __decorate([
129
- ViewChild(EditorComponent, { static: true }),
130
- __metadata("design:type", EditorComponent)
131
- ], FsTextEditorComponent.prototype, "_editorContainer", void 0);
132
- FsTextEditorComponent = FsTextEditorComponent_1 = __decorate([
133
- Component({
134
- selector: 'fs-text-editor',
135
- template: "<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n",
136
- providers: [{
137
- provide: NG_VALUE_ACCESSOR,
138
- useExisting: forwardRef(() => FsTextEditorComponent_1),
139
- multi: true
140
- }],
141
- 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}"]
142
- }),
143
- __metadata("design:paramtypes", [ElementRef])
144
- ], FsTextEditorComponent);
6
+ class FsTextEditorComponent {
7
+ constructor(_element) {
8
+ this._element = _element;
9
+ this.config = {};
10
+ this.scrollable = false;
11
+ this.init = new EventEmitter();
12
+ this.blur = new EventEmitter();
13
+ this.defaultConfig = {
14
+ minimap: {
15
+ enabled: false
16
+ },
17
+ theme: 'vs-dark',
18
+ automaticLayout: false,
19
+ scrollBeyondLastLine: false,
20
+ autoHeight: true,
21
+ scrollbar: {
22
+ vertical: 'hidden'
23
+ },
24
+ hideCursorInOverviewRuler: true
25
+ };
26
+ this.onChange = (_) => { };
27
+ this.onTouched = () => { };
28
+ this.LINE_HEIGHT = 18;
29
+ this._value = '';
30
+ }
31
+ get monaco() {
32
+ return window.monaco;
33
+ }
34
+ ;
35
+ ;
36
+ ngOnInit() {
37
+ if (this.config) {
38
+ this.config = Object.assign({}, this.defaultConfig, this.config);
39
+ }
40
+ }
41
+ get value() {
42
+ return this._value;
43
+ }
44
+ onEditorInit(event) {
45
+ // Timeout allows the content to fully load to and calculate height
46
+ setTimeout(() => {
47
+ this._editorRef = event;
48
+ this._initEditor();
49
+ this.init.next(event);
50
+ if (!this.scrollable) {
51
+ this._disableScroll();
52
+ }
53
+ });
54
+ }
55
+ writeValue(value) {
56
+ this._value = value || '';
57
+ }
58
+ changed(e) {
59
+ if (this._value !== e) {
60
+ this._value = e;
61
+ this.onChange(e);
62
+ }
63
+ }
64
+ registerOnChange(fn) {
65
+ this.onChange = fn;
66
+ }
67
+ registerOnTouched(fn) {
68
+ this.onTouched = fn;
69
+ }
70
+ _initEditor() {
71
+ if (this._editorRef && this.config.autoHeight) {
72
+ this._updateEditorHeight();
73
+ this._editorRef.onDidChangeModelContent((e) => {
74
+ this._updateEditorHeight();
75
+ });
76
+ this._editorRef.onDidBlurEditorText(() => {
77
+ this.blur.next();
78
+ });
79
+ }
80
+ }
81
+ _updateEditorHeight() {
82
+ const editorDomNode = this._editorRef.getDomNode();
83
+ if (!editorDomNode) {
84
+ return;
85
+ }
86
+ const container = editorDomNode.getElementsByClassName('view-lines')[0];
87
+ const lineHeight = container.firstChild
88
+ ? container.firstChild.offsetHeight
89
+ : this.LINE_HEIGHT;
90
+ const editorModel = this._editorRef.getModel();
91
+ if (!editorModel) {
92
+ return;
93
+ }
94
+ const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
95
+ // set the height and redo layout
96
+ editorDomNode.style.height = nextHeight + 'px';
97
+ this.updateLayout();
98
+ }
99
+ updateLayout() {
100
+ this._editorRef.layout();
101
+ }
102
+ _disableScroll() {
103
+ const node = this._editorRef.getDomNode();
104
+ node.addEventListener('wheel', (e) => {
105
+ e.stopPropagation();
106
+ }, true);
107
+ }
108
+ }
109
+ FsTextEditorComponent.decorators = [
110
+ { type: Component, args: [{
111
+ selector: 'fs-text-editor',
112
+ template: "<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n",
113
+ providers: [{
114
+ provide: NG_VALUE_ACCESSOR,
115
+ useExisting: forwardRef(() => FsTextEditorComponent),
116
+ multi: true
117
+ }],
118
+ 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"]
119
+ },] }
120
+ ];
121
+ FsTextEditorComponent.ctorParameters = () => [
122
+ { type: ElementRef }
123
+ ];
124
+ FsTextEditorComponent.propDecorators = {
125
+ config: [{ type: Input }],
126
+ scrollable: [{ type: Input }],
127
+ init: [{ type: Output }],
128
+ blur: [{ type: Output }],
129
+ _editorContainer: [{ type: ViewChild, args: [EditorComponent, { static: true },] }]
130
+ };
145
131
 
146
- let FsTextEditorModule = class FsTextEditorModule {
147
- };
148
- FsTextEditorModule = __decorate([
149
- NgModule({
150
- imports: [
151
- CommonModule,
152
- MonacoEditorModule,
153
- FormsModule,
154
- ],
155
- exports: [
156
- FsTextEditorComponent,
157
- ],
158
- entryComponents: [],
159
- declarations: [
160
- FsTextEditorComponent,
161
- ]
162
- })
163
- ], FsTextEditorModule);
132
+ class FsTextEditorModule {
133
+ }
134
+ FsTextEditorModule.decorators = [
135
+ { type: NgModule, args: [{
136
+ imports: [
137
+ CommonModule,
138
+ MonacoEditorModule,
139
+ FormsModule,
140
+ ],
141
+ exports: [
142
+ FsTextEditorComponent,
143
+ ],
144
+ entryComponents: [],
145
+ declarations: [
146
+ FsTextEditorComponent,
147
+ ]
148
+ },] }
149
+ ];
164
150
 
165
- /*
166
- * Public API Surface of fs-menu
151
+ /*
152
+ * Public API Surface of fs-menu
167
153
  */
168
154
 
169
- /**
170
- * Generated bundle index. Do not edit.
155
+ /**
156
+ * Generated bundle index. Do not edit.
171
157
  */
172
158
 
173
- export { FsTextEditorModule, FsTextEditorComponent as ɵa };
159
+ export { FsTextEditorComponent, FsTextEditorModule };
174
160
  //# sourceMappingURL=firestitch-text-editor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firestitch-text-editor.js","sources":["ng://@firestitch/text-editor/app/components/text-editor/text-editor.component.ts","ng://@firestitch/text-editor/app/fs-text-editor.module.ts","ng://@firestitch/text-editor/public_api.ts","ng://@firestitch/text-editor/firestitch-text-editor.ts"],"sourcesContent":["import { Component, EventEmitter, forwardRef, Input, OnInit, Output, ViewChild, ElementRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorComponent } from 'ngx-monaco-editor';\n\nimport ICodeEditor = monaco.editor.ICodeEditor;\n\nimport { FsTextEditorConfig } from '../../interfaces/config.interface';\n\n\n@Component({\n selector: 'fs-text-editor',\n templateUrl: 'text-editor.component.html',\n styleUrls: [ 'text-editor.component.scss' ],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FsTextEditorComponent),\n multi: true\n }]\n})\nexport class FsTextEditorComponent implements OnInit, ControlValueAccessor {\n\n @Input() public config: FsTextEditorConfig = {};\n @Input() public scrollable = false;\n\n @Output() public init = new EventEmitter();\n @Output() public blur = new EventEmitter();\n @ViewChild(EditorComponent, { static: true }) _editorContainer: EditorComponent;\n\n public defaultConfig: FsTextEditorConfig = {\n minimap: {\n enabled: false\n },\n theme: 'vs-dark',\n automaticLayout: false,\n scrollBeyondLastLine: false,\n autoHeight: true,\n scrollbar: {\n vertical: 'hidden'\n },\n hideCursorInOverviewRuler: true\n };\n\n public onChange = (_: any) => {};\n public onTouched = () => {};\n\n public get monaco() {\n return (<any>window).monaco;\n };\n\n constructor(private _element: ElementRef) {};\n\n public readonly LINE_HEIGHT = 18;\n\n private _editorRef: ICodeEditor;\n private _value = '';\n\n public ngOnInit() {\n\n if (this.config) {\n this.config = Object.assign({}, this.defaultConfig, this.config);\n }\n }\n\n get value() {\n return this._value;\n }\n\n public onEditorInit(event) {\n // Timeout allows the content to fully load to and calculate height\n setTimeout(() => {\n this._editorRef = event;\n this._initEditor();\n this.init.next(event);\n\n if (!this.scrollable) {\n this._disableScroll();\n }\n });\n }\n\n public writeValue(value: any): void {\n this._value = value || '';\n }\n\n public changed(e) {\n this._value = e;\n this.onChange(e);\n }\n\n public registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n private _initEditor() {\n if (this._editorRef && this.config.autoHeight) {\n this._updateEditorHeight();\n\n this._editorRef.onDidChangeModelContent((e) => {\n this._updateEditorHeight();\n });\n\n this._editorRef.onDidBlurEditorText(() => {\n this.blur.next();\n });\n }\n }\n\n private _updateEditorHeight() {\n\n const editorDomNode = this._editorRef.getDomNode();\n\n if (!editorDomNode) {\n return;\n }\n\n const container = editorDomNode.getElementsByClassName('view-lines')[0] as HTMLElement;\n const lineHeight = container.firstChild\n ? (container.firstChild as HTMLElement).offsetHeight\n : this.LINE_HEIGHT;\n\n const editorModel = this._editorRef.getModel();\n\n if (!editorModel) {\n return;\n }\n\n const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;\n\n // set the height and redo layout\n editorDomNode.style.height = nextHeight + 'px';\n this.updateLayout();\n }\n\n public updateLayout(): void {\n this._editorRef.layout();\n }\n\n private _disableScroll() {\n const node = this._editorRef.getDomNode();\n\n node.addEventListener('wheel', (e) => {\n e.stopPropagation();\n }, true);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MonacoEditorModule } from 'ngx-monaco-editor';\nimport { FsTextEditorComponent } from './components/text-editor/text-editor.component';\n\n@NgModule({\n imports: [\n CommonModule,\n MonacoEditorModule,\n FormsModule,\n ],\n exports: [\n FsTextEditorComponent,\n ],\n entryComponents: [\n ],\n declarations: [\n FsTextEditorComponent,\n ]\n})\nexport class FsTextEditorModule {\n\n}\n","/*\n * Public API Surface of fs-menu\n */\n\nexport { FsTextEditorModule } from './app/fs-text-editor.module';\n\nexport { FsTextEditorConfig } from './app/interfaces/config.interface';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n\nexport {FsTextEditorComponent as ɵa} from './app/components/text-editor/text-editor.component';"],"names":[],"mappings":";;;;;;;IAmBa,qBAAqB,6BAAlC,MAAa,qBAAqB;IA8BhC,YAAoB,QAAoB;QAApB,aAAQ,GAAR,QAAQ,CAAY;QA5BxB,WAAM,GAAuB,EAAE,CAAC;QAChC,e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AAC;KACrB;IAEM,YAAY;QACjB,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;KAC1B;IAEO,cAAc;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAE1C,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/B,CAAC,CAAC,eAAe,EAAE,CAAC;SACrB,EAAE,IAAI,CAAC,CAAC;KACV;EACF;;YAnG+B,UAAU;;AA5B/B;IAAR,KAAK,EAAE;;qDAAwC;AACvC;IAAR,KAAK,EAAE;;yDAA2B;AAEzB;IAAT,MAAM,EAAE;;mDAAkC;AACjC;IAAT,MAAM,EAAE;;mDAAkC;AACG;IAA7C,SAAS,CAAC,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;8BAAmB,eAAe;+DAAC;AAPrE,qBAAqB;IAVjC,SAAS,CAAC;QACT,QAAQ,EAAE,gBAAgB;QAC1B,kLAAyC;QAEzC,SAAS,EAAE,CAAC;gBACV,OAAO,EAAE,iBAAiB;gBAC1B,WAAW,EAAE,UAAU,CAAC,MAAM,uBAAqB,CAAC;gBACpD,KAAK,EAAE,IAAI;aACZ,CAAC;;KACH,CAAC;qCA+B8B,UAAU;GA9B7B,qBAAqB,CAiIjC;;IC9HY,kBAAkB,GAA/B,MAAa,kBAAkB;EAE9B;AAFY,kBAAkB;IAf9B,QAAQ,CAAC;QACR,OAAO,EAAE;YACP,YAAY;YACZ,kBAAkB;YAClB,WAAW;SACZ;QACD,OAAO,EAAE;YACP,qBAAqB;SACtB;QACD,eAAe,EAAE,EAChB;QACD,YAAY,EAAE;YACZ,qBAAqB;SACtB;KACF,CAAC;GACW,kBAAkB,CAE9B;;ACxBD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"firestitch-text-editor.js","sources":["../../src/app/components/text-editor/text-editor.component.ts","../../src/app/fs-text-editor.module.ts","../../src/public_api.ts","../../src/firestitch-text-editor.ts"],"sourcesContent":["import { Component, EventEmitter, forwardRef, Input, OnInit, Output, ViewChild, ElementRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorComponent } from 'ngx-monaco-editor';\n\nimport ICodeEditor = monaco.editor.ICodeEditor;\n\nimport { FsTextEditorConfig } from '../../interfaces/config.interface';\n\n\n@Component({\n selector: 'fs-text-editor',\n templateUrl: 'text-editor.component.html',\n styleUrls: [ 'text-editor.component.scss' ],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FsTextEditorComponent),\n multi: true\n }]\n})\nexport class FsTextEditorComponent implements OnInit, ControlValueAccessor {\n\n @Input() public config: FsTextEditorConfig = {};\n @Input() public scrollable = false;\n\n @Output() public init = new EventEmitter();\n @Output() public blur = new EventEmitter();\n @ViewChild(EditorComponent, { static: true }) _editorContainer: EditorComponent;\n\n public defaultConfig: FsTextEditorConfig = {\n minimap: {\n enabled: false\n },\n theme: 'vs-dark',\n automaticLayout: false,\n scrollBeyondLastLine: false,\n autoHeight: true,\n scrollbar: {\n vertical: 'hidden'\n },\n hideCursorInOverviewRuler: true\n };\n\n public onChange = (_: any) => {};\n public onTouched = () => {};\n\n public get monaco() {\n return (<any>window).monaco;\n };\n\n constructor(private _element: ElementRef) {};\n\n public readonly LINE_HEIGHT = 18;\n\n private _editorRef: ICodeEditor;\n private _value = '';\n\n public ngOnInit() {\n\n if (this.config) {\n this.config = Object.assign({}, this.defaultConfig, this.config);\n }\n }\n\n get value() {\n return this._value;\n }\n\n public onEditorInit(event) {\n // Timeout allows the content to fully load to and calculate height\n setTimeout(() => {\n this._editorRef = event;\n this._initEditor();\n this.init.next(event);\n\n if (!this.scrollable) {\n this._disableScroll();\n }\n });\n }\n\n public writeValue(value: any): void {\n this._value = value || '';\n }\n\n public changed(e) {\n if (this._value !== e) {\n this._value = e;\n this.onChange(e);\n }\n }\n\n public registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n private _initEditor() {\n if (this._editorRef && this.config.autoHeight) {\n this._updateEditorHeight();\n\n this._editorRef.onDidChangeModelContent((e) => {\n this._updateEditorHeight();\n });\n\n this._editorRef.onDidBlurEditorText(() => {\n this.blur.next();\n });\n }\n }\n\n private _updateEditorHeight() {\n\n const editorDomNode = this._editorRef.getDomNode();\n\n if (!editorDomNode) {\n return;\n }\n\n const container = editorDomNode.getElementsByClassName('view-lines')[0] as HTMLElement;\n const lineHeight = container.firstChild\n ? (container.firstChild as HTMLElement).offsetHeight\n : this.LINE_HEIGHT;\n\n const editorModel = this._editorRef.getModel();\n\n if (!editorModel) {\n return;\n }\n\n const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;\n\n // set the height and redo layout\n editorDomNode.style.height = nextHeight + 'px';\n this.updateLayout();\n }\n\n public updateLayout(): void {\n this._editorRef.layout();\n }\n\n private _disableScroll() {\n const node = this._editorRef.getDomNode();\n\n node.addEventListener('wheel', (e) => {\n e.stopPropagation();\n }, true);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MonacoEditorModule } from 'ngx-monaco-editor';\nimport { FsTextEditorComponent } from './components/text-editor/text-editor.component';\n\n@NgModule({\n imports: [\n CommonModule,\n MonacoEditorModule,\n FormsModule,\n ],\n exports: [\n FsTextEditorComponent,\n ],\n entryComponents: [\n ],\n declarations: [\n FsTextEditorComponent,\n ]\n})\nexport class FsTextEditorModule {\n\n}\n","/*\n * Public API Surface of fs-menu\n */\n\nimport { from } from 'rxjs';\n\nexport { FsTextEditorModule } from './app/fs-text-editor.module';\n\nexport { FsTextEditorConfig } from './app/interfaces/config.interface';\n\n\nexport { FsTextEditorComponent } from './app/components/text-editor/text-editor.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":[],"mappings":";;;;;MAmBa,qBAAqB;IA8BhC,YAAoB,QAA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AAY,EAAE,GAAG,UAAU,CAAC;;QAG1E,aAAa,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC;QAC/C,IAAI,CAAC,YAAY,EAAE,CAAC;KACrB;IAEM,YAAY;QACjB,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;KAC1B;IAEO,cAAc;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAE1C,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;YAC/B,CAAC,CAAC,eAAe,EAAE,CAAC;SACrB,EAAE,IAAI,CAAC,CAAC;KACV;;;YA5IF,SAAS,SAAC;gBACT,QAAQ,EAAE,gBAAgB;gBAC1B,kLAAyC;gBAEzC,SAAS,EAAE,CAAC;wBACV,OAAO,EAAE,iBAAiB;wBAC1B,WAAW,EAAE,UAAU,CAAC,MAAM,qBAAqB,CAAC;wBACpD,KAAK,EAAE,IAAI;qBACZ,CAAC;;aACH;;;YAlB+E,UAAU;;;qBAqBvF,KAAK;yBACL,KAAK;mBAEL,MAAM;mBACN,MAAM;+BACN,SAAS,SAAC,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;MCJjC,kBAAkB;;;YAf9B,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;oBACZ,kBAAkB;oBAClB,WAAW;iBACZ;gBACD,OAAO,EAAE;oBACP,qBAAqB;iBACtB;gBACD,eAAe,EAAE,EAChB;gBACD,YAAY,EAAE;oBACZ,qBAAqB;iBACtB;aACF;;;ACrBD;;;;ACAA;;;;;;"}
@@ -1,5 +1,4 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public_api';
5
- export { FsTextEditorComponent as ɵa } from './app/components/text-editor/text-editor.component';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public_api';
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"FsTextEditorModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":9,"character":4},{"__symbolic":"reference","module":"ngx-monaco-editor","name":"MonacoEditorModule","line":10,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":11,"character":4}],"exports":[{"__symbolic":"reference","name":"ɵa"}],"entryComponents":[],"declarations":[{"__symbolic":"reference","name":"ɵa"}]}]}],"members":{}},"FsTextEditorConfig":{"__symbolic":"interface"},"ɵa":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":9,"character":1},"arguments":[{"selector":"fs-text-editor","providers":[{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":14,"character":13},"useExisting":{"__symbolic":"reference","name":"ɵa"},"multi":true}],"template":"<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n","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}"]}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"scrollable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"init":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":24,"character":3}}]}],"blur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":25,"character":3}}]}],"_editorContainer":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":26,"character":3},"arguments":[{"__symbolic":"reference","module":"ngx-monaco-editor","name":"EditorComponent","line":26,"character":13},{"static":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":49,"character":32}]}],"ngOnInit":[{"__symbolic":"method"}],"onEditorInit":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"changed":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_initEditor":[{"__symbolic":"method"}],"_updateEditorHeight":[{"__symbolic":"method"}],"updateLayout":[{"__symbolic":"method"}],"_disableScroll":[{"__symbolic":"method"}]}}},"origins":{"FsTextEditorModule":"./app/fs-text-editor.module","FsTextEditorConfig":"./app/interfaces/config.interface","ɵa":"./app/components/text-editor/text-editor.component"},"importAs":"@firestitch/text-editor"}
1
+ {"__symbolic":"module","version":4,"metadata":{"FsTextEditorModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule","line":9,"character":4},{"__symbolic":"reference","module":"ngx-monaco-editor","name":"MonacoEditorModule","line":10,"character":4},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule","line":11,"character":4}],"exports":[{"__symbolic":"reference","name":"FsTextEditorComponent"}],"entryComponents":[],"declarations":[{"__symbolic":"reference","name":"FsTextEditorComponent"}]}]}],"members":{}},"FsTextEditorConfig":{"__symbolic":"interface"},"FsTextEditorComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":9,"character":1},"arguments":[{"selector":"fs-text-editor","providers":[{"provide":{"__symbolic":"reference","module":"@angular/forms","name":"NG_VALUE_ACCESSOR","line":14,"character":13},"useExisting":{"__symbolic":"reference","name":"FsTextEditorComponent"},"multi":true}],"template":"<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n","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"]}]}],"members":{"config":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":21,"character":3}}]}],"scrollable":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":22,"character":3}}]}],"init":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":24,"character":3}}]}],"blur":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":25,"character":3}}]}],"_editorContainer":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"ViewChild","line":26,"character":3},"arguments":[{"__symbolic":"reference","module":"ngx-monaco-editor","name":"EditorComponent","line":26,"character":13},{"static":true}]}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":49,"character":32}]}],"ngOnInit":[{"__symbolic":"method"}],"onEditorInit":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"changed":[{"__symbolic":"method"}],"registerOnChange":[{"__symbolic":"method"}],"registerOnTouched":[{"__symbolic":"method"}],"_initEditor":[{"__symbolic":"method"}],"_updateEditorHeight":[{"__symbolic":"method"}],"updateLayout":[{"__symbolic":"method"}],"_disableScroll":[{"__symbolic":"method"}]}}},"origins":{"FsTextEditorModule":"./app/fs-text-editor.module","FsTextEditorConfig":"./app/interfaces/config.interface","FsTextEditorComponent":"./app/components/text-editor/text-editor.component"},"importAs":"@firestitch/text-editor"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestitch/text-editor",
3
- "version": "9.0.1",
3
+ "version": "12.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Firestitch/ngx-text-editor"
@@ -17,17 +17,17 @@
17
17
  "url": "https://github.com/Firestitch/ngx-text-editor/issues"
18
18
  },
19
19
  "peerDependencies": {
20
- "ngx-monaco-editor": ">=7.0.0",
21
- "tslib": "^1.10.0"
20
+ "ngx-monaco-editor": ">=7.0.0"
22
21
  },
23
22
  "sideEffects": false,
24
23
  "main": "bundles/firestitch-text-editor.umd.js",
25
- "module": "fesm5/firestitch-text-editor.js",
24
+ "module": "fesm2015/firestitch-text-editor.js",
26
25
  "es2015": "fesm2015/firestitch-text-editor.js",
27
- "esm5": "esm5/firestitch-text-editor.js",
28
26
  "esm2015": "esm2015/firestitch-text-editor.js",
29
- "fesm5": "fesm5/firestitch-text-editor.js",
30
27
  "fesm2015": "fesm2015/firestitch-text-editor.js",
31
28
  "typings": "firestitch-text-editor.d.ts",
32
- "metadata": "firestitch-text-editor.metadata.json"
33
- }
29
+ "metadata": "firestitch-text-editor.metadata.json",
30
+ "dependencies": {
31
+ "tslib": "^2.2.0"
32
+ }
33
+ }
package/public_api.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { FsTextEditorModule } from './app/fs-text-editor.module';
2
- export { FsTextEditorConfig } from './app/interfaces/config.interface';
1
+ export { FsTextEditorModule } from './app/fs-text-editor.module';
2
+ export { FsTextEditorConfig } from './app/interfaces/config.interface';
3
+ export { FsTextEditorComponent } from './app/components/text-editor/text-editor.component';
@@ -1,16 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@angular/forms"),require("ngx-monaco-editor")):"function"==typeof define&&define.amd?define("@firestitch/text-editor",["exports","@angular/core","@angular/common","@angular/forms","ngx-monaco-editor"],e):e(((t=t||self).firestitch=t.firestitch||{},t.firestitch["text-editor"]={}),t.ng.core,t.ng.common,t.ng.forms,t.ngxMonacoEditor)}(this,(function(t,e,o,n,i){"use strict";
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function r(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var d=t.length-1;d>=0;d--)(i=t[d])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var d=function(){function t(t){this._element=t,this.config={},this.scrollable=!1,this.init=new e.EventEmitter,this.blur=new e.EventEmitter,this.defaultConfig={minimap:{enabled:!1},theme:"vs-dark",automaticLayout:!1,scrollBeyondLastLine:!1,autoHeight:!0,scrollbar:{vertical:"hidden"},hideCursorInOverviewRuler:!0},this.onChange=function(t){},this.onTouched=function(){},this.LINE_HEIGHT=18,this._value=""}var o;return o=t,Object.defineProperty(t.prototype,"monaco",{get:function(){return window.monaco},enumerable:!0,configurable:!0}),t.prototype.ngOnInit=function(){this.config&&(this.config=Object.assign({},this.defaultConfig,this.config))},Object.defineProperty(t.prototype,"value",{get:function(){return this._value},enumerable:!0,configurable:!0}),t.prototype.onEditorInit=function(t){var e=this;setTimeout((function(){e._editorRef=t,e._initEditor(),e.init.next(t),e.scrollable||e._disableScroll()}))},t.prototype.writeValue=function(t){this._value=t||""},t.prototype.changed=function(t){this._value=t,this.onChange(t)},t.prototype.registerOnChange=function(t){this.onChange=t},t.prototype.registerOnTouched=function(t){this.onTouched=t},t.prototype._initEditor=function(){var t=this;this._editorRef&&this.config.autoHeight&&(this._updateEditorHeight(),this._editorRef.onDidChangeModelContent((function(e){t._updateEditorHeight()})),this._editorRef.onDidBlurEditorText((function(){t.blur.next()})))},t.prototype._updateEditorHeight=function(){var t=this._editorRef.getDomNode();if(t){var e=t.getElementsByClassName("view-lines")[0],o=e.firstChild?e.firstChild.offsetHeight:this.LINE_HEIGHT;if(this._editorRef.getModel()){var n=this._editorRef.getModel().getLineCount()*o;t.style.height=n+"px",this.updateLayout()}}},t.prototype.updateLayout=function(){this._editorRef.layout()},t.prototype._disableScroll=function(){this._editorRef.getDomNode().addEventListener("wheel",(function(t){t.stopPropagation()}),!0)},t.ctorParameters=function(){return[{type:e.ElementRef}]},r([e.Input(),a("design:type",Object)],t.prototype,"config",void 0),r([e.Input(),a("design:type",Object)],t.prototype,"scrollable",void 0),r([e.Output(),a("design:type",Object)],t.prototype,"init",void 0),r([e.Output(),a("design:type",Object)],t.prototype,"blur",void 0),r([e.ViewChild(i.EditorComponent,{static:!0}),a("design:type",i.EditorComponent)],t.prototype,"_editorContainer",void 0),t=o=r([e.Component({selector:"fs-text-editor",template:'<ngx-monaco-editor\n [ngModel]="value"\n (ngModelChange)="changed($event)"\n [options]="config"\n (onInit)="onEditorInit($event)">\n</ngx-monaco-editor>\n',providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:e.forwardRef((function(){return o})),multi:!0}],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}"]}),a("design:paramtypes",[e.ElementRef])],t)}(),u=function(){function t(){}return t=r([e.NgModule({imports:[o.CommonModule,i.MonacoEditorModule,n.FormsModule],exports:[d],entryComponents:[],declarations:[d]})],t)}();t.FsTextEditorModule=u,t.ɵa=d,Object.defineProperty(t,"__esModule",{value:!0})}));
16
- //# sourceMappingURL=firestitch-text-editor.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../node_modules/tslib/tslib.es6.js","ng://@firestitch/text-editor/app/components/text-editor/text-editor.component.ts","ng://@firestitch/text-editor/app/fs-text-editor.module.ts"],"names":["__decorate","decorators","target","key","desc","d","c","arguments","length","r","Object","getOwnPropertyDescriptor","Reflect","decorate","i","defineProperty","__metadata","metadataKey","metadataValue","metadata","FsTextEditorComponent","_element","this","config","scrollable","init","EventEmitter","blur","defaultConfig","minimap","enabled","theme","automaticLayout","scrollBeyondLastLine","autoHeight","scrollbar","vertical","hideCursorInOverviewRuler","onChange","_","onTouched","LINE_HEIGHT","_value","prototype","window","monaco","ngOnInit","assign","onEditorInit","event","_this","setTimeout","_editorRef","_initEditor","next","_disableScroll","writeValue","value","changed","e","registerOnChange","fn","registerOnTouched","_updateEditorHeight","onDidChangeModelContent","onDidBlurEditorText","editorDomNode","getDomNode","container","getElementsByClassName","lineHeight","firstChild","offsetHeight","getModel","nextHeight","getLineCount","style","height","updateLayout","layout","addEventListener","stopPropagation","ElementRef","Input","Output","ViewChild","EditorComponent","static","FsTextEditorComponent_1","Component","selector","template","providers","provide","NG_VALUE_ACCESSOR","useExisting","forwardRef","multi","FsTextEditorModule","NgModule","imports","CommonModule","MonacoEditorModule","FormsModule","exports","entryComponents","declarations"],"mappings":";;;;;;;;;;;;;;oFAoDO,SAASA,EAAWC,EAAYC,EAAQ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rBlF,EAAA,CAARmF,EAAAA,8DACQnF,EAAA,CAARmF,EAAAA,kEAESnF,EAAA,CAAToF,EAAAA,6DACSpF,EAAA,CAAToF,EAAAA,6DAC6CpF,EAAA,CAA7CqF,EAAAA,UAAUC,EAAAA,gBAAiB,CAAEC,QAAQ,oBAA0BD,EAAAA,yDAPrDlE,EAAqBoE,EAAAxF,EAAA,CAVjCyF,EAAAA,UAAU,CACTC,SAAU,iBACVC,SAAA,iKAEAC,UAAW,CAAC,CACVC,QAASC,EAAAA,kBACTC,YAAaC,EAAAA,YAAW,WAAM,OAAAR,KAC9BS,OAAO,gOAiCqBf,EAAAA,cA9BnB9D,mBCGb,SAAA8E,KAEA,OAFaA,EAAkBlG,EAAA,CAf9BmG,EAAAA,SAAS,CACRC,QAAS,CACPC,EAAAA,aACAC,EAAAA,mBACAC,EAAAA,aAEFC,QAAS,CACPpF,GAEFqF,gBAAiB,GAEjBC,aAAc,CACZtF,MAGS8E","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n 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); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Component, EventEmitter, forwardRef, Input, OnInit, Output, ViewChild, ElementRef } from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { EditorComponent } from 'ngx-monaco-editor';\n\nimport ICodeEditor = monaco.editor.ICodeEditor;\n\nimport { FsTextEditorConfig } from '../../interfaces/config.interface';\n\n\n@Component({\n selector: 'fs-text-editor',\n templateUrl: 'text-editor.component.html',\n styleUrls: [ 'text-editor.component.scss' ],\n providers: [{\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => FsTextEditorComponent),\n multi: true\n }]\n})\nexport class FsTextEditorComponent implements OnInit, ControlValueAccessor {\n\n @Input() public config: FsTextEditorConfig = {};\n @Input() public scrollable = false;\n\n @Output() public init = new EventEmitter();\n @Output() public blur = new EventEmitter();\n @ViewChild(EditorComponent, { static: true }) _editorContainer: EditorComponent;\n\n public defaultConfig: FsTextEditorConfig = {\n minimap: {\n enabled: false\n },\n theme: 'vs-dark',\n automaticLayout: false,\n scrollBeyondLastLine: false,\n autoHeight: true,\n scrollbar: {\n vertical: 'hidden'\n },\n hideCursorInOverviewRuler: true\n };\n\n public onChange = (_: any) => {};\n public onTouched = () => {};\n\n public get monaco() {\n return (<any>window).monaco;\n };\n\n constructor(private _element: ElementRef) {};\n\n public readonly LINE_HEIGHT = 18;\n\n private _editorRef: ICodeEditor;\n private _value = '';\n\n public ngOnInit() {\n\n if (this.config) {\n this.config = Object.assign({}, this.defaultConfig, this.config);\n }\n }\n\n get value() {\n return this._value;\n }\n\n public onEditorInit(event) {\n // Timeout allows the content to fully load to and calculate height\n setTimeout(() => {\n this._editorRef = event;\n this._initEditor();\n this.init.next(event);\n\n if (!this.scrollable) {\n this._disableScroll();\n }\n });\n }\n\n public writeValue(value: any): void {\n this._value = value || '';\n }\n\n public changed(e) {\n this._value = e;\n this.onChange(e);\n }\n\n public registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {\n this.onTouched = fn;\n }\n\n private _initEditor() {\n if (this._editorRef && this.config.autoHeight) {\n this._updateEditorHeight();\n\n this._editorRef.onDidChangeModelContent((e) => {\n this._updateEditorHeight();\n });\n\n this._editorRef.onDidBlurEditorText(() => {\n this.blur.next();\n });\n }\n }\n\n private _updateEditorHeight() {\n\n const editorDomNode = this._editorRef.getDomNode();\n\n if (!editorDomNode) {\n return;\n }\n\n const container = editorDomNode.getElementsByClassName('view-lines')[0] as HTMLElement;\n const lineHeight = container.firstChild\n ? (container.firstChild as HTMLElement).offsetHeight\n : this.LINE_HEIGHT;\n\n const editorModel = this._editorRef.getModel();\n\n if (!editorModel) {\n return;\n }\n\n const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;\n\n // set the height and redo layout\n editorDomNode.style.height = nextHeight + 'px';\n this.updateLayout();\n }\n\n public updateLayout(): void {\n this._editorRef.layout();\n }\n\n private _disableScroll() {\n const node = this._editorRef.getDomNode();\n\n node.addEventListener('wheel', (e) => {\n e.stopPropagation();\n }, true);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MonacoEditorModule } from 'ngx-monaco-editor';\nimport { FsTextEditorComponent } from './components/text-editor/text-editor.component';\n\n@NgModule({\n imports: [\n CommonModule,\n MonacoEditorModule,\n FormsModule,\n ],\n exports: [\n FsTextEditorComponent,\n ],\n entryComponents: [\n ],\n declarations: [\n FsTextEditorComponent,\n ]\n})\nexport class FsTextEditorModule {\n\n}\n"]}