From 7fa0c53c14e9029d2e3960cc81edf91592fd1768 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:26:20 -0700 Subject: added save for code view, fixed code view editor bug, reuse code editor options component in document bar Signed-off-by: Ananya Sen Conflicts: js/document/views/design-code.js Signed-off-by: Ananya Sen --- js/document/models/base.js | 11 +++++++++++ js/document/views/design-code.js | 5 +---- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'js/document') diff --git a/js/document/models/base.js b/js/document/models/base.js index c44123c3..a73b8b20 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -236,6 +236,8 @@ exports.BaseDocumentModel = Montage.create(Component, { // save: { value: function (callback, libCopyCallback) { + var self = this; + //TODO: Implement on demand logic if (this.needsSave) { //Save @@ -270,6 +272,15 @@ exports.BaseDocumentModel = Montage.create(Component, { } } else if (this.currentView === this.views.code) { //TODO: Add save logic for code view + //save to textarea + self.views.code.editor.save(); + //save to disk + this.application.ninja.ioMediator.fileSave({ + mode: 'html-text', + file: self.file, + content:self.views.code.textArea.value + }, this.handleSaved.bind({callback: callback, model: this})); + } else { //TODO: Error handle } diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js index 44d12549..8ad6d555 100644 --- a/js/document/views/design-code.js +++ b/js/document/views/design-code.js @@ -70,10 +70,7 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, { // show: { value: function (callback) { - - this.textViewContainer.style.display = "block"; - this.textViewContainer.style.background = "white"; - this.textViewContainer.style.height = "100%"; + this.textViewContainer.setAttribute("class", "codeViewContainer cm-s-default"); //todo : update options bar -- cgit v1.2.3 From 0262cbeccef538d3aa125eb7cd16d8ca758c82b1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:27:40 -0700 Subject: added save for code view, fixed code view editor bug, reuse code editor options component in document bar Signed-off-by: Ananya Sen Conflicts: js/document/views/design-code.js Signed-off-by: Ananya Sen --- js/document/views/design-code.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js index 8ad6d555..70afe785 100644 --- a/js/document/views/design-code.js +++ b/js/document/views/design-code.js @@ -72,7 +72,7 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, { value: function (callback) { this.textViewContainer.setAttribute("class", "codeViewContainer cm-s-default"); - //todo : update options bar + //todo : update options bar // if (callback) callback(); -- cgit v1.2.3 From fa2e82cf10aaa4900a462410cbb99b5b0433a1b1 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 25 Jul 2012 12:28:58 -0700 Subject: fixing code editor double vertical scrollbar bug Signed-off-by: Ananya Sen Conflicts: js/document/views/design-code.js Signed-off-by: Ananya Sen --- js/document/views/design-code.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/views/design-code.js b/js/document/views/design-code.js index 70afe785..bf6e186f 100644 --- a/js/document/views/design-code.js +++ b/js/document/views/design-code.js @@ -72,7 +72,9 @@ exports.DesignCodeView = Montage.create(CodeDocumentView, { value: function (callback) { this.textViewContainer.setAttribute("class", "codeViewContainer cm-s-default"); - //todo : update options bar + this.textViewContainer.style.display = "block"; + + //todo : update options bar // if (callback) callback(); -- cgit v1.2.3