fixing some slight oversights
This commit is contained in:
1 parent
80a2772bfe
commit
b4a74221b9
3 files changed
+35
-9
No files matched your search
@@ -20,9 +20,11 @@
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
.logo {
|
||||||
height: 50px;
|
height: 50px;
|
||||||
margin-bottom: 5px;
|
margin: 0 0 10px 0;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: 0;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="main-section" [ngStyle]="{'width': isNarrow ? '100%' : 'calc(100% - 340px)'}">
|
<div class="main-section" [ngStyle]="{'width': isNarrow ? '100%' : 'calc(100% - 340px)'}">
|
||||||
<div class="dashboard-titlebar" [ngStyle]="{'justify-content': isNarrow ? 'center' : 'space-between'}">
|
<div class="dashboard-titlebar" [ngStyle]="{'justify-content': isNarrow ? 'center' : 'space-between'}">
|
||||||
@if (!isNarrow) {
|
@if (!isNarrow) {
|
||||||
<img alt="Logo" src="/assets/logo_m.svg" [routerLink]="'/'">
|
<img class="logo" alt="Logo" src="/assets/logo_m.svg" [routerLink]="'/'">
|
||||||
<div class="title">
|
<div class="title">
|
||||||
<h2>Admin Dashboard</h2>
|
<h2>Admin Dashboard</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -52,13 +52,37 @@ export class BlogComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitizeContent(content: string): string {
|
truncateContent(content: string, maxLength: number): string {
|
||||||
if (!content) return '';
|
if (!content) return '';
|
||||||
return content.replace(/<[^>]*>/g, ' ').replace(/\s+/g, ' ').trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
truncateContent(content: string, length: number): string {
|
let preview = content;
|
||||||
const sanitized = this.sanitizeContent(content);
|
|
||||||
return sanitized.length > length ? sanitized.slice(0, length) + '...' : sanitized;
|
preview = preview.replace(/\[center\]([\s\S]*?)\[\/center\]/gi, '$1');
|
||||||
|
preview = preview.replace(/\[gallery\]([\s\S]*?)\[\/gallery\]/gi, '');
|
||||||
|
|
||||||
|
preview = preview.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '$1');
|
||||||
|
|
||||||
|
preview = preview.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '$1');
|
||||||
|
|
||||||
|
preview = preview.replace(/^#{1,6}\s*/gm, '');
|
||||||
|
|
||||||
|
preview = preview.replace(/(\*\*|__)(.*?)\1/g, '$2');
|
||||||
|
preview = preview.replace(/(\*|_)(.*?)\1/g, '$2');
|
||||||
|
preview = preview.replace(/~~(.*?)~~/g, '$1');
|
||||||
|
preview = preview.replace(/`([^`]+)`/g, '$1');
|
||||||
|
|
||||||
|
preview = preview.replace(/^>\s*/gm, '');
|
||||||
|
preview = preview.replace(/^[-*+]\s+/gm, '');
|
||||||
|
preview = preview.replace(/^\d+\.\s+/gm, '');
|
||||||
|
|
||||||
|
preview = preview.replace(/<[^>]+>/g, '');
|
||||||
|
|
||||||
|
preview = preview.replace(/\s+/g, ' ').trim();
|
||||||
|
|
||||||
|
if (preview.length <= maxLength) {
|
||||||
|
return preview;
|
||||||
|
}
|
||||||
|
|
||||||
|
return preview.slice(0, maxLength).trimEnd() + '...';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user