aboutsummaryrefslogtreecommitdiff
path: root/js/document/models/base.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/document/models/base.js')
-rwxr-xr-xjs/document/models/base.js35
1 files changed, 29 insertions, 6 deletions
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 6d9d2e89..0957145a 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -62,6 +62,20 @@ exports.BaseDocumentModel = Montage.create(Component, {
62 }, 62 },
63 //////////////////////////////////////////////////////////////////// 63 ////////////////////////////////////////////////////////////////////
64 // 64 //
65 _selection: {
66 value: []
67 },
68
69 selection: {
70 get: function() {
71 return this._selection;
72 },
73 set: function(value) {
74 this._selection = value;
75 }
76 },
77 ////////////////////////////////////////////////////////////////////
78 //
65 fileTemplate: { 79 fileTemplate: {
66 value: null 80 value: null
67 }, 81 },
@@ -85,11 +99,20 @@ exports.BaseDocumentModel = Montage.create(Component, {
85 //////////////////////////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////
86 //TODO: Add API to allow other browser support 100 //TODO: Add API to allow other browser support
87 browserPreview: { 101 browserPreview: {
88 value: function (browser) { 102 value: function (browser, screen, context) {
103 //Making call to show feedback screen
104 if (screen) screen.show(context);
89 //Generating URL for document 105 //Generating URL for document
90 var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1]; 106 var url = this.application.ninja.coreIoApi.rootUrl + this.file.uri.split(this.application.ninja.coreIoApi.cloudData.root)[1];
91 //TODO: Add logic to prompt user to save (all) before preview 107 //TODO: Add logic to prompt user to save (all) before preview
92 this.saveAll(function (result) { 108 this.saveAll(null,function (success) {
109 //Making call to show feedback screen
110 if (screen) screen.hide(context);
111 //TODO: Add error handling logic
112 if (!success) {
113 console.log('Error!');
114 return;
115 }
93 //Currently only supporting current browser (Chrome, obviously) 116 //Currently only supporting current browser (Chrome, obviously)
94 switch (this.browser) { 117 switch (this.browser) {
95 case 'chrome': 118 case 'chrome':
@@ -131,7 +154,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
131 //////////////////////////////////////////////////////////////////// 154 ////////////////////////////////////////////////////////////////////
132 // 155 //
133 save: { 156 save: {
134 value: function (callback) { 157 value: function (callback, libCopyCallback) {
135 // 158 //
136 if (this.needsSave) { 159 if (this.needsSave) {
137 //Save 160 //Save
@@ -151,7 +174,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
151 head: this.views.design.iframe.contentWindow.document.head, 174 head: this.views.design.iframe.contentWindow.document.head,
152 body: this.views.design.iframe.contentWindow.document.body, 175 body: this.views.design.iframe.contentWindow.document.body,
153 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator 176 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
154 }, this.handleSaved.bind({callback: callback, model: this})); 177 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback);
155 } else { 178 } else {
156 //TODO: Add logic to save code view data 179 //TODO: Add logic to save code view data
157 } 180 }
@@ -160,7 +183,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
160 //////////////////////////////////////////////////////////////////// 183 ////////////////////////////////////////////////////////////////////
161 // 184 //
162 saveAll: { 185 saveAll: {
163 value: function (callback) { 186 value: function (callback, libCopyCallback) {
164 // 187 //
165 if (this.needsSave) { 188 if (this.needsSave) {
166 //Save 189 //Save
@@ -180,7 +203,7 @@ exports.BaseDocumentModel = Montage.create(Component, {
180 head: this.views.design.iframe.contentWindow.document.head, 203 head: this.views.design.iframe.contentWindow.document.head,
181 body: this.views.design.iframe.contentWindow.document.body, 204 body: this.views.design.iframe.contentWindow.document.body,
182 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator 205 mjsTemplateCreator: this.views.design.iframe.contentWindow.mjsTemplateCreator
183 }, this.handleSaved.bind({callback: callback, model: this})); 206 }, this.handleSaved.bind({callback: callback, model: this}), libCopyCallback);
184 } else { 207 } else {
185 //TODO: Add logic to save code view data 208 //TODO: Add logic to save code view data
186 } 209 }