@firestitch/text-editor 12.3.0 → 12.4.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 +37 -37
- package/app/fs-text-editor.module.d.ts +13 -13
- package/app/interfaces/config.interface.d.ts +4 -4
- package/app/modules/ngx-monaco-editor/base-editor.d.ts +18 -0
- package/app/modules/ngx-monaco-editor/config.d.ts +9 -0
- package/app/modules/ngx-monaco-editor/diff-editor.component.d.ts +17 -0
- package/app/modules/ngx-monaco-editor/editor.component.d.ts +23 -0
- package/app/modules/ngx-monaco-editor/editor.module.d.ts +12 -0
- package/app/modules/ngx-monaco-editor/types.d.ts +9 -0
- package/bundles/firestitch-text-editor.umd.js +1020 -225
- package/bundles/firestitch-text-editor.umd.js.map +1 -1
- package/esm2015/app/components/text-editor/text-editor.component.js +150 -150
- package/esm2015/app/fs-text-editor.module.js +43 -43
- package/esm2015/app/interfaces/config.interface.js +1 -1
- package/esm2015/app/modules/ngx-monaco-editor/base-editor.js +77 -0
- package/esm2015/app/modules/ngx-monaco-editor/config.js +3 -0
- package/esm2015/app/modules/ngx-monaco-editor/diff-editor.component.js +91 -0
- package/esm2015/app/modules/ngx-monaco-editor/editor.component.js +121 -0
- package/esm2015/app/modules/ngx-monaco-editor/editor.module.js +40 -0
- package/esm2015/app/modules/ngx-monaco-editor/types.js +2 -0
- package/esm2015/firestitch-text-editor.js +4 -4
- package/esm2015/public_api.js +5 -5
- package/fesm2015/firestitch-text-editor.js +491 -181
- package/fesm2015/firestitch-text-editor.js.map +1 -1
- package/firestitch-text-editor.d.ts +5 -5
- package/package.json +2 -11
- package/public_api.d.ts +3 -3
|
@@ -1,239 +1,1034 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(this, (function (exports, i0, common, i2,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('rxjs')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@firestitch/text-editor', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'rxjs'], factory) :
|
|
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.rxjs));
|
|
5
|
+
})(this, (function (exports, i0, common, i2, rxjs) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
});
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
20
18
|
}
|
|
21
|
-
|
|
22
|
-
return Object.freeze(n);
|
|
19
|
+
});
|
|
23
20
|
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
28
27
|
|
|
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
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
28
|
+
/******************************************************************************
|
|
29
|
+
Copyright (c) Microsoft Corporation.
|
|
30
|
+
|
|
31
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
32
|
+
purpose with or without fee is hereby granted.
|
|
33
|
+
|
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
35
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
36
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
37
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
38
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
39
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
41
|
+
***************************************************************************** */
|
|
42
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
43
|
+
var extendStatics = function (d, b) {
|
|
44
|
+
extendStatics = Object.setPrototypeOf ||
|
|
45
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
46
|
+
function (d, b) { for (var p in b)
|
|
47
|
+
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
48
|
+
d[p] = b[p]; };
|
|
49
|
+
return extendStatics(d, b);
|
|
50
|
+
};
|
|
51
|
+
function __extends(d, b) {
|
|
52
|
+
if (typeof b !== "function" && b !== null)
|
|
53
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
54
|
+
extendStatics(d, b);
|
|
55
|
+
function __() { this.constructor = d; }
|
|
56
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
57
|
+
}
|
|
58
|
+
var __assign = function () {
|
|
59
|
+
__assign = Object.assign || function __assign(t) {
|
|
60
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
61
|
+
s = arguments[i];
|
|
62
|
+
for (var p in s)
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
64
|
+
t[p] = s[p];
|
|
65
|
+
}
|
|
66
|
+
return t;
|
|
67
|
+
};
|
|
68
|
+
return __assign.apply(this, arguments);
|
|
69
|
+
};
|
|
70
|
+
function __rest(s, e) {
|
|
71
|
+
var t = {};
|
|
72
|
+
for (var p in s)
|
|
73
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
74
|
+
t[p] = s[p];
|
|
75
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
76
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
77
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
78
|
+
t[p[i]] = s[p[i]];
|
|
79
|
+
}
|
|
80
|
+
return t;
|
|
81
|
+
}
|
|
82
|
+
function __decorate(decorators, target, key, desc) {
|
|
83
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
84
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
85
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
86
|
+
else
|
|
87
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
88
|
+
if (d = decorators[i])
|
|
89
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
90
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
91
|
+
}
|
|
92
|
+
function __param(paramIndex, decorator) {
|
|
93
|
+
return function (target, key) { decorator(target, key, paramIndex); };
|
|
94
|
+
}
|
|
95
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
96
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
|
97
|
+
throw new TypeError("Function expected"); return f; }
|
|
98
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
99
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
100
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
101
|
+
var _, done = false;
|
|
102
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
103
|
+
var context = {};
|
|
104
|
+
for (var p in contextIn)
|
|
105
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
|
106
|
+
for (var p in contextIn.access)
|
|
107
|
+
context.access[p] = contextIn.access[p];
|
|
108
|
+
context.addInitializer = function (f) { if (done)
|
|
109
|
+
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
110
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
111
|
+
if (kind === "accessor") {
|
|
112
|
+
if (result === void 0)
|
|
113
|
+
continue;
|
|
114
|
+
if (result === null || typeof result !== "object")
|
|
115
|
+
throw new TypeError("Object expected");
|
|
116
|
+
if (_ = accept(result.get))
|
|
117
|
+
descriptor.get = _;
|
|
118
|
+
if (_ = accept(result.set))
|
|
119
|
+
descriptor.set = _;
|
|
120
|
+
if (_ = accept(result.init))
|
|
121
|
+
initializers.unshift(_);
|
|
122
|
+
}
|
|
123
|
+
else if (_ = accept(result)) {
|
|
124
|
+
if (kind === "field")
|
|
125
|
+
initializers.unshift(_);
|
|
126
|
+
else
|
|
127
|
+
descriptor[key] = _;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (target)
|
|
131
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
|
132
|
+
done = true;
|
|
133
|
+
}
|
|
134
|
+
;
|
|
135
|
+
function __runInitializers(thisArg, initializers, value) {
|
|
136
|
+
var useValue = arguments.length > 2;
|
|
137
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
138
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
139
|
+
}
|
|
140
|
+
return useValue ? value : void 0;
|
|
141
|
+
}
|
|
142
|
+
;
|
|
143
|
+
function __propKey(x) {
|
|
144
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
|
145
|
+
}
|
|
146
|
+
;
|
|
147
|
+
function __setFunctionName(f, name, prefix) {
|
|
148
|
+
if (typeof name === "symbol")
|
|
149
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
|
150
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
151
|
+
}
|
|
152
|
+
;
|
|
153
|
+
function __metadata(metadataKey, metadataValue) {
|
|
154
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
155
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
156
|
+
}
|
|
157
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
158
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
159
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
160
|
+
function fulfilled(value) { try {
|
|
161
|
+
step(generator.next(value));
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
reject(e);
|
|
165
|
+
} }
|
|
166
|
+
function rejected(value) { try {
|
|
167
|
+
step(generator["throw"](value));
|
|
168
|
+
}
|
|
169
|
+
catch (e) {
|
|
170
|
+
reject(e);
|
|
171
|
+
} }
|
|
172
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
173
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function __generator(thisArg, body) {
|
|
177
|
+
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
178
|
+
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
179
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
180
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
181
|
+
function step(op) {
|
|
182
|
+
if (f)
|
|
183
|
+
throw new TypeError("Generator is already executing.");
|
|
184
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
|
185
|
+
try {
|
|
186
|
+
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)
|
|
187
|
+
return t;
|
|
188
|
+
if (y = 0, t)
|
|
189
|
+
op = [op[0] & 2, t.value];
|
|
190
|
+
switch (op[0]) {
|
|
191
|
+
case 0:
|
|
192
|
+
case 1:
|
|
193
|
+
t = op;
|
|
194
|
+
break;
|
|
195
|
+
case 4:
|
|
196
|
+
_.label++;
|
|
197
|
+
return { value: op[1], done: false };
|
|
198
|
+
case 5:
|
|
199
|
+
_.label++;
|
|
200
|
+
y = op[1];
|
|
201
|
+
op = [0];
|
|
202
|
+
continue;
|
|
203
|
+
case 7:
|
|
204
|
+
op = _.ops.pop();
|
|
205
|
+
_.trys.pop();
|
|
206
|
+
continue;
|
|
207
|
+
default:
|
|
208
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
209
|
+
_ = 0;
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
213
|
+
_.label = op[1];
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
217
|
+
_.label = t[1];
|
|
218
|
+
t = op;
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
if (t && _.label < t[2]) {
|
|
222
|
+
_.label = t[2];
|
|
223
|
+
_.ops.push(op);
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
if (t[2])
|
|
227
|
+
_.ops.pop();
|
|
228
|
+
_.trys.pop();
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
op = body.call(thisArg, _);
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
op = [6, e];
|
|
235
|
+
y = 0;
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
f = t = 0;
|
|
239
|
+
}
|
|
240
|
+
if (op[0] & 5)
|
|
241
|
+
throw op[1];
|
|
242
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
246
|
+
if (k2 === undefined)
|
|
247
|
+
k2 = k;
|
|
248
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
249
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
250
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
|
251
|
+
}
|
|
252
|
+
Object.defineProperty(o, k2, desc);
|
|
253
|
+
}) : (function (o, m, k, k2) {
|
|
254
|
+
if (k2 === undefined)
|
|
255
|
+
k2 = k;
|
|
256
|
+
o[k2] = m[k];
|
|
257
|
+
});
|
|
258
|
+
function __exportStar(m, o) {
|
|
259
|
+
for (var p in m)
|
|
260
|
+
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
261
|
+
__createBinding(o, m, p);
|
|
262
|
+
}
|
|
263
|
+
function __values(o) {
|
|
264
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
265
|
+
if (m)
|
|
266
|
+
return m.call(o);
|
|
267
|
+
if (o && typeof o.length === "number")
|
|
268
|
+
return {
|
|
269
|
+
next: function () {
|
|
270
|
+
if (o && i >= o.length)
|
|
271
|
+
o = void 0;
|
|
272
|
+
return { value: o && o[i++], done: !o };
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
276
|
+
}
|
|
277
|
+
function __read(o, n) {
|
|
278
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
279
|
+
if (!m)
|
|
280
|
+
return o;
|
|
281
|
+
var i = m.call(o), r, ar = [], e;
|
|
282
|
+
try {
|
|
283
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
284
|
+
ar.push(r.value);
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
e = { error: error };
|
|
288
|
+
}
|
|
289
|
+
finally {
|
|
290
|
+
try {
|
|
291
|
+
if (r && !r.done && (m = i["return"]))
|
|
292
|
+
m.call(i);
|
|
293
|
+
}
|
|
294
|
+
finally {
|
|
295
|
+
if (e)
|
|
296
|
+
throw e.error;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return ar;
|
|
300
|
+
}
|
|
301
|
+
/** @deprecated */
|
|
302
|
+
function __spread() {
|
|
303
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
304
|
+
ar = ar.concat(__read(arguments[i]));
|
|
305
|
+
return ar;
|
|
306
|
+
}
|
|
307
|
+
/** @deprecated */
|
|
308
|
+
function __spreadArrays() {
|
|
309
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
310
|
+
s += arguments[i].length;
|
|
311
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
312
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
313
|
+
r[k] = a[j];
|
|
314
|
+
return r;
|
|
315
|
+
}
|
|
316
|
+
function __spreadArray(to, from, pack) {
|
|
317
|
+
if (pack || arguments.length === 2)
|
|
318
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
319
|
+
if (ar || !(i in from)) {
|
|
320
|
+
if (!ar)
|
|
321
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
322
|
+
ar[i] = from[i];
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
326
|
+
}
|
|
327
|
+
function __await(v) {
|
|
328
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
329
|
+
}
|
|
330
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
331
|
+
if (!Symbol.asyncIterator)
|
|
332
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
333
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
334
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
335
|
+
function verb(n) { if (g[n])
|
|
336
|
+
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
337
|
+
function resume(n, v) { try {
|
|
338
|
+
step(g[n](v));
|
|
339
|
+
}
|
|
340
|
+
catch (e) {
|
|
341
|
+
settle(q[0][3], e);
|
|
342
|
+
} }
|
|
343
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
344
|
+
function fulfill(value) { resume("next", value); }
|
|
345
|
+
function reject(value) { resume("throw", value); }
|
|
346
|
+
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
347
|
+
resume(q[0][0], q[0][1]); }
|
|
348
|
+
}
|
|
349
|
+
function __asyncDelegator(o) {
|
|
350
|
+
var i, p;
|
|
351
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
352
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
353
|
+
}
|
|
354
|
+
function __asyncValues(o) {
|
|
355
|
+
if (!Symbol.asyncIterator)
|
|
356
|
+
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
357
|
+
var m = o[Symbol.asyncIterator], i;
|
|
358
|
+
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);
|
|
359
|
+
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); }); }; }
|
|
360
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
361
|
+
}
|
|
362
|
+
function __makeTemplateObject(cooked, raw) {
|
|
363
|
+
if (Object.defineProperty) {
|
|
364
|
+
Object.defineProperty(cooked, "raw", { value: raw });
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
cooked.raw = raw;
|
|
368
|
+
}
|
|
369
|
+
return cooked;
|
|
370
|
+
}
|
|
371
|
+
;
|
|
372
|
+
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
373
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
374
|
+
}) : function (o, v) {
|
|
375
|
+
o["default"] = v;
|
|
376
|
+
};
|
|
377
|
+
function __importStar(mod) {
|
|
378
|
+
if (mod && mod.__esModule)
|
|
379
|
+
return mod;
|
|
380
|
+
var result = {};
|
|
381
|
+
if (mod != null)
|
|
382
|
+
for (var k in mod)
|
|
383
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
384
|
+
__createBinding(result, mod, k);
|
|
385
|
+
__setModuleDefault(result, mod);
|
|
386
|
+
return result;
|
|
387
|
+
}
|
|
388
|
+
function __importDefault(mod) {
|
|
389
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
390
|
+
}
|
|
391
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
392
|
+
if (kind === "a" && !f)
|
|
393
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
394
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
395
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
396
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
397
|
+
}
|
|
398
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
399
|
+
if (kind === "m")
|
|
400
|
+
throw new TypeError("Private method is not writable");
|
|
401
|
+
if (kind === "a" && !f)
|
|
402
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
403
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
404
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
405
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
406
|
+
}
|
|
407
|
+
function __classPrivateFieldIn(state, receiver) {
|
|
408
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
|
409
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
|
410
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
|
411
|
+
}
|
|
412
|
+
function __addDisposableResource(env, value, async) {
|
|
413
|
+
if (value !== null && value !== void 0) {
|
|
414
|
+
if (typeof value !== "object" && typeof value !== "function")
|
|
415
|
+
throw new TypeError("Object expected.");
|
|
416
|
+
var dispose;
|
|
417
|
+
if (async) {
|
|
418
|
+
if (!Symbol.asyncDispose)
|
|
419
|
+
throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
420
|
+
dispose = value[Symbol.asyncDispose];
|
|
421
|
+
}
|
|
422
|
+
if (dispose === void 0) {
|
|
423
|
+
if (!Symbol.dispose)
|
|
424
|
+
throw new TypeError("Symbol.dispose is not defined.");
|
|
425
|
+
dispose = value[Symbol.dispose];
|
|
426
|
+
}
|
|
427
|
+
if (typeof dispose !== "function")
|
|
428
|
+
throw new TypeError("Object not disposable.");
|
|
429
|
+
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
430
|
+
}
|
|
431
|
+
else if (async) {
|
|
432
|
+
env.stack.push({ async: true });
|
|
433
|
+
}
|
|
434
|
+
return value;
|
|
435
|
+
}
|
|
436
|
+
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
437
|
+
var e = new Error(message);
|
|
438
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
439
|
+
};
|
|
440
|
+
function __disposeResources(env) {
|
|
441
|
+
function fail(e) {
|
|
442
|
+
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
443
|
+
env.hasError = true;
|
|
444
|
+
}
|
|
445
|
+
function next() {
|
|
446
|
+
while (env.stack.length) {
|
|
447
|
+
var rec = env.stack.pop();
|
|
448
|
+
try {
|
|
449
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
450
|
+
if (rec.async)
|
|
451
|
+
return Promise.resolve(result).then(next, function (e) { fail(e); return next(); });
|
|
452
|
+
}
|
|
453
|
+
catch (e) {
|
|
454
|
+
fail(e);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
if (env.hasError)
|
|
458
|
+
throw env.error;
|
|
459
|
+
}
|
|
460
|
+
return next();
|
|
461
|
+
}
|
|
462
|
+
var tslib_es6 = {
|
|
463
|
+
__extends: __extends,
|
|
464
|
+
__assign: __assign,
|
|
465
|
+
__rest: __rest,
|
|
466
|
+
__decorate: __decorate,
|
|
467
|
+
__param: __param,
|
|
468
|
+
__metadata: __metadata,
|
|
469
|
+
__awaiter: __awaiter,
|
|
470
|
+
__generator: __generator,
|
|
471
|
+
__createBinding: __createBinding,
|
|
472
|
+
__exportStar: __exportStar,
|
|
473
|
+
__values: __values,
|
|
474
|
+
__read: __read,
|
|
475
|
+
__spread: __spread,
|
|
476
|
+
__spreadArrays: __spreadArrays,
|
|
477
|
+
__spreadArray: __spreadArray,
|
|
478
|
+
__await: __await,
|
|
479
|
+
__asyncGenerator: __asyncGenerator,
|
|
480
|
+
__asyncDelegator: __asyncDelegator,
|
|
481
|
+
__asyncValues: __asyncValues,
|
|
482
|
+
__makeTemplateObject: __makeTemplateObject,
|
|
483
|
+
__importStar: __importStar,
|
|
484
|
+
__importDefault: __importDefault,
|
|
485
|
+
__classPrivateFieldGet: __classPrivateFieldGet,
|
|
486
|
+
__classPrivateFieldSet: __classPrivateFieldSet,
|
|
487
|
+
__classPrivateFieldIn: __classPrivateFieldIn,
|
|
488
|
+
__addDisposableResource: __addDisposableResource,
|
|
489
|
+
__disposeResources: __disposeResources,
|
|
490
|
+
};
|
|
184
491
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
492
|
+
var NGX_MONACO_EDITOR_CONFIG = new i0.InjectionToken('NGX_MONACO_EDITOR_CONFIG');
|
|
493
|
+
|
|
494
|
+
var loadedMonaco = false;
|
|
495
|
+
var loadPromise;
|
|
496
|
+
var BaseEditor = /** @class */ (function () {
|
|
497
|
+
function BaseEditor(config) {
|
|
498
|
+
this.config = config;
|
|
499
|
+
this.onInit = new i0.EventEmitter();
|
|
500
|
+
}
|
|
501
|
+
BaseEditor.prototype.ngAfterViewInit = function () {
|
|
502
|
+
var _this = this;
|
|
503
|
+
if (loadedMonaco) {
|
|
504
|
+
// Wait until monaco editor is available
|
|
505
|
+
loadPromise.then(function () {
|
|
506
|
+
_this.initMonaco(_this._options);
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
loadedMonaco = true;
|
|
511
|
+
loadPromise = new Promise(function (resolve) {
|
|
512
|
+
var baseUrl = (_this.config.baseUrl || './assets') + '/monaco-editor/min/vs';
|
|
513
|
+
if (typeof (window.monaco) === 'object') {
|
|
514
|
+
resolve();
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
var onGotAmdLoader = function () {
|
|
518
|
+
// Load monaco
|
|
519
|
+
window.require.config({ paths: { 'vs': "" + baseUrl } });
|
|
520
|
+
window.require(["vs/editor/editor.main"], function () {
|
|
521
|
+
if (typeof _this.config.onMonacoLoad === 'function') {
|
|
522
|
+
_this.config.onMonacoLoad();
|
|
523
|
+
}
|
|
524
|
+
_this.initMonaco(_this._options);
|
|
525
|
+
resolve();
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
// Load AMD loader if necessary
|
|
529
|
+
if (!window.require) {
|
|
530
|
+
var loaderScript = document.createElement('script');
|
|
531
|
+
loaderScript.type = 'text/javascript';
|
|
532
|
+
loaderScript.src = baseUrl + "/loader.js";
|
|
533
|
+
loaderScript.addEventListener('load', onGotAmdLoader);
|
|
534
|
+
document.body.appendChild(loaderScript);
|
|
535
|
+
}
|
|
536
|
+
else {
|
|
537
|
+
onGotAmdLoader();
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
BaseEditor.prototype.ngOnDestroy = function () {
|
|
543
|
+
if (this._windowResizeSubscription) {
|
|
544
|
+
this._windowResizeSubscription.unsubscribe();
|
|
545
|
+
}
|
|
546
|
+
if (this._editor) {
|
|
547
|
+
this._editor.dispose();
|
|
548
|
+
this._editor = undefined;
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
return BaseEditor;
|
|
552
|
+
}());
|
|
553
|
+
BaseEditor.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: BaseEditor, deps: [{ token: NGX_MONACO_EDITOR_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
554
|
+
BaseEditor.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: BaseEditor, selector: "ng-component", outputs: { onInit: "onInit" }, viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: ["editorContainer"], descendants: true, static: true }], ngImport: i0__namespace, template: '', isInline: true });
|
|
555
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: BaseEditor, decorators: [{
|
|
556
|
+
type: i0.Component,
|
|
557
|
+
args: [{
|
|
558
|
+
template: ''
|
|
559
|
+
}]
|
|
560
|
+
}], ctorParameters: function () {
|
|
561
|
+
return [{ type: undefined, decorators: [{
|
|
562
|
+
type: i0.Inject,
|
|
563
|
+
args: [NGX_MONACO_EDITOR_CONFIG]
|
|
564
|
+
}] }];
|
|
565
|
+
}, propDecorators: { _editorContainer: [{
|
|
566
|
+
type: i0.ViewChild,
|
|
567
|
+
args: ['editorContainer', { static: true }]
|
|
568
|
+
}], onInit: [{
|
|
569
|
+
type: i0.Output
|
|
570
|
+
}] } });
|
|
571
|
+
|
|
572
|
+
var EditorComponent = /** @class */ (function (_super) {
|
|
573
|
+
__extends(EditorComponent, _super);
|
|
574
|
+
function EditorComponent(zone, editorConfig) {
|
|
575
|
+
var _this = _super.call(this, editorConfig) || this;
|
|
576
|
+
_this.zone = zone;
|
|
577
|
+
_this.editorConfig = editorConfig;
|
|
578
|
+
_this._value = '';
|
|
579
|
+
_this.propagateChange = function (_) { };
|
|
580
|
+
_this.onTouched = function () { };
|
|
581
|
+
return _this;
|
|
582
|
+
}
|
|
583
|
+
Object.defineProperty(EditorComponent.prototype, "options", {
|
|
584
|
+
get: function () {
|
|
585
|
+
return this._options;
|
|
586
|
+
},
|
|
587
|
+
set: function (options) {
|
|
588
|
+
this._options = Object.assign({}, this.config.defaultOptions, options);
|
|
589
|
+
if (this._editor) {
|
|
590
|
+
this._editor.dispose();
|
|
591
|
+
this.initMonaco(options);
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
enumerable: false,
|
|
595
|
+
configurable: true
|
|
596
|
+
});
|
|
597
|
+
Object.defineProperty(EditorComponent.prototype, "model", {
|
|
598
|
+
set: function (model) {
|
|
599
|
+
this.options.model = model;
|
|
600
|
+
if (this._editor) {
|
|
601
|
+
this._editor.dispose();
|
|
602
|
+
this.initMonaco(this.options);
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
enumerable: false,
|
|
606
|
+
configurable: true
|
|
607
|
+
});
|
|
608
|
+
EditorComponent.prototype.writeValue = function (value) {
|
|
609
|
+
var _this = this;
|
|
610
|
+
this._value = value || '';
|
|
611
|
+
// Fix for value change while dispose in process.
|
|
612
|
+
setTimeout(function () {
|
|
613
|
+
if (_this._editor && !_this.options.model) {
|
|
614
|
+
_this._editor.setValue(_this._value);
|
|
615
|
+
}
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
EditorComponent.prototype.registerOnChange = function (fn) {
|
|
619
|
+
this.propagateChange = fn;
|
|
620
|
+
};
|
|
621
|
+
EditorComponent.prototype.registerOnTouched = function (fn) {
|
|
622
|
+
this.onTouched = fn;
|
|
623
|
+
};
|
|
624
|
+
EditorComponent.prototype.initMonaco = function (options) {
|
|
625
|
+
var _this = this;
|
|
626
|
+
var hasModel = !!options.model;
|
|
627
|
+
if (hasModel) {
|
|
628
|
+
var model = monaco.editor.getModel(options.model.uri || '');
|
|
629
|
+
if (model) {
|
|
630
|
+
options.model = model;
|
|
631
|
+
options.model.setValue(this._value);
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
options.model = monaco.editor.createModel(options.model.value, options.model.language, options.model.uri);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
this._editor = monaco.editor.create(this._editorContainer.nativeElement, options);
|
|
638
|
+
if (!hasModel) {
|
|
639
|
+
this._editor.setValue(this._value);
|
|
640
|
+
}
|
|
641
|
+
this._editor.onDidChangeModelContent(function (e) {
|
|
642
|
+
var value = _this._editor.getValue();
|
|
643
|
+
// value is not propagated to parent when executing outside zone.
|
|
644
|
+
_this.zone.run(function () {
|
|
645
|
+
_this.propagateChange(value);
|
|
646
|
+
_this._value = value;
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
this._editor.onDidBlurEditorWidget(function () {
|
|
650
|
+
_this.onTouched();
|
|
651
|
+
});
|
|
652
|
+
// refresh layout on resize event.
|
|
653
|
+
if (this._windowResizeSubscription) {
|
|
654
|
+
this._windowResizeSubscription.unsubscribe();
|
|
655
|
+
}
|
|
656
|
+
this._windowResizeSubscription = rxjs.fromEvent(window, 'resize').subscribe(function () { return _this._editor.layout(); });
|
|
657
|
+
this.onInit.emit(this._editor);
|
|
658
|
+
};
|
|
659
|
+
return EditorComponent;
|
|
660
|
+
}(BaseEditor));
|
|
661
|
+
EditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EditorComponent, deps: [{ token: i0__namespace.NgZone }, { token: NGX_MONACO_EDITOR_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
662
|
+
EditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: EditorComponent, selector: "ngx-monaco-editor", inputs: { options: "options", model: "model" }, providers: [{
|
|
663
|
+
provide: i2.NG_VALUE_ACCESSOR,
|
|
664
|
+
useExisting: i0.forwardRef(function () { return EditorComponent; }),
|
|
665
|
+
multi: true
|
|
666
|
+
}], usesInheritance: true, ngImport: i0__namespace, template: '<div class="editor-container" #editorContainer></div>', isInline: true, styles: ["\n :host {\n display: block;\n height: 200px;\n }\n\n .editor-container {\n width: 100%;\n height: 98%;\n }\n "] });
|
|
667
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: EditorComponent, decorators: [{
|
|
668
|
+
type: i0.Component,
|
|
669
|
+
args: [{
|
|
670
|
+
selector: 'ngx-monaco-editor',
|
|
671
|
+
template: '<div class="editor-container" #editorContainer></div>',
|
|
672
|
+
styles: ["\n :host {\n display: block;\n height: 200px;\n }\n\n .editor-container {\n width: 100%;\n height: 98%;\n }\n "],
|
|
673
|
+
providers: [{
|
|
674
|
+
provide: i2.NG_VALUE_ACCESSOR,
|
|
675
|
+
useExisting: i0.forwardRef(function () { return EditorComponent; }),
|
|
676
|
+
multi: true
|
|
677
|
+
}]
|
|
678
|
+
}]
|
|
679
|
+
}], ctorParameters: function () {
|
|
680
|
+
return [{ type: i0__namespace.NgZone }, { type: undefined, decorators: [{
|
|
681
|
+
type: i0.Inject,
|
|
682
|
+
args: [NGX_MONACO_EDITOR_CONFIG]
|
|
683
|
+
}] }];
|
|
684
|
+
}, propDecorators: { options: [{
|
|
685
|
+
type: i0.Input,
|
|
686
|
+
args: ['options']
|
|
687
|
+
}], model: [{
|
|
688
|
+
type: i0.Input,
|
|
689
|
+
args: ['model']
|
|
690
|
+
}] } });
|
|
691
|
+
|
|
692
|
+
var FsTextEditorComponent = /** @class */ (function () {
|
|
693
|
+
function FsTextEditorComponent(_element, _document) {
|
|
694
|
+
this._element = _element;
|
|
695
|
+
this._document = _document;
|
|
696
|
+
this.config = {};
|
|
697
|
+
this.scrollable = false;
|
|
698
|
+
this.init = new i0.EventEmitter();
|
|
699
|
+
this.blur = new i0.EventEmitter();
|
|
700
|
+
this.defaultConfig = {
|
|
701
|
+
minimap: {
|
|
702
|
+
enabled: false
|
|
703
|
+
},
|
|
704
|
+
theme: 'vs-dark',
|
|
705
|
+
automaticLayout: false,
|
|
706
|
+
scrollBeyondLastLine: false,
|
|
707
|
+
autoHeight: true,
|
|
708
|
+
scrollbar: {
|
|
709
|
+
vertical: 'hidden'
|
|
710
|
+
},
|
|
711
|
+
hideCursorInOverviewRuler: true
|
|
712
|
+
};
|
|
713
|
+
this.onChange = function (_) { };
|
|
714
|
+
this.onTouched = function () { };
|
|
715
|
+
this._window = this._document.defaultView;
|
|
716
|
+
this.LINE_HEIGHT = 18;
|
|
717
|
+
this._value = '';
|
|
718
|
+
}
|
|
719
|
+
Object.defineProperty(FsTextEditorComponent.prototype, "monaco", {
|
|
720
|
+
get: function () {
|
|
721
|
+
return this._window.monaco;
|
|
722
|
+
},
|
|
723
|
+
enumerable: false,
|
|
724
|
+
configurable: true
|
|
725
|
+
});
|
|
726
|
+
;
|
|
727
|
+
;
|
|
728
|
+
FsTextEditorComponent.prototype.ngOnInit = function () {
|
|
729
|
+
if (this.config) {
|
|
730
|
+
this.config = Object.assign({}, this.defaultConfig, this.config);
|
|
731
|
+
}
|
|
732
|
+
};
|
|
733
|
+
FsTextEditorComponent.prototype.ngOnDestroy = function () {
|
|
734
|
+
// must be there to cleanup https://github.com/microsoft/monaco-editor/issues/827
|
|
735
|
+
this._window.define = null;
|
|
736
|
+
};
|
|
737
|
+
Object.defineProperty(FsTextEditorComponent.prototype, "value", {
|
|
738
|
+
get: function () {
|
|
739
|
+
return this._value;
|
|
740
|
+
},
|
|
741
|
+
enumerable: false,
|
|
742
|
+
configurable: true
|
|
743
|
+
});
|
|
744
|
+
FsTextEditorComponent.prototype.onEditorInit = function (event) {
|
|
745
|
+
var _this = this;
|
|
746
|
+
// Timeout allows the content to fully load to and calculate height
|
|
747
|
+
setTimeout(function () {
|
|
748
|
+
_this._editorRef = event;
|
|
749
|
+
_this._initEditor();
|
|
750
|
+
_this.init.next(event);
|
|
751
|
+
if (!_this.scrollable) {
|
|
752
|
+
_this._disableScroll();
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
};
|
|
756
|
+
FsTextEditorComponent.prototype.writeValue = function (value) {
|
|
757
|
+
this._value = value || '';
|
|
758
|
+
};
|
|
759
|
+
FsTextEditorComponent.prototype.changed = function (e) {
|
|
760
|
+
if (this._value !== e) {
|
|
761
|
+
this._value = e;
|
|
762
|
+
this.onChange(e);
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
FsTextEditorComponent.prototype.registerOnChange = function (fn) {
|
|
766
|
+
this.onChange = fn;
|
|
767
|
+
};
|
|
768
|
+
FsTextEditorComponent.prototype.registerOnTouched = function (fn) {
|
|
769
|
+
this.onTouched = fn;
|
|
770
|
+
};
|
|
771
|
+
FsTextEditorComponent.prototype._initEditor = function () {
|
|
772
|
+
var _this = this;
|
|
773
|
+
if (this._editorRef && this.config.autoHeight) {
|
|
774
|
+
this._updateEditorHeight();
|
|
775
|
+
this._editorRef.onDidChangeModelContent(function (e) {
|
|
776
|
+
_this._updateEditorHeight();
|
|
777
|
+
});
|
|
778
|
+
this._editorRef.onDidBlurEditorText(function () {
|
|
779
|
+
_this.blur.next();
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
};
|
|
783
|
+
FsTextEditorComponent.prototype._updateEditorHeight = function () {
|
|
784
|
+
var editorDomNode = this._editorRef.getDomNode();
|
|
785
|
+
if (!editorDomNode) {
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
var container = editorDomNode.getElementsByClassName('view-lines')[0];
|
|
789
|
+
var lineHeight = container.firstChild
|
|
790
|
+
? container.firstChild.offsetHeight
|
|
791
|
+
: this.LINE_HEIGHT;
|
|
792
|
+
var editorModel = this._editorRef.getModel();
|
|
793
|
+
if (!editorModel) {
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
var nextHeight = this._editorRef.getModel().getLineCount() * lineHeight;
|
|
797
|
+
// set the height and redo layout
|
|
798
|
+
editorDomNode.style.height = nextHeight + 'px';
|
|
799
|
+
this.updateLayout();
|
|
800
|
+
};
|
|
801
|
+
FsTextEditorComponent.prototype.updateLayout = function () {
|
|
802
|
+
this._editorRef.layout();
|
|
803
|
+
};
|
|
804
|
+
FsTextEditorComponent.prototype._disableScroll = function () {
|
|
805
|
+
var node = this._editorRef.getDomNode();
|
|
806
|
+
node.addEventListener('wheel', function (e) {
|
|
807
|
+
e.stopPropagation();
|
|
808
|
+
}, true);
|
|
809
|
+
};
|
|
810
|
+
return FsTextEditorComponent;
|
|
811
|
+
}());
|
|
812
|
+
FsTextEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FsTextEditorComponent, deps: [{ token: i0__namespace.ElementRef }, { token: common.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
813
|
+
FsTextEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: FsTextEditorComponent, selector: "fs-text-editor", inputs: { config: "config", scrollable: "scrollable" }, outputs: { init: "init", blur: "blur" }, providers: [{
|
|
814
|
+
provide: i2.NG_VALUE_ACCESSOR,
|
|
815
|
+
useExisting: i0.forwardRef(function () { return FsTextEditorComponent; }),
|
|
816
|
+
multi: true
|
|
817
|
+
}], viewQueries: [{ propertyName: "_editorContainer", first: true, predicate: EditorComponent, descendants: true, static: true }], ngImport: i0__namespace, 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: EditorComponent, selector: "ngx-monaco-editor", inputs: ["options", "model"] }], directives: [{ type: i2__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2__namespace.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }] });
|
|
818
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FsTextEditorComponent, decorators: [{
|
|
819
|
+
type: i0.Component,
|
|
820
|
+
args: [{
|
|
821
|
+
selector: 'fs-text-editor',
|
|
822
|
+
templateUrl: 'text-editor.component.html',
|
|
823
|
+
styleUrls: ['text-editor.component.scss'],
|
|
824
|
+
providers: [{
|
|
825
|
+
provide: i2.NG_VALUE_ACCESSOR,
|
|
826
|
+
useExisting: i0.forwardRef(function () { return FsTextEditorComponent; }),
|
|
827
|
+
multi: true
|
|
828
|
+
}]
|
|
829
|
+
}]
|
|
830
|
+
}], ctorParameters: function () {
|
|
831
|
+
return [{ type: i0__namespace.ElementRef }, { type: Document, decorators: [{
|
|
832
|
+
type: i0.Inject,
|
|
833
|
+
args: [common.DOCUMENT]
|
|
834
|
+
}] }];
|
|
835
|
+
}, propDecorators: { config: [{
|
|
836
|
+
type: i0.Input
|
|
837
|
+
}], scrollable: [{
|
|
838
|
+
type: i0.Input
|
|
839
|
+
}], init: [{
|
|
840
|
+
type: i0.Output
|
|
841
|
+
}], blur: [{
|
|
842
|
+
type: i0.Output
|
|
843
|
+
}], _editorContainer: [{
|
|
844
|
+
type: i0.ViewChild,
|
|
845
|
+
args: [EditorComponent, { static: true }]
|
|
846
|
+
}] } });
|
|
847
|
+
|
|
848
|
+
var DiffEditorComponent = /** @class */ (function (_super) {
|
|
849
|
+
__extends(DiffEditorComponent, _super);
|
|
850
|
+
function DiffEditorComponent(editorConfig) {
|
|
851
|
+
var _this = _super.call(this, editorConfig) || this;
|
|
852
|
+
_this.editorConfig = editorConfig;
|
|
853
|
+
return _this;
|
|
854
|
+
}
|
|
855
|
+
Object.defineProperty(DiffEditorComponent.prototype, "options", {
|
|
856
|
+
get: function () {
|
|
857
|
+
return this._options;
|
|
858
|
+
},
|
|
859
|
+
set: function (options) {
|
|
860
|
+
this._options = Object.assign({}, this.config.defaultOptions, options);
|
|
861
|
+
if (this._editor) {
|
|
862
|
+
this._editor.dispose();
|
|
863
|
+
this.initMonaco(options);
|
|
864
|
+
}
|
|
865
|
+
},
|
|
866
|
+
enumerable: false,
|
|
867
|
+
configurable: true
|
|
868
|
+
});
|
|
869
|
+
Object.defineProperty(DiffEditorComponent.prototype, "originalModel", {
|
|
870
|
+
set: function (model) {
|
|
871
|
+
this._originalModel = model;
|
|
872
|
+
if (this._editor) {
|
|
873
|
+
this._editor.dispose();
|
|
874
|
+
this.initMonaco(this.options);
|
|
875
|
+
}
|
|
876
|
+
},
|
|
877
|
+
enumerable: false,
|
|
878
|
+
configurable: true
|
|
879
|
+
});
|
|
880
|
+
Object.defineProperty(DiffEditorComponent.prototype, "modifiedModel", {
|
|
881
|
+
set: function (model) {
|
|
882
|
+
this._modifiedModel = model;
|
|
883
|
+
if (this._editor) {
|
|
884
|
+
this._editor.dispose();
|
|
885
|
+
this.initMonaco(this.options);
|
|
886
|
+
}
|
|
887
|
+
},
|
|
888
|
+
enumerable: false,
|
|
889
|
+
configurable: true
|
|
890
|
+
});
|
|
891
|
+
DiffEditorComponent.prototype.initMonaco = function (options) {
|
|
892
|
+
var _this = this;
|
|
893
|
+
if (!this._originalModel || !this._modifiedModel) {
|
|
894
|
+
throw new Error('originalModel or modifiedModel not found for ngx-monaco-diff-editor');
|
|
895
|
+
}
|
|
896
|
+
this._originalModel.language = this._originalModel.language || options.language;
|
|
897
|
+
this._modifiedModel.language = this._modifiedModel.language || options.language;
|
|
898
|
+
var originalModel = monaco.editor.createModel(this._originalModel.code, this._originalModel.language);
|
|
899
|
+
var modifiedModel = monaco.editor.createModel(this._modifiedModel.code, this._modifiedModel.language);
|
|
900
|
+
this._editorContainer.nativeElement.innerHTML = '';
|
|
901
|
+
var theme = options.theme;
|
|
902
|
+
this._editor = monaco.editor.createDiffEditor(this._editorContainer.nativeElement, options);
|
|
903
|
+
options.theme = theme;
|
|
904
|
+
this._editor.setModel({
|
|
905
|
+
original: originalModel,
|
|
906
|
+
modified: modifiedModel
|
|
907
|
+
});
|
|
908
|
+
// refresh layout on resize event.
|
|
909
|
+
if (this._windowResizeSubscription) {
|
|
910
|
+
this._windowResizeSubscription.unsubscribe();
|
|
911
|
+
}
|
|
912
|
+
this._windowResizeSubscription = rxjs.fromEvent(window, 'resize').subscribe(function () { return _this._editor.layout(); });
|
|
913
|
+
this.onInit.emit(this._editor);
|
|
914
|
+
};
|
|
915
|
+
return DiffEditorComponent;
|
|
916
|
+
}(BaseEditor));
|
|
917
|
+
DiffEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DiffEditorComponent, deps: [{ token: NGX_MONACO_EDITOR_CONFIG }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
918
|
+
DiffEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: DiffEditorComponent, selector: "ngx-monaco-diff-editor", inputs: { options: "options", originalModel: "originalModel", modifiedModel: "modifiedModel" }, usesInheritance: true, ngImport: i0__namespace, template: '<div class="editor-container" #editorContainer></div>', isInline: true, styles: ["\n :host {\n display: block;\n height: 200px;\n }\n\n .editor-container {\n width: 100%;\n height: 98%;\n }\n "] });
|
|
919
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: DiffEditorComponent, decorators: [{
|
|
920
|
+
type: i0.Component,
|
|
921
|
+
args: [{
|
|
922
|
+
selector: 'ngx-monaco-diff-editor',
|
|
923
|
+
template: '<div class="editor-container" #editorContainer></div>',
|
|
924
|
+
styles: ["\n :host {\n display: block;\n height: 200px;\n }\n\n .editor-container {\n width: 100%;\n height: 98%;\n }\n "]
|
|
925
|
+
}]
|
|
926
|
+
}], ctorParameters: function () {
|
|
927
|
+
return [{ type: undefined, decorators: [{
|
|
928
|
+
type: i0.Inject,
|
|
929
|
+
args: [NGX_MONACO_EDITOR_CONFIG]
|
|
930
|
+
}] }];
|
|
931
|
+
}, propDecorators: { options: [{
|
|
932
|
+
type: i0.Input,
|
|
933
|
+
args: ['options']
|
|
934
|
+
}], originalModel: [{
|
|
935
|
+
type: i0.Input,
|
|
936
|
+
args: ['originalModel']
|
|
937
|
+
}], modifiedModel: [{
|
|
938
|
+
type: i0.Input,
|
|
939
|
+
args: ['modifiedModel']
|
|
940
|
+
}] } });
|
|
941
|
+
|
|
942
|
+
var MonacoEditorModule = /** @class */ (function () {
|
|
943
|
+
function MonacoEditorModule() {
|
|
944
|
+
}
|
|
945
|
+
MonacoEditorModule.forRoot = function (config) {
|
|
946
|
+
if (config === void 0) { config = {}; }
|
|
947
|
+
return {
|
|
948
|
+
ngModule: MonacoEditorModule,
|
|
949
|
+
providers: [
|
|
950
|
+
{ provide: NGX_MONACO_EDITOR_CONFIG, useValue: config }
|
|
951
|
+
]
|
|
952
|
+
};
|
|
953
|
+
};
|
|
954
|
+
return MonacoEditorModule;
|
|
955
|
+
}());
|
|
956
|
+
MonacoEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MonacoEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
957
|
+
MonacoEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MonacoEditorModule, declarations: [EditorComponent,
|
|
958
|
+
DiffEditorComponent], imports: [common.CommonModule], exports: [EditorComponent,
|
|
959
|
+
DiffEditorComponent] });
|
|
960
|
+
MonacoEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MonacoEditorModule, imports: [[
|
|
961
|
+
common.CommonModule
|
|
962
|
+
]] });
|
|
963
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MonacoEditorModule, decorators: [{
|
|
964
|
+
type: i0.NgModule,
|
|
965
|
+
args: [{
|
|
966
|
+
imports: [
|
|
967
|
+
common.CommonModule
|
|
968
|
+
],
|
|
969
|
+
declarations: [
|
|
970
|
+
EditorComponent,
|
|
971
|
+
DiffEditorComponent
|
|
972
|
+
],
|
|
973
|
+
exports: [
|
|
974
|
+
EditorComponent,
|
|
975
|
+
DiffEditorComponent
|
|
976
|
+
]
|
|
977
|
+
}]
|
|
978
|
+
}] });
|
|
979
|
+
|
|
980
|
+
var FsTextEditorModule = /** @class */ (function () {
|
|
981
|
+
function FsTextEditorModule() {
|
|
982
|
+
}
|
|
983
|
+
FsTextEditorModule.forRoot = function (config) {
|
|
984
|
+
return {
|
|
985
|
+
ngModule: FsTextEditorModule,
|
|
986
|
+
providers: [
|
|
987
|
+
MonacoEditorModule.forRoot(config).providers,
|
|
988
|
+
],
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
return FsTextEditorModule;
|
|
992
|
+
}());
|
|
993
|
+
FsTextEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FsTextEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
994
|
+
FsTextEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FsTextEditorModule, declarations: [FsTextEditorComponent], imports: [common.CommonModule,
|
|
995
|
+
MonacoEditorModule,
|
|
996
|
+
i2.FormsModule], exports: [FsTextEditorComponent] });
|
|
997
|
+
FsTextEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FsTextEditorModule, imports: [[
|
|
998
|
+
common.CommonModule,
|
|
999
|
+
MonacoEditorModule,
|
|
1000
|
+
i2.FormsModule,
|
|
1001
|
+
]] });
|
|
1002
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FsTextEditorModule, decorators: [{
|
|
1003
|
+
type: i0.NgModule,
|
|
1004
|
+
args: [{
|
|
1005
|
+
imports: [
|
|
1006
|
+
common.CommonModule,
|
|
1007
|
+
MonacoEditorModule,
|
|
1008
|
+
i2.FormsModule,
|
|
1009
|
+
],
|
|
1010
|
+
exports: [
|
|
1011
|
+
FsTextEditorComponent,
|
|
1012
|
+
],
|
|
1013
|
+
entryComponents: [],
|
|
1014
|
+
declarations: [
|
|
1015
|
+
FsTextEditorComponent,
|
|
1016
|
+
]
|
|
1017
|
+
}]
|
|
1018
|
+
}] });
|
|
224
1019
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
1020
|
+
/*
|
|
1021
|
+
* Public API Surface of fs-menu
|
|
1022
|
+
*/
|
|
228
1023
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
1024
|
+
/**
|
|
1025
|
+
* Generated bundle index. Do not edit.
|
|
1026
|
+
*/
|
|
232
1027
|
|
|
233
|
-
|
|
234
|
-
|
|
1028
|
+
exports.FsTextEditorComponent = FsTextEditorComponent;
|
|
1029
|
+
exports.FsTextEditorModule = FsTextEditorModule;
|
|
235
1030
|
|
|
236
|
-
|
|
1031
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
237
1032
|
|
|
238
1033
|
}));
|
|
239
1034
|
//# sourceMappingURL=firestitch-text-editor.umd.js.map
|