Fixed console spam when importing block palettes with blank lines

This commit is contained in:
Lucas Dower 2023-04-17 18:38:33 +01:00
parent 9b05272372
commit ab5e8476d1
No known key found for this signature in database
GPG Key ID: B3EE6B8499593605

View File

@ -103,10 +103,15 @@ export class PaletteComponent extends ConfigComponent<Palette, HTMLDivElement> {
});
AppConsole.info(LOC('assign.deselected_blocks', { count: countDeselected }));
AppConsole.info(LOC('assign.found_blocks', { count: blockNames.length }));
let countFound = 0;
let countChecked = 0;
blockNames.forEach((blockName) => {
blockName = blockName.trim();
if (blockName.length === 0) {
return;
}
++countFound;
if (!AppUtil.Text.isNamespacedBlock(blockName)) {
AppConsole.error(LOC('assign.block_not_namespaced', { block_name: blockName }));
} else {
@ -120,6 +125,7 @@ export class PaletteComponent extends ConfigComponent<Palette, HTMLDivElement> {
}
});
AppConsole.info(LOC('assign.found_blocks', { count: countFound }));
AppConsole.info(LOC('assign.selected_blocks', { count: countChecked }));
this._onCountSelectedChanged();