Skip to content

Commit

Permalink
Merge pull request #236 from orppst/211-default-justification-showing…
Browse files Browse the repository at this point in the history
…-as-undefined

Empty string showing as null or undefined
  • Loading branch information
AllanEngland authored Aug 16, 2024
2 parents 6278fd9 + b2777d7 commit 1004d26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ export default function JustificationsEditModal(justificationProps : Justificati
opened={opened}
onClose={props.closeModal}
title={"View/Edit " + capitalizeFirstChar(props.which) + " Justification"}
//fullScreen
size="auto"
height={75}
centered

size="60%"
>
<JustificationForm {...props} />
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const JustificationTextArea = (form : UseFormReturnType<Justification>) => {
return (
<Paper withBorder={true} bg={"gray.1"} c={"black"} p={"xs"} m={"xs"}>
<Editor
value={form.values.text!}
value={form.values.text ?? ""}
onValueChange={newValue => form.setValues({text: newValue, format: form.values.format})}
highlight={code => highlight(code, languages.asciidoc, 'asciidoc')}
highlight={code => highlight(code ?? "", languages.asciidoc, 'asciidoc')}
maxLength={MAX_CHARS_FOR_JUSTIFICATION}
{...form.getInputProps('text')}
/>
Expand All @@ -40,9 +40,9 @@ const JustificationTextArea = (form : UseFormReturnType<Justification>) => {
return (
<Paper withBorder={true} bg={"gray.1"} c={"black"} p={"xs"} m={"xs"}>
<Editor
value={form.values.text!}
value={form.values.text ?? ""}
onValueChange={newValue => form.setValues({text: newValue, format: form.values.format})}
highlight={code => highlight(code, languages.latex, 'latex')}
highlight={code => highlight(code ?? "", languages.latex, 'latex')}
maxLength={MAX_CHARS_FOR_JUSTIFICATION}
{...form.getInputProps('text')}
/>
Expand All @@ -52,9 +52,9 @@ const JustificationTextArea = (form : UseFormReturnType<Justification>) => {
return (
<Paper withBorder={true} bg={"gray.1"} c={"black"} p={"xs"} m={"xs"}>
<Editor
value={form.values.text!}
value={form.values.text ?? ""}
onValueChange={newValue => form.setValues({text: newValue, format: form.values.format})}
highlight={code => highlight(code, languages.rest, 'rest')}
highlight={code => highlight(code ?? "", languages.rest, 'rest')}
maxLength={MAX_CHARS_FOR_JUSTIFICATION}
{...form.getInputProps('text')}
/>
Expand Down Expand Up @@ -151,7 +151,7 @@ export default function JustificationForm(props: JustificationProps)
</Grid>

</form>
{form.values.format==='latex' && PreviewJustification(form.values.format!, form.values.text!)}
{form.values.format==='latex' && PreviewJustification(form.values.format!, form.values.text ?? "")}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default function JustificationsTable(justifications: JustificationKinds)
<Table.Tbody>
<Table.Tr>
<Table.Td>Scientific</Table.Td>
<Table.Td>{WordCount(justifications.scientific.text!)}</Table.Td>
<Table.Td>{WordCount(justifications.scientific.text ?? "")}</Table.Td>
<Table.Td>{justifications.scientific.format}</Table.Td>
<Table.Td>
<JustificationsEditModal
Expand All @@ -49,7 +49,7 @@ export default function JustificationsTable(justifications: JustificationKinds)
</Table.Tr>
<Table.Tr>
<Table.Td>Technical</Table.Td>
<Table.Td>{WordCount(justifications.technical.text!)}</Table.Td>
<Table.Td>{WordCount(justifications.technical.text ?? "")}</Table.Td>
<Table.Td>{justifications.technical.format}</Table.Td>
<Table.Td>
<JustificationsEditModal
Expand Down

0 comments on commit 1004d26

Please sign in to comment.