From de44370a96e94846a2e0b47ca79599cdb127226a Mon Sep 17 00:00:00 2001 From: enes Date: Fri, 25 Oct 2024 18:42:16 +0200 Subject: [PATCH] feat: add squiggle support --- src/components/MarkFormField/index.tsx | 21 +++++++++-------- src/components/MarkInputs/Text.tsx | 19 +++++++++++++++ src/components/PDFView/PdfMarkItem.tsx | 7 +++++- src/components/PDFView/PdfMarking.tsx | 3 +-- src/pages/verify/index.tsx | 7 +++++- src/utils/pdf.ts | 32 ++++++++++++++++++++++---- 6 files changed, 72 insertions(+), 17 deletions(-) create mode 100644 src/components/MarkInputs/Text.tsx diff --git a/src/components/MarkFormField/index.tsx b/src/components/MarkFormField/index.tsx index 9a14989..7328065 100644 --- a/src/components/MarkFormField/index.tsx +++ b/src/components/MarkFormField/index.tsx @@ -7,13 +7,12 @@ import { isCurrentValueLast } from '../../utils' import React, { useState } from 'react' +import { MARK_TYPE_CONFIG } from '../getMarkComponents.tsx' interface MarkFormFieldProps { currentUserMarks: CurrentUserMark[] handleCurrentUserMarkChange: (mark: CurrentUserMark) => void - handleSelectedMarkValueChange: ( - event: React.ChangeEvent - ) => void + handleSelectedMarkValueChange: (value: string) => void handleSubmit: (event: React.FormEvent) => void selectedMark: CurrentUserMark selectedMarkValue: string @@ -53,6 +52,8 @@ const MarkFormField = ({ } const toggleActions = () => setDisplayActions(!displayActions) const markLabel = getToolboxLabelByMarkType(selectedMark.mark.type) + const { input: MarkInputComponent } = + MARK_TYPE_CONFIG[selectedMark.mark.type] || {} return (
@@ -83,12 +84,14 @@ const MarkFormField = ({
handleFormSubmit(e)}> - + {typeof MarkInputComponent !== 'undefined' && ( + + )}