Browse Source

Detect when the node has already a type defined

pull/1229/head
Artur Arseniev 8 years ago
parent
commit
6dc37f652a
  1. 21
      src/parser/model/ParserHtml.js

21
src/parser/model/ParserHtml.js

@ -71,15 +71,22 @@ module.exports = config => {
// Start with understanding what kind of component it is
if (ct) {
let obj = '';
let type =
node.getAttribute && node.getAttribute(`${modelAttrStart}type`);
// Iterate over all available Component Types and
// the first with a valid result will be that component
for (let it = 0; it < ct.length; it++) {
obj = ct[it].model.isComponent(node);
if (obj) break;
}
// If the type is already defined, use it
if (type) {
model = { type };
} else {
// Iterate over all available Component Types and
// the first with a valid result will be that component
for (let it = 0; it < ct.length; it++) {
obj = ct[it].model.isComponent(node);
if (obj) break;
}
model = obj;
model = obj;
}
}
// Set tag name if not yet done

Loading…
Cancel
Save