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,
|
MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
||||||
:value, :help, :required, :errors, :post,
|
:value, :help, :required, :errors, :post,
|
||||||
:layout, keyword_init: true) do
|
:layout, keyword_init: true) do
|
||||||
include ActionText::ContentHelper
|
|
||||||
|
|
||||||
attr_reader :value_was
|
attr_reader :value_was
|
||||||
|
|
||||||
|
@ -124,6 +123,18 @@ MetadataTemplate = Struct.new(:site, :document, :name, :label, :type,
|
||||||
tags: allowed_tags,
|
tags: allowed_tags,
|
||||||
attributes: allowed_attributes,
|
attributes: allowed_attributes,
|
||||||
scrubber: scrubber).strip.html_safe
|
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
|
end
|
||||||
|
|
||||||
# Decifra el valor
|
# Decifra el valor
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
post: post, attribute: attribute, metadata: metadata
|
post: post, attribute: attribute, metadata: metadata
|
||||||
|
|
||||||
.editor
|
.editor
|
||||||
= text_area_tag "post[#{attribute}]", metadata.value,
|
= text_area_tag "post[#{attribute}]", '',
|
||||||
dir: dir, lang: locale,
|
dir: dir, lang: locale,
|
||||||
**field_options(attribute, metadata), class: 'd-none'
|
**field_options(attribute, metadata), class: 'd-none'
|
||||||
|
|
||||||
|
@ -70,3 +70,4 @@
|
||||||
%input.form-control{ type: 'url', data: { prop: 'link-href' } }/
|
%input.form-control{ type: 'url', data: { prop: 'link-href' } }/
|
||||||
|
|
||||||
.editor-content.form-control.h-auto{ contenteditable: 'true' }
|
.editor-content.form-control.h-auto{ contenteditable: 'true' }
|
||||||
|
= metadata.value
|
||||||
|
|
Loading…
Reference in a new issue