diff --git a/app/models/tiny_mce_asset.rb b/app/models/tiny_mce_asset.rb index a43392a5f..c5667e145 100644 --- a/app/models/tiny_mce_asset.rb +++ b/app/models/tiny_mce_asset.rb @@ -49,6 +49,9 @@ class TinyMceAsset < ApplicationRecord end def self.generate_url(description) + # Check tinymce for old format + description = update_old_tinymce(description) + description = Nokogiri::HTML(description) tm_assets = description.css('img') tm_assets.each do |tm_asset| @@ -105,7 +108,7 @@ class TinyMceAsset < ApplicationRecord def self.update_old_tinymce(description) description.scan(/\[~tiny_mce_id:(\w+)\]/).flatten.each do |token| old_format = /\[~tiny_mce_id:#{token}\]/ - new_format = "" + new_format = "" description.sub!(old_format, new_format) end description