diff --git a/Gemfile b/Gemfile index b01ab29ad62464c6031fec4e4bd16c404928a6fa..140bdf705713bc451b99bcddec8e697dd7427a23 100644 --- a/Gemfile +++ b/Gemfile @@ -46,7 +46,7 @@ gem 'simple-navigation' gem 'simple_form' gem 'simple_form_bs5_file_input'#, path: '../simple_form_bs5_file_input' gem 'simple_form_password_with_hints'#, path: '../simple_form_password_with_hints' -gem 'summernote-rails', git: 'https://github.com/noesya/summernote-rails.git', branch: 'activestorage' +gem 'summernote-rails', git: 'https://github.com/noesya/summernote-rails.git', branch: 'feature/cleaner' # gem 'summernote-rails', path: '../summernote-rails' gem 'two_factor_authentication', git: 'https://github.com/noesya/two_factor_authentication.git' # gem 'two_factor_authentication', path: '../two_factor_authentication' diff --git a/Gemfile.lock b/Gemfile.lock index e76deb9aee181111bdcf3b5c6e5537c9b344274e..bb4f7801a59fb34c9acb2a84e98500d0bf48c672 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,10 @@ GIT remote: https://github.com/noesya/summernote-rails.git - revision: 529473cfdd85a50de64c6a7c8bce476cec8e85de - branch: activestorage + revision: da6e54c1e45c09dbeef2382d50f390aba968bd63 + branch: feature/cleaner specs: - summernote-rails (0.8.24.0) - rails (>= 6.0) + summernote-rails (0.8.20.1) + railties (>= 3.1) GIT remote: https://github.com/noesya/two_factor_authentication.git @@ -89,11 +89,11 @@ GEM execjs (~> 2) aws-eventstream (1.2.0) aws-partitions (1.589.0) - aws-sdk-core (3.131.0) + aws-sdk-core (3.131.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.525.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) + jmespath (~> 1, >= 1.6.1) aws-sdk-kms (1.57.0) aws-sdk-core (~> 3, >= 3.127.0) aws-sigv4 (~> 1.1) @@ -545,4 +545,4 @@ RUBY VERSION ruby 2.7.5p203 BUNDLED WITH - 2.3.12 + 2.3.9 diff --git a/app/models/communication/website/imported/page.rb b/app/models/communication/website/imported/page.rb index f4dbdce8b81fd6e8eaea69c81cbe758c6badc6f7..18420493d442c459c29460b24a6b35195b094e8d 100644 --- a/app/models/communication/website/imported/page.rb +++ b/app/models/communication/website/imported/page.rb @@ -122,6 +122,6 @@ class Communication::Website::Imported::Page < ApplicationRecord end end end - page.update(text: rich_text_with_attachments(page.text.to_s)) + page.update(text: rich_text_with_attachments(page.text)) end end diff --git a/app/models/communication/website/imported/post.rb b/app/models/communication/website/imported/post.rb index 8e2bcaec9fdd9d675bc39f557c55f873ce59a9c2..0c77bc954ea42d38ec2479fc0293e80ee1f7cceb 100644 --- a/app/models/communication/website/imported/post.rb +++ b/app/models/communication/website/imported/post.rb @@ -122,7 +122,7 @@ class Communication::Website::Imported::Post < ApplicationRecord content_type: featured_medium.file.blob.content_type ) else - fragment = Nokogiri::HTML.fragment(post.text.body.to_html) + fragment = Nokogiri::HTML.fragment(post.text) image = fragment.css('img').first if image.present? begin @@ -135,6 +135,6 @@ class Communication::Website::Imported::Post < ApplicationRecord end end end - post.update(text: rich_text_with_attachments(post.text.body.to_html)) + post.update(text: rich_text_with_attachments(post.text)) end end diff --git a/app/services/osuny/sanitizer.rb b/app/services/osuny/sanitizer.rb index ede92d17125ac5eb9b3365f935a1a1f0c57ac37f..bb3484bf258bb311cea4dd5f9539f42200856559 100644 --- a/app/services/osuny/sanitizer.rb +++ b/app/services/osuny/sanitizer.rb @@ -9,12 +9,8 @@ class Osuny::Sanitizer private - # input can be String or ActionText::Content def self.sanitize_text(input) - input.is_a?(String) ? safe_list_sanitizer.sanitize(input) - : ActionText::Content.new( - safe_list_sanitizer.sanitize(input.to_html) - ) + safe_list_sanitizer.sanitize(input) end def self.sanitize_string(string) diff --git a/app/views/admin/communication/websites/pages/_form.html.erb b/app/views/admin/communication/websites/pages/_form.html.erb index 00d096e51246a0b8869a5c9227360a2c4327b5e4..d32d113d373408172e0e452249241c17a5b218e0 100644 --- a/app/views/admin/communication/websites/pages/_form.html.erb +++ b/app/views/admin/communication/websites/pages/_form.html.erb @@ -13,7 +13,7 @@ <%= f.input :breadcrumb_title %> <%= f.input :description_short, input_html: { value: page.description_short&.gsub('&', '&') } %> <%= f.input :header_text, as: :string %> - <%= f.input :text, as: :summernote if page.text&.to_plain_text.present? %> + <%= f.input :text, as: :summernote if page.text&.present? %> </div> </div> <div class="card"> diff --git a/app/views/admin/communication/websites/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb index 0b5b5f084162a58ca88921b755da1300e6850d8d..b86553e58735c655d2d2fcc96f28ba70a71965fa 100644 --- a/app/views/admin/communication/websites/pages/show.html.erb +++ b/app/views/admin/communication/websites/pages/show.html.erb @@ -20,7 +20,7 @@ </div> <div class="card-body"> <%= render 'admin/application/property/text', object: @page, property: :description_short %> - <%= render 'admin/application/property/text', object: @page, property: :text if @page.text&.to_plain_text.present? %> + <%= render 'admin/application/property/text', object: @page, property: :text if @page.text&.present? %> </div> </div> <%= render 'admin/communication/blocks/list', about: @page %>