Explorar el Código

Make bidirectional support a preference

Fixes #270
Zed hace 5 años
padre
commit
82fe5d8b78
Se han modificado 3 ficheros con 13 adiciones y 1 borrados
  1. 3 0
      src/prefs_impl.nim
  2. 5 0
      src/sass/tweet/_base.scss
  3. 5 1
      src/views/tweet.nim

+ 3 - 0
src/prefs_impl.nim

@@ -88,6 +88,9 @@ genPrefs:
     stickyProfile(checkbox, true):
       "Make profile sidebar stick to top"
 
+    bidiSupport(checkbox, false):
+      "Support bidirectional text (makes clicking on tweets harder)"
+
     hideTweetStats(checkbox, false):
       "Hide tweet stats (replies, retweets, likes)"
 

+ 5 - 0
src/sass/tweet/_base.scss

@@ -20,6 +20,11 @@
     font-family: $font_3;
     line-height: 1.4em;
     pointer-events: all;
+    display: inline;
+}
+
+.tweet-bidi {
+    display: block !important;
 }
 
 .tweet-header {

+ 5 - 1
src/views/tweet.nim

@@ -299,7 +299,11 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; index=0;
          (tweet.reply.len > 1 or tweet.reply[0] != tweet.profile.username):
         renderReply(tweet)
 
-      tdiv(class="tweet-content media-body", dir="auto"):
+      var tweetClass = "tweet-content media-body"
+      if prefs.bidiSupport:
+        tweetClass &= " tweet-bidi"
+
+      tdiv(class=tweetClass, dir="auto"):
         verbatim replaceUrl(tweet.text, prefs) & renderLocation(tweet)
 
       if tweet.attribution.isSome: