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