diff --git a/public/js/app.js b/public/js/app.js index ad270b5..dbc00c6 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -9,7 +9,6 @@ $(function(){ //(remove the content of everything else) //remove the classes. $("body").on("blur", "#marked-mathjax-input", function(){ - debugger; var editor = $("#marked-mathjax-input"); //(this is the text-area) var wrapper = editor.closest(".hoverWrap"); var text = editor.siblings(".Current").html(); @@ -142,7 +141,8 @@ voInitializer = function(that, event){ vo.thisId = vo.thisLI.attr("data-id"); //data-id. vo.thisIndex = vo.thisLI.index(); //returns -1 if there's no match. vo.thisModel = nodesCollection.findWhere({_id: vo.thisId}); - vo.thisView = vo.thisModel.get("views")[0]; //split screen isn't implemented yet. + vo.thisView = vo.thisModel.get("views").slice(-1)[0]; //we're assuming a tree. + //(also, I'm not garbage collecting extra views when you zoom in/out, so we have to grab last element). //alert(thisIndex) //thisModel = nodesCollection.get(thisId); diff --git a/public/js/router.js b/public/js/router.js index 2c4785d..5ba226d 100644 --- a/public/js/router.js +++ b/public/js/router.js @@ -162,6 +162,7 @@ if ( null != this.currentView ) { this.currentView.undelegateEvents(); } + this.currentView = view; $("textarea").textareaAutoExpand(); diff --git a/public/js/views/showView.js b/public/js/views/showView.js index e299830..3ecbf0e 100644 --- a/public/js/views/showView.js +++ b/public/js/views/showView.js @@ -23,7 +23,7 @@ var showView = Backbone.View.extend({ var id = that.model.get("_id"); var text = that.model.get("text"); - var html = that.createUIBullet(id, text, that.depth); + var html = that.createUIBullet(id, text, that.depth); that.$el.children("ul").addClass("collapsed"); that.$el.attr("data-depth", that.depth); that.$el.attr("data-id", id); @@ -80,7 +80,7 @@ var showView = Backbone.View.extend({ //text-area => MarkDownEditor. createMarkDownBullet: function(){ var that = this; - var textarea = that.$el.find("textarea"); + var textarea = that.$el.children(".hoverWrap").children("textarea"); var newDiv = "
" + textarea.val() + "