From f2c1073ce17342f47da533c0d32ab426b0b109f5 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Mon, 3 Oct 2016 12:37:53 -0700 Subject: fixing small bug with escaped/unescaped value on hidden input --- management/editor/elements.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'management') diff --git a/management/editor/elements.go b/management/editor/elements.go index 573272a..d48c1c8 100644 --- a/management/editor/elements.go +++ b/management/editor/elements.go @@ -36,6 +36,14 @@ func Textarea(fieldName string, p interface{}, attrs map[string]string) []byte { return domElement(e) } +// File returns the []byte of a HTML element with a label. +// IMPORTANT: +// The `fieldName` argument will cause a panic if it is not exactly the string +// form of the struct field that this editor input is representing +func File(fieldName string, p interface{}, attrs map[string]string) []byte { + return nil +} + // Richtext returns the []byte of a rich text editor (provided by http://summernote.org/) with a label. // IMPORTANT: // The `fieldName` argument will cause a panic if it is not exactly the string @@ -88,6 +96,11 @@ func Richtext(fieldName string, p interface{}, attrs map[string]string) []byte { ] }); + // initialize hidden input with escaped value + _editor.on('materialnote.init', function() { + hidden.val(_.escape(hidden.val())); + }) + // update hidden input with escaped value _editor.on('materialnote.change', function(e, content, $editable) { hidden.val(_.escape(content)); -- cgit v1.2.3