guardar y mostrar el html guardado
This commit is contained in:
parent
8ff1a43791
commit
3c8dc2d2cc
2 changed files with 14 additions and 2 deletions
|
@ -7,7 +7,6 @@
|
|||
MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
||||
:value, :help, :required, :errors, :post,
|
||||
:layout, keyword_init: true) do
|
||||
include ActionText::ContentHelper
|
||||
|
||||
attr_reader :value_was
|
||||
|
||||
|
@ -124,6 +123,18 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
|||
tags: allowed_tags,
|
||||
attributes: allowed_attributes,
|
||||
scrubber: scrubber).strip.html_safe
|
||||
en,
|
||||
|
||||
def sanitizer
|
||||
@sanitizer ||= Rails::Html::Sanitizer.safe_list_sanitizer.new
|
||||
end
|
||||
|
||||
def allowed_attributes
|
||||
@allowed_attributes ||= %w[style src alt controls data-align]
|
||||
end
|
||||
|
||||
def allowed_tags
|
||||
@allowed_tags ||= %w[strong em del u mark p h1 h2 h3 h4 h5 h6 ul ol li img iframe audio video div]
|
||||
end
|
||||
|
||||
# Decifra el valor
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
post: post, attribute: attribute, metadata: metadata
|
||||
|
||||
.editor
|
||||
= text_area_tag "post[#{attribute}]", metadata.value,
|
||||
= text_area_tag "post[#{attribute}]", '',
|
||||
dir: dir, lang: locale,
|
||||
**field_options(attribute, metadata), class: 'd-none'
|
||||
|
||||
|
@ -70,3 +70,4 @@
|
|||
%input.form-control{ type: 'url', data: { prop: 'link-href' } }/
|
||||
|
||||
.editor-content.form-control.h-auto{ contenteditable: 'true' }
|
||||
= metadata.value
|
||||
|
|
Loading…
Reference in a new issue