#3358 Review changes

This commit is contained in:
Knut Sveidqvist
2024-01-30 14:37:06 +01:00
parent 10237976f3
commit 452cb83ad7
3 changed files with 11 additions and 20 deletions

View File

@@ -83,7 +83,7 @@ export const setCssClass = function (itemIds: string, cssClassName: string) {
});
};
const populateBlockDatabase = (_blockList: (Block[] | Block[][]), parent: Block): void => {
const populateBlockDatabase = (_blockList: Block[] | Block[][], parent: Block): void => {
const blockList = _blockList.flat();
const children = [];
for (const block of blockList) {
@@ -265,13 +265,14 @@ const getColumns = (blockid: string): number => {
* @returns
*/
const getBlocksFlat = () => {
const result: Block[] = [];
// log.debug('abc88 getBlocksFlat', blockDatabase);
const keys = Object.keys(blockDatabase);
for (const key of keys) {
result.push(blockDatabase[key]);
}
return result;
// const result: Block[] = [];
// // log.debug('abc88 getBlocksFlat', blockDatabase);
// const keys = Object.keys(blockDatabase);
// for (const key of keys) {
// result.push(blockDatabase[key]);
// }
// return result;
return [...Object.values(blockDatabase)];
};
/**
* Returns the the hierarchy of blocks
@@ -280,6 +281,7 @@ const getBlocksFlat = () => {
const getBlocks = () => {
return blocks || [];
};
const getEdges = () => {
return edgeList;
};

View File

@@ -5,12 +5,6 @@ import db from './blockDB.js';
import flowStyles from './styles.js';
import renderer from './blockRenderer.js';
// TODO: do we need this?
// import { prepareTextForParsing } from './blockUtils.js';
// const originalParse = parser.parse.bind(parser);
// parser.parse = (text: string) => originalParse(prepareTextForParsing(text));
// parser.yy.getLogger = () => console;
export const diagram: DiagramDefinition = {
parser,
db,

View File

@@ -25,12 +25,7 @@ import { configureSvgSize } from '../../setupGraphViewbox.js';
* @returns ClassDef - The styles
*/
export const getClasses = function (text: any, diagObj: any) {
log.debug('Extracting classes', diagObj.db.getClasses());
try {
return diagObj.db.getClasses();
} catch (e) {
return;
}
return diagObj.db.getClasses();
};
export const draw = async function (