Skip to content

Commit

Permalink
Use landscape option for printing with electron
Browse files Browse the repository at this point in the history
  • Loading branch information
ebma committed Sep 29, 2020
1 parent fa9c93d commit 6e4d929
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions electron/src/ipc/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { Messages } from "../shared/ipc"
import { getOpenWindows } from "../window"
import { expose } from "./_ipc"

expose(Messages.Print, () => {
expose(Messages.Print, (options?: Electron.WebContentsPrintOptions) => {
const windows = getOpenWindows()
if (windows.length) {
windows[0].webContents.print()
windows[0].webContents.print(options)
}
})
2 changes: 1 addition & 1 deletion shared/types/ipc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ declare namespace IPC {

[Messages.OpenLink]: (href: string) => void

[Messages.Print]: (content: string | undefined, options: object | undefined) => void
[Messages.Print]: (options: object | undefined, content: string | undefined) => void

[Messages.DeepLinkURL]: () => string

Expand Down
2 changes: 1 addition & 1 deletion src/AccountSettings/components/ExportKeyDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const printOptions =
orientation: "landscape",
pageCount: 1
}
: {}
: { landscape: true }

interface PromptToRevealProps {
children: React.ReactNode
Expand Down
2 changes: 1 addition & 1 deletion src/App/cordova/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ function print(content?: string, options?: object) {
}

export default function initializePrinter() {
expose(Messages.Print, (storage, keystore, content, options) => print(content, options))
expose(Messages.Print, (storage, keystore, options, content) => print(content, options))
}
2 changes: 1 addition & 1 deletion src/Platform/print.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { Messages } from "~shared/ipc"
import { call } from "./ipc"

export async function print(options?: object, content?: string) {
return call(Messages.Print, content, options)
return call(Messages.Print, options, content)
}

0 comments on commit 6e4d929

Please sign in to comment.