Permalink
Browse files

Allow copy and pasting of web source by pressing 'c'

  • Loading branch information...
1 parent db39aee commit 38f16a2122f4a8404f3be97a91a511f0c42f764b @pieter pieter committed Sep 19, 2008
Showing with 11 additions and 1 deletion.
  1. +1 −1 PBCommitList.m
  2. +8 −0 PBWebGitController.m
  3. +2 −0 html/keyboardNavigation.js
View
@@ -22,7 +22,7 @@ - (void) keyDown: (id) event
else
[webView scrollPageDown: self];
}
- else if ([character rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"jkv"]].location == 0)
+ else if ([character rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"jkcv"]].location == 0)
[webController sendKey: character];
else
[super keyDown: event];
@@ -73,6 +73,14 @@ - (void) sendKey: (NSString*) key
[script callWebScriptMethod:@"handleKeyFromCocoa" withArguments: [NSArray arrayWithObject:key]];
}
+- (void) copySource
+{
+ NSString *source = [[[[view mainFrame] DOMDocument] documentElement] outerHTML];
+ NSPasteboard *a =[NSPasteboard generalPasteboard];
+ [a declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:self];
+ [a setString:source forType: NSStringPboardType];
+}
+
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
{
return NO;
@@ -24,6 +24,8 @@ var handleKeyFromCocoa = function(key) {
changeHunk(false);
else if (key == 'v')
showDiffs();
+ else if (key == 'c')
+ Controller.copySource();
}
var changeHunk = function(next) {

0 comments on commit 38f16a2

Please sign in to comment.