diff --git a/www/document.html b/www/document.html index 7a110a0..1093a55 100644 --- a/www/document.html +++ b/www/document.html @@ -334,6 +334,44 @@ display: none; } + .docPreviewMeta { + border: 1px solid var(--muted-color); + border-radius: 8px; + padding: 10px; + margin-bottom: 10px; + display: flex; + flex-direction: column; + gap: 6px; + background: color-mix(in srgb, var(--secondary-color) 88%, var(--muted-color) 12%); + } + + .docPreviewMetaRow { + font-size: 84%; + line-height: 1.4; + word-break: break-word; + } + + .docPreviewMetaLabel { + font-weight: 700; + color: var(--primary-color); + } + + .docPreviewImageWrap { + margin-top: 6px; + } + + .docPreviewImage { + max-width: 100%; + height: auto; + border-radius: 8px; + border: 1px solid var(--muted-color); + display: block; + } + + .docPreviewContent { + min-height: 40px; + } + #divDocumentInfo { font-size: 72%; color: var(--muted-color); @@ -1215,12 +1253,47 @@ user: return window.DOMPurify ? window.DOMPurify.sanitize(html) : html; } + function normalizePreviewImageUrl(rawUrl) { + const value = String(rawUrl || '').trim(); + if (!value) return ''; + try { + const parsed = new URL(value, window.location.origin); + if (parsed.protocol === 'http:' || parsed.protocol === 'https:') { + return parsed.href; + } + } catch (_error) { + // ignore invalid urls + } + return ''; + } + + function renderDocumentMetaPreview() { + const title = String(inpDocumentTitle?.value || '').trim(); + const summary = String(inpDocumentSummary?.value || '').trim(); + const tags = String(inpDocumentTags?.value || '').trim(); + const imageUrl = normalizePreviewImageUrl(inpDocumentImage?.value || ''); + const imageBlock = imageUrl + ? `