@coolon/angular-ui-powerups 12.4.0-alpha.78 → 12.4.0-alpha.79
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/coolon-angular-ui-powerups.umd.js +26 -4
- package/bundles/coolon-angular-ui-powerups.umd.js.map +1 -1
- package/coolon-angular-ui-powerups.metadata.json +1 -1
- package/esm2015/lib/components/text/markdown/markdown.component.js +27 -4
- package/esm2015/lib/components/text/markdown/markdown.component.js.map +1 -1
- package/esm2015/lib/components/text/markdown/markdown.component.metadata.json +1 -1
- package/esm2015/lib/services/markdown/markdown.service.js +0 -1
- package/esm2015/lib/services/markdown/markdown.service.js.map +1 -1
- package/fesm2015/coolon-angular-ui-powerups.js +27 -5
- package/fesm2015/coolon-angular-ui-powerups.js.map +1 -1
- package/lib/components/text/markdown/markdown.component.d.ts +15 -1
- package/package.json +1 -1
|
@@ -785,7 +785,6 @@
|
|
|
785
785
|
}
|
|
786
786
|
MarkdownService.prototype.render = function (content) {
|
|
787
787
|
return marked.marked.parse(content, {
|
|
788
|
-
gfm: true,
|
|
789
788
|
smartLists: true
|
|
790
789
|
});
|
|
791
790
|
};
|
|
@@ -5077,10 +5076,23 @@
|
|
|
5077
5076
|
label: [{ type: i0.Input }]
|
|
5078
5077
|
};
|
|
5079
5078
|
|
|
5079
|
+
/**
|
|
5080
|
+
* @example
|
|
5081
|
+
* <aup-markdown [content]="..."></aup-markdown>
|
|
5082
|
+
* <aup-markdown [content$]="stringValueModel$"></aup-markdown>
|
|
5083
|
+
* <aup-markdown ngPreserveWhitespaces>
|
|
5084
|
+
* # This is markdown content
|
|
5085
|
+
*
|
|
5086
|
+
* With a list
|
|
5087
|
+
* - a
|
|
5088
|
+
* - b
|
|
5089
|
+
* </aup-markdown>
|
|
5090
|
+
*/
|
|
5080
5091
|
var MarkdownComponent = /** @class */ (function (_super) {
|
|
5081
5092
|
__extends(MarkdownComponent, _super);
|
|
5082
|
-
function MarkdownComponent(element, markdownService) {
|
|
5093
|
+
function MarkdownComponent(platform, element, markdownService) {
|
|
5083
5094
|
var _this = _super.call(this) || this;
|
|
5095
|
+
_this.platform = platform;
|
|
5084
5096
|
_this.element = element;
|
|
5085
5097
|
_this.markdownService = markdownService;
|
|
5086
5098
|
_this.inline = false;
|
|
@@ -5092,13 +5104,22 @@
|
|
|
5092
5104
|
var when = pectin.Dsl.disposeWith(this).when;
|
|
5093
5105
|
when(this.content$).changes(function (content) { return _this.renderContent(content); }, { initialValue: 'triggerChangeUnlessNil' });
|
|
5094
5106
|
if (___namespace.isNil(this.content) && !___namespace.isEmpty(this.element.nativeElement.innerHTML)) {
|
|
5095
|
-
this.renderContent(this.element.nativeElement.innerHTML);
|
|
5107
|
+
this.renderContent(this.extractInnerContent(this.element.nativeElement.innerHTML));
|
|
5096
5108
|
}
|
|
5097
5109
|
};
|
|
5110
|
+
MarkdownComponent.prototype.extractInnerContent = function (content) {
|
|
5111
|
+
var lines = content.split("\n");
|
|
5112
|
+
var prefix = lines.reduce(function (maxPrefix, line) {
|
|
5113
|
+
return Math.max(maxPrefix, line.search(/\S/));
|
|
5114
|
+
}, 0);
|
|
5115
|
+
return lines.map(function (l) { return l.substr(prefix); }).join("\n");
|
|
5116
|
+
};
|
|
5098
5117
|
MarkdownComponent.prototype.renderContent = function (content) {
|
|
5099
5118
|
if (!___namespace.isNil(content)) {
|
|
5100
|
-
|
|
5119
|
+
var markdown = this.inline ?
|
|
5120
|
+
this.markdownService.renderInline(content) :
|
|
5101
5121
|
this.markdownService.render(content);
|
|
5122
|
+
this.element.nativeElement.innerHTML = markdown;
|
|
5102
5123
|
}
|
|
5103
5124
|
};
|
|
5104
5125
|
return MarkdownComponent;
|
|
@@ -5111,6 +5132,7 @@
|
|
|
5111
5132
|
},] }
|
|
5112
5133
|
];
|
|
5113
5134
|
MarkdownComponent.ctorParameters = function () { return [
|
|
5135
|
+
{ type: Object, decorators: [{ type: i0.Inject, args: [i0.PLATFORM_ID,] }] },
|
|
5114
5136
|
{ type: i0.ElementRef },
|
|
5115
5137
|
{ type: MarkdownService }
|
|
5116
5138
|
]; };
|