@ng-util/markdown 11.2.0 → 12.1.2
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/bundles/ng-util-markdown.umd.js +160 -353
- package/bundles/ng-util-markdown.umd.js.map +1 -1
- package/esm2015/markdown-base.component.js +29 -85
- package/esm2015/markdown-preview.component.js +8 -55
- package/esm2015/markdown.component.js +13 -86
- package/esm2015/markdown.config.js +1 -23
- package/esm2015/markdown.module.js +2 -11
- package/esm2015/markdown.service.js +22 -63
- package/esm2015/ng-util-markdown.js +4 -11
- package/esm2015/public-api.js +5 -8
- package/fesm2015/ng-util-markdown.js +84 -338
- package/fesm2015/ng-util-markdown.js.map +1 -1
- package/markdown-base.component.d.ts +6 -1
- package/markdown-preview.component.d.ts +0 -6
- package/markdown.component.d.ts +0 -5
- package/ng-util-markdown.d.ts +2 -4
- package/ng-util-markdown.metadata.json +1 -1
- package/package.json +3 -3
- package/public-api.d.ts +2 -0
- package/bundles/ng-util-markdown.umd.min.js +0 -21
- package/bundles/ng-util-markdown.umd.min.js.map +0 -1
|
@@ -1,13 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license ng-util(cipchk@qq.com)
|
|
2
|
+
* @license ng-util(cipchk@qq.com) v12.1.2
|
|
3
3
|
* (c) 2020 cipchk https://github.com/ng-util
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
7
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@
|
|
8
|
-
typeof define === 'function' && define.amd ? define('@ng-util/markdown', ['exports', '@angular/core', '@
|
|
9
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['ng-util'] = global['ng-util'] || {}, global['ng-util'].markdown = {}), global.ng.core, global
|
|
10
|
-
}(this, (function (exports, i0,
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ng-util/util/convert'), require('@ng-util/lazy'), require('rxjs'), require('@angular/forms'), require('@angular/common')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define('@ng-util/markdown', ['exports', '@angular/core', '@ng-util/util/convert', '@ng-util/lazy', 'rxjs', '@angular/forms', '@angular/common'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['ng-util'] = global['ng-util'] || {}, global['ng-util'].markdown = {}), global.ng.core, global['@ng-util/util/convert'], global['@ng-util/lazy'], global.rxjs, global.ng.forms, global.ng.common));
|
|
10
|
+
}(this, (function (exports, i0, convert, i2, rxjs, forms, common) { 'use strict';
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return e[k];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
n['default'] = e;
|
|
29
|
+
return Object.freeze(n);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
33
|
+
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
11
34
|
|
|
12
35
|
/*! *****************************************************************************
|
|
13
36
|
Copyright (c) Microsoft Corporation.
|
|
@@ -33,6 +56,8 @@
|
|
|
33
56
|
return extendStatics(d, b);
|
|
34
57
|
};
|
|
35
58
|
function __extends(d, b) {
|
|
59
|
+
if (typeof b !== "function" && b !== null)
|
|
60
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
36
61
|
extendStatics(d, b);
|
|
37
62
|
function __() { this.constructor = d; }
|
|
38
63
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -218,11 +243,13 @@
|
|
|
218
243
|
}
|
|
219
244
|
return ar;
|
|
220
245
|
}
|
|
246
|
+
/** @deprecated */
|
|
221
247
|
function __spread() {
|
|
222
248
|
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
223
249
|
ar = ar.concat(__read(arguments[i]));
|
|
224
250
|
return ar;
|
|
225
251
|
}
|
|
252
|
+
/** @deprecated */
|
|
226
253
|
function __spreadArrays() {
|
|
227
254
|
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
228
255
|
s += arguments[i].length;
|
|
@@ -231,7 +258,17 @@
|
|
|
231
258
|
r[k] = a[j];
|
|
232
259
|
return r;
|
|
233
260
|
}
|
|
234
|
-
|
|
261
|
+
function __spreadArray(to, from, pack) {
|
|
262
|
+
if (pack || arguments.length === 2)
|
|
263
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
264
|
+
if (ar || !(i in from)) {
|
|
265
|
+
if (!ar)
|
|
266
|
+
ar = Array.prototype.slice.call(from, 0, i);
|
|
267
|
+
ar[i] = from[i];
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
271
|
+
}
|
|
235
272
|
function __await(v) {
|
|
236
273
|
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
237
274
|
}
|
|
@@ -296,54 +333,26 @@
|
|
|
296
333
|
function __importDefault(mod) {
|
|
297
334
|
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
298
335
|
}
|
|
299
|
-
function __classPrivateFieldGet(receiver,
|
|
300
|
-
if (!
|
|
301
|
-
throw new TypeError("
|
|
302
|
-
|
|
303
|
-
|
|
336
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
337
|
+
if (kind === "a" && !f)
|
|
338
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
339
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
340
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
341
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
304
342
|
}
|
|
305
|
-
function __classPrivateFieldSet(receiver,
|
|
306
|
-
if (
|
|
307
|
-
throw new TypeError("
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
343
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
344
|
+
if (kind === "m")
|
|
345
|
+
throw new TypeError("Private method is not writable");
|
|
346
|
+
if (kind === "a" && !f)
|
|
347
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
348
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
349
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
350
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
311
351
|
}
|
|
312
352
|
|
|
313
|
-
/**
|
|
314
|
-
* @fileoverview added by tsickle
|
|
315
|
-
* Generated from: markdown.config.ts
|
|
316
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
317
|
-
*/
|
|
318
|
-
/** @type {?} */
|
|
319
353
|
var NU_MARKDOWN_CONFIG = new i0.InjectionToken('NU_MARKDOWN_CONFIG');
|
|
320
|
-
/**
|
|
321
|
-
* @record
|
|
322
|
-
*/
|
|
323
|
-
function NuMarkdownConfig() { }
|
|
324
|
-
if (false) {
|
|
325
|
-
/**
|
|
326
|
-
* The base URL to [Vditor](https://github.com/Vanessa219/vditor) library, Default: `['https://cdn.jsdelivr.net/npm/vditor/dist/index.min.js', 'https://cdn.jsdelivr.net/npm/vditor/dist/index.css']`
|
|
327
|
-
* @type {?|undefined}
|
|
328
|
-
*/
|
|
329
|
-
NuMarkdownConfig.prototype.libs;
|
|
330
|
-
/**
|
|
331
|
-
* Equar [IOptions](https://github.com/Vanessa219/vditor/blob/master/types/index.d.ts#L432)
|
|
332
|
-
* @type {?|undefined}
|
|
333
|
-
*/
|
|
334
|
-
NuMarkdownConfig.prototype.defaultOptions;
|
|
335
|
-
}
|
|
336
354
|
|
|
337
|
-
/**
|
|
338
|
-
* @fileoverview added by tsickle
|
|
339
|
-
* Generated from: markdown.service.ts
|
|
340
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
341
|
-
*/
|
|
342
355
|
var NuMarkdownService = /** @class */ (function () {
|
|
343
|
-
/**
|
|
344
|
-
* @param {?} config
|
|
345
|
-
* @param {?} lazySrv
|
|
346
|
-
*/
|
|
347
356
|
function NuMarkdownService(config, lazySrv) {
|
|
348
357
|
this.lazySrv = lazySrv;
|
|
349
358
|
this.loading = false;
|
|
@@ -355,138 +364,88 @@
|
|
|
355
364
|
];
|
|
356
365
|
}
|
|
357
366
|
Object.defineProperty(NuMarkdownService.prototype, "notify", {
|
|
358
|
-
/**
|
|
359
|
-
* @return {?}
|
|
360
|
-
*/
|
|
361
367
|
get: function () {
|
|
362
368
|
return this.notify$.asObservable();
|
|
363
369
|
},
|
|
364
370
|
enumerable: false,
|
|
365
371
|
configurable: true
|
|
366
372
|
});
|
|
367
|
-
/**
|
|
368
|
-
* @template THIS
|
|
369
|
-
* @this {THIS}
|
|
370
|
-
* @return {THIS}
|
|
371
|
-
*/
|
|
372
373
|
NuMarkdownService.prototype.load = function () {
|
|
373
374
|
var _this = this;
|
|
374
|
-
if (
|
|
375
|
-
if (
|
|
376
|
-
|
|
375
|
+
if (this.loading) {
|
|
376
|
+
if (this.loaded) {
|
|
377
|
+
this.notify$.next();
|
|
377
378
|
}
|
|
378
|
-
return
|
|
379
|
+
return this;
|
|
379
380
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
}));
|
|
389
|
-
( /** @type {?} */(this)).lazySrv.load(libs);
|
|
390
|
-
return ( /** @type {?} */(this));
|
|
381
|
+
this.loading = true;
|
|
382
|
+
var libs = this.libs;
|
|
383
|
+
this.lazySrv.monitor(libs).subscribe(function () {
|
|
384
|
+
_this.loaded = true;
|
|
385
|
+
_this.notify$.next();
|
|
386
|
+
});
|
|
387
|
+
this.lazySrv.load(libs);
|
|
388
|
+
return this;
|
|
391
389
|
};
|
|
392
390
|
return NuMarkdownService;
|
|
393
391
|
}());
|
|
392
|
+
/** @nocollapse */ NuMarkdownService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function NuMarkdownService_Factory() { return new NuMarkdownService(i0__namespace.ɵɵinject(NU_MARKDOWN_CONFIG), i0__namespace.ɵɵinject(i2__namespace.NuLazyService)); }, token: NuMarkdownService, providedIn: "root" });
|
|
393
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
394
394
|
NuMarkdownService.decorators = [
|
|
395
395
|
{ type: i0.Injectable, args: [{ providedIn: 'root' },] }
|
|
396
396
|
];
|
|
397
|
-
/**
|
|
397
|
+
/**
|
|
398
|
+
* @type {function(): !Array<(null|{
|
|
399
|
+
* type: ?,
|
|
400
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
401
|
+
* })>}
|
|
402
|
+
* @nocollapse
|
|
403
|
+
*/
|
|
398
404
|
NuMarkdownService.ctorParameters = function () { return [
|
|
399
405
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [NU_MARKDOWN_CONFIG,] }] },
|
|
400
406
|
{ type: i2.NuLazyService }
|
|
401
407
|
]; };
|
|
402
|
-
/** @nocollapse */ NuMarkdownService.ɵprov = i0.ɵɵdefineInjectable({ factory: function NuMarkdownService_Factory() { return new NuMarkdownService(i0.ɵɵinject(NU_MARKDOWN_CONFIG), i0.ɵɵinject(i2.NuLazyService)); }, token: NuMarkdownService, providedIn: "root" });
|
|
403
|
-
if (false) {
|
|
404
|
-
/**
|
|
405
|
-
* @type {?}
|
|
406
|
-
* @private
|
|
407
|
-
*/
|
|
408
|
-
NuMarkdownService.prototype.libs;
|
|
409
|
-
/**
|
|
410
|
-
* @type {?}
|
|
411
|
-
* @private
|
|
412
|
-
*/
|
|
413
|
-
NuMarkdownService.prototype.loading;
|
|
414
|
-
/**
|
|
415
|
-
* @type {?}
|
|
416
|
-
* @private
|
|
417
|
-
*/
|
|
418
|
-
NuMarkdownService.prototype.loaded;
|
|
419
|
-
/**
|
|
420
|
-
* @type {?}
|
|
421
|
-
* @private
|
|
422
|
-
*/
|
|
423
|
-
NuMarkdownService.prototype.notify$;
|
|
424
|
-
/**
|
|
425
|
-
* @type {?}
|
|
426
|
-
* @private
|
|
427
|
-
*/
|
|
428
|
-
NuMarkdownService.prototype.lazySrv;
|
|
429
|
-
}
|
|
430
408
|
|
|
431
|
-
/**
|
|
432
|
-
* @fileoverview added by tsickle
|
|
433
|
-
* Generated from: markdown-base.component.ts
|
|
434
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
435
|
-
*/
|
|
436
|
-
/**
|
|
437
|
-
* @abstract
|
|
438
|
-
*/
|
|
439
409
|
var NuMarkdownBaseComponent = /** @class */ (function () {
|
|
440
|
-
/**
|
|
441
|
-
* @param {?} el
|
|
442
|
-
* @param {?} config
|
|
443
|
-
* @param {?} srv
|
|
444
|
-
* @param {?} ngZone
|
|
445
|
-
*/
|
|
446
410
|
function NuMarkdownBaseComponent(el, config, srv, ngZone) {
|
|
447
411
|
var _this = this;
|
|
448
412
|
this.el = el;
|
|
449
413
|
this.config = config;
|
|
450
414
|
this.srv = srv;
|
|
451
415
|
this.ngZone = ngZone;
|
|
452
|
-
this.
|
|
453
|
-
|
|
454
|
-
|
|
416
|
+
this.delay = 0;
|
|
417
|
+
this.disabled = false;
|
|
418
|
+
this.ready = new i0.EventEmitter();
|
|
419
|
+
this.notify$ = this.srv.notify.subscribe(function () { return _this.initDelay(); });
|
|
455
420
|
}
|
|
421
|
+
Object.defineProperty(NuMarkdownBaseComponent.prototype, "value", {
|
|
422
|
+
set: function (v) {
|
|
423
|
+
this._value = v;
|
|
424
|
+
if (this.loaded) {
|
|
425
|
+
this.init();
|
|
426
|
+
}
|
|
427
|
+
},
|
|
428
|
+
enumerable: false,
|
|
429
|
+
configurable: true
|
|
430
|
+
});
|
|
456
431
|
Object.defineProperty(NuMarkdownBaseComponent.prototype, "instance", {
|
|
457
|
-
/**
|
|
458
|
-
* @return {?}
|
|
459
|
-
*/
|
|
460
432
|
get: function () {
|
|
461
433
|
return this._instance;
|
|
462
434
|
},
|
|
463
435
|
enumerable: false,
|
|
464
436
|
configurable: true
|
|
465
437
|
});
|
|
466
|
-
/**
|
|
467
|
-
* @private
|
|
468
|
-
* @return {?}
|
|
469
|
-
*/
|
|
470
438
|
NuMarkdownBaseComponent.prototype.initDelay = function () {
|
|
471
439
|
var _this = this;
|
|
472
|
-
setTimeout((
|
|
473
|
-
* @return {?}
|
|
474
|
-
*/function () { return _this.init(); }), this.delay);
|
|
440
|
+
setTimeout(function () { return _this.init(); }, this.delay);
|
|
475
441
|
};
|
|
476
442
|
Object.defineProperty(NuMarkdownBaseComponent.prototype, "loaded", {
|
|
477
|
-
/**
|
|
478
|
-
* @protected
|
|
479
|
-
* @return {?}
|
|
480
|
-
*/
|
|
481
443
|
get: function () {
|
|
482
|
-
return !!
|
|
444
|
+
return !!window.Vditor;
|
|
483
445
|
},
|
|
484
446
|
enumerable: false,
|
|
485
447
|
configurable: true
|
|
486
448
|
});
|
|
487
|
-
/**
|
|
488
|
-
* @return {?}
|
|
489
|
-
*/
|
|
490
449
|
NuMarkdownBaseComponent.prototype.ngAfterViewInit = function () {
|
|
491
450
|
if (this.loaded) {
|
|
492
451
|
this.initDelay();
|
|
@@ -494,117 +453,97 @@
|
|
|
494
453
|
}
|
|
495
454
|
this.srv.load();
|
|
496
455
|
};
|
|
497
|
-
/**
|
|
498
|
-
* @return {?}
|
|
499
|
-
*/
|
|
500
456
|
NuMarkdownBaseComponent.prototype.ngOnDestroy = function () {
|
|
501
457
|
this.notify$.unsubscribe();
|
|
502
458
|
};
|
|
503
459
|
return NuMarkdownBaseComponent;
|
|
504
460
|
}());
|
|
461
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
505
462
|
NuMarkdownBaseComponent.decorators = [
|
|
506
463
|
{ type: i0.Directive }
|
|
507
464
|
];
|
|
508
|
-
/**
|
|
465
|
+
/**
|
|
466
|
+
* @type {function(): !Array<(null|{
|
|
467
|
+
* type: ?,
|
|
468
|
+
* decorators: (undefined|!Array<{type: !Function, args: (undefined|!Array<?>)}>),
|
|
469
|
+
* })>}
|
|
470
|
+
* @nocollapse
|
|
471
|
+
*/
|
|
509
472
|
NuMarkdownBaseComponent.ctorParameters = function () { return [
|
|
510
473
|
{ type: i0.ElementRef },
|
|
511
474
|
{ type: undefined, decorators: [{ type: i0.Inject, args: [NU_MARKDOWN_CONFIG,] }] },
|
|
512
475
|
{ type: NuMarkdownService },
|
|
513
476
|
{ type: i0.NgZone }
|
|
514
477
|
]; };
|
|
478
|
+
/** @type {!Object<string, !Array<{type: !Function, args: (undefined|!Array<?>)}>>} */
|
|
515
479
|
NuMarkdownBaseComponent.propDecorators = {
|
|
516
|
-
delay: [{ type: i0.Input }]
|
|
480
|
+
delay: [{ type: i0.Input }],
|
|
481
|
+
disabled: [{ type: i0.Input }],
|
|
482
|
+
options: [{ type: i0.Input }],
|
|
483
|
+
ready: [{ type: i0.Output }],
|
|
484
|
+
value: [{ type: i0.Input }]
|
|
517
485
|
};
|
|
518
486
|
__decorate([
|
|
519
487
|
convert.InputNumber(),
|
|
520
|
-
__metadata("design:type",
|
|
488
|
+
__metadata("design:type", Object)
|
|
521
489
|
], NuMarkdownBaseComponent.prototype, "delay", void 0);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
/**
|
|
556
|
-
* @abstract
|
|
557
|
-
* @protected
|
|
558
|
-
* @return {?}
|
|
559
|
-
*/
|
|
560
|
-
NuMarkdownBaseComponent.prototype.init = function () { };
|
|
561
|
-
}
|
|
490
|
+
|
|
491
|
+
var NuMarkdownPreviewComponent = /** @class */ (function (_super) {
|
|
492
|
+
__extends(NuMarkdownPreviewComponent, _super);
|
|
493
|
+
function NuMarkdownPreviewComponent() {
|
|
494
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
495
|
+
}
|
|
496
|
+
NuMarkdownPreviewComponent.prototype.init = function () {
|
|
497
|
+
var _this = this;
|
|
498
|
+
this.ngZone.runOutsideAngular(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
499
|
+
var _this = this;
|
|
500
|
+
return __generator(this, function (_a) {
|
|
501
|
+
switch (_a.label) {
|
|
502
|
+
case 0: return [4 /*yield*/, Vditor.preview(this.el.nativeElement, this._value)];
|
|
503
|
+
case 1:
|
|
504
|
+
_a.sent();
|
|
505
|
+
console.log(this.el.nativeElement.innerHTML);
|
|
506
|
+
this.ngZone.run(function () { return _this.ready.emit(_this.el.nativeElement.innerHTML); });
|
|
507
|
+
return [2 /*return*/];
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}); });
|
|
511
|
+
};
|
|
512
|
+
return NuMarkdownPreviewComponent;
|
|
513
|
+
}(NuMarkdownBaseComponent));
|
|
514
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
515
|
+
NuMarkdownPreviewComponent.decorators = [
|
|
516
|
+
{ type: i0.Component, args: [{
|
|
517
|
+
selector: 'nu-markdown-preview',
|
|
518
|
+
template: "",
|
|
519
|
+
exportAs: 'nuMarkdownPreview',
|
|
520
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
521
|
+
},] }
|
|
522
|
+
];
|
|
562
523
|
|
|
563
524
|
var NuMarkdownComponent = /** @class */ (function (_super) {
|
|
564
525
|
__extends(NuMarkdownComponent, _super);
|
|
565
526
|
function NuMarkdownComponent() {
|
|
566
|
-
var _this = _super.apply(this,
|
|
567
|
-
_this.
|
|
568
|
-
_this.onChange = ( /**
|
|
569
|
-
* @param {?} _
|
|
570
|
-
* @return {?}
|
|
571
|
-
*/function (_) { });
|
|
527
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
528
|
+
_this.onChange = function (_) { };
|
|
572
529
|
return _this;
|
|
573
530
|
}
|
|
574
|
-
/**
|
|
575
|
-
* @protected
|
|
576
|
-
* @return {?}
|
|
577
|
-
*/
|
|
578
531
|
NuMarkdownComponent.prototype.init = function () {
|
|
579
532
|
var _this = this;
|
|
580
|
-
this.ngZone.runOutsideAngular((
|
|
581
|
-
* @return {?}
|
|
582
|
-
*/function () {
|
|
533
|
+
this.ngZone.runOutsideAngular(function () {
|
|
583
534
|
var _a;
|
|
584
|
-
/** @type {?} */
|
|
585
535
|
var options = Object.assign(Object.assign({ value: _this._value, cache: {
|
|
586
536
|
enable: false,
|
|
587
|
-
}, mode: 'sv', minHeight: 350, input: (
|
|
588
|
-
|
|
589
|
-
* @return {?}
|
|
590
|
-
*/function (value) {
|
|
591
|
-
_this.ngZone.run(( /**
|
|
592
|
-
* @return {?}
|
|
593
|
-
*/function () {
|
|
537
|
+
}, mode: 'sv', minHeight: 350, input: function (value) {
|
|
538
|
+
_this.ngZone.run(function () {
|
|
594
539
|
_this._value = value;
|
|
595
540
|
_this.onChange(value);
|
|
596
|
-
})
|
|
597
|
-
}
|
|
541
|
+
});
|
|
542
|
+
} }, (_a = _this.config) === null || _a === void 0 ? void 0 : _a.defaultOptions), _this.options);
|
|
598
543
|
_this._instance = new Vditor(_this.el.nativeElement, options);
|
|
599
|
-
_this.ngZone.run((
|
|
600
|
-
|
|
601
|
-
*/function () { return _this.ready.emit(_this._instance); }));
|
|
602
|
-
}));
|
|
544
|
+
_this.ngZone.run(function () { return _this.ready.emit(_this._instance); });
|
|
545
|
+
});
|
|
603
546
|
};
|
|
604
|
-
/**
|
|
605
|
-
* @private
|
|
606
|
-
* @return {?}
|
|
607
|
-
*/
|
|
608
547
|
NuMarkdownComponent.prototype.setDisabled = function () {
|
|
609
548
|
if (!this.instance) {
|
|
610
549
|
return;
|
|
@@ -616,38 +555,23 @@
|
|
|
616
555
|
this.instance.enable();
|
|
617
556
|
}
|
|
618
557
|
};
|
|
619
|
-
/**
|
|
620
|
-
* @param {?} value
|
|
621
|
-
* @return {?}
|
|
622
|
-
*/
|
|
623
558
|
NuMarkdownComponent.prototype.writeValue = function (value) {
|
|
624
559
|
this._value = value || '';
|
|
625
560
|
if (this.instance) {
|
|
626
561
|
this.instance.setValue(this._value);
|
|
627
562
|
}
|
|
628
563
|
};
|
|
629
|
-
/**
|
|
630
|
-
* @param {?} fn
|
|
631
|
-
* @return {?}
|
|
632
|
-
*/
|
|
633
564
|
NuMarkdownComponent.prototype.registerOnChange = function (fn) {
|
|
634
565
|
this.onChange = fn;
|
|
635
566
|
};
|
|
636
|
-
/**
|
|
637
|
-
* @param {?} _
|
|
638
|
-
* @return {?}
|
|
639
|
-
*/
|
|
640
567
|
NuMarkdownComponent.prototype.registerOnTouched = function (_) { };
|
|
641
|
-
/**
|
|
642
|
-
* @param {?} _isDisabled
|
|
643
|
-
* @return {?}
|
|
644
|
-
*/
|
|
645
568
|
NuMarkdownComponent.prototype.setDisabledState = function (_isDisabled) {
|
|
646
569
|
this.disabled = _isDisabled;
|
|
647
570
|
this.setDisabled();
|
|
648
571
|
};
|
|
649
572
|
return NuMarkdownComponent;
|
|
650
573
|
}(NuMarkdownBaseComponent));
|
|
574
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
651
575
|
NuMarkdownComponent.decorators = [
|
|
652
576
|
{ type: i0.Component, args: [{
|
|
653
577
|
selector: 'nu-markdown',
|
|
@@ -656,128 +580,18 @@
|
|
|
656
580
|
providers: [
|
|
657
581
|
{
|
|
658
582
|
provide: forms.NG_VALUE_ACCESSOR,
|
|
659
|
-
useExisting: i0.forwardRef((
|
|
660
|
-
* @return {?}
|
|
661
|
-
*/function () { return NuMarkdownComponent; })),
|
|
583
|
+
useExisting: i0.forwardRef(function () { return NuMarkdownComponent; }),
|
|
662
584
|
multi: true,
|
|
663
585
|
},
|
|
664
586
|
],
|
|
665
587
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
666
|
-
}] }
|
|
667
|
-
];
|
|
668
|
-
NuMarkdownComponent.propDecorators = {
|
|
669
|
-
options: [{ type: i0.Input }],
|
|
670
|
-
disabled: [{ type: i0.Input }],
|
|
671
|
-
ready: [{ type: i0.Output }]
|
|
672
|
-
};
|
|
673
|
-
if (false) {
|
|
674
|
-
/**
|
|
675
|
-
* @type {?}
|
|
676
|
-
* @private
|
|
677
|
-
*/
|
|
678
|
-
NuMarkdownComponent.prototype._value;
|
|
679
|
-
/** @type {?} */
|
|
680
|
-
NuMarkdownComponent.prototype.options;
|
|
681
|
-
/** @type {?} */
|
|
682
|
-
NuMarkdownComponent.prototype.disabled;
|
|
683
|
-
/** @type {?} */
|
|
684
|
-
NuMarkdownComponent.prototype.ready;
|
|
685
|
-
/**
|
|
686
|
-
* @type {?}
|
|
687
|
-
* @private
|
|
688
|
-
*/
|
|
689
|
-
NuMarkdownComponent.prototype.onChange;
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
var NuMarkdownPreviewComponent = /** @class */ (function (_super) {
|
|
693
|
-
__extends(NuMarkdownPreviewComponent, _super);
|
|
694
|
-
function NuMarkdownPreviewComponent() {
|
|
695
|
-
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
696
|
-
_this.ready = new i0.EventEmitter();
|
|
697
|
-
return _this;
|
|
698
|
-
}
|
|
699
|
-
Object.defineProperty(NuMarkdownPreviewComponent.prototype, "value", {
|
|
700
|
-
/**
|
|
701
|
-
* @param {?} v
|
|
702
|
-
* @return {?}
|
|
703
|
-
*/
|
|
704
|
-
set: function (v) {
|
|
705
|
-
this._value = v;
|
|
706
|
-
if (this.loaded) {
|
|
707
|
-
this.init();
|
|
708
|
-
}
|
|
709
|
-
},
|
|
710
|
-
enumerable: false,
|
|
711
|
-
configurable: true
|
|
712
|
-
});
|
|
713
|
-
/**
|
|
714
|
-
* @protected
|
|
715
|
-
* @return {?}
|
|
716
|
-
*/
|
|
717
|
-
NuMarkdownPreviewComponent.prototype.init = function () {
|
|
718
|
-
var _this = this;
|
|
719
|
-
this.ngZone.runOutsideAngular(( /**
|
|
720
|
-
* @return {?}
|
|
721
|
-
*/function () { return __awaiter(_this, void 0, void 0, function () {
|
|
722
|
-
var _this = this;
|
|
723
|
-
return __generator(this, function (_a) {
|
|
724
|
-
switch (_a.label) {
|
|
725
|
-
case 0: return [4 /*yield*/, Vditor.preview(this.el.nativeElement, this._value)];
|
|
726
|
-
case 1:
|
|
727
|
-
_a.sent();
|
|
728
|
-
console.log(this.el.nativeElement.innerHTML);
|
|
729
|
-
this.ngZone.run(( /**
|
|
730
|
-
* @return {?}
|
|
731
|
-
*/function () { return _this.ready.emit(_this.el.nativeElement.innerHTML); }));
|
|
732
|
-
return [2 /*return*/];
|
|
733
|
-
}
|
|
734
|
-
});
|
|
735
|
-
}); }));
|
|
736
|
-
};
|
|
737
|
-
return NuMarkdownPreviewComponent;
|
|
738
|
-
}(NuMarkdownBaseComponent));
|
|
739
|
-
NuMarkdownPreviewComponent.decorators = [
|
|
740
|
-
{ type: i0.Component, args: [{
|
|
741
|
-
selector: 'nu-markdown-preview',
|
|
742
|
-
template: "{{ value }}",
|
|
743
|
-
exportAs: 'nuMarkdownPreview',
|
|
744
|
-
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
745
|
-
}] }
|
|
588
|
+
},] }
|
|
746
589
|
];
|
|
747
|
-
NuMarkdownPreviewComponent.propDecorators = {
|
|
748
|
-
value: [{ type: i0.Input }],
|
|
749
|
-
options: [{ type: i0.Input }],
|
|
750
|
-
disabled: [{ type: i0.Input }],
|
|
751
|
-
ready: [{ type: i0.Output }]
|
|
752
|
-
};
|
|
753
|
-
if (false) {
|
|
754
|
-
/**
|
|
755
|
-
* @type {?}
|
|
756
|
-
* @private
|
|
757
|
-
*/
|
|
758
|
-
NuMarkdownPreviewComponent.prototype._value;
|
|
759
|
-
/** @type {?} */
|
|
760
|
-
NuMarkdownPreviewComponent.prototype.options;
|
|
761
|
-
/** @type {?} */
|
|
762
|
-
NuMarkdownPreviewComponent.prototype.disabled;
|
|
763
|
-
/** @type {?} */
|
|
764
|
-
NuMarkdownPreviewComponent.prototype.ready;
|
|
765
|
-
}
|
|
766
590
|
|
|
767
|
-
/**
|
|
768
|
-
* @fileoverview added by tsickle
|
|
769
|
-
* Generated from: markdown.module.ts
|
|
770
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
771
|
-
*/
|
|
772
|
-
/** @type {?} */
|
|
773
591
|
var COMPONENTS = [NuMarkdownComponent, NuMarkdownPreviewComponent];
|
|
774
592
|
var NuMarkdownModule = /** @class */ (function () {
|
|
775
593
|
function NuMarkdownModule() {
|
|
776
594
|
}
|
|
777
|
-
/**
|
|
778
|
-
* @param {?=} config
|
|
779
|
-
* @return {?}
|
|
780
|
-
*/
|
|
781
595
|
NuMarkdownModule.forRoot = function (config) {
|
|
782
596
|
return {
|
|
783
597
|
ngModule: NuMarkdownModule,
|
|
@@ -786,6 +600,7 @@
|
|
|
786
600
|
};
|
|
787
601
|
return NuMarkdownModule;
|
|
788
602
|
}());
|
|
603
|
+
/** @type {!Array<{type: !Function, args: (undefined|!Array<?>)}>} */
|
|
789
604
|
NuMarkdownModule.decorators = [
|
|
790
605
|
{ type: i0.NgModule, args: [{
|
|
791
606
|
imports: [common.CommonModule],
|
|
@@ -795,23 +610,15 @@
|
|
|
795
610
|
];
|
|
796
611
|
|
|
797
612
|
/**
|
|
798
|
-
*
|
|
799
|
-
* Generated from: public-api.ts
|
|
800
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
801
|
-
*/
|
|
802
|
-
|
|
803
|
-
/**
|
|
804
|
-
* @fileoverview added by tsickle
|
|
805
|
-
* Generated from: ng-util-markdown.ts
|
|
806
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
613
|
+
* Generated bundle index. Do not edit.
|
|
807
614
|
*/
|
|
808
615
|
|
|
616
|
+
exports.NuMarkdownBaseComponent = NuMarkdownBaseComponent;
|
|
809
617
|
exports.NuMarkdownComponent = NuMarkdownComponent;
|
|
810
618
|
exports.NuMarkdownModule = NuMarkdownModule;
|
|
811
|
-
exports
|
|
812
|
-
exports.ɵ
|
|
813
|
-
exports.ɵ
|
|
814
|
-
exports.ɵe = NuMarkdownPreviewComponent;
|
|
619
|
+
exports.NuMarkdownPreviewComponent = NuMarkdownPreviewComponent;
|
|
620
|
+
exports.ɵa = NU_MARKDOWN_CONFIG;
|
|
621
|
+
exports.ɵc = NuMarkdownService;
|
|
815
622
|
|
|
816
623
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
817
624
|
|