forked from marktext/marktext
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.js
More file actions
executable file
·120 lines (114 loc) · 3.33 KB
/
help.js
File metadata and controls
executable file
·120 lines (114 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import path from 'path'
import { shell } from 'electron'
import { isFile } from 'common/filesystem'
import * as actions from '../actions/help'
import { checkUpdates } from '../actions/marktext'
/// Check whether the package is updatable at runtime.
const isUpdatable = () => {
// TODO: If not updatable, allow to check whether there is a new version available.
const resFile = isFile(path.join(process.resourcesPath, 'app-update.yml'))
if (!resFile) {
// No update resource file available.
return false
} else if (process.env.APPIMAGE) {
// We are running as AppImage.
return true
} else if (process.platform === 'win32' && isFile(path.join(process.resourcesPath, 'md.ico'))) {
// Windows is a little but tricky. The update resource file is always available and
// there is no way to check the target type at runtime (electron-builder#4119).
// As workaround we check whether "md.ico" exists that is only included in the setup.
return true
}
// Otherwise assume that we cannot perform an auto update (standalone binary, archives,
// packed for package manager).
return false
}
export default function () {
const helpMenu = {
label: '&Help',
role: 'help',
submenu: [{
label: 'Quick Start...',
click () {
shell.openExternal('https://github.com/marktext/marktext/blob/master/docs/README.md')
}
}, {
label: 'Markdown Reference...',
click () {
shell.openExternal('https://github.com/marktext/marktext/blob/master/docs/MARKDOWN_SYNTAX.md')
}
}, {
label: 'Changelog...',
click () {
shell.openExternal('https://github.com/marktext/marktext/blob/master/.github/CHANGELOG.md')
}
}, {
type: 'separator'
}, {
label: 'Donate via Open Collective...',
click (item, win) {
shell.openExternal('https://opencollective.com/marktext')
}
}, {
label: 'Feedback via Twitter...',
click (item, win) {
actions.showTweetDialog(win, 'twitter')
}
}, {
label: 'Report Issue or Request Feature...',
click () {
shell.openExternal('https://github.com/marktext/marktext/issues')
}
}, {
type: 'separator'
}, {
label: 'Website...',
click () {
shell.openExternal('https://marktext.app')
}
}, {
label: 'Watch on GitHub...',
click () {
shell.openExternal('https://github.com/marktext/marktext')
}
}, {
label: 'Follow us on Github...',
click () {
shell.openExternal('https://github.com/Jocs')
}
}, {
label: 'Follow us on Twitter...',
click () {
shell.openExternal('https://twitter.com/marktextapp')
}
}, {
type: 'separator'
}, {
label: 'License...',
click () {
shell.openExternal('https://github.com/marktext/marktext/blob/master/LICENSE')
}
}]
}
if (isUpdatable()) {
helpMenu.submenu.push({
type: 'separator'
}, {
label: 'Check for updates...',
click (menuItem, browserWindow) {
checkUpdates(browserWindow)
}
})
}
if (process.platform !== 'darwin') {
helpMenu.submenu.push({
type: 'separator'
}, {
label: 'About MarkText...',
click (menuItem, browserWindow) {
actions.showAboutDialog(browserWindow)
}
})
}
return helpMenu
}