Fix #16
This commit is contained in:
parent
b92f57ed26
commit
024b0c50cd
@ -228,16 +228,20 @@ function savenote(callback) {
|
||||
closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection.
|
||||
}).open();
|
||||
save_in_progress = true;
|
||||
|
||||
|
||||
var noteid = $("#note").data("noteid");
|
||||
var note = new Note();
|
||||
var append = "";
|
||||
if (noteid != "") {
|
||||
note = NOTES.get(noteid);
|
||||
if (note.getSyncStatus() != "LOCAL_ONLY") {
|
||||
note.setSyncStatus("LOCAL_EDITED");
|
||||
}
|
||||
} else {
|
||||
var tempuuid = Math.random() * 100000000000000000;
|
||||
append = " <!-- MobileNewNoteSaveTempID:" + tempuuid + " -->";
|
||||
}
|
||||
note.setText($("#note").val());
|
||||
note.setText($("#note").val() + append);
|
||||
note.setModified();
|
||||
NOTES.set(note);
|
||||
NOTES.syncAll(function () {
|
||||
@ -246,6 +250,14 @@ function savenote(callback) {
|
||||
closeTimeout: 3000
|
||||
}).open();
|
||||
$("#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;
|
||||
if (typeof callback == "function") {
|
||||
callback();
|
||||
@ -256,6 +268,14 @@ function savenote(callback) {
|
||||
closeTimeout: 3000
|
||||
}).open();
|
||||
$("#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;
|
||||
if (typeof callback == "function") {
|
||||
callback();
|
||||
|
@ -34,7 +34,7 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user