Merge pull request #6619 from electron/web-contents-copy-image-at
Add webContents.copyImageAt(x, y)
This commit is contained in:
commit
99b523176b
3 changed files with 15 additions and 0 deletions
|
@ -1146,6 +1146,12 @@ void WebContents::ShowDefinitionForSelection() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebContents::CopyImageAt(int x, int y) {
|
||||||
|
const auto host = web_contents()->GetRenderViewHost();
|
||||||
|
if (host)
|
||||||
|
host->CopyImageAt(x, y);
|
||||||
|
}
|
||||||
|
|
||||||
void WebContents::Focus() {
|
void WebContents::Focus() {
|
||||||
web_contents()->Focus();
|
web_contents()->Focus();
|
||||||
}
|
}
|
||||||
|
@ -1425,6 +1431,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
||||||
.SetMethod("showDefinitionForSelection",
|
.SetMethod("showDefinitionForSelection",
|
||||||
&WebContents::ShowDefinitionForSelection)
|
&WebContents::ShowDefinitionForSelection)
|
||||||
|
.SetMethod("copyImageAt", &WebContents::CopyImageAt)
|
||||||
.SetMethod("capturePage", &WebContents::CapturePage)
|
.SetMethod("capturePage", &WebContents::CapturePage)
|
||||||
.SetMethod("isFocused", &WebContents::IsFocused)
|
.SetMethod("isFocused", &WebContents::IsFocused)
|
||||||
.SetProperty("id", &WebContents::ID)
|
.SetProperty("id", &WebContents::ID)
|
||||||
|
|
|
@ -126,6 +126,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
uint32_t FindInPage(mate::Arguments* args);
|
uint32_t FindInPage(mate::Arguments* args);
|
||||||
void StopFindInPage(content::StopFindAction action);
|
void StopFindInPage(content::StopFindAction action);
|
||||||
void ShowDefinitionForSelection();
|
void ShowDefinitionForSelection();
|
||||||
|
void CopyImageAt(int x, int y);
|
||||||
|
|
||||||
// Focus.
|
// Focus.
|
||||||
void Focus();
|
void Focus();
|
||||||
|
|
|
@ -626,6 +626,13 @@ Executes the editing command `cut` in web page.
|
||||||
|
|
||||||
Executes the editing command `copy` in web page.
|
Executes the editing command `copy` in web page.
|
||||||
|
|
||||||
|
### `contents.copyImageAt(x, y)`
|
||||||
|
|
||||||
|
* `x` Integer
|
||||||
|
* `y` Integer
|
||||||
|
|
||||||
|
Copy the image at the given position to the clipboard.
|
||||||
|
|
||||||
#### `contents.paste()`
|
#### `contents.paste()`
|
||||||
|
|
||||||
Executes the editing command `paste` in web page.
|
Executes the editing command `paste` in web page.
|
||||||
|
|
Loading…
Reference in a new issue