diff options
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/views/StyleProviderQuiz.tsx | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/views/StyleProviderQuiz.tsx b/src/client/views/StyleProviderQuiz.tsx index bcb4b4ec1..0268771ff 100644 --- a/src/client/views/StyleProviderQuiz.tsx +++ b/src/client/views/StyleProviderQuiz.tsx @@ -1,6 +1,5 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Tooltip } from '@mui/material'; -import axios from 'axios'; import * as React from 'react'; import { returnFalse, setupMoveUpEvents } from '../../ClientUtils'; import { emptyFunction } from '../../Utils'; @@ -86,7 +85,7 @@ export namespace styleProviderQuiz { if (!quizBoxes.length) { imgBox.Loading = true; - const response = await Networking.PostToServer('/labels', { file: i ? i : imgBox.paths[0], drag: i ? 'drag' : 'full', smart: quiz }); + const response = (await Networking.PostToServer('/labels', { file: i ? i : imgBox.paths[0], drag: i ? 'drag' : 'full', smart: quiz })) as { result: string }; const parsedResponse = JSON.parse(response.result.replace(/'/g, '"')); if (parsedResponse['boxes'].length != 0) { createBoxes(imgBox, parsedResponse['boxes'], parsedResponse['text']); @@ -222,8 +221,8 @@ export namespace styleProviderQuiz { */ function extractHexAndSentences(inputString: string) { // Regular expression to match a hexadecimal number at the beginning followed by a period and sentences - const regex = /^#([0-9A-Fa-f]+)\.\s*(.+)$/s; - const match = inputString.match(regex); + const regex = /^#([0-9A-Fa-f]+)\.\s*(.+)$/; + const match = inputString.replace('\n', ' ').match(regex); if (match) { const hexNumber = match[1]; |
