Browse Source

Fix #16

tags/v1.3.0
Skylar Ittner 8 months ago
parent
commit
024b0c50cd
2 changed files with 23 additions and 3 deletions
  1. +22
    -2
      www/js/editor.js
  2. +1
    -1
      www/pages/editor.html

+ 22
- 2
www/js/editor.js View File

@@ -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();


+ 1
- 1
www/pages/editor.html View File

@@ -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…
Cancel
Save