Editables: when formatting input value, make sure < and > stay < and >
This commit is contained in:
parent
64a92791ac
commit
0940d7317b
2 changed files with 8 additions and 4 deletions
|
@ -190,8 +190,10 @@ Ox.Editable = function(options, self) {
|
|||
function formatInputValue() {
|
||||
return Ox.decodeHTMLEntities(
|
||||
self.options.type == 'input'
|
||||
? self.options.value
|
||||
: self.options.value.replace(/<br\/?><br\/?>/g, '\n\n')
|
||||
? self.options.value
|
||||
: self.options.value.replace(/<br\/?><br\/?>/g, '\n\n')
|
||||
.replace(/</g, '&lt;')
|
||||
.replace(/>/g, '&gt;')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,9 +87,9 @@ Ox.EditableContent = function(options, self) {
|
|||
});
|
||||
},
|
||||
paste: function(e) {
|
||||
Ox.print('PASTE', e);
|
||||
//Ox.print('PASTE', e);
|
||||
if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData) {
|
||||
Ox.print('TYPES', e.originalEvent.clipboardData.types);
|
||||
//Ox.print('TYPES', e.originalEvent.clipboardData.types);
|
||||
var value = e.originalEvent.clipboardData.getData('text/plain');
|
||||
value = Ox.encodeHTMLEntities(value).replace(/\n\n\n/g, '<br/><br/>\n');
|
||||
document.execCommand('insertHTML', false, value);
|
||||
|
@ -163,6 +163,8 @@ Ox.EditableContent = function(options, self) {
|
|||
self.options.type == 'input'
|
||||
? self.options.value
|
||||
: self.options.value.replace(/<br\/?><br\/?>/g, '\n\n')
|
||||
.replace(/</g, '&lt;')
|
||||
.replace(/>/g, '&gt;')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue