From cb2baf9cb4ce1e33e6756969b1f71eb0e011f2c8 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Sat, 11 Dec 2010 13:09:07 +0000 Subject: =?UTF-8?q?=E2=80=A2=20the=20default=20behaviour=20is=20that=20'Sh?= =?UTF-8?q?ow=20HTML=20Window'=20will=20order=20front=20the=20window=20but?= =?UTF-8?q?=20the=20focus=20remains=20at=20the=20caller=20for=20convenienc?= =?UTF-8?q?e=20but=20under=20some=20circumstances=20it=20could=20be=20usef?= =?UTF-8?q?ul=20to=20make=20the=20HTML=20window=20the=20first=20responder;?= =?UTF-8?q?=20now=20this=20can=20be=20done=20via=20JavaScript=20like:=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPBundleHTMLOutputController.m | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'Source') diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index c57c79f4..365c15a3 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -59,22 +59,13 @@ return @"BundleHTMLOutput"; } -- (void)windowControllerDidLoadNib:(NSWindowController *) aController -{ - [super windowControllerDidLoadNib:aController]; - -} - - (void)displayHTMLContent:(NSString *)content withOptions:(NSDictionary *)displayOptions { [[self window] orderFront:nil]; - NSString *fullContent = @"%@"; - fullContent = [NSString stringWithFormat:fullContent, content]; - [self setInitHTMLSourceString:fullContent]; - [[webView mainFrame] loadHTMLString:@"" baseURL:nil]; - [[webView mainFrame] loadHTMLString:fullContent baseURL:nil]; + [self setInitHTMLSourceString:content]; + [[webView mainFrame] loadHTMLString:content baseURL:nil]; } @@ -385,6 +376,12 @@ if(!command) return @"No JavaScript command found."; + // Check for internal commands passed via JavaScript + if([command isEqualToString:@"_SP_self_makeKeyWindow"]) { + [[self window] makeKeyAndOrderFront:nil]; + return @""; + } + NSString *output = nil; if(uuid == nil) output = [command runBashCommandWithEnvironment:nil atCurrentDirectoryPath:nil error:&err]; -- cgit v1.2.3