small tweaks
This commit is contained in:
@@ -233,6 +233,9 @@ export const measureDominionText = async (
|
||||
) {
|
||||
line.pieces = line.pieces.slice(0, -1);
|
||||
}
|
||||
line.width = line.pieces
|
||||
.map((piece) => piece.measure.width)
|
||||
.reduce((a, b) => a + b);
|
||||
return line;
|
||||
}),
|
||||
width: Math.max(...lines.map((line) => line.width)),
|
||||
@@ -308,7 +311,7 @@ export const parse = (text: string): Piece[] => {
|
||||
pieces.push({ type: "coin", text: text.slice(i + 1, i + end) });
|
||||
i += end - 1;
|
||||
} else {
|
||||
const end = text.slice(i).match(/\S+/)![0].length;
|
||||
const end = text.slice(i).match(/[^$ \n]+/)![0].length;
|
||||
pieces.push({ type: "text", text: text.slice(i, i + end) });
|
||||
i += end - 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user