-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: print spectra feat: prepare NMRium structure for printing fix: trigger printing after the NMRium viewer is rendered and rescaled to an A4 page * feat: create print content component * refactor: use new print component * fix: print page config * feat: improve print content page options modal * fix: return the window size to origin after the print is finished * chore: fix prettier and eslint * chore: fix prettier and eslint * fix: print padding * feat: improve print * feat: save print page settings in the workspace * fix: type and page padding * fix: print in firefox * refactor: change label from 'margin' to 'Margin' * fix: display overlay div to prevent hover effects close #3139
- Loading branch information
1 parent
d1a48f1
commit 1287bc1
Showing
15 changed files
with
709 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,25 @@ | ||
import { produce } from 'immer'; | ||
import { createContext, useContext } from 'react'; | ||
|
||
import { usePrintPage } from '../elements/print'; | ||
import { initialState, State } from '../reducer/Reducer'; | ||
|
||
export const ChartContext = createContext<State>(initialState); | ||
export const ChartDataProvider = ChartContext.Provider; | ||
|
||
export function useChartData() { | ||
return useContext(ChartContext); | ||
const data = useContext(ChartContext); | ||
|
||
const printOptions = usePrintPage(); | ||
|
||
if (!printOptions) return data; | ||
|
||
const { width, height } = printOptions; | ||
|
||
const updatedData = produce(data, (draft) => { | ||
draft.width = width; | ||
draft.height = height; | ||
}); | ||
|
||
return updatedData; | ||
} |
Oops, something went wrong.