Compare commits

...

12 Commits

Author SHA1 Message Date
Electron Bot
846a12056d Bump v14.0.0-beta.2 2021-05-31 06:33:28 -07:00
trop[bot]
e0f6313739 refactor: publish-to-npm respects main (#29408) 2021-05-31 10:33:01 +02:00
trop[bot]
8866b312ad docs: update link to Chromium's coding style guide (#29398)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-05-31 10:19:48 +02:00
trop[bot]
cb8fada7a0 fix: close autoHide menu bar when focus is lost (#29349)
Co-authored-by: Cheng Zhao <zcbenz@gmail.com>
2021-05-28 19:00:55 +09:00
trop[bot]
b983bda721 Update quick-start.md (#29371)
In version 13.0.1 preload process should added to webPreferences.

Co-authored-by: aydon <41415004+congjiye@users.noreply.github.com>
2021-05-27 18:52:56 -07:00
trop[bot]
3125ec093d docs: fix typos in clang-tidy examples (#29355)
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2021-05-27 18:52:44 -07:00
trop[bot]
a27329d9ad refactor: version-utils respects main (#29392)
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-05-27 18:44:59 -07:00
trop[bot]
5362882cf6 refactor: getCurrentBranch respects main (#29386)
* refactor: getCurrentBranch respects main

* add note about migration

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-05-27 18:43:44 -07:00
trop[bot]
c58446d9d7 docs: remove freenode channel from support list (#29383)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-05-27 17:24:25 -07:00
trop[bot]
1c2ed2ba95 docs: Update notifications (main) docs (#29357)
* remove version info from index.html page

* remove nodeIntegration

* format code and update readme

* add note to user in index.html

Co-authored-by: Jeremy Foster <jeremy.foster@live.com>
2021-05-27 12:41:33 -07:00
trop[bot]
1c0e496ee2 docs: fix link to docs/fiddle/quick-start (#29353)
Co-authored-by: Erick Zhao <erick@hotmail.ca>
2021-05-27 12:38:48 -07:00
Electron Bot
0f32b0f1ce Bump v14.0.0-beta.1 2021-05-26 10:13:55 -07:00
14 changed files with 43 additions and 41 deletions

View File

@@ -1 +1 @@
14.0.0-nightly.20210524
14.0.0-beta.2

View File

@@ -10,12 +10,12 @@ files, you need to have built Electron so that it knows which compiler flags
were used. There is one required option for the script `--output-dir`, which
tells the script which build directory to pull the compilation information
from. A typical usage would be:
`npm run lint:clang-tiy --out-dir ../out/Testing`
`npm run lint:clang-tidy --out-dir ../out/Testing`
With no filenames provided, all C/C++/Objective-C files will be checked.
You can provide a list of files to be checked by passing the filenames after
the options:
`npm run lint:clang-tiy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc`
`npm run lint:clang-tidy --out-dir ../out/Testing shell/browser/api/electron_api_app.cc`
While `clang-tidy` has a
[long list](https://clang.llvm.org/extra/clang-tidy/checks/list.html)

View File

@@ -25,7 +25,7 @@ You can run `npm run lint` to show any style issues detected by `cpplint` and
## C++ and Python
For C++ and Python, we follow Chromium's [Coding
Style](https://www.chromium.org/developers/coding-style). You can use
Style](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/styleguide/styleguide.md). You can use
[clang-format](clang-format.md) to format the C++ code automatically. There is
also a script `script/cpplint.py` to check whether all files conform.

View File

@@ -7,10 +7,6 @@
</head>
<body>
<h1>Hello World!</h1>
<p>
We are using node <script>document.write(process.versions.node)</script>,
Chrome <script>document.write(process.versions.chrome)</script>,
and Electron <script>document.write(process.versions.electron)</script>.
</p>
<p>After launching this application, you should see the system notification.</p>
</body>
</html>

View File

@@ -3,21 +3,17 @@ const { app, BrowserWindow, Notification } = require('electron')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
height: 600
})
win.loadFile('index.html')
}
const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'
function showNotification () {
const notification = {
title: 'Basic Notification',
body: 'Notification from the Main process'
}
new Notification(notification).show()
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
app.whenReady().then(createWindow).then(showNotification)

View File

@@ -55,18 +55,17 @@ Starting with a working application from the
```javascript fiddle='docs/fiddles/features/notifications/main'
const { Notification } = require('electron')
const NOTIFICATION_TITLE = 'Basic Notification'
const NOTIFICATION_BODY = 'Notification from the Main process'
function showNotification () {
const notification = {
title: 'Basic Notification',
body: 'Notification from the Main process'
}
new Notification(notification).show()
new Notification({ title: NOTIFICATION_TITLE, body: NOTIFICATION_BODY }).show()
}
app.whenReady().then(createWindow).then(showNotification)
```
After launching the Electron application, you should see the notification:
After launching the Electron application, you should see the system notification:
![Notification in the Main process](../images/notification-main.png)

View File

@@ -299,7 +299,9 @@ function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
preload: path.join(__dirname, 'preload.js')
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
@@ -440,7 +442,7 @@ window.addEventListener('DOMContentLoaded', () => {
</html>
```
```fiddle docs/fiddles/quickstart
```fiddle docs/fiddles/quick-start
```
To summarize all the steps we've done:

View File

@@ -16,7 +16,6 @@ you can interact with the community in these locations:
* Sharing ideas with other Electron app developers
* And more!
* [`electron`](https://discuss.atom.io/c/electron) category on the Atom forums
* `#atom-shell` channel on Freenode
* `#electron` channel on [Atom's Slack](https://discuss.atom.io/t/join-us-on-slack/16638?source_topic_id=25406)
* [`electron-ru`](https://telegram.me/electron_ru) *(Russian)*
* [`electron-br`](https://electron-br.slack.com) *(Brazilian Portuguese)*

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "14.0.0-nightly.20210524",
"version": "14.0.0-beta.2",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

View File

@@ -6,6 +6,9 @@ const ELECTRON_DIR = path.resolve(__dirname, '..', '..');
const SRC_DIR = path.resolve(ELECTRON_DIR, '..');
const RELEASE_BRANCH_PATTERN = /(\d)+-(?:(?:[0-9]+-x$)|(?:x+-y$))/;
// TODO(main-migration): Simplify once main branch is renamed
const MAIN_BRANCH_PATTERN = /^(main|master)$/;
const ORIGIN_MAIN_BRANCH_PATTERN = /^origin\/(main|master)$/;
require('colors');
const pass = '✓'.green;
@@ -73,7 +76,7 @@ async function handleGitCall (args, gitDir) {
async function getCurrentBranch (gitDir) {
let branch = await handleGitCall(['rev-parse', '--abbrev-ref', 'HEAD'], gitDir);
if (branch !== 'master' && !RELEASE_BRANCH_PATTERN.test(branch)) {
if (!MAIN_BRANCH_PATTERN.test(branch) && !RELEASE_BRANCH_PATTERN.test(branch)) {
const lastCommit = await handleGitCall(['rev-parse', 'HEAD'], gitDir);
const branches = (await handleGitCall([
'branch',
@@ -82,7 +85,7 @@ async function getCurrentBranch (gitDir) {
'--remote'
], gitDir)).split('\n');
branch = branches.filter(b => b.trim() === 'master' || b.trim() === 'origin/master' || RELEASE_BRANCH_PATTERN.test(b.trim()))[0];
branch = branches.find(b => MAIN_BRANCH_PATTERN.test(b.trim()) || ORIGIN_MAIN_BRANCH_PATTERN.test(b.trim()) || RELEASE_BRANCH_PATTERN.test(b.trim()));
if (!branch) {
console.log(`${fail} no release branch exists for this ref`);
process.exit(1);

View File

@@ -111,8 +111,9 @@ new Promise((resolve, reject) => {
const currentBranch = await getCurrentBranch();
if (release.tag_name.indexOf('nightly') > 0) {
if (currentBranch === 'master') {
// Nightlies get published to their own module, so master nightlies should be tagged as latest
// TODO(main-migration): Simplify once main branch is renamed.
if (currentBranch === 'master' || currentBranch === 'main') {
// Nightlies get published to their own module, so they should be tagged as latest
npmTag = 'latest';
} else {
npmTag = `nightly-${currentBranch}`;
@@ -127,10 +128,10 @@ new Promise((resolve, reject) => {
JSON.stringify(currentJson, null, 2)
);
} else {
if (currentBranch === 'master') {
// This should never happen, master releases should be nightly releases
if (currentBranch === 'master' || currentBranch === 'main') {
// This should never happen, main releases should be nightly releases
// this is here just-in-case
npmTag = 'master';
throw new Error('Unreachable release phase, can\'t tag a non-nightly release on the main branch');
} else if (!release.prerelease) {
// Tag the release with a `2-0-x` style tag
npmTag = currentBranch;

View File

@@ -65,8 +65,9 @@ async function nextNightly (v) {
const pre = `nightly.${getCurrentDate()}`;
const branch = (await GitProcess.exec(['rev-parse', '--abbrev-ref', 'HEAD'], ELECTRON_DIR)).stdout.trim();
if (branch === 'master') {
next = semver.inc(await getLastMajorForMaster(), 'major');
// TODO(main-migration): Simplify once main branch is renamed
if (branch === 'master' || branch === 'main') {
next = semver.inc(await getLastMajorForMain(), 'major');
} else if (isStable(v)) {
next = semver.inc(next, 'patch');
}
@@ -74,7 +75,7 @@ async function nextNightly (v) {
return `${next}-${pre}`;
}
async function getLastMajorForMaster () {
async function getLastMajorForMain () {
let branchNames;
const result = await GitProcess.exec(['branch', '-a', '--remote', '--list', 'origin/[0-9]*-x-y'], ELECTRON_DIR);
if (result.exitCode === 0) {

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 14,0,0,20210524
PRODUCTVERSION 14,0,0,20210524
FILEVERSION 14,0,0,2
PRODUCTVERSION 14,0,0,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L

View File

@@ -124,7 +124,10 @@ bool MenuBar::AcceleratorPressed(const ui::Accelerator& accelerator) {
? ui::Accelerator(ui::VKEY_ESCAPE, accelerator.modifiers(),
accelerator.key_state(), accelerator.time_stamp())
: accelerator;
return views::AccessiblePaneView::AcceleratorPressed(translated);
bool result = views::AccessiblePaneView::AcceleratorPressed(translated);
if (result && !pane_has_focus())
root_view_->RestoreFocus();
return result;
}
bool MenuBar::SetPaneFocusAndFocusDefault() {
@@ -149,6 +152,8 @@ void MenuBar::OnThemeChanged() {
void MenuBar::OnDidChangeFocus(View* focused_before, View* focused_now) {
views::AccessiblePaneView::OnDidChangeFocus(focused_before, focused_now);
SetAcceleratorVisibility(pane_has_focus());
if (!pane_has_focus())
root_view_->RestoreFocus();
}
const char* MenuBar::GetClassName() const {