Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add more fiddles for launch in fiddle feature #19849

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/accelerator.md
Expand Up @@ -15,7 +15,7 @@ Shortcuts are registered with the [`globalShortcut`](global-shortcut.md) module
using the [`register`](global-shortcut.md#globalshortcutregisteraccelerator-callback)
method, i.e.

```javascript
```javascript fiddle='docs/fiddles/accelerator
const { app, globalShortcut } = require('electron')

app.on('ready', () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/api/screen.md
Expand Up @@ -27,7 +27,7 @@ app.on('ready', () => {

Another example of creating a window in the external display:

```javascript
```javascript fiddle='docs/fiddles/screen/fit-screen-external
const { app, BrowserWindow, screen } = require('electron')

let win
Expand Down
28 changes: 28 additions & 0 deletions docs/fiddles/accelerator/main.js
@@ -0,0 +1,28 @@
// Adding a global shortcut to electron
//
// For more info, see:
// https://electronjs.org/docs/api/screen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should point to the global shortcut docs :)


const { app, globalShortcut, BrowserWindow } = require('electron')

let mainWindow = null;

app.on('ready', () => {
// Register a 'CommandOrControl+Y' shortcut listener.
globalShortcut.register('CommandOrControl+Y', () => {
// Do stuff when Y and either Command/Control is pressed.
console.log('shortcut...');
});

mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
cvaldez98 marked this conversation as resolved.
Show resolved Hide resolved
});

// and load the index.html of the app.
mainWindow.loadFile('index.html');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm there is no index.html in this fiddle - we can remove this line or add a simple html

})

24 changes: 24 additions & 0 deletions docs/fiddles/screen/fit-screen-external/main.js
@@ -0,0 +1,24 @@
// Creating a window in the external display
//
// For more info, see:
// https://electronjs.org/docs/api/screen

const electron = require('electron')
const { app, BrowserWindow } = require('electron')
cvaldez98 marked this conversation as resolved.
Show resolved Hide resolved

let win

app.on('ready', () => {
let displays = electron.screen.getAllDisplays()
cvaldez98 marked this conversation as resolved.
Show resolved Hide resolved
let externalDisplay = displays.find((display) => {
return display.bounds.x !== 0 || display.bounds.y !== 0
})

if (externalDisplay) {
win = new BrowserWindow({
x: externalDisplay.bounds.x + 50,
y: externalDisplay.bounds.y + 50
})
win.loadURL('https://electronjs.org')
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about an else case with a console.log("no ext display or so")?

})
14 changes: 2 additions & 12 deletions docs/tutorial/security.md
Expand Up @@ -27,18 +27,8 @@ see [SECURITY.md](https://github.com/electron/electron/tree/master/SECURITY.md)

## Chromium Security Issues and Upgrades

While Electron strives to support new versions of Chromium as soon as possible,
developers should be aware that upgrading is a serious undertaking - involving
hand-editing dozens or even hundreds of files. Given the resources and
contributions available today, Electron will often not be on the very latest
version of Chromium, lagging behind by several weeks or a few months.

We feel that our current system of updating the Chromium component strikes an
appropriate balance between the resources we have available and the needs of
the majority of applications built on top of the framework. We definitely are
interested in hearing more about specific use cases from the people that build
things on top of Electron. Pull requests and contributions supporting this
effort are always very welcome.
Electron keeps up to date with alternating Chromium releases. For more information,
see the [Electron Release Cadence blog post](https://electronjs.org/blog/12-week-cadence).
ckerr marked this conversation as resolved.
Show resolved Hide resolved

## Security Is Everyone's Responsibility

Expand Down