1
0
Fork 0
forked from 0x2620/oxjs

some improvements to Ox.Editable

This commit is contained in:
rlx 2011-10-27 08:47:31 +00:00
commit 1eb93125e6
2 changed files with 34 additions and 33 deletions

View file

@ -37,10 +37,9 @@ Ox.parseHTML <f> Takes HTML from an untrusted source and returns something sane
Ox.parseHTML = (function() {
var defaultTags = [
// fixme: why not p?
'a', 'b', 'blockquote', 'cite', 'code',
'a', 'b', 'blockquote', 'br', 'cite', 'code',
'del', 'em', 'i', 'img', 'ins',
'li', 'ol', 'q', 'rtl', 's',
'li', 'ol', 'p', 'q', 'rtl', 's',
'strong', 'sub', 'sup', 'ul', '[]'
],
parse = {
@ -89,7 +88,8 @@ Ox.parseHTML = (function() {
matches.forEach(function(match, i) {
html = html.replace(new RegExp(tab + i + tab, 'gi'), match);
});
html = html.replace(/\n/g, '<br/>\n');
//html = html.replace(/\n/g, '<br/>\n');
html = html.replace(/\n/g, '<br/>');
// close extra opening (and remove extra closing) tags
// note: this converts '&quot;' to '"'
return Ox.element('<div>').html(html).html();