mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
parent
e3eda4676e
commit
2b75866949
@ -2,18 +2,18 @@
|
|||||||
<div class="blog" *ngIf="markdowns.length > 0">
|
<div class="blog" *ngIf="markdowns.length > 0">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body" style="min-height: 77px" [style.height]="!open ? '77px':''">
|
<div class="card-body" style="min-height: 77px" [style.height]="!open ? '77px':''">
|
||||||
<ng-container *ngFor="let md of markdowns; let last = last">
|
<ng-container *ngFor="let md of markdowns; let last = last; let first = first">
|
||||||
<markdown
|
<markdown
|
||||||
*ngIf="open"
|
*ngIf="open"
|
||||||
[data]="md.text">
|
[data]="md.text">
|
||||||
</markdown>
|
</markdown>
|
||||||
<span *ngIf="!open" class="text-preview">
|
<span *ngIf="!open && first" class="text-preview">
|
||||||
<markdown
|
<markdown
|
||||||
[inline]="true"
|
[inline]="true"
|
||||||
[data]="md.text">
|
[data]="md.textShort">
|
||||||
</markdown>
|
</markdown>
|
||||||
</span>
|
</span>
|
||||||
<hr *ngIf="!last">
|
<hr *ngIf="open && !last">
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,11 +55,14 @@ export class BlogService {
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.push({
|
const baseText = markdown.substring(0, matches[0].index).trim();
|
||||||
text: markdown.substring(0, matches[0].index),
|
// don't show empty
|
||||||
file: file
|
if (baseText) {
|
||||||
});
|
ret.push({
|
||||||
|
text: baseText,
|
||||||
|
file: file
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < matches.length; ++i) {
|
for (let i = 0; i < matches.length; ++i) {
|
||||||
const matchedStr = matches[i][0];
|
const matchedStr = matches[i][0];
|
||||||
@ -72,8 +75,12 @@ export class BlogService {
|
|||||||
if (groupDate === undefined) {
|
if (groupDate === undefined) {
|
||||||
groupDate = dates[dates.length - 1];
|
groupDate = dates[dates.length - 1];
|
||||||
}
|
}
|
||||||
const text = i + 1 >= matches.length ? markdown.substring(matches[i].index) : markdown.substring(matches[i].index, matches[i + 1].index);
|
const text = (i + 1 >= matches.length ? markdown.substring(matches[i].index) : markdown.substring(matches[i].index, matches[i + 1].index)).trim();
|
||||||
|
|
||||||
|
// don't show empty
|
||||||
|
if (!text) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// if it would be in the same group. Concatenate it
|
// if it would be in the same group. Concatenate it
|
||||||
const sameGroup = ret.find(g => g.date == groupDate);
|
const sameGroup = ret.find(g => g.date == groupDate);
|
||||||
if (sameGroup) {
|
if (sameGroup) {
|
||||||
@ -87,6 +94,8 @@ export class BlogService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret.forEach(md => md.textShort = md.text.substring(0, 200));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,5 +121,6 @@ export class BlogService {
|
|||||||
export interface GroupedMarkdown {
|
export interface GroupedMarkdown {
|
||||||
date?: number;
|
date?: number;
|
||||||
text: string;
|
text: string;
|
||||||
|
textShort?: string;
|
||||||
file: FileDTO;
|
file: FileDTO;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user