mirror of
https://github.com/ruilisi/fortune-sheet.git
synced 2025-01-08 11:47:38 +08:00
Merge pull request #636 from Kreijstal/globalThis-not-in-browser
check for globalThis.
This commit is contained in:
commit
2629e8b51d
@ -227,7 +227,7 @@ export function defaultContext(refs: RefValues): Context {
|
|||||||
defaultrowNum: 84,
|
defaultrowNum: 84,
|
||||||
addDefaultRows: 50,
|
addDefaultRows: 50,
|
||||||
fullscreenmode: true,
|
fullscreenmode: true,
|
||||||
devicePixelRatio: (globalThis || window).devicePixelRatio,
|
devicePixelRatio: (typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}).devicePixelRatio,
|
||||||
|
|
||||||
contextMenu: {},
|
contextMenu: {},
|
||||||
sheetTabContextMenu: {},
|
sheetTabContextMenu: {},
|
||||||
|
@ -30,7 +30,7 @@ const Sheet: React.FC<Props> = ({ sheet }) => {
|
|||||||
if (!data) return;
|
if (!data) return;
|
||||||
setContext((draftCtx) => {
|
setContext((draftCtx) => {
|
||||||
if (settings.devicePixelRatio === 0) {
|
if (settings.devicePixelRatio === 0) {
|
||||||
draftCtx.devicePixelRatio = (globalThis || window).devicePixelRatio;
|
draftCtx.devicePixelRatio = (typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}).devicePixelRatio;
|
||||||
}
|
}
|
||||||
updateContextWithSheetData(draftCtx, data);
|
updateContextWithSheetData(draftCtx, data);
|
||||||
updateContextWithCanvas(
|
updateContextWithCanvas(
|
||||||
|
Loading…
Reference in New Issue
Block a user