@firestitch/text-editor 12.2.0 → 12.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,180 +1,197 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, forwardRef, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
3
- import { CommonModule } from '@angular/common';
2
+ import { EventEmitter, forwardRef, Component, Inject, Input, Output, ViewChild, NgModule } from '@angular/core';
3
+ import { DOCUMENT, CommonModule } from '@angular/common';
4
4
  import * as i2 from '@angular/forms';
5
5
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
6
6
  import * as i1 from 'ngx-monaco-editor';
7
7
  import { EditorComponent, MonacoEditorModule } from 'ngx-monaco-editor';
8
8
 
9
- class FsTextEditorComponent {
10
- constructor(_element) {
11
- this._element = _element;
12
- this.config = {};
13
- this.scrollable = false;
14
- this.init = new EventEmitter();
15
- this.blur = new EventEmitter();
16
- this.defaultConfig = {
17
- minimap: {
18
- enabled: false
19
- },
20
- theme: 'vs-dark',
21
- automaticLayout: false,
22
- scrollBeyondLastLine: false,
23
- autoHeight: true,
24
- scrollbar: {
25
- vertical: 'hidden'
26
- },
27
- hideCursorInOverviewRuler: true
28
- };
29
- this.onChange = (_) => { };
30
- this.onTouched = () => { };
31
- this.LINE_HEIGHT = 18;
32
- this._value = '';
33
- }
34
- get monaco() {
35
- return window.monaco;
36
- }
37
- ;
38
- ;
39
- ngOnInit() {
40
- if (this.config) {
41
- this.config = Object.assign({}, this.defaultConfig, this.config);
42
- }
43
- }
44
- get value() {
45
- return this._value;
46
- }
47
- onEditorInit(event) {
48
- // Timeout allows the content to fully load to and calculate height
49
- setTimeout(() => {
50
- this._editorRef = event;
51
- this._initEditor();
52
- this.init.next(event);
53
- if (!this.scrollable) {
54
- this._disableScroll();
55
- }
56
- });
57
- }
58
- writeValue(value) {
59
- this._value = value || '';
60
- }
61
- changed(e) {
62
- if (this._value !== e) {
63
- this._value = e;
64
- this.onChange(e);
65
- }
66
- }
67
- registerOnChange(fn) {
68
- this.onChange = fn;
69
- }
70
- registerOnTouched(fn) {
71
- this.onTouched = fn;
72
- }
73
- _initEditor() {
74
- if (this._editorRef && this.config.autoHeight) {
75
- this._updateEditorHeight();
76
- this._editorRef.onDidChangeModelContent((e) => {
77
- this._updateEditorHeight();
78
- });
79
- this._editorRef.onDidBlurEditorText(() => {
80
- this.blur.next();
81
- });
82
- }
83
- }
84
- _updateEditorHeight() {
85
- const editorDomNode = this._editorRef.getDomNode();
86
- if (!editorDomNode) {
87
- return;
88
- }
89
- const container = editorDomNode.getElementsByClassName('view-lines')[0];
90
- const lineHeight = container.firstChild
91
- ? container.firstChild.offsetHeight
92
- : this.LINE_HEIGHT;
93
- const editorModel = this._editorRef.getModel();
94
- if (!editorModel) {
95
- return;
96
- }
97
- const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
98
- // set the height and redo layout
99
- editorDomNode.style.height = nextHeight + 'px';
100
- this.updateLayout();
101
- }
102
- updateLayout() {
103
- this._editorRef.layout();
104
- }
105
- _disableScroll() {
106
- const node = this._editorRef.getDomNode();
107
- node.addEventListener('wheel', (e) => {
108
- e.stopPropagation();
109
- }, true);
110
- }
111
- }
112
- FsTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
113
- FsTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsTextEditorComponent, selector: "fs-text-editor", inputs: { config: "config", scrollable: "scrollable" }, outputs: { init: "init", blur: "blur" }, providers: [{
114
- provide: NG_VALUE_ACCESSOR,
115
- useExisting: forwardRef(() => FsTextEditorComponent),
116
- multi: true
117
- }], viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: EditorComponent, descendants: true, static: true }], ngImport: i0, 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"], components: [{ type: i1.EditorComponent, selector: "ngx-monaco-editor", inputs: ["options", "model"] }], directives: [{ type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
118
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorComponent, decorators: [{
119
- type: Component,
120
- args: [{
121
- selector: 'fs-text-editor',
122
- templateUrl: 'text-editor.component.html',
123
- styleUrls: ['text-editor.component.scss'],
124
- providers: [{
125
- provide: NG_VALUE_ACCESSOR,
126
- useExisting: forwardRef(() => FsTextEditorComponent),
127
- multi: true
128
- }]
129
- }]
130
- }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { config: [{
131
- type: Input
132
- }], scrollable: [{
133
- type: Input
134
- }], init: [{
135
- type: Output
136
- }], blur: [{
137
- type: Output
138
- }], _editorContainer: [{
139
- type: ViewChild,
140
- args: [EditorComponent, { static: true }]
9
+ class FsTextEditorComponent {
10
+ constructor(_element, _document) {
11
+ this._element = _element;
12
+ this._document = _document;
13
+ this.config = {};
14
+ this.scrollable = false;
15
+ this.init = new EventEmitter();
16
+ this.blur = new EventEmitter();
17
+ this.defaultConfig = {
18
+ minimap: {
19
+ enabled: false
20
+ },
21
+ theme: 'vs-dark',
22
+ automaticLayout: false,
23
+ scrollBeyondLastLine: false,
24
+ autoHeight: true,
25
+ scrollbar: {
26
+ vertical: 'hidden'
27
+ },
28
+ hideCursorInOverviewRuler: true
29
+ };
30
+ this.onChange = (_) => { };
31
+ this.onTouched = () => { };
32
+ this._window = this._document.defaultView;
33
+ this.LINE_HEIGHT = 18;
34
+ this._value = '';
35
+ }
36
+ get monaco() {
37
+ return this._window.monaco;
38
+ }
39
+ ;
40
+ ;
41
+ ngOnInit() {
42
+ if (this.config) {
43
+ this.config = Object.assign({}, this.defaultConfig, this.config);
44
+ }
45
+ }
46
+ ngOnDestroy() {
47
+ // must be there to cleanup https://github.com/microsoft/monaco-editor/issues/827
48
+ this._window.define = null;
49
+ }
50
+ get value() {
51
+ return this._value;
52
+ }
53
+ onEditorInit(event) {
54
+ // Timeout allows the content to fully load to and calculate height
55
+ setTimeout(() => {
56
+ this._editorRef = event;
57
+ this._initEditor();
58
+ this.init.next(event);
59
+ if (!this.scrollable) {
60
+ this._disableScroll();
61
+ }
62
+ });
63
+ }
64
+ writeValue(value) {
65
+ this._value = value || '';
66
+ }
67
+ changed(e) {
68
+ if (this._value !== e) {
69
+ this._value = e;
70
+ this.onChange(e);
71
+ }
72
+ }
73
+ registerOnChange(fn) {
74
+ this.onChange = fn;
75
+ }
76
+ registerOnTouched(fn) {
77
+ this.onTouched = fn;
78
+ }
79
+ _initEditor() {
80
+ if (this._editorRef && this.config.autoHeight) {
81
+ this._updateEditorHeight();
82
+ this._editorRef.onDidChangeModelContent((e) => {
83
+ this._updateEditorHeight();
84
+ });
85
+ this._editorRef.onDidBlurEditorText(() => {
86
+ this.blur.next();
87
+ });
88
+ }
89
+ }
90
+ _updateEditorHeight() {
91
+ const editorDomNode = this._editorRef.getDomNode();
92
+ if (!editorDomNode) {
93
+ return;
94
+ }
95
+ const container = editorDomNode.getElementsByClassName('view-lines')[0];
96
+ const lineHeight = container.firstChild
97
+ ? container.firstChild.offsetHeight
98
+ : this.LINE_HEIGHT;
99
+ const editorModel = this._editorRef.getModel();
100
+ if (!editorModel) {
101
+ return;
102
+ }
103
+ const nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
104
+ // set the height and redo layout
105
+ editorDomNode.style.height = nextHeight + 'px';
106
+ this.updateLayout();
107
+ }
108
+ updateLayout() {
109
+ this._editorRef.layout();
110
+ }
111
+ _disableScroll() {
112
+ const node = this._editorRef.getDomNode();
113
+ node.addEventListener('wheel', (e) => {
114
+ e.stopPropagation();
115
+ }, true);
116
+ }
117
+ }
118
+ FsTextEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorComponent, deps: [{ token: i0.ElementRef }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component });
119
+ FsTextEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: FsTextEditorComponent, selector: "fs-text-editor", inputs: { config: "config", scrollable: "scrollable" }, outputs: { init: "init", blur: "blur" }, providers: [{
120
+ provide: NG_VALUE_ACCESSOR,
121
+ useExisting: forwardRef(() => FsTextEditorComponent),
122
+ multi: true
123
+ }], viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: EditorComponent, descendants: true, static: true }], ngImport: i0, 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"], components: [{ type: i1.EditorComponent, selector: "ngx-monaco-editor", inputs: ["options", "model"] }], directives: [{ type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
124
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorComponent, decorators: [{
125
+ type: Component,
126
+ args: [{
127
+ selector: 'fs-text-editor',
128
+ templateUrl: 'text-editor.component.html',
129
+ styleUrls: ['text-editor.component.scss'],
130
+ providers: [{
131
+ provide: NG_VALUE_ACCESSOR,
132
+ useExisting: forwardRef(() => FsTextEditorComponent),
133
+ multi: true
134
+ }]
135
+ }]
136
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: Document, decorators: [{
137
+ type: Inject,
138
+ args: [DOCUMENT]
139
+ }] }]; }, propDecorators: { config: [{
140
+ type: Input
141
+ }], scrollable: [{
142
+ type: Input
143
+ }], init: [{
144
+ type: Output
145
+ }], blur: [{
146
+ type: Output
147
+ }], _editorContainer: [{
148
+ type: ViewChild,
149
+ args: [EditorComponent, { static: true }]
141
150
  }] } });
142
151
 
143
- class FsTextEditorModule {
144
- }
145
- FsTextEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
146
- FsTextEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, declarations: [FsTextEditorComponent], imports: [CommonModule,
147
- MonacoEditorModule,
148
- FormsModule], exports: [FsTextEditorComponent] });
149
- FsTextEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, imports: [[
150
- CommonModule,
151
- MonacoEditorModule,
152
- FormsModule,
153
- ]] });
154
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, decorators: [{
155
- type: NgModule,
156
- args: [{
157
- imports: [
158
- CommonModule,
159
- MonacoEditorModule,
160
- FormsModule,
161
- ],
162
- exports: [
163
- FsTextEditorComponent,
164
- ],
165
- entryComponents: [],
166
- declarations: [
167
- FsTextEditorComponent,
168
- ]
169
- }]
152
+ class FsTextEditorModule {
153
+ static forRoot(config) {
154
+ return {
155
+ ngModule: FsTextEditorModule,
156
+ providers: [
157
+ MonacoEditorModule.forRoot(config).providers,
158
+ ],
159
+ };
160
+ }
161
+ }
162
+ FsTextEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
163
+ FsTextEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, declarations: [FsTextEditorComponent], imports: [CommonModule,
164
+ MonacoEditorModule,
165
+ FormsModule], exports: [FsTextEditorComponent] });
166
+ FsTextEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, imports: [[
167
+ CommonModule,
168
+ MonacoEditorModule,
169
+ FormsModule,
170
+ ]] });
171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: FsTextEditorModule, decorators: [{
172
+ type: NgModule,
173
+ args: [{
174
+ imports: [
175
+ CommonModule,
176
+ MonacoEditorModule,
177
+ FormsModule,
178
+ ],
179
+ exports: [
180
+ FsTextEditorComponent,
181
+ ],
182
+ entryComponents: [],
183
+ declarations: [
184
+ FsTextEditorComponent,
185
+ ]
186
+ }]
170
187
  }] });
171
188
 
172
- /*
173
- * Public API Surface of fs-menu
189
+ /*
190
+ * Public API Surface of fs-menu
174
191
  */
175
192
 
176
- /**
177
- * Generated bundle index. Do not edit.
193
+ /**
194
+ * Generated bundle index. Do not edit.
178
195
  */
179
196
 
180
197
  export { FsTextEditorComponent, FsTextEditorModule };
@@ -1 +1 @@
1
- {"version":3,"file":"firestitch-text-editor.js","sources":["../../src/app/components/text-editor/text-editor.component.ts","../../src/app/components/text-editor/text-editor.component.html","../../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 { editor } from 'monaco-editor';\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: editor.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","<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\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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,kBAAkB,iBAH3B,qBAAqB,aAVrB,YAAY;QACZ,kBAAkB;QAClB,WAAW,aAGX,qBAAqB;iHAQZ,kBAAkB,YAdpB;YACP,YAAY;YACZ,kBAAkB;YAClB,WAAW;SACZ;4FAUU,kBAAkB;kBAf9B,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,YAAY;wBACZ,kBAAkB;wBAClB,WAAW;qBACZ;oBACD,OAAO,EAAE;wBACP,qBAAqB;qBACtB;oBACD,eAAe,EAAE,EAChB;oBACD,YAAY,EAAE;wBACZ,qBAAqB;qBACtB;iBACF;;;ACrBD;;;;ACAA;;;;;;"}
1
+ {"version":3,"file":"firestitch-text-editor.js","sources":["../../src/app/components/text-editor/text-editor.component.ts","../../src/app/components/text-editor/text-editor.component.html","../../src/app/fs-text-editor.module.ts","../../src/public_api.ts","../../src/firestitch-text-editor.ts"],"sourcesContent":["import {\n Component,\n EventEmitter,\n forwardRef,\n Input,\n OnInit,\n Output,\n ViewChild,\n ElementRef,\n OnDestroy,\n Inject,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { DOCUMENT } from '@angular/common';\n\nimport { EditorComponent } from 'ngx-monaco-editor';\nimport { editor } from 'monaco-editor';\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, OnDestroy, 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 private _window: any = this._document.defaultView;\n\n public get monaco() {\n return this._window.monaco;\n };\n\n constructor(\n private _element: ElementRef,\n @Inject(DOCUMENT)\n private _document: Document,\n ) {};\n\n public readonly LINE_HEIGHT = 18;\n\n private _editorRef: editor.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 public ngOnDestroy() {\n // must be there to cleanup https://github.com/microsoft/monaco-editor/issues/827\n this._window.define = null;\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","<ngx-monaco-editor\n [ngModel]=\"value\"\n (ngModelChange)=\"changed($event)\"\n [options]=\"config\"\n (onInit)=\"onEditorInit($event)\">\n</ngx-monaco-editor>\n","import { ModuleWithProviders, NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\n\nimport { MonacoEditorModule, NgxMonacoEditorConfig } from 'ngx-monaco-editor';\nimport { FsTextEditorComponent } from './components/text-editor/text-editor.component';\n\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 static forRoot(config?: NgxMonacoEditorConfig): ModuleWithProviders<FsTextEditorModule> {\n return {\n ngModule: FsTextEditorModule,\n providers: [\n MonacoEditorModule.forRoot(config).providers,\n ],\n };\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":";;;;;;;;MA+Ba,qBAAqB;IAgChC,YACU,QAAoB,EAEpB,SAAmB;QAFnB,aAAQ,GAAR,QAAQ,CAAY;QAEpB,cAAS,GAAT,SAAS,CAAU;QAjCb,WAAM,GAAuB,EAAE,CAAC;QAChC,eAAU,GAAG,KAAK,CAAC;QAElB,SAAI,GAAG,IAAI,YAAY,EAAE,CAAC;QAC1B,SAAI,GAAG,IAAI,YAAY,EAA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AO,CAAC,MAAM,CAAC,CAAC,SAAS;aAC7C;SACF,CAAC;KACH;;gHARU,kBAAkB;iHAAlB,kBAAkB,iBAH3B,qBAAqB,aAVrB,YAAY;QACZ,kBAAkB;QAClB,WAAW,aAGX,qBAAqB;iHAQZ,kBAAkB,YAdpB;YACP,YAAY;YACZ,kBAAkB;YAClB,WAAW;SACZ;4FAUU,kBAAkB;kBAf9B,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,YAAY;wBACZ,kBAAkB;wBAClB,WAAW;qBACZ;oBACD,OAAO,EAAE;wBACP,qBAAqB;qBACtB;oBACD,eAAe,EAAE,EAChB;oBACD,YAAY,EAAE;wBACZ,qBAAqB;qBACtB;iBACF;;;ACtBD;;;;ACAA;;;;;;"}
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@firestitch/text-editor" />
5
- export * from './public_api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@firestitch/text-editor" />
5
+ export * from './public_api';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firestitch/text-editor",
3
- "version": "12.2.0",
3
+ "version": "12.3.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Firestitch/ngx-text-editor"
@@ -16,9 +16,6 @@
16
16
  "bugs": {
17
17
  "url": "https://github.com/Firestitch/ngx-text-editor/issues"
18
18
  },
19
- "peerDependencies": {
20
- "ngx-monaco-editor": ">=12.0.0"
21
- },
22
19
  "dependencies": {
23
20
  "monaco-editor": "^0.33.0",
24
21
  "ngx-monaco-editor": "^12.0.0",
package/public_api.d.ts CHANGED
@@ -1,3 +1,3 @@
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
+ 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';