diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 0d9730d7afc5..b0f0a95ed2fd 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -540,6 +540,10 @@ void WebContents::Paste() { web_contents()->Paste(); } +void WebContents::PasteAndMatchStyle() { + web_contents()->PasteAndMatchStyle(); +} + void WebContents::Delete() { web_contents()->Delete(); } @@ -662,6 +666,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("cut", &WebContents::Cut) .SetMethod("copy", &WebContents::Copy) .SetMethod("paste", &WebContents::Paste) + .SetMethod("pasteAndMatchStyle", &WebContents::PasteAndMatchStyle) .SetMethod("delete", &WebContents::Delete) .SetMethod("selectAll", &WebContents::SelectAll) .SetMethod("unselect", &WebContents::Unselect) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 4d0937436f36..eb69d65bf9aa 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -77,6 +77,7 @@ class WebContents : public mate::EventEmitter, void Cut(); void Copy(); void Paste(); + void PasteAndMatchStyle(); void Delete(); void SelectAll(); void Unselect(); diff --git a/atom/renderer/lib/web-view/web-view.coffee b/atom/renderer/lib/web-view/web-view.coffee index bf163c0cfb5c..881300c4dd0a 100644 --- a/atom/renderer/lib/web-view/web-view.coffee +++ b/atom/renderer/lib/web-view/web-view.coffee @@ -261,6 +261,7 @@ registerWebViewElement = -> "cut" "copy" "paste" + "pasteAndMatchStyle" "delete" "selectAll" "unselect" diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 14740e929c4e..4eb3eb332737 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -854,6 +854,10 @@ Executes editing command `copy` in page. Executes editing command `paste` in page. +### WebContents.pasteAndMatchStyle() + +Executes editing command `pasteAndMatchStyle` in page. + ### WebContents.delete() Executes editing command `delete` in page. diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md index 55f4ad77bfac..5536920c5b7b 100644 --- a/docs/api/web-view-tag.md +++ b/docs/api/web-view-tag.md @@ -254,6 +254,10 @@ Executes editing command `copy` in page. Executes editing command `paste` in page. +### ``.pasteAndMatchStyle() + +Executes editing command `pasteAndMatchStyle` in page. + ### ``.delete() Executes editing command `delete` in page.