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