mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-01 13:13:22 +08:00
fix protocol preview, remove unneeded functions, fix copy paste tokens
This commit is contained in:
parent
e69e9f6794
commit
7442684846
2 changed files with 5 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
module TinyMceHelper
|
||||
def parse_tiny_mce_asset_to_token(text, obj)
|
||||
ids = []
|
||||
html = Nokogiri::HTML(text)
|
||||
html = Nokogiri::HTML(remove_pasted_tokens(text))
|
||||
html.search('img').each do |img|
|
||||
next unless img['data-token']
|
||||
img_id = Base62.decode(img['data-token'])
|
||||
|
@ -66,8 +66,8 @@ module TinyMceHelper
|
|||
end
|
||||
end
|
||||
|
||||
def check_parse_token_permissions(obj, img)
|
||||
return true if obj.class == Step && img.result_text.nil?
|
||||
return true if obj.class == ResultText && img.step.nil?
|
||||
def remove_pasted_tokens(text)
|
||||
regex = Constants::TINY_MCE_ASSET_REGEX
|
||||
text.gsub(regex, ' ')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<em><%= t("protocols.steps.no_description") %></em>
|
||||
<% else %>
|
||||
<div class="ql-editor">
|
||||
<%= sanitize_input(generate_image_tag_from_token(step.description), ['img']) %>
|
||||
<%= sanitize_input(generate_image_tag_from_token(step.description, step), ['img']) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue