mirror of
https://github.com/heyman/heynote.git
synced 2025-06-23 11:01:32 +02:00
Add isMac, isWindows, isLinux to a global window.platform object in the renderer
This commit is contained in:
parent
d4078d50d4
commit
fc63ad1651
6
electron/preload/detect-platform.ts
Normal file
6
electron/preload/detect-platform.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
const os = require('os');
|
||||||
|
|
||||||
|
export const isMac = os.platform() === "darwin";
|
||||||
|
export const isWindows = os.platform() === "win32";
|
||||||
|
export const isLinux = os.platform() === "linux";
|
||||||
|
|
@ -1,6 +1,11 @@
|
|||||||
const { contextBridge } = require('electron')
|
const { contextBridge } = require('electron')
|
||||||
import darkMode from "./theme-mode"
|
import darkMode from "./theme-mode"
|
||||||
|
import { isMac, isWindows, isLinux } from "./detect-platform"
|
||||||
|
|
||||||
|
contextBridge.exposeInMainWorld("platform", {
|
||||||
|
isMac,
|
||||||
|
isWindows,
|
||||||
|
isLinux,
|
||||||
})
|
})
|
||||||
contextBridge.exposeInMainWorld('darkMode', darkMode)
|
contextBridge.exposeInMainWorld('darkMode', darkMode)
|
||||||
|
|
||||||
|
@ -3,13 +3,17 @@
|
|||||||
import { HeynoteEditor } from '../editor/editor.js'
|
import { HeynoteEditor } from '../editor/editor.js'
|
||||||
import testContent from "../editor/fixture.js"
|
import testContent from "../editor/fixture.js"
|
||||||
|
|
||||||
|
const modChar = window.platform.isMac ? "⌘" : "Ctrl"
|
||||||
|
|
||||||
const initialContent = `
|
const initialContent = `
|
||||||
∞∞∞text-a
|
∞∞∞text-a
|
||||||
Welcome to Heynote!
|
Welcome to Heynote!
|
||||||
|
|
||||||
[⌘ + Enter] Insert new note block
|
[${modChar} + Enter] Insert new note block
|
||||||
[⌘ + A] Select all text in a note block. Press again to select the whole scratchpad
|
[${modChar} + Down] Goto next block
|
||||||
[⌘ + ⌥ + Up/Down] Add additional cursor above/below
|
[${modChar} + Up] Goto previous block
|
||||||
|
[${modChar} + A] Select all text in a note block. Press again to select the whole scratchpad
|
||||||
|
[${modChar} + ⌥ + Up/Down] Add additional cursor above/below
|
||||||
∞∞∞text-a
|
∞∞∞text-a
|
||||||
`
|
`
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user