From f82e47ee081196ab44ff8ac3081bd10424453d8a Mon Sep 17 00:00:00 2001 From: Aiko Mastboom Date: Fri, 3 May 2013 20:20:04 +0200 Subject: [PATCH] #2 introduce concept of projects and project switching --- public/index.html | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/public/index.html b/public/index.html index 30a2102..881c3ad 100644 --- a/public/index.html +++ b/public/index.html @@ -504,18 +504,19 @@ function initViewModel_main(app, key, doc, vm_config) { viewModel._activeAttributes = ko.observableArray(); /* - viewModel._newAttribute.subscribe(function (newValue) { - if (newValue) { - app.doc.main.submitOp({ - p: [newValue], - oi: {} - }, function (err, result) { - //viewModel._newAttribute(""); - }); - viewModel._goToAttribute(newValue); - } - }); - */ + viewModel._newAttribute.subscribe(function (newValue) { + if (newValue) { + app.doc.main.submitOp({ + p: [newValue], + oi: {} + }, function (err, result) { + //viewModel._newAttribute(""); + }); + viewModel._goToAttribute(newValue); + } + }); + */ + viewModel._previewAttribute = function () { var attribute = viewModel._chosenAttribute(); if (attribute) { @@ -635,6 +636,7 @@ function user_functions(app, viewModel, vm_config) { od: current, oi: position }); + debug && console.log('storeCurrentPosition ops', ops); doc.submitOp(ops, function (err) { console.log('set position', position, err); }); @@ -643,12 +645,18 @@ function user_functions(app, viewModel, vm_config) { getCurrentPosition: function (name) { var position_doc = app.doc.user.at(['positions', name]); - var position = position_doc.get(); + var position = null; + try { + position = position_doc.get(); + }catch (e) { + // ignore 'bad path' error + } if (!position) { position = cursorPositions[name]; } return position } + } }