mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-25 00:03:27 +08:00
Merge pull request #2906 from urbanrotnik/ur-sci-5043-v2
Fix missing elements from list elements[SCI-5043]
This commit is contained in:
commit
20958adc34
2 changed files with 10 additions and 1 deletions
|
@ -99,6 +99,10 @@ module Reports
|
|||
link I18n.t('projects.reports.renderers.lists.appended_table'), item[:bookmark_id] do
|
||||
internal true
|
||||
end
|
||||
elsif %w(text).include?(item[:type])
|
||||
# TODO: Text with styles, not working yet.
|
||||
style = item[:style] || {}
|
||||
text item[:value], style
|
||||
end
|
||||
else
|
||||
text item
|
||||
|
|
|
@ -148,7 +148,8 @@ module Reports
|
|||
end
|
||||
|
||||
def list_element(list_element)
|
||||
data_array = list_element.children.select { |n| %w(li ul ol a img).include?(n.name) }.map do |li_child|
|
||||
allowed_elements = %w(li ul ol a img strong em h1 h2 h2 h3 h4 h5 span)
|
||||
data_array = list_element.children.select { |n| allowed_elements.include?(n.name) }.map do |li_child|
|
||||
li_child.children.map do |item|
|
||||
if item.is_a? Nokogiri::XML::Text
|
||||
item.text.chomp
|
||||
|
@ -160,6 +161,10 @@ module Reports
|
|||
img_element(item)&.merge(bookmark_id: SecureRandom.hex)
|
||||
elsif %w(table).include?(item.name)
|
||||
tiny_mce_table_element(item).merge(bookmark_id: SecureRandom.hex)
|
||||
elsif %w(strong em h1 h2 h2 h3 h4 h5 span).include?(item.name)
|
||||
# Pass styles and extend renderer for li with style, some limitations on li items
|
||||
# { type: 'text', value: item[:value], style: paragraph_styling(item) }
|
||||
item.children.text
|
||||
end
|
||||
end.reject(&:blank?)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue