Skip to content

Commit

Permalink
remove explicit widths from tinymce tables; wrap & scroll tinymce tables
Browse files Browse the repository at this point in the history
  • Loading branch information
ahamelers committed Jul 8, 2024
1 parent d71945a commit 62e5a69
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions app/assets/stylesheets/scss/_columns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

.c-columns__content, #page-content {
padding-left: 2px;
overflow: auto;
overflow-wrap: anywhere;

@include bp(screen3) {
Expand Down
6 changes: 6 additions & 0 deletions app/javascript/react/components/MetadataEntry/Description.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ export default function Description({
table_toolbar: 'tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | '
+ 'tableinsertcolbefore tableinsertcolafter tabledeletecol',
content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:14px }',
invalid_styles: {
table: 'width height',
tr: 'width height',
th: 'width height',
td: 'width height',
},
branding: false,
paste_block_drop: true,
paste_preprocess,
Expand Down
7 changes: 7 additions & 0 deletions app/models/stash_datacite/description.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ def update_search_words
resource&.identifier&.update_search_words! if description_type == 'abstract' && saved_change_to_description?
end

def display_desc
fragment = Nokogiri::HTML5.fragment(description)
tables = fragment.css('table')
tables.wrap('<div class="table-wrapper"></div>')
fragment.to_html
end

after_save :update_search_words
end
end
6 changes: 3 additions & 3 deletions app/views/stash_datacite/descriptions/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h3 class="o-heading__level2">Abstract</h3>
<% end %>
<div class="t-landing__text-wall <%= 'highlight' if highlight_fields.include?('abstract') %>">
<%= raw(abstract.description) %>
<%= raw(abstract.display_desc) %>
</div>
<% end %>

Expand All @@ -16,7 +16,7 @@
<h3 class="o-heading__level2">Methods</h3>
<% end %>
<div class="t-landing__text-wall <%= 'highlight' if highlight_fields.include?('methods') %>">
<%= raw(methods.description) %>
<%= raw(methods.display_desc) %>
</div>
<% end %>

Expand All @@ -27,6 +27,6 @@
<h3 class="o-heading__level2">Usage notes</h3>
<% end %>
<div class="t-landing__text-wall <%= 'highlight' if highlight_fields.include?('usage_notes') %>">
<%= raw(other.description) %>
<%= raw(other.display_desc) %>
</div>
<% end %>

0 comments on commit 62e5a69

Please sign in to comment.