Skip to content

Commit

Permalink
[iOS] - Fix ReaderMode Text Replacements (#25889)
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-T authored Oct 9, 2024
1 parent 00e7210 commit e39aafb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,21 @@ struct ReaderModeUtils {
with: readabilityResult.credits.javaScriptEscapedString?.unquotedIfNecessary
?? readabilityResult.credits.htmlEntityEncodedString
)
.replacingOccurrences(of: "%READER-CONTENT%", with: readabilityResult.content)
.replacingOccurrences(
of: "%READER-DIRECTION%",
with: readabilityResult.direction.javaScriptEscapedString?.unquotedIfNecessary
?? readabilityResult.direction.htmlEntityEncodedString
)
.replacingOccurrences(of: "%READER-MESSAGE%", with: "")

// PAGE UNESCAPED REPLACEMENTS MUST BE DONE AFTER THIS LINE
.replacingOccurrences(
of: "%READER-ORIGINAL-PAGE-META-TAGS%",
with: readabilityResult.cspMetaTags.joined(separator: " \n")
)

// DO NOT DO ANY REPLACEMENTS AFTER THIS LINE
.replacingOccurrences(of: "%READER-CONTENT%", with: readabilityResult.content)
}
}

Expand Down

0 comments on commit e39aafb

Please sign in to comment.