aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 95fcde8..6875856 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -14099,8 +14099,21 @@ export function messagesFeature(ctx) {
// You could only find out by posting. This runs the draft through noteBody
// — the very renderer the feed uses — so the preview is not a lookalike of
// the real thing, it IS the real thing.
+ // A link's card needs its page read first: the feed warms that before a
+ // post shows, a draft only once the typing settles (not one registrar call
+ // per keystroke of a URL), then repaints into the card.
+ let draftPvTimer = null;
+ function warmDraftPreviews(body) {
+ const want = notePreviewUrls(body).filter((u) => !previews.has(u));
+ clearTimeout(draftPvTimer);
+ if (!want.length) return;
+ draftPvTimer = setTimeout(() => {
+ for (const u of want) warmPreview(u).then(() => { if (previews.get(u)) scheduleRepaint(); });
+ }, 500);
+ }
function draftPreview(text) {
const body = String(text || '').trim();
+ warmDraftPreviews(body);
return h('div', { class: 'draft-preview' },
h('div', { class: 'draft-preview-tag' }, t('composePreviewTag')),
body