mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
new implementation based on the usage of NSTextAttachment to allocate space for the timestamp
This commit is contained in:
@@ -101,6 +101,25 @@ extension String {
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
/// Whether the first character with a strong BiDi direction is right-to-left.
|
||||
/// Mirrors the Unicode BiDi "first strong" rule used by TextKit to resolve
|
||||
/// paragraph direction when `baseWritingDirection` is `.natural`.
|
||||
var firstStrongCharacterIsRTL: Bool {
|
||||
for scalar in unicodeScalars {
|
||||
let value = scalar.value
|
||||
// Strong RTL: Hebrew, Arabic, Syriac, Thaana, NKo, Samaritan, Mandaic,
|
||||
// Arabic Extended, and their presentation forms.
|
||||
let isStrongRTL = (0x0590...0x08FF).contains(value) ||
|
||||
(0xFB1D...0xFDFF).contains(value) ||
|
||||
(0xFE70...0xFEFF).contains(value)
|
||||
if isStrongRTL { return true }
|
||||
if scalar.properties.isAlphabetic { return false }
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
extension String {
|
||||
/// To be used if the string is actually a URL
|
||||
var asSanitizedLink: String {
|
||||
|
||||
Reference in New Issue
Block a user