-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
150 additions
and
117 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
.pdf__page__annotation[data-subtype='20'] { | ||
position: relative; | ||
position: absolute; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,10 @@ export enum PdfAnnotationTool { | |
* Drawing path | ||
*/ | ||
Pencil, | ||
/** | ||
* Fill form | ||
*/ | ||
FillForm, | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React, { | ||
ReactNode, | ||
useCallback, | ||
useContext, | ||
useEffect, | ||
useState, | ||
} from 'react'; | ||
import { | ||
PdfAnnotationObject, | ||
PdfPageObject, | ||
Position, | ||
Size, | ||
} from '@unionpdf/models'; | ||
import { useLogger, usePdfDocument, usePdfEngine } from '../../core'; | ||
|
||
export const FORM_CONTEXT_LOG_SOURCE = 'PdfFormContext'; | ||
|
||
/** | ||
* Value in PdfFormContext | ||
*/ | ||
export interface PdfFormContextValue { | ||
values: Record<string, string>; | ||
} | ||
|
||
export const PdfFormContext = React.createContext<PdfFormContextValue>({ | ||
values: {}, | ||
}); | ||
|
||
/** | ||
* Properties of PdfFormContextProvider | ||
*/ | ||
export interface PdfFormContextProviderProps { | ||
/** | ||
* Children nodes | ||
*/ | ||
children: ReactNode; | ||
} | ||
|
||
/** | ||
* Provider of PdfFormContext, used to maintaining Form status and data | ||
* @param props - properties of PdfFormContextProvider | ||
* @returns | ||
* | ||
* @public | ||
*/ | ||
export function PdfFormContextProvider(props: PdfFormContextProviderProps) { | ||
const { children } = props; | ||
|
||
return ( | ||
<PdfFormContext.Provider | ||
value={{ | ||
values: {}, | ||
}} | ||
> | ||
{children} | ||
</PdfFormContext.Provider> | ||
); | ||
} | ||
|
||
export function usePdfForm() { | ||
return useContext(PdfFormContext); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters