Automatically add key to "rt-if" if missing (fixes #99)

This commit is contained in:
nino-porcino 2016-05-02 16:05:54 +02:00 committed by Omer Ganim
parent 731296b27a
commit b2483bd2de
2 changed files with 4 additions and 1 deletions

View File

@ -329,6 +329,9 @@ function convertHtmlToReact(node, context) {
if (node.attribs[ifAttr]) { if (node.attribs[ifAttr]) {
validateIfAttribute(node, context, data); validateIfAttribute(node, context, data);
data.condition = node.attribs[ifAttr].trim(); data.condition = node.attribs[ifAttr].trim();
if (!node.attribs.key) {
_.set(node, ['attribs', 'key'], `${node.startIndex}`);
}
} }
data.props = generateProps(node, context); data.props = generateProps(node, context);

View File

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