aboutsummaryrefslogtreecommitdiff
path: root/js/document/views/design.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/views/design.js')
-rwxr-xr-xjs/document/views/design.js72
1 files changed, 59 insertions, 13 deletions
diff --git a/js/document/views/design.js b/js/document/views/design.js
index ecd2956c..10963cab 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -7,44 +7,85 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
7//////////////////////////////////////////////////////////////////////// 7////////////////////////////////////////////////////////////////////////
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 CodeDocumentView = require("js/document/views/code").CodeDocumentView; 10 BaseDocumentView = require("js/document/views/base").BaseDocumentView;
11//////////////////////////////////////////////////////////////////////// 11////////////////////////////////////////////////////////////////////////
12// 12//
13exports.DesignDocumentView = Montage.create(CodeDocumentView, { 13exports.DesignDocumentView = Montage.create(BaseDocumentView, {
14 //////////////////////////////////////////////////////////////////// 14 ////////////////////////////////////////////////////////////////////
15 // 15 //
16 hasTemplate: { 16 hasTemplate: {
17 enumerable: false,
18 value: false 17 value: false
19 }, 18 },
20 //////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////
21 // 20 //
21 _callback: {
22 value: null
23 },
24 ////////////////////////////////////////////////////////////////////
25 //
26 _document: {
27 value: null
28 },
29 ////////////////////////////////////////////////////////////////////
30 //
31 content: {
32 value: null
33 },
34 ////////////////////////////////////////////////////////////////////
35 //
36 document: {
37 get: function() {return this._document;},
38 set: function(value) {this._document = value;}
39 },
40 ////////////////////////////////////////////////////////////////////
41 //
22 initiliaze: { 42 initiliaze: {
23 enumerable: false, 43 value: function (parent) {
24 value: function () { 44 //
45 this.iframe = document.createElement("iframe");
25 // 46 //
47 this.iframe.style.border = "none";
48 this.iframe.style.background = "#FFF";
49 this.iframe.style.height = "100%";
50 this.iframe.style.width = "100%";
51 //
52 return parent.appendChild(this.iframe);
26 } 53 }
27 }, 54 },
28 //////////////////////////////////////////////////////////////////// 55 ////////////////////////////////////////////////////////////////////
29 // 56 //
30 render: { 57 render: {
31 enumerable: false, 58 value: function (callback) {
32 value: function () {
33 // 59 //
60 this._callback = callback;
61 this.iframe.addEventListener("load", this.onTemplateLoad.bind(this), true);
62 this.iframe.src = "js/document/templates/montage-web/index.html";
34 } 63 }
35 }, 64 },
36 //////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////
37 // 66 //
38 onTemplateLoad: { 67 onTemplateLoad: {
39 enumerable: false, 68 value: function (e) {
40 value: function () { 69 //
70 this.document = this.iframe.contentWindow.document;
71 //
72
73
74
75
76 //this.document.head.innerHTML += this.content.head;
77 this.document.body.innerHTML = this.content.head + this.content.body;
78
79
80
81
41 // 82 //
83 if (this._callback) this._callback();
42 } 84 }
43 }, 85 },
44 //////////////////////////////////////////////////////////////////// 86 ////////////////////////////////////////////////////////////////////
45 // 87 //
46 initCss: { 88 initCss: {
47 enumerable: false,
48 value: function () { 89 value: function () {
49 // 90 //
50 } 91 }
@@ -52,7 +93,6 @@ exports.DesignDocumentView = Montage.create(CodeDocumentView, {
52 //////////////////////////////////////////////////////////////////// 93 ////////////////////////////////////////////////////////////////////
53 // 94 //
54 initWebGl: { 95 initWebGl: {
55 enumerable: false,
56 value: function () { 96 value: function () {
57 // 97 //
58 } 98 }
@@ -60,11 +100,17 @@ exports.DesignDocumentView = Montage.create(CodeDocumentView, {
60 //////////////////////////////////////////////////////////////////// 100 ////////////////////////////////////////////////////////////////////
61 // 101 //
62 initMontage: { 102 initMontage: {
63 enumerable: false,
64 value: function () { 103 value: function () {
65 // 104 //
66 } 105 }
67 } 106 },
107 ////////////////////////////////////////////////////////////////////
108 //
109 getElementFromPoint: {
110 value: function(x, y) {
111 return this.iframe.contentWindow.getElement(x,y);
112 }
113 },
68 //////////////////////////////////////////////////////////////////// 114 ////////////////////////////////////////////////////////////////////
69 //////////////////////////////////////////////////////////////////// 115 ////////////////////////////////////////////////////////////////////
70}); 116});