mirror of
https://github.com/heyman/heynote.git
synced 2024-11-21 23:43:22 +01: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')
|
||||
import darkMode from "./theme-mode"
|
||||
import { isMac, isWindows, isLinux } from "./detect-platform"
|
||||
|
||||
contextBridge.exposeInMainWorld("platform", {
|
||||
isMac,
|
||||
isWindows,
|
||||
isLinux,
|
||||
})
|
||||
contextBridge.exposeInMainWorld('darkMode', darkMode)
|
||||
|
||||
|
@ -3,13 +3,17 @@
|
||||
import { HeynoteEditor } from '../editor/editor.js'
|
||||
import testContent from "../editor/fixture.js"
|
||||
|
||||
const modChar = window.platform.isMac ? "⌘" : "Ctrl"
|
||||
|
||||
const initialContent = `
|
||||
∞∞∞text-a
|
||||
Welcome to Heynote!
|
||||
|
||||
[⌘ + Enter] Insert new note block
|
||||
[⌘ + A] Select all text in a note block. Press again to select the whole scratchpad
|
||||
[⌘ + ⌥ + Up/Down] Add additional cursor above/below
|
||||
[${modChar} + Enter] Insert new note block
|
||||
[${modChar} + Down] Goto next block
|
||||
[${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
|
||||
`
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user