Adding text wrap and logic for placing nodes in the svg

This commit is contained in:
Knut Sveidqvist
2022-07-23 10:16:54 +02:00
parent 6029c5371e
commit 7de68f0bf2
14 changed files with 564 additions and 46 deletions

View File

@@ -1,6 +1,5 @@
/** Created by knut on 15-01-14. */
import { log } from '../../logger';
import { sanitizeText } from '../../diagram-api/diagramAPI';
import { log, sanitizeText, getConfig } from '../../diagram-api/diagramAPI';
var message = '';
var info = false;
@@ -26,7 +25,14 @@ export const getMindmap = () => {
return nodes.length > 0 ? nodes[0] : null;
};
export const addNode = (level, id, descr, type) => {
const node = { id: sanitizeText(id), level, descr: sanitizeText(descr), type, children: [] };
const node = {
id: sanitizeText(id),
level,
descr: sanitizeText(descr),
type,
children: [],
width: getConfig().mindmap.maxNodeWidth,
};
const parent = getParent(level);
if (parent) {
parent.children.push(node);