Skip to content

Commit

Permalink
docs: update source
Browse files Browse the repository at this point in the history
  • Loading branch information
molant committed Oct 7, 2021
1 parent 66fcf35 commit 24cba12
Show file tree
Hide file tree
Showing 35 changed files with 59 additions and 27 deletions.
2 changes: 1 addition & 1 deletion docs/latest/api/menu.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Menu"
description: ""
description: "Create native application menus and context menus."
slug: menu
hide_title: false
---
Expand Down
9 changes: 6 additions & 3 deletions docs/latest/api/native-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ Settings this property to `light` will have the following effects:
The usage of this property should align with a classic "dark mode" state machine in your application
where the user has three options.

* `Follow OS` --> `themeSource = 'system'`
* `Dark Mode` --> `themeSource = 'dark'`
* `Light Mode` --> `themeSource = 'light'`
* `Follow OS` -->
`themeSource = 'system'`
* `Dark Mode` -->
`themeSource = 'dark'`
* `Light Mode` -->
`themeSource = 'light'`

Your application should then always use `shouldUseDarkColors` to determine what CSS to apply.

Expand Down
2 changes: 1 addition & 1 deletion docs/latest/api/touch-bar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "TouchBar"
description: ""
description: "Create TouchBar layouts for native macOS applications"
slug: touch-bar
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/api/tray.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Tray"
description: ""
description: "Add icons and context menus to the system's notification area."
slug: tray
hide_title: false
---
Expand Down
1 change: 1 addition & 0 deletions docs/latest/api/web-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,7 @@ app.whenReady().then(() => {

```html
<!-- index.html -->

<html>
<body>
<script>
Expand Down
4 changes: 3 additions & 1 deletion docs/latest/api/webview-tag.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "`<webview>` Tag"
description: ""
description: "Electron's webview tag is based on Chromium's webview, which is undergoing dramatic architectural changes. This impacts the stability of webviews, including rendering, navigation, and event routing. We currently recommend to not use the webview tag and to consider alternatives, like iframe, Electron's BrowserView, or an architecture that avoids embedded content altogether."
slug: webview-tag
hide_title: false
---
Expand Down Expand Up @@ -151,8 +151,10 @@ browser plugins. Plugins are disabled by default.

```html
<!-- from a file -->

<webview src="https://www.github.com/" preload="./test.js"></webview>
<!-- or if you want to load from an asar archive -->

<webview src="https://www.github.com/" preload="./app.asar/test.js"></webview>
```

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Debugging with XCode"
description: ""
description: "Run gn gen with the --ide=xcode argument."
slug: debugging-instructions-macos-xcode
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/development/issues.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Issues In Electron"
description: ""
description: "For any issue, there are fundamentally three ways an individual can contribute:"
slug: issues
hide_title: false
---
Expand Down
3 changes: 2 additions & 1 deletion docs/latest/development/pull-requests.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Pull Requests"
description: ""
description: "Fork the project on GitHub and clone your fork locally."
slug: pull-requests
hide_title: false
---
Expand Down Expand Up @@ -198,6 +198,7 @@ Bug fixes and new features should include tests and possibly benchmarks.

Contributors guide: https://github.com/electron/electron/blob/main/CONTRIBUTING.md
-->

```

### Step 10: Discuss and update
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/faq.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Electron FAQ"
description: ""
description: "When running npm install electron, some users occasionally encounter installation errors."
slug: faq
hide_title: false
---
Expand Down
1 change: 1 addition & 0 deletions docs/latest/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ folder.
There are a few style guidelines that aren't covered by the linter rules:

<!--TODO(erickzhao): make sure this matches with the lint:markdownlint task-->

* Use `sh` instead of `cmd` in code blocks (due to the syntax highlighter).
* Keep line lengths between 80 and 100 characters if possible for readability
purposes.
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/application-distribution.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Application Distribution"
description: ""
description: "To distribute your app with Electron, you need to package and rebrand it. To do this, you can either use specialized tooling or manual approaches."
slug: application-distribution
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/context-isolation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Context Isolation"
description: ""
description: "Context Isolation is a feature that ensures that both your preload scripts and Electron's internal logic run in a separate context to the website you load in a webContents. This is important for security purposes as it helps prevent the website from accessing Electron internals or the powerful APIs your preload script has access to."
slug: context-isolation
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/dark-mode.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Dark Mode"
description: ""
description: "\"Native interfaces\" include the file picker, window border, dialogs, context menus, and more - anything where the UI comes from your operating system and not from your app. The default behavior is to opt into this automatic theming from the OS."
slug: dark-mode
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/in-app-purchases.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "In-App Purchases (macOS)"
description: ""
description: "If you haven't already, you’ll need to sign the Paid Applications Agreement and set up your banking and tax information in iTunes Connect."
slug: in-app-purchases
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/keyboard-shortcuts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Keyboard Shortcuts"
description: ""
description: "This feature allows you to configure local and global keyboard shortcuts for your Electron application."
slug: keyboard-shortcuts
hide_title: false
---
Expand Down
3 changes: 3 additions & 0 deletions docs/latest/tutorial/launch-app-from-url-in-another-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ hide_title: true

<!-- ✍ Update this section if you want to provide more details -->


This guide will take you through the process of setting your Electron app as the default
handler for a specific [protocol](https://www.electronjs.org/docs/api/protocol).

Expand Down Expand Up @@ -207,8 +208,10 @@ show an error dialog box.
can leave it empty.
-->


```fiddle docs/latest/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app
```

<!-- ✍ Explanation of the code below -->

2 changes: 1 addition & 1 deletion docs/latest/tutorial/linux-desktop-actions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Desktop Launcher Actions (Linux)"
description: ""
description: "On many Linux environments, you can add custom entries to the system launcher by modifying the .desktop file. For Canonical's Unity documentation, see Adding Shortcuts to a Launcher. For details on a more generic implementation, see the freedesktop.org Specification."
slug: linux-desktop-actions
hide_title: false
---
Expand Down
1 change: 1 addition & 0 deletions docs/latest/tutorial/mac-app-store-submission-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ By passing `--no-gatekeeper-assess`, the `electron-osx-sign` will skip the macOS
GateKeeper check as your app usually has not been notarized yet by this step.

<!-- TODO(zcbenz): Add a chapter about App Notarization -->

This guide does not cover [App Notarization][app-notarization], but you might
want to do it otherwise Apple may prevent users from using your app outside Mac
App Store.
Expand Down
3 changes: 3 additions & 0 deletions docs/latest/tutorial/message-ports.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ app.whenReady().then(async () => {

```html
<!-- worker.html ------------------------------------------------------------>

<script>
const { ipcRenderer } = require('electron')
Expand All @@ -162,6 +163,7 @@ ipcRenderer.on('new-client', (event) => {

```html
<!-- app.html --------------------------------------------------------------->

<script>
const { ipcRenderer } = require('electron')
Expand Down Expand Up @@ -306,6 +308,7 @@ ipcRenderer.on('main-world-port', async (event) => {

```html
<!-- index.html ------------------------------------------------------------->

<script>
window.onmessage = (event) => {
// event.source === window means the message is coming from the preload
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/native-file-drag-drop.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Native File Drag & Drop"
description: ""
description: "Certain kinds of applications that manipulate files might want to support the operating system's native file drag & drop feature. Dragging files into web content is common and supported by many websites. Electron additionally supports dragging files and content out from web content into the operating system's world."
slug: native-file-drag-drop
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/notifications.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Notifications"
description: ""
description: "All three operating systems provide means for applications to send notifications to the user. The technique of showing notifications is different for the Main and Renderer processes."
slug: notifications
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/offscreen-rendering.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Offscreen Rendering"
description: ""
description: "Offscreen rendering lets you obtain the content of a BrowserWindow in a bitmap, so it can be rendered anywhere, for example, on texture in a 3D scene. The offscreen rendering in Electron uses a similar approach to that of the Chromium Embedded Framework project."
slug: offscreen-rendering
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/online-offline-events.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Online/Offline Event Detection"
description: ""
description: "Online and offline event detection can be implemented in the Renderer process using the navigator.onLine attribute, part of standard HTML5 API."
slug: online-offline-events
hide_title: false
---
Expand Down
1 change: 1 addition & 0 deletions docs/latest/tutorial/process-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ way to import Electron's content scripts.

<!-- Note: This guide doesn't take sandboxing into account, which might fundamentally
change the statements here. -->

Preload scripts contain code that executes in a renderer process before its web content
begins loading. These scripts run within the renderer context, but are granted more
privileges by having access to Node.js APIs.
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/progress-bar.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Taskbar Progress Bar (Windows & macOS)"
description: ""
description: "A progress bar enables a window to provide progress information to the user without the need of switching to the window itself."
slug: progress-bar
hide_title: false
---
Expand Down
5 changes: 5 additions & 0 deletions docs/latest/tutorial/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ folder of your project:
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
Expand Down Expand Up @@ -358,6 +359,7 @@ Electron application that looks like this:
![Simplest Electron app](../images/simplest-electron-app.png)

<!--TODO(erickzhao): Remove the individual code blocks for static website -->

The full code is available below:

```js
Expand Down Expand Up @@ -428,11 +430,13 @@ window.addEventListener('DOMContentLoaded', () => {
```html
<!--index.html-->


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->

<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
Expand All @@ -444,6 +448,7 @@ window.addEventListener('DOMContentLoaded', () => {
and Electron <span id="electron-version"></span>.

<!-- You can also require other files to run in this process -->

<script src="./renderer.js"></script>
</body>
</html>
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/recent-documents.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Recent Documents (Windows & macOS)"
description: ""
description: "Windows and macOS provide access to a list of recent documents opened by the application via JumpList or dock menu, respectively."
slug: recent-documents
hide_title: false
---
Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/represented-file.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Representing Files in a BrowserWindow (macOS)"
description: ""
description: "On macOS, you can set a represented file for any window in your application. The represented file's icon will be shown in the title bar, and when users Command-Click or Control-Click, a popup with a path to the file will be shown."
slug: represented-file
hide_title: false
---
Expand Down
2 changes: 2 additions & 0 deletions docs/latest/tutorial/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ websites, just to name a few. For this reason, we recommend enabling renderer sa
for the vast majority of cases under an abundance of caution.

<!--TODO: update this guide when #28466 is either solved or closed -->

Note that there is an active discussion in the issue tracker to enable renderer sandboxing
by default. See [#28466][issue-28466]) for details.

Expand All @@ -54,6 +55,7 @@ regular Chrome renderer would. A sandboxed renderer won't have a Node.js
environment initialized.

<!-- TODO(erickzhao): when we have a solid guide for IPC, link it here -->

Therefore, when the sandbox is enabled, renderer processes can only perform privileged
tasks (such as interacting with the filesystem, making changes to the system, or spawning
subprocesses) by delegating these tasks to the main process via inter-process
Expand Down
8 changes: 8 additions & 0 deletions docs/latest/tutorial/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,12 @@ browserWindow.loadURL('https://example.com')

```html
<!-- Bad -->

<script crossorigin src="http://example.com/react.js"></script>
<link rel="stylesheet" href="http://example.com/style.css">

<!-- Good -->

<script crossorigin src="https://example.com/react.js"></script>
<link rel="stylesheet" href="https://example.com/style.css">
```
Expand Down Expand Up @@ -206,9 +208,11 @@ mainWindow.loadURL('https://example.com')

```html
<!-- Bad -->

<webview nodeIntegration src="page.html"></webview>

<!-- Good -->

<webview src="page.html"></webview>
```

Expand Down Expand Up @@ -339,9 +343,11 @@ const mainWindow = new BrowserWindow()

```html
<!-- Bad -->

<webview disablewebsecurity src="page.html"></webview>

<!-- Good -->

<webview src="page.html"></webview>
```

Expand Down Expand Up @@ -519,9 +525,11 @@ you know it needs that feature.

```html
<!-- Bad -->

<webview allowpopups src="page.html"></webview>

<!-- Good -->

<webview src="page.html"></webview>
```

Expand Down
2 changes: 1 addition & 1 deletion docs/latest/tutorial/support.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Electron Support"
description: ""
description: "If you have a security concern, please see the security document."
slug: support
hide_title: false
---
Expand Down
1 change: 1 addition & 0 deletions docs/latest/tutorial/tray.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ hide_title: true

<!-- ✍ Update this section if you want to provide more details -->


This guide will take you through the process of creating a
[Tray](https://www.electronjs.org/docs/api/tray) icon with
its own context menu to the system's notification area.
Expand Down
Loading

0 comments on commit 24cba12

Please sign in to comment.