From 7bdcab084d1991361ba8d37a7435efd229648630 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 1 May 2012 10:12:40 -0700 Subject: Setting up new architecture for I/O --- js/document/document-html.js | 102 +++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 57 deletions(-) (limited to 'js/document/document-html.js') diff --git a/js/document/document-html.js b/js/document/document-html.js index 89717dd6..28406ee8 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -18,25 +18,33 @@ exports.HtmlDocument = Montage.create(Component, { enumerable: false, value: false }, - + //////////////////////////////////////////////////////////////////// + // model: { + enumerable: false, value: null }, - + //////////////////////////////////////////////////////////////////// + // loadDelegate: { + enumerable: false, value: null }, - + //////////////////////////////////////////////////////////////////// + // delegateContext: { + enumerable: false, value: null }, - + //////////////////////////////////////////////////////////////////// + // exclusionList: { + enumerable: false, value: ["HTML", "BODY"] }, - - // Getters for the model. - // TODO: Change how these properties are accessed through Ninja + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// + //TODO: Remove these setters/getters, should call model directly name: { get: function() { return this.model._name; @@ -45,7 +53,7 @@ exports.HtmlDocument = Montage.create(Component, { this.model._name = value; } }, - + // isActive: { get: function() { return this.model._isActive; @@ -54,7 +62,7 @@ exports.HtmlDocument = Montage.create(Component, { this.model._isActive = value; } }, - + // needsSave: { get: function() { return this.model._needsSave; @@ -63,82 +71,62 @@ exports.HtmlDocument = Montage.create(Component, { this.model._needsSave = value; } }, - - // View Properties - // TODO: Move those into a view object - for now dump it here - iframe: { - value: null - }, - + // uuid: { get: function() { return this._uuid; } }, - + // currentView: { value: "design" }, //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// - init: { - value:function(file, context, callback) { - this.model = Montage.create(HtmlDocumentModel, { - file: { - value: file - } - }); - - this.name = file.name; - - // this.init(file.name, file.uri, file.extension, iframe, uuid, callback); - - - this.iframe = this.createView(); - - //this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"]; - //this.currentView = "design"; - // - - this.delegateContext = context; - this.loadDelegate = callback; - } + // + iframe: { //MOVE TO: base.js in views + value: null }, - - // Create View - // Move this into a base view object - createView: { + // + createView: { //MOVE TO: design.js in views value: function() { var ifr = document.createElement("iframe"); + // ifr.id = "document_" + this._uuid; - - ifr.style.border = "none"; ifr.style.background = "#FFF"; ifr.style.height = "100%"; ifr.style.width = "100%"; - - // TODO: Reable opacity to display only when done loading -// ifr.style.opacity = 0; - + // ifr.src = "js/document/templates/montage-web/index.html"; ifr.addEventListener("load", this.handleWebTemplateLoad.bind(this), true); - + // return document.getElementById("iframeContainer").appendChild(ifr); } }, - + //////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////// + // + init: { + value:function(file, context, callback) { + this.model = Montage.create(HtmlDocumentModel, { + file: { + value: file + } + }); + this.name = file.name; + this.iframe = this.createView(); + this.delegateContext = context; + this.loadDelegate = callback; + } + }, + //////////////////////////////////////////////////////////////////// + // handleWebTemplateLoad: { value: function(event) { //TODO: Remove, also for prototyping this.application.ninja.documentController._hackRootFlag = true; - - //TODO: Clean up, using for prototyping save -// this._templateDocument = {}; -// this._templateDocument.html = this.iframe.contentWindow.document; -// this._templateDocument.body = - this._window = this.iframe.contentWindow; this._document = this.iframe.contentWindow.document; this.documentRoot = this.iframe.contentWindow.document.body; -- cgit v1.2.3