mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-09 21:36:44 +08:00
Add check for old tinymce for report and reassign process
This commit is contained in:
parent
5d959f648e
commit
f201c5440b
1 changed files with 9 additions and 1 deletions
|
@ -13,6 +13,10 @@ module TinyMceImages
|
||||||
|
|
||||||
def prepare_for_report(field)
|
def prepare_for_report(field)
|
||||||
description = self[field]
|
description = self[field]
|
||||||
|
|
||||||
|
# Check tinymce for old format
|
||||||
|
description = TinyMceAsset.update_old_tinymce(description)
|
||||||
|
|
||||||
tiny_mce_assets.each do |tm_asset|
|
tiny_mce_assets.each do |tm_asset|
|
||||||
tmp_f = Tempfile.open(tm_asset.image_file_name, Rails.root.join('tmp'))
|
tmp_f = Tempfile.open(tm_asset.image_file_name, Rails.root.join('tmp'))
|
||||||
begin
|
begin
|
||||||
|
@ -41,7 +45,11 @@ module TinyMceImages
|
||||||
# and updates references in assosiated object's description
|
# and updates references in assosiated object's description
|
||||||
def reassign_tiny_mce_image_references(images = [])
|
def reassign_tiny_mce_image_references(images = [])
|
||||||
object_field = Extends::RICH_TEXT_FIELD_MAPPINGS[self.class.name]
|
object_field = Extends::RICH_TEXT_FIELD_MAPPINGS[self.class.name]
|
||||||
parsed_description = Nokogiri::HTML(read_attribute(object_field))
|
description = read_attribute(object_field)
|
||||||
|
# Check tinymce for old format
|
||||||
|
description = TinyMceAsset.update_old_tinymce(description)
|
||||||
|
|
||||||
|
parsed_description = Nokogiri::HTML(description)
|
||||||
images.each do |image|
|
images.each do |image|
|
||||||
old_id = image[0]
|
old_id = image[0]
|
||||||
new_id = image[1]
|
new_id = image[1]
|
||||||
|
|
Loading…
Add table
Reference in a new issue