From 0940d7317ba4ea3ee3f7cf4b5fdd5599e547edba Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 4 Feb 2014 06:46:28 +0000 Subject: [PATCH] Editables: when formatting input value, make sure < and > stay < and > --- source/Ox.UI/js/Form/Editable.js | 6 ++++-- source/Ox.UI/js/Form/EditableContent.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/Ox.UI/js/Form/Editable.js b/source/Ox.UI/js/Form/Editable.js index 98bc563a..ee4e8a23 100644 --- a/source/Ox.UI/js/Form/Editable.js +++ b/source/Ox.UI/js/Form/Editable.js @@ -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(//g, '\n\n') + ? self.options.value + : self.options.value.replace(//g, '\n\n') + .replace(/</g, '&lt;') + .replace(/>/g, '&gt;') ); } diff --git a/source/Ox.UI/js/Form/EditableContent.js b/source/Ox.UI/js/Form/EditableContent.js index 265bd25c..0e147d3a 100644 --- a/source/Ox.UI/js/Form/EditableContent.js +++ b/source/Ox.UI/js/Form/EditableContent.js @@ -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, '

\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(//g, '\n\n') + .replace(/</g, '&lt;') + .replace(/>/g, '&gt;') ); }