Skip to content

Commit

Permalink
basic rtl (right-to-left) support
Browse files Browse the repository at this point in the history
  • Loading branch information
mawise committed Jan 17, 2024
1 parent ad06570 commit 22397fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ GEM
net-smtp (0.3.3)
net-protocol
nio4r (2.7.0)
nokogiri (1.15.4-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
Expand Down Expand Up @@ -274,6 +276,7 @@ GEM
zeitwerk (2.6.11)

PLATFORMS
arm64-darwin-23
x86_64-darwin-20
x86_64-linux

Expand Down
2 changes: 1 addition & 1 deletion app/views/feeds/read.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% safe_tags = %w(h1 h2 h3 h4 h5 h6 img video audio source type figure figcaption a p span div pre code hr mark section main em i strong b blockquote cite del ul ol li table thead tbody tr th td br sup sub abbr)
safe_attr = %w(href src srcset sizes alt title id width border object-fit aspect-ratio start controls autoplay muted loop playsinline)
safe_attr = %w(href src srcset sizes alt title id width border object-fit aspect-ratio start controls autoplay muted loop playsinline dir)
no_style_or_scripts = Loofah::Scrubber.new do |node|
if node.name == "style" or node.name == "script"
node.remove
Expand Down
4 changes: 2 additions & 2 deletions app/views/posts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%= form_with model: @post, local: true do |form| %>
<%= form.date_field :date, :style => 'display:inline;', :value => @post.datetime.strftime("%Y-%m-%d"), type: (@settings.show_post_date ? :date : :hidden) %>
<%= form.time_field :time, :style => 'display:inline;', :value => @post.datetime.strftime("%H:%M"), type: (@settings.show_post_date ? :time : :hidden) %>
<%= form.text_area :content, :rows => 10, :style => 'display:block;width:100%;', :oninput => "doRender();", :value => @post.content %>
<%= form.text_area :content, :rows => 10, :dir => "auto", :style => 'display:block;width:100%;', :oninput => "doRender();", :value => @post.content %>
<%= form.file_field :pic, :accept => "image/*,.mp4,.mp3", :style => "display:inline;" %>
<%= form.submit :value => "Upload Selected Image", :style => "display:inline;" %>
<%= form.submit :value => "Save Post", :style => "display:block;" %>
Expand All @@ -12,7 +12,7 @@
<hr>


<div id="display">
<div id="display" dir="auto">
</div>

<script type="text/javascript">
Expand Down
2 changes: 2 additions & 0 deletions app/views/posts/_posts.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<div class="post-author"><%= post.author.name %></div>
<% end %>

<div dir="auto">
<%= CommonMarker.render_html(post.content, [:UNSAFE, :HARDBREAKS], PostsController::GFM_EXT).html_safe %>
</div>

<% if @settings.comments %>
<% if post.likes.size > 0 or post.comments.size > 0 %>
Expand Down

0 comments on commit 22397fc

Please sign in to comment.