master
Skylar Ittner 4 years ago
parent b92f57ed26
commit 024b0c50cd

@ -228,16 +228,20 @@ function savenote(callback) {
closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection. closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection.
}).open(); }).open();
save_in_progress = true; save_in_progress = true;
var noteid = $("#note").data("noteid"); var noteid = $("#note").data("noteid");
var note = new Note(); var note = new Note();
var append = "";
if (noteid != "") { if (noteid != "") {
note = NOTES.get(noteid); note = NOTES.get(noteid);
if (note.getSyncStatus() != "LOCAL_ONLY") { if (note.getSyncStatus() != "LOCAL_ONLY") {
note.setSyncStatus("LOCAL_EDITED"); note.setSyncStatus("LOCAL_EDITED");
} }
} else {
var tempuuid = Math.random() * 100000000000000000;
append = " <!-- MobileNewNoteSaveTempID:" + tempuuid + " -->";
} }
note.setText($("#note").val()); note.setText($("#note").val() + append);
note.setModified(); note.setModified();
NOTES.set(note); NOTES.set(note);
NOTES.syncAll(function () { NOTES.syncAll(function () {
@ -246,6 +250,14 @@ function savenote(callback) {
closeTimeout: 3000 closeTimeout: 3000
}).open(); }).open();
$("#orignote").val(note.content); $("#orignote").val(note.content);
if (append != "") {
for (n in NOTES.notes) {
if (NOTES.notes[n].getText().endsWith(append)) {
$("#note").data("noteid", NOTES.notes[n].noteid);
NOTES.notes[n].setText(NOTES.notes[n].getText().replace(append, ""));
}
}
}
save_in_progress = false; save_in_progress = false;
if (typeof callback == "function") { if (typeof callback == "function") {
callback(); callback();
@ -256,6 +268,14 @@ function savenote(callback) {
closeTimeout: 3000 closeTimeout: 3000
}).open(); }).open();
$("#orignote").val(note.content); $("#orignote").val(note.content);
if (append != "") {
for (n in NOTES.notes) {
if (NOTES.notes[n].getText().endsWith(append)) {
$("#note").data("noteid", NOTES.notes[n].noteid);
NOTES.notes[n].setText(NOTES.notes[n].getText().replace(append, ""));
}
}
}
save_in_progress = false; save_in_progress = false;
if (typeof callback == "function") { if (typeof callback == "function") {
callback(); callback();

@ -34,7 +34,7 @@
</div> </div>
<div class="page-content"> <div class="page-content">
<textarea style="display: none;" id="orignote" data-noteid="{{noteid}}">{{content}}</textarea> <textarea style="display: none;" id="orignote">{{content}}</textarea>
<textarea id="note" data-noteid="{{noteid}}">{{content}}</textarea> <textarea id="note" data-noteid="{{noteid}}">{{content}}</textarea>
</div> </div>

Loading…
Cancel
Save