Browse Source

Expose UIWebView from JSEditor

Josh Engebretson 9 years ago
parent
commit
b3d44c743c

+ 8 - 1
Script/AtomicEditor/ui/frames/ResourceFrame.ts

@@ -100,7 +100,14 @@ class ResourceFrame extends ScriptWidget {
 
 
         if (ext == ".js" || ext == ".txt" || ext == ".json" || ext == ".ts") {
         if (ext == ".js" || ext == ".txt" || ext == ".json" || ext == ".ts") {
 
 
-            editor = new Editor.JSResourceEditor(path, this.tabcontainer);
+             let jseditor = new Editor.JSResourceEditor(path, this.tabcontainer);
+
+             jseditor.subscribeToEvent(EditorEvents.UserPreferencesChangedNotification, (data) => {
+                 // We can get the webclient here now, though this might not be a great place to set this up                 
+                 let webClient = jseditor.webView.webClient;
+             });
+
+             editor = jseditor;
 
 
         } else if (ext == ".scene") {
         } else if (ext == ".scene") {
 
 

+ 1 - 1
Script/Packages/Editor/Editor.json

@@ -1,6 +1,6 @@
 {
 {
 	"name" : "Editor",
 	"name" : "Editor",
-	"includes" : ["<Atomic/Graphics/DebugRenderer.h>"],
+	"includes" : ["<Atomic/Graphics/DebugRenderer.h>", "<AtomicWebView/UIWebView.h>"],
 	"sources" : ["Source/AtomicEditor/Application", "Source/AtomicEditor/Utils",
 	"sources" : ["Source/AtomicEditor/Application", "Source/AtomicEditor/Utils",
 							 "Source/AtomicEditor/EditorMode", "Source/AtomicEditor/PlayerMode",
 							 "Source/AtomicEditor/EditorMode", "Source/AtomicEditor/PlayerMode",
 							 "Source/AtomicEditor/Editors", "Source/AtomicEditor/Editors/SceneEditor3D",
 							 "Source/AtomicEditor/Editors", "Source/AtomicEditor/Editors/SceneEditor3D",

+ 1 - 1
Script/Packages/Editor/Package.json

@@ -2,7 +2,7 @@
 {
 {
   "name" : "Editor",
   "name" : "Editor",
   "namespace" : "AtomicEditor",
   "namespace" : "AtomicEditor",
-  "dependencies" : ["Script/Packages/Atomic"],
+  "dependencies" : ["Script/Packages/WebView"],
   "modules" : ["Editor"],
   "modules" : ["Editor"],
   "platforms" : ["WINDOWS", "MACOSX", "LINUX"]
   "platforms" : ["WINDOWS", "MACOSX", "LINUX"]
 }
 }

+ 4 - 1
Source/AtomicEditor/Editors/JSResourceEditor.h

@@ -47,6 +47,9 @@ public:
 
 
     virtual ~JSResourceEditor();
     virtual ~JSResourceEditor();
 
 
+    /// Get the editor's UIWebView
+    UIWebView* GetWebView() const { return webView_; }
+
     bool OnEvent(const TBWidgetEvent &ev);
     bool OnEvent(const TBWidgetEvent &ev);
 
 
     bool FindText(const String& findText, unsigned flags);
     bool FindText(const String& findText, unsigned flags);
@@ -60,7 +63,7 @@ public:
     void SetFocus();
     void SetFocus();
 
 
     bool Save();
     bool Save();
-    
+
 private:
 private:
 
 
     void HandleWebViewLoadEnd(StringHash eventType, VariantMap& eventData);
     void HandleWebViewLoadEnd(StringHash eventType, VariantMap& eventData);