Merge branch 'master' of github.com:standardnotes/web into ivs

This commit is contained in:
Mo Bitar
2017-03-18 15:48:42 -05:00
20 changed files with 179 additions and 130 deletions

View File

@@ -46,7 +46,12 @@ angular.module('app.frontend')
}
}.bind(this), false);
$rootScope.$on("tag-changed", function(){
this.loadTagsString();
}.bind(this));
this.setNote = function(note, oldNote) {
this.noteReady = false;
var currentEditor = this.customEditor;
this.customEditor = null;
this.showExtensions = false;
@@ -56,6 +61,7 @@ angular.module('app.frontend')
var setEditor = function(editor) {
this.customEditor = editor;
this.postNoteToExternalEditor();
this.noteReady = true;
}.bind(this)
var editor = this.editorForNote(note);
@@ -71,6 +77,7 @@ angular.module('app.frontend')
}
} else {
this.customEditor = null;
this.noteReady = true;
}
if(note.safeText().length == 0 && note.dummy) {

View File

@@ -91,18 +91,19 @@ angular.module('app.frontend')
$scope.tagsSave = function(tag, callback) {
if(!tag.title || tag.title.length == 0) {
$scope.notesRemoveTag(tag);
$scope.removeTag(tag);
return;
}
tag.setDirty(true);
syncManager.sync(callback);
$rootScope.$broadcast("tag-changed");
}
/*
Notes Ctrl Callbacks
*/
$scope.notesRemoveTag = function(tag) {
$scope.removeTag = function(tag) {
var validNotes = Note.filterDummyNotes(tag.notes);
if(validNotes == 0) {
modelManager.setItemToBeDeleted(tag);

View File

@@ -4,8 +4,7 @@ angular.module('app.frontend')
scope: {
addNew: "&",
selectionMade: "&",
tag: "=",
removeTag: "&"
tag: "="
},
templateUrl: 'frontend/notes.html',
@@ -69,11 +68,6 @@ angular.module('app.frontend')
this.selectFirstNote(createNew);
}
this.selectedTagDelete = function() {
this.showMenu = false;
this.removeTag()(this.tag);
}
this.selectFirstNote = function(createNew) {
var visibleNotes = this.sortedNotes.filter(function(note){
return note.visible;

View File

@@ -9,7 +9,8 @@ angular.module('app.frontend')
save: "&",
tags: "=",
allTag: "=",
updateNoteTag: "&"
updateNoteTag: "&",
removeTag: "&"
},
templateUrl: 'frontend/tags.html',
replace: true,
@@ -32,7 +33,7 @@ angular.module('app.frontend')
}
}
})
.controller('TagsCtrl', function (modelManager) {
.controller('TagsCtrl', function (modelManager, $timeout) {
var initialLoad = true;
@@ -68,11 +69,6 @@ angular.module('app.frontend')
this.addNew()(this.newTag);
}
var originalTagName = "";
this.onTagTitleFocus = function(tag) {
originalTagName = tag.title;
}
this.tagTitleDidChange = function(tag) {
this.editingTag = tag;
}
@@ -98,6 +94,23 @@ angular.module('app.frontend')
}.bind(this));
}
function inputElementForTag(tag) {
return document.getElementById("tag-" + tag.uuid);
}
var originalTagName = "";
this.selectedRenameTag = function($event, tag) {
originalTagName = tag.title;
this.editingTag = tag;
$timeout(function(){
inputElementForTag(tag).focus();
})
}
this.selectedDeleteTag = function(tag) {
this.removeTag()(tag);
}
this.noteCount = function(tag) {
var validNotes = Note.filterDummyNotes(tag.notes);
return validNotes.length;

View File

@@ -98,11 +98,17 @@ class AccountMenu {
}
$scope.submitRegistrationForm = function() {
var confirmation = prompt("Please confirm your password. Note that because your notes are encrypted using your password, Standard Notes does not have a password reset option. You cannot forget your password.")
$scope.formData.confirmPassword = true;
}
$scope.submitPasswordConfirmation = function() {
let confirmation = $scope.formData.pw_confirmation;
if(confirmation !== $scope.formData.user_password) {
alert("The two passwords you entered do not match. Please try again.");
return;
}
$scope.formData.confirmPassword = false;
$scope.formData.status = "Generating Account Keys...";
$timeout(function(){

View File

@@ -92,6 +92,10 @@ class ExtensionManager {
*/
retrieveExtensionFromServer(url, callback) {
this.httpManager.getAbsolute(url, {}, function(response){
if(typeof response !== 'object') {
callback(null);
return;
}
var ext = this.handleExtensionLoadExternalResponseItem(url, response);
if(callback) {
callback(ext);

View File

@@ -28,7 +28,9 @@ class HttpManager {
if (xmlhttp.readyState == 4) {
var response = xmlhttp.responseText;
if(response) {
response = JSON.parse(response);
try {
response = JSON.parse(response);
} catch(e) {}
}
if(xmlhttp.status >= 200 && xmlhttp.status <= 299){

View File

@@ -10,7 +10,7 @@ class SyncManager {
}
get serverURL() {
return localStorage.getItem("server") || "https://n3.standardnotes.org";
return localStorage.getItem("server") || window._default_sf_server;
}
get masterKey() {