Gruppen-Plugin 1.0.0
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
5bdfb8a082
49 changed files with 4679 additions and 0 deletions
22
resources/js/lib/format.js
Normal file
22
resources/js/lib/format.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/** Text in Stücke zerlegen, Links erkennen – ohne v-html */
|
||||
export function linkify(text) {
|
||||
const parts = [];
|
||||
const pattern = /(https?:\/\/[^\s<>"']+[^\s<>"'.,;:!?)\]])/g;
|
||||
let last = 0;
|
||||
|
||||
for (const match of (text ?? '').matchAll(pattern)) {
|
||||
if (match.index > last) parts.push({ text: text.slice(last, match.index) });
|
||||
parts.push({ text: match[0], href: match[0] });
|
||||
last = match.index + match[0].length;
|
||||
}
|
||||
|
||||
if (last < (text ?? '').length) parts.push({ text: text.slice(last) });
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
export function fileSize(bytes) {
|
||||
if (bytes < 1024 * 1024) return `${Math.max(1, Math.round(bytes / 1024))} KB`;
|
||||
|
||||
return `${(bytes / 1024 / 1024).toFixed(1).replace('.', ',')} MB`;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue