Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class ReaderDetailCoordinator {
/// Given a URL presents it the best way possible.
///
/// If it's an image, shows it fullscreen.
/// If it's a fullscreen Story link, open it in the webview controller
/// If it's a post, open a new detail screen.
/// If it's a regular URL, open it in the webview controller
///
Expand All @@ -290,6 +291,8 @@ class ReaderDetailCoordinator {
view?.scroll(to: hash)
} else if url.pathExtension.contains("gif") || url.pathExtension.contains("jpg") || url.pathExtension.contains("jpeg") || url.pathExtension.contains("png") {
presentImage(url)
} else if url.query?.contains("wp-story") ?? false {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to open that in fullscreen?

presentWebViewController(url)
} else if readerLinkRouter.canHandle(url: url) {
readerLinkRouter.handle(url: url, shouldTrack: false, source: viewController)
} else if url.isWordPressDotComPost {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ class ReaderWebView: WKWebView {
})

// Make all images tappable
document.querySelectorAll('img').forEach((el) => { el.outerHTML = `<a href="${el.src}">${el.outerHTML}</a>` })
// Exception for images in Stories, which have their own link structure
document.querySelectorAll('img:not(.wp-story-image)').forEach((el) => {
el.outerHTML = `<a href="${el.src}">${el.outerHTML}</a>`
})

// Only display images after they have fully loaded, to have a native feel
document.querySelectorAll('img').forEach((el) => {
Expand Down