Don't ignore whitespace in html text

This commit is contained in:
amitk 2014-11-30 10:55:38 +02:00
parent dddc3770a4
commit 68b6015bfd
2 changed files with 5 additions and 6 deletions

View File

@ -48,7 +48,6 @@ function concatChildren(children) {
var curlyMap = {'{': 1, '}': -1};
function convertText(node, context, txt) {
txt = txt.trim();
var res = '';
var first = true;
while (txt.indexOf('{') !== -1) {
@ -192,13 +191,13 @@ function generateProps(node, context) {
}));
var styleArray = [];
_.forEach(styleParts, function (stylePart) {
styleArray.push(stringUtils.convertToCamelCase(stylePart[0]) + ' : ' + convertText(node, context, stylePart[1]));
styleArray.push(stringUtils.convertToCamelCase(stylePart[0]) + ' : ' + convertText(node, context, stylePart[1].trim()));
});
props[propKey] = '{' + styleArray.join(',') + '}';
} else if (key === classSetProp) {
props[propKey] = classSetTemplate({classSet: val});
} else if (key.indexOf('rt-') !== 0) {
props[propKey] = convertText(node, context, val);
props[propKey] = convertText(node, context, val.trim());
}
});
@ -298,7 +297,7 @@ function convertHtmlToReact(node, context) {
return (commentTemplate(node));
} else if (node.type === 'text') {
if (node.data.trim()) {
return convertText(node, context, node.data.trim());
return convertText(node, context, node.data);
}
return '';
}

View File

@ -26,6 +26,6 @@ define([
height: '100%',
border: '0'
}
}))), React.DOM.div({}, 'editor', !this.props.editorState.previewMode ? React.DOM.div({}, 'left bar') : null));
}))), React.DOM.div({}, 'editor\n ', !this.props.editorState.previewMode ? React.DOM.div({}, 'left bar') : null));
};
});
});