Merge branch 'master' of github.com:electron/electron into zh-cn-docs

This commit is contained in:
x-yao 2016-12-26 12:03:00 +08:00
commit 6f2f3ed1ac
23 changed files with 50 additions and 53 deletions

View file

@ -5,6 +5,7 @@
#include "atom/browser/ui/message_box.h" #include "atom/browser/ui/message_box.h"
#include "atom/browser/browser.h" #include "atom/browser/browser.h"
#include "atom/browser/native_window_observer.h"
#include "atom/browser/native_window_views.h" #include "atom/browser/native_window_views.h"
#include "atom/browser/unresponsive_suppressor.h" #include "atom/browser/unresponsive_suppressor.h"
#include "base/callback.h" #include "base/callback.h"
@ -25,7 +26,7 @@ namespace atom {
namespace { namespace {
class GtkMessageBox { class GtkMessageBox : public NativeWindowObserver {
public: public:
GtkMessageBox(NativeWindow* parent_window, GtkMessageBox(NativeWindow* parent_window,
MessageBoxType type, MessageBoxType type,
@ -77,6 +78,7 @@ class GtkMessageBox {
// Parent window. // Parent window.
if (parent_) { if (parent_) {
parent_->AddObserver(this);
parent_->SetEnabled(false); parent_->SetEnabled(false);
libgtk2ui::SetGtkTransientForAura(dialog_, parent_->GetNativeWindow()); libgtk2ui::SetGtkTransientForAura(dialog_, parent_->GetNativeWindow());
gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE); gtk_window_set_modal(GTK_WINDOW(dialog_), TRUE);
@ -85,9 +87,11 @@ class GtkMessageBox {
~GtkMessageBox() { ~GtkMessageBox() {
gtk_widget_destroy(dialog_); gtk_widget_destroy(dialog_);
if (parent_) if (parent_) {
parent_->RemoveObserver(this);
parent_->SetEnabled(true); parent_->SetEnabled(true);
} }
}
GtkMessageType GetMessageType(MessageBoxType type) { GtkMessageType GetMessageType(MessageBoxType type) {
switch (type) { switch (type) {
@ -144,6 +148,11 @@ class GtkMessageBox {
Show(); Show();
} }
void OnWindowClosed() override {
parent_->RemoveObserver(this);
parent_ = nullptr;
}
CHROMEGTK_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, int); CHROMEGTK_CALLBACK_1(GtkMessageBox, void, OnResponseDialog, int);
private: private:

View file

@ -24,7 +24,7 @@
### Elementos DOM personalizados: ### Elementos DOM personalizados:
* [Objeto `File`](../../docs/api/file-object.md) * [Objeto `File`](../../docs/api/file-object.md)
* [Etiqueta `<webview>`](../../docs/api/web-view-tag.md) * [Etiqueta `<webview>`](../../docs/api/webview-tag.md)
* [Función `window.open`](../../docs/api/window-open.md) * [Función `window.open`](../../docs/api/window-open.md)
### Módulos del Proceso Principal: ### Módulos del Proceso Principal:

View file

@ -43,7 +43,7 @@ dans la FAQ :
### Eléments DOM Personnalisés: ### Eléments DOM Personnalisés:
* [Objet `File`](api/file-object.md) * [Objet `File`](api/file-object.md)
* [Tag `<webview>`](api/web-view-tag.md) * [Tag `<webview>`](api/webview-tag.md)
* [Fonction `window.open`](api/window-open.md) * [Fonction `window.open`](api/window-open.md)
### Modules pour le Processus Principal : ### Modules pour le Processus Principal :

View file

@ -49,7 +49,7 @@ sezione prima di creare una issue:
### Elementi personalizzati DOM: ### Elementi personalizzati DOM:
* [Oggetto `File`](api/oggetto-file.md) * [Oggetto `File`](api/oggetto-file.md)
* [Tag `<webview>`](api/web-view-tag.md) * [Tag `<webview>`](api/webview-tag.md)
* [Funzione `window.open`](api/window-open.md) * [Funzione `window.open`](api/window-open.md)
### Moduli per il Processo Main: ### Moduli per il Processo Main:

View file

@ -44,7 +44,7 @@ _リンクになっていないリストは未翻訳のものです。_
### カスタムDOM要素: ### カスタムDOM要素:
* [`File` Object](api/file-object.md) * [`File` Object](api/file-object.md)
* [`<webview>` タグ](api/web-view-tag.md) * [`<webview>` タグ](api/webview-tag.md)
* [`window.open` 関数](api/window-open.md) * [`window.open` 関数](api/window-open.md)
### Main Processのモジュール: ### Main Processのモジュール:

View file

@ -396,11 +396,11 @@ Executes editing command `undo` in page.
* `wordStart` Boolean - ワード始まりからの検索かを指定します。省略時は`false`で、語途中でもマッチします。 * `wordStart` Boolean - ワード始まりからの検索かを指定します。省略時は`false`で、語途中でもマッチします。
* `medialCapitalAsWordStart` Boolean - `wordStart`指定時、CamelCaseの途中もワード始まりと見なすかを指定します。省略時は`false`です。 * `medialCapitalAsWordStart` Boolean - `wordStart`指定時、CamelCaseの途中もワード始まりと見なすかを指定します。省略時は`false`です。
`text`をページ内全てから検索し、リクエストに使用するリクエストID(`Integer`)を返します。リクエストの結果は、[`found-in-page`](web-view-tag.md#event-found-in-page)イベントを介して受け取ることができます。 `text`をページ内全てから検索し、リクエストに使用するリクエストID(`Integer`)を返します。リクエストの結果は、[`found-in-page`](webview-tag.md#event-found-in-page)イベントを介して受け取ることができます。
### `<webview>.stopFindInPage(action)` ### `<webview>.stopFindInPage(action)`
* `action` String - [`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage)リクエストを終わらせる時にとるアクションを指定します。 * `action` String - [`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage)リクエストを終わらせる時にとるアクションを指定します。
* `clearSelection` - 選択をクリアします。 * `clearSelection` - 選択をクリアします。
* `keepSelection` - 選択を通常の選択へと変換します。 * `keepSelection` - 選択を通常の選択へと変換します。
* `activateSelection` - 選択ノードにフォーカスを当て、クリックします。 * `activateSelection` - 選択ノードにフォーカスを当て、クリックします。
@ -573,7 +573,7 @@ webview.addEventListener('console-message', (e) => {
* `matches` Integer (optional) - マッチした数です。 * `matches` Integer (optional) - マッチした数です。
* `selectionArea` Object (optional) - 最初のマッチした場所です。 * `selectionArea` Object (optional) - 最初のマッチした場所です。
[`webview.findInPage`](web-view-tag.md#webviewtagfindinpage)リクエストで結果が得られた場合に発生します。 [`webview.findInPage`](webview-tag.md#webviewtagfindinpage)リクエストで結果が得られた場合に発生します。
```javascript ```javascript
webview.addEventListener('found-in-page', (e) => { webview.addEventListener('found-in-page', (e) => {

View file

@ -51,7 +51,7 @@ Electron에 대해 자주 묻는 질문이 있습니다. 이슈를 생성하기
### 커스텀 DOM 요소: ### 커스텀 DOM 요소:
* [`File` 객체](api/file-object.md) * [`File` 객체](api/file-object.md)
* [`<webview>` 태그](api/web-view-tag.md) * [`<webview>` 태그](api/webview-tag.md)
* [`window.open` 함수](api/window-open.md) * [`window.open` 함수](api/window-open.md)
### 메인 프로세스에서 사용할 수 있는 모듈: ### 메인 프로세스에서 사용할 수 있는 모듈:

View file

@ -473,12 +473,12 @@ Returns `Boolean` - 게스트 페이지 음소거 여부.
웹 페이지에서 `text`에 일치하는 모든 대상을 찾는 요청을 시작하고 요청에 사용된 요청을 웹 페이지에서 `text`에 일치하는 모든 대상을 찾는 요청을 시작하고 요청에 사용된 요청을
표현하는 `정수(integer)`를 반환합니다. 요청의 결과는 표현하는 `정수(integer)`를 반환합니다. 요청의 결과는
[`found-in-page`](web-view-tag.md#event-found-in-page) 이벤트를 통해 취득할 수 [`found-in-page`](webview-tag.md#event-found-in-page) 이벤트를 통해 취득할 수
있습니다. 있습니다.
### `webContents.stopFindInPage(action)` ### `webContents.stopFindInPage(action)`
* `action` String - [`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage) * `action` String - [`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage)
요청이 종료되었을 때 일어날 수 있는 작업을 지정합니다. 요청이 종료되었을 때 일어날 수 있는 작업을 지정합니다.
* `clearSelection` - 선택을 취소합니다. * `clearSelection` - 선택을 취소합니다.
* `keepSelection` - 선택을 일반 선택으로 변경합니다. * `keepSelection` - 선택을 일반 선택으로 변경합니다.

View file

@ -41,7 +41,7 @@ Existem muitas perguntas comuns que são feitas, verifique antes de criar uma is
### Elementos DOM Personalizados: ### Elementos DOM Personalizados:
* [Objeto `File`](api/file-object.md) * [Objeto `File`](api/file-object.md)
* [Tag `<webview>`](../../docs/api/web-view-tag.md) * [Tag `<webview>`](../../docs/api/webview-tag.md)
* [Função `window.open`](api/window-open.md) * [Função `window.open`](api/window-open.md)
### Módulos para o Processo Principal: ### Módulos para o Processo Principal:

View file

@ -34,7 +34,7 @@
### Пользовательские элементы DOM: ### Пользовательские элементы DOM:
* [`File` Object](api/file-object.md) * [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/web-view-tag.md) * [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md) * [`window.open` Function](api/window-open.md)
### Модули для Main Process: ### Модули для Main Process:

View file

@ -25,7 +25,7 @@
### การปรับแต่ง DOM: ### การปรับแต่ง DOM:
* [วัตถุ `File`](api/file-object.md) * [วัตถุ `File`](api/file-object.md)
* [แท็ก `<webview>`](api/web-view-tag.md) * [แท็ก `<webview>`](api/webview-tag.md)
* [ฟังก์ชัน `window.open`](api/window-open.md) * [ฟังก์ชัน `window.open`](api/window-open.md)
### โมดูลสำหรับกระบวนการหลัก : ### โมดูลสำหรับกระบวนการหลัก :

View file

@ -37,7 +37,7 @@ Bir problem(issue) bildirmeden önce sıkça sorulan sorulara göz atın:
### Özel DOM Elementleri: ### Özel DOM Elementleri:
* [`File` Nesnesi](api/file-object.md) * [`File` Nesnesi](api/file-object.md)
* [`<webview>` Etiketi](https://github.com/electron/electron/tree/master/docs/api/web-view-tag.md) * [`<webview>` Etiketi](https://github.com/electron/electron/tree/master/docs/api/webview-tag.md)
* [`window.open` Fonksiyonu](https://github.com/electron/electron/tree/master/docs/api/window-open.md) * [`window.open` Fonksiyonu](https://github.com/electron/electron/tree/master/docs/api/window-open.md)
### Ana Süreç(Main Process) Modülleri: ### Ana Süreç(Main Process) Modülleri:

View file

@ -36,7 +36,7 @@
### Користувальницькі елементи DOM ### Користувальницькі елементи DOM
* [`File` Object](api/file-object.md) * [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/web-view-tag.md) * [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md) * [`window.open` Function](api/window-open.md)
### Модулі для Main Process: ### Модулі для Main Process:

View file

@ -43,7 +43,7 @@
### 自定义的 DOM 元素: ### 自定义的 DOM 元素:
* [`File` 对象](api/file-object.md) * [`File` 对象](api/file-object.md)
* [`<webview>` 标签](api/web-view-tag.md) * [`<webview>` 标签](api/webview-tag.md)
* [`window.open` 函数](api/window-open.md) * [`window.open` 函数](api/window-open.md)
### 在主进程内可用的模块: ### 在主进程内可用的模块:

View file

@ -359,12 +359,12 @@ guest page 导航到指定的相对位置.
默认为 `false`. 默认为 `false`.
* `medialCapitalAsWordStart` Boolean - 当配合 `wordStart`的时候,接受一个文字中的匹配项,要求匹配项是以大写字母开头后面跟小写字母或者没有字母。可以接受一些其他单词内部匹配, 默认为 `false`. * `medialCapitalAsWordStart` Boolean - 当配合 `wordStart`的时候,接受一个文字中的匹配项,要求匹配项是以大写字母开头后面跟小写字母或者没有字母。可以接受一些其他单词内部匹配, 默认为 `false`.
发起一个请求来寻找页面中的所有匹配 `text` 的地方并且返回一个 `Integer`来表示这个请求用的请求Id. 这个请求结果可以通过订阅[`found-in-page`](web-view-tag.md#event-found-in-page) 事件来取得. 发起一个请求来寻找页面中的所有匹配 `text` 的地方并且返回一个 `Integer`来表示这个请求用的请求Id. 这个请求结果可以通过订阅[`found-in-page`](webview-tag.md#event-found-in-page) 事件来取得.
### `<webview>.stopFindInPage(action)` ### `<webview>.stopFindInPage(action)`
* `action` String - 指定一个行为来接替停止 * `action` String - 指定一个行为来接替停止
[`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage) 请求. [`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage) 请求.
* `clearSelection` - 转变为一个普通的 selection. * `clearSelection` - 转变为一个普通的 selection.
* `keepSelection` - 清除 selection. * `keepSelection` - 清除 selection.
* `activateSelection` - 聚焦并点击 selection node. * `activateSelection` - 聚焦并点击 selection node.
@ -533,7 +533,7 @@ webview.addEventListener('console-message', function (e) {
* `matches` Integer (optional) - 匹配数量. * `matches` Integer (optional) - 匹配数量.
* `selectionArea` Object (optional) - 整合第一个匹配域. * `selectionArea` Object (optional) - 整合第一个匹配域.
在请求[`webview.findInPage`](web-view-tag.md#webviewtagfindinpage)结果有效时触发. 在请求[`webview.findInPage`](webview-tag.md#webviewtagfindinpage)结果有效时触发.
```javascript ```javascript
webview.addEventListener('found-in-page', function (e) { webview.addEventListener('found-in-page', function (e) {

View file

@ -25,7 +25,7 @@
客製的 DOM 元素: 客製的 DOM 元素:
* [`File`物件](api/file-object.md) * [`File`物件](api/file-object.md)
* [`<webview>`物件](api/web-view-tag.md) * [`<webview>`物件](api/webview-tag.md)
* [`window.open`函數](api/window-open.md) * [`window.open`函數](api/window-open.md)
主行程可用的模組: 主行程可用的模組:

View file

@ -50,7 +50,7 @@ an issue:
### Custom DOM Elements: ### Custom DOM Elements:
* [`File` Object](api/file-object.md) * [`File` Object](api/file-object.md)
* [`<webview>` Tag](api/web-view-tag.md) * [`<webview>` Tag](api/webview-tag.md)
* [`window.open` Function](api/window-open.md) * [`window.open` Function](api/window-open.md)
### Modules for the Main Process: ### Modules for the Main Process:

View file

@ -46,14 +46,23 @@ geocoding requests. To enable geocoding requests, visit [this page](https://cons
Disables ASAR support. This variable is only supported in forked child processes Disables ASAR support. This variable is only supported in forked child processes
and spawned child processes that set `ELECTRON_RUN_AS_NODE`. and spawned child processes that set `ELECTRON_RUN_AS_NODE`.
### `ELECTRON_RUN_AS_NODE`
Starts the process as a normal Node.js process.
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
Don't attach to the current console session.
### `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_
Don't use the global menu bar on Linux.
## Development Variables ## Development Variables
The following environment variables are intended primarily for development and The following environment variables are intended primarily for development and
debugging purposes. debugging purposes.
### `ELECTRON_RUN_AS_NODE`
Starts the process as a normal Node.js process.
### `ELECTRON_ENABLE_LOGGING` ### `ELECTRON_ENABLE_LOGGING`
@ -76,11 +85,3 @@ This environment variable will not work if the `crashReporter` is started.
Shows the Windows's crash dialog when Electron crashes. Shows the Windows's crash dialog when Electron crashes.
This environment variable will not work if the `crashReporter` is started. This environment variable will not work if the `crashReporter` is started.
### `ELECTRON_NO_ATTACH_CONSOLE` _Windows_
Don't attach to the current console session.
### `ELECTRON_FORCE_WINDOW_MENU_BAR` _Linux_
Don't use the global menu bar on Linux.

View file

@ -515,12 +515,12 @@ Inserts `text` to the focused element.
Starts a request to find all matches for the `text` in the web page and returns an `Integer` Starts a request to find all matches for the `text` in the web page and returns an `Integer`
representing the request id used for the request. The result of the request can be representing the request id used for the request. The result of the request can be
obtained by subscribing to [`found-in-page`](web-view-tag.md#event-found-in-page) event. obtained by subscribing to [`found-in-page`](webview-tag.md#event-found-in-page) event.
### `<webview>.stopFindInPage(action)` ### `<webview>.stopFindInPage(action)`
* `action` String - Specifies the action to take place when ending * `action` String - Specifies the action to take place when ending
[`<webview>.findInPage`](web-view-tag.md#webviewtagfindinpage) request. [`<webview>.findInPage`](webview-tag.md#webviewtagfindinpage) request.
* `clearSelection` - Clear the selection. * `clearSelection` - Clear the selection.
* `keepSelection` - Translate the selection into a normal selection. * `keepSelection` - Translate the selection into a normal selection.
* `activateSelection` - Focus and click the selection node. * `activateSelection` - Focus and click the selection node.
@ -720,7 +720,7 @@ Returns:
* `selectionArea` Object - Coordinates of first match region. * `selectionArea` Object - Coordinates of first match region.
Fired when a result is available for Fired when a result is available for
[`webview.findInPage`](web-view-tag.md#webviewtagfindinpage) request. [`webview.findInPage`](webview-tag.md#webviewtagfindinpage) request.
```javascript ```javascript
const webview = document.getElementById('foo') const webview = document.getElementById('foo')

View file

@ -6,7 +6,7 @@ Electron began in 2013 as the framework on which [Atom](https://atom.io), GitHub
It has since become a popular tool used by open source developers, startups, and established companies. [See who is building on Electron](/apps). It has since become a popular tool used by open source developers, startups, and established companies. [See who is building on Electron](/apps).
Read on to learn more about the contributors and releases of Electron or get started building with Electron in the [Quick Start Guide](../quick-start). Read on to learn more about the contributors and releases of Electron or get started building with Electron in the [Quick Start Guide](quick-start.md).
## Core Team and Contributors ## Core Team and Contributors

View file

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>test</title>
<script>
console.log(typeof process)
</script>
</head>
<body>
test?
</body>
</html>

View file

@ -6,7 +6,7 @@ const {app, session, getGuestWebContents, ipcMain, BrowserWindow, webContents} =
const {closeWindow} = require('./window-helpers') const {closeWindow} = require('./window-helpers')
describe('<webview> tag', function () { describe('<webview> tag', function () {
this.timeout(60000) this.timeout(3 * 60 * 1000)
var fixtures = path.join(__dirname, 'fixtures') var fixtures = path.join(__dirname, 'fixtures')