1
0
Fork 0
forked from 0x2620/oxjs

add 'unformat' option to editables

This commit is contained in:
rolux 2014-12-16 20:38:41 +00:00
commit e43881c594
3 changed files with 8 additions and 3 deletions

View file

@ -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(/<br\/?><br\/?>/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 ? '&nbsp;'
: self.options.type == 'input'
? value.replace(/ /g, '&nbsp;')