diff --git a/packages/mindplot/src/components/import/FreemindImporter.ts b/packages/mindplot/src/components/import/FreemindImporter.ts index ece2cd7c..476578eb 100644 --- a/packages/mindplot/src/components/import/FreemindImporter.ts +++ b/packages/mindplot/src/components/import/FreemindImporter.ts @@ -17,6 +17,8 @@ import FreemindArrowLink from '../export/freemind/Arrowlink'; import VersionNumber from '../export/freemind/importer/VersionNumber'; import FreemindIconConverter from './FreemindIconConverter'; import NoteModel from '../model/NoteModel'; +import FeatureModelFactory from '../model/FeatureModelFactory'; +import FeatureModel from '../model/FeatureModel'; export default class FreemindImporter extends Importer { private mindmap: Mindmap; @@ -61,7 +63,7 @@ export default class FreemindImporter extends Importer { this.nodesmap.set(freeNode.getId(), wiseTopic); - this.convertChildNodes(freeNode, wiseTopic, this.mindmap, 1, wiseTopicId); + this.convertChildNodes(freeNode, wiseTopic, this.mindmap, 1); this.addRelationship(this.mindmap); this.mindmap.setDescription(description); @@ -153,7 +155,7 @@ export default class FreemindImporter extends Importer { if (folded) wiseTopic.setChildrenShrunken(folded); } - private convertChildNodes(freeParent: FreemindNode, wiseParent: NodeModel, mindmap: Mindmap, depth: number, nodeId: number): void { + private convertChildNodes(freeParent: FreemindNode, wiseParent: NodeModel, mindmap: Mindmap, depth: number): void { const freeChilden = freeParent.getArrowlinkOrCloudOrEdge(); let currentWiseTopic: NodeModel = wiseParent; let order = 0; @@ -188,9 +190,7 @@ export default class FreemindImporter extends Importer { // Convert the rest of the node properties... this.convertNodeProperties(child, wiseChild, false); - if (child.getArrowlinkOrCloudOrEdge().length > 0) { - this.convertChildNodes(child, wiseChild, mindmap, depth++, nodeId); - } + this.convertChildNodes(child, wiseChild, mindmap, depth++); if (wiseChild !== wiseParent) { wiseParent.append(wiseChild); @@ -239,7 +239,7 @@ export default class FreemindImporter extends Importer { if (type === 'NOTE') { // Formating text const text = this.html2Text(child.getHtml()); - const noteModel: NoteModel = new NoteModel({ text: text || FreemindConstant.EMPTY_NOTE }); + const noteModel: FeatureModel = FeatureModelFactory.createModel('note', { text: text || FreemindConstant.EMPTY_NOTE }); currentWiseTopic.addFeature(noteModel); } } @@ -309,6 +309,8 @@ export default class FreemindImporter extends Importer { result = TopicShape.ROUNDED_RECT; } else if (node.getBackgorundColor()) { result = TopicShape.RECTANGLE; + } else { + result = TopicShape.LINE; } return result; } @@ -378,7 +380,7 @@ export default class FreemindImporter extends Importer { } } else { const position = wiseParent.getPosition(); - y = position.y - ((childrenCount / 2) * FreemindConstant.SECOND_LEVEL_TOPIC_HEIGHT - (order * FreemindConstant.SECOND_LEVEL_TOPIC_HEIGHT)); + y = Math.round(position.y - ((childrenCount / 2) * FreemindConstant.SECOND_LEVEL_TOPIC_HEIGHT - (order * FreemindConstant.SECOND_LEVEL_TOPIC_HEIGHT))); } return { @@ -389,7 +391,6 @@ export default class FreemindImporter extends Importer { private html2Text(content: string): string { const contentConvert = content.replace(/(<([^>]+)>)/gi, ''); - contentConvert.replace('\t', ''); return contentConvert.trim(); } } diff --git a/packages/mindplot/test/unit/import/expected/bug2.wxml b/packages/mindplot/test/unit/import/expected/bug2.wxml index 713e55e2..4e7394c4 100644 --- a/packages/mindplot/test/unit/import/expected/bug2.wxml +++ b/packages/mindplot/test/unit/import/expected/bug2.wxml @@ -1,49 +1,44 @@ - - - - - + + + + + - - - - - - - - + + + + + + + + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - + A diferencia de la práctica tradicional, pretendemos ahondar en el conocimiento partiendo de lo que realmente interesa al niño o niña, + ayudándole a que encuentre respuesta a las preguntas que él o ella se plantea. + + Por ese motivo, SaberMás proyecta estar al lado de los niños que necesitan una motivación extra para entender la escuela y fluir en ella, + y también al lado de aquellos a quienes la curiosidad y las ganas de saber les lleva más allá.]]> + + + + + \ No newline at end of file