From e43881c59465349d8294e68ec6c60011d5735bad Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 16 Dec 2014 20:38:41 +0000 Subject: [PATCH] add 'unformat' option to editables --- source/UI/js/Form/ArrayEditable.js | 2 ++ source/UI/js/Form/Editable.js | 7 +++++-- source/UI/js/Video/AnnotationFolder.js | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/source/UI/js/Form/ArrayEditable.js b/source/UI/js/Form/ArrayEditable.js index acf5954c..4efb2d50 100644 --- a/source/UI/js/Form/ArrayEditable.js +++ b/source/UI/js/Form/ArrayEditable.js @@ -41,6 +41,7 @@ Ox.ArrayEditable = function(options, self) { submitOnBlur: true, tooltipText: '', type: 'input', + unformat: null, width: 256 }) .options(options || {}) @@ -185,6 +186,7 @@ Ox.ArrayEditable = function(options, self) { : '' ), type: self.options.type, + unformat: self.options.unformat, value: item.value, width: self.options.type == 'input' ? 0 : self.options.width - 9 }) diff --git a/source/UI/js/Form/Editable.js b/source/UI/js/Form/Editable.js index 93f0bd71..8f98f3f3 100644 --- a/source/UI/js/Form/Editable.js +++ b/source/UI/js/Form/Editable.js @@ -37,6 +37,7 @@ Ox.Editable = function(options, self) { tags: null, tooltip: '', type: 'input', + unformat: null, value: '', width: 0 }) @@ -199,12 +200,14 @@ Ox.Editable = function(options, self) { function formatInputValue() { return self.options.type == 'input' - ? self.options.value + ? (self.options.unformat || Ox.identity)(self.options.value) : self.options.value.replace(//g, '\n\n'); } function formatTestValue() { - var value = Ox.encodeHTMLEntities(self.$input.options('value')); + var value = Ox.encodeHTMLEntities( + (self.options.unformat || Ox.identity)(self.$input.options('value')) + ); return !value ? ' ' : self.options.type == 'input' ? value.replace(/ /g, ' ') diff --git a/source/UI/js/Video/AnnotationFolder.js b/source/UI/js/Video/AnnotationFolder.js index 16603e64..b3689c49 100644 --- a/source/UI/js/Video/AnnotationFolder.js +++ b/source/UI/js/Video/AnnotationFolder.js @@ -295,7 +295,7 @@ Ox.AnnotationFolder = function(options, self) { autocompleteSelect: true, autocompleteSelectHighlight: true, autocompleteSelectMaxWidth: 256, - format: function(value) { + unformat: function(value) { return Ox.stripTags(value); } } : {}))