Add Twitter Embed, plus Fix TikTok Embed Height #376
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added Twitter Embed functionality
e.g. https://twitter.com/teslaownersSV/status/1819749725568110806
or https://x.com/teslaownersSV/status/1819749725568110806
Twitter Embed IFRAME has been given 500px height - this accommodates shorter tweets without requiring the user to scroll the iframe...but longer tweets will still require internal iframe scrolling. This 500px seemed like a good height trade-off i.e. choosing between: avoiding scrolling in "most cases" vs introducing a lot of extra white-space when the tweet is short but the IFRAME was hardcoded to something like 700px. ...setting a fixed IFRAME height will never be perfect when the inner content height is unknown.
Please note that Twitter's Tweet.html page contains a HTML tag with style for overflow-y: scroll. Which forces a scrollbar to be visible inside the IFRAME (even if the content height is less than the IFRAME height). This is unavoidable.
<html dir="ltr" lang="en" style="overflow-y: scroll; overscroll-behavior-y: none;">I've also gone ahead and fixed the TikTok Embed height, previously it was given 700px height when posting, but then 315px height when viewing a post (a bug)...the cause of this was isValidTiktokEmbedURL did not match the EmbedVideoURL. So I added an additional check against isTikTokLink to accommodate for both URLs (normal url and embed url). I also updated to 760px height for TikTok embeds as this height more reliably avoids seeing a scrollbar inside the IFRAME.