mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
loading frames with their own JSCocoa OSX objects
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface AtomWindowController : NSWindowController {
|
||||
IBOutlet id webView;
|
||||
NSString *URL;
|
||||
|
||||
@@ -26,7 +26,10 @@
|
||||
|
||||
[self setShouldCascadeWindows:NO];
|
||||
[self setWindowFrameAutosaveName:@"atomWindow"];
|
||||
|
||||
|
||||
|
||||
[webView setFrameLoadDelegate:self];
|
||||
|
||||
if (self.URL) {
|
||||
[webView setMainFrameURL:self.URL];
|
||||
} else {
|
||||
@@ -36,10 +39,13 @@
|
||||
NSString *html = [NSString stringWithContentsOfURL:indexURL encoding:NSUTF8StringEncoding error:nil];;
|
||||
[[webView mainFrame] loadHTMLString:html baseURL:htmlURL];
|
||||
}
|
||||
|
||||
// https://github.com/parmanoir/jscocoa#readme
|
||||
JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[[webView mainFrame] globalContext]];
|
||||
[jsc setObject:self withName:@"App"];
|
||||
}
|
||||
|
||||
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame {
|
||||
// https://github.com/parmanoir/jscocoa#readme
|
||||
JSCocoa* jsc = [[JSCocoa alloc] initWithGlobalContext:[frame globalContext]];
|
||||
[jsc setObject:self withName:@"App"];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"$PROJECT_DIR/script/compile.sh\"";
|
||||
shellScript = "\"$PROJECT_DIR/script/compile.sh\" ";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
32
HTML/editor.html
Normal file
32
HTML/editor.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font: 18px Inconsolada, Monaco, Courier;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="editor"></div>
|
||||
|
||||
<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/mode-coffee.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/mode-html.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="underscore.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="coffee-script.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script src="osx.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="atomicity.js" type="text/javascript" charset="utf-8"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +1,8 @@
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font: 18px Inconsolada, Monaco, Courier;
|
||||
}
|
||||
</style>
|
||||
<div id="editor"></div>
|
||||
<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/mode-coffee.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="ace/mode-html.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="underscore.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="jquery.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="coffee-script.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script src="osx.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="atomicity.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<frameset cols = "25%, *">
|
||||
<frame src ="project.html" />
|
||||
<frame src ="editor.html" />
|
||||
</frameset>
|
||||
</html>
|
||||
|
||||
0
HTML/project.html
Normal file
0
HTML/project.html
Normal file
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SOURCE_SCRIPTS_DIR="$PROJECT_DIR/HTML"
|
||||
DESTINATION_SCRIPTS_DIR="$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources/"
|
||||
|
||||
cp -r "$SOURCE_SCRIPTS_DIR" "$DESTINATION_SCRIPTS_DIR"
|
||||
echo "$DESTINATION_SCRIPTS_DIR"
|
||||
Reference in New Issue
Block a user