From 3160b30dec8a8661e7bebac92e011f3acef19059 Mon Sep 17 00:00:00 2001 From: f Date: Wed, 16 Mar 2022 17:49:28 -0300 Subject: [PATCH] eliminar atributo style del editor --- app/models/metadata_content.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/models/metadata_content.rb b/app/models/metadata_content.rb index 9d3a1040..9516b907 100644 --- a/app/models/metadata_content.rb +++ b/app/models/metadata_content.rb @@ -72,6 +72,17 @@ class MetadataContent < MetadataTemplate resource['controls'] = true end + # Elimina los estilos salvo los que asigne el editor + html.css('*').each do |element| + next if elements_with_style.include? element.name.downcase + + element.remove_attribute('style') + end + html.to_s.html_safe end + + def elements_with_style + @elements_with_style ||= %w[div mark].freeze + end end