Improve Twitter/X link handling and text formatting
- Use FxTwitter API for full note tweet text (with syndication API fallback) - Save Twitter posts based on media content: - Videos → embed type (proxied video) - Images → image type (gallery) - Text-only → quote type - Add granular preview badges: 'X VIDEO', 'X GALLERY', 'X POST' - Preserve formatting/spacing with white-space: pre-wrap for quotes and descriptions - Rename VideoInfo to EmbedInfo for better semantic clarity
This commit is contained in:
parent
8a046728ef
commit
4a2cb341fa
7 changed files with 249 additions and 137 deletions
|
|
@ -194,6 +194,7 @@ button, input, textarea, select {
|
|||
font-style: italic;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 0.75rem;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.quote-card blockquote::before {
|
||||
|
|
@ -376,6 +377,7 @@ button, input, textarea, select {
|
|||
font-style: italic;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 1rem;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.quote-detail blockquote::before {
|
||||
|
|
@ -405,6 +407,7 @@ button, input, textarea, select {
|
|||
.item-meta .description {
|
||||
margin-bottom: 1rem;
|
||||
color: var(--gray-3);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.item-meta .source-link {
|
||||
|
|
@ -597,6 +600,7 @@ input[type="file"] {
|
|||
.preview-description {
|
||||
font-size: 0.85rem;
|
||||
color: var(--gray-3);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
/* Image Gallery (detail page) */
|
||||
|
|
|
|||
|
|
@ -183,7 +183,17 @@ async function fetchPreview(url) {
|
|||
html += `<div class="preview-description">${escapeHtml(data.description)}</div>`;
|
||||
}
|
||||
if (data.isEmbed) {
|
||||
html += `<div class="preview-badge">${escapeHtml(data.provider.toUpperCase())} VIDEO</div>`;
|
||||
let badge = data.provider.toUpperCase() + ' VIDEO';
|
||||
if (data.provider === 'twitter') {
|
||||
if (data.mediaType === 'video') {
|
||||
badge = 'X VIDEO';
|
||||
} else if (data.mediaType === 'images') {
|
||||
badge = 'X GALLERY';
|
||||
} else {
|
||||
badge = 'X POST';
|
||||
}
|
||||
}
|
||||
html += `<div class="preview-badge">${escapeHtml(badge)}</div>`;
|
||||
}
|
||||
|
||||
preview.innerHTML = html || "<div>No preview available</div>";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue