@firestitch/text-editor 12.3.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.
@@ -6,192 +6,192 @@ 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, _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 }]
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 }]
150
150
  }] } });
151
151
 
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
- }]
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
+ }]
187
187
  }] });
188
188
 
189
- /*
190
- * Public API Surface of fs-menu
189
+ /*
190
+ * Public API Surface of fs-menu
191
191
  */
192
192
 
193
- /**
194
- * Generated bundle index. Do not edit.
193
+ /**
194
+ * Generated bundle index. Do not edit.
195
195
  */
196
196
 
197
197
  export { FsTextEditorComponent, FsTextEditorModule };
@@ -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.3.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';