Commit fa42ff1d authored by erikchen's avatar erikchen Committed by Commit Bot

Fix paste without style on macOS.

NSViews in Views need to implement pasteAndMatchStyle:.

The IDS_PASTE_MATCH_STYLE_MAC main menu item had the wrong key equivalent.

Bug: 882166
Change-Id: I0ba029afddaab8e155d5cfadaccadf2c231a3e79
Reviewed-on: https://chromium-review.googlesource.com/1255864
Commit-Queue: Erik Chen <erikchen@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596280}
parent 737b0a6f
...@@ -141,8 +141,7 @@ base::scoped_nsobject<NSMenuItem> BuildEditMenu(NSApplication* nsapp, ...@@ -141,8 +141,7 @@ base::scoped_nsobject<NSMenuItem> BuildEditMenu(NSApplication* nsapp,
Item(IDS_PASTE_MATCH_STYLE_MAC) Item(IDS_PASTE_MATCH_STYLE_MAC)
.action(@selector(pasteAndMatchStyle:)) .action(@selector(pasteAndMatchStyle:))
.is_alternate() .is_alternate()
.key_equivalent(@"v", NSEventModifierFlagCommand | .key_equivalent(@"V", NSEventModifierFlagCommand |
NSEventModifierFlagShift |
NSEventModifierFlagOption), NSEventModifierFlagOption),
Item(IDS_EDIT_DELETE_MAC) Item(IDS_EDIT_DELETE_MAC)
.tag(IDC_CONTENT_CONTEXT_DELETE) .tag(IDC_CONTENT_CONTEXT_DELETE)
......
...@@ -195,6 +195,8 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -195,6 +195,8 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
return ui::TextEditCommand::COPY; return ui::TextEditCommand::COPY;
if (action == @selector(paste:)) if (action == @selector(paste:))
return ui::TextEditCommand::PASTE; return ui::TextEditCommand::PASTE;
if (action == @selector(pasteAndMatchStyle:))
return ui::TextEditCommand::PASTE;
if (action == @selector(selectAll:)) if (action == @selector(selectAll:))
return ui::TextEditCommand::SELECT_ALL; return ui::TextEditCommand::SELECT_ALL;
return ui::TextEditCommand::INVALID_COMMAND; return ui::TextEditCommand::INVALID_COMMAND;
...@@ -260,6 +262,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -260,6 +262,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
- (void)cut:(id)sender; - (void)cut:(id)sender;
- (void)copy:(id)sender; - (void)copy:(id)sender;
- (void)paste:(id)sender; - (void)paste:(id)sender;
- (void)pasteAndMatchStyle:(id)sender;
- (void)selectAll:(id)sender; - (void)selectAll:(id)sender;
@end @end
...@@ -660,6 +663,13 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -660,6 +663,13 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
eventFlags:ui::EF_CONTROL_DOWN]; eventFlags:ui::EF_CONTROL_DOWN];
} }
- (void)pasteAndMatchStyle:(id)sender {
[self handleAction:ui::TextEditCommand::PASTE
keyCode:ui::VKEY_V
domCode:ui::DomCode::US_V
eventFlags:ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN];
}
- (void)selectAll:(id)sender { - (void)selectAll:(id)sender {
[self handleAction:ui::TextEditCommand::SELECT_ALL [self handleAction:ui::TextEditCommand::SELECT_ALL
keyCode:ui::VKEY_A keyCode:ui::VKEY_A
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment