mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-07 05:34:55 +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
|
module TinyMceHelper
|
||||||
def parse_tiny_mce_asset_to_token(text, obj)
|
def parse_tiny_mce_asset_to_token(text, obj)
|
||||||
ids = []
|
ids = []
|
||||||
html = Nokogiri::HTML(text)
|
html = Nokogiri::HTML(remove_pasted_tokens(text))
|
||||||
html.search('img').each do |img|
|
html.search('img').each do |img|
|
||||||
next unless img['data-token']
|
next unless img['data-token']
|
||||||
img_id = Base62.decode(img['data-token'])
|
img_id = Base62.decode(img['data-token'])
|
||||||
|
@ -66,8 +66,8 @@ module TinyMceHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_parse_token_permissions(obj, img)
|
def remove_pasted_tokens(text)
|
||||||
return true if obj.class == Step && img.result_text.nil?
|
regex = Constants::TINY_MCE_ASSET_REGEX
|
||||||
return true if obj.class == ResultText && img.step.nil?
|
text.gsub(regex, ' ')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
<em><%= t("protocols.steps.no_description") %></em>
|
<em><%= t("protocols.steps.no_description") %></em>
|
||||||
<% else %>
|
<% else %>
|
||||||
<div class="ql-editor">
|
<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>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue