mirror of
https://github.com/zadam/trilium.git
synced 2024-11-11 01:23:57 +08:00
less obtrusive saved indicator, fixes #122
This commit is contained in:
parent
1db2f0c2c5
commit
d82898421e
4 changed files with 21 additions and 6 deletions
|
@ -28,6 +28,7 @@ const $noteDetailWrapper = $("#note-detail-wrapper");
|
|||
const $noteIdDisplay = $("#note-id-display");
|
||||
const $childrenOverview = $("#children-overview");
|
||||
const $scriptArea = $("#note-detail-script-area");
|
||||
const $savedIndicator = $("#saved-indicator");
|
||||
|
||||
let currentNote = null;
|
||||
|
||||
|
@ -78,6 +79,8 @@ function noteChanged() {
|
|||
}
|
||||
|
||||
isNoteChanged = true;
|
||||
|
||||
$savedIndicator.fadeOut();
|
||||
}
|
||||
|
||||
async function reload() {
|
||||
|
@ -120,15 +123,16 @@ async function saveNote() {
|
|||
protectedSessionHolder.touchProtectedSession();
|
||||
}
|
||||
|
||||
infoService.showMessage("Saved!");
|
||||
$savedIndicator.fadeIn();
|
||||
}
|
||||
|
||||
async function saveNoteIfChanged() {
|
||||
if (!isNoteChanged) {
|
||||
return;
|
||||
if (isNoteChanged) {
|
||||
await saveNote();
|
||||
}
|
||||
|
||||
await saveNote();
|
||||
// make sure indicator is visible in a case there was some race condition.
|
||||
$savedIndicator.fadeIn();
|
||||
}
|
||||
|
||||
function setNoteBackgroundIfProtected(note) {
|
||||
|
@ -294,7 +298,7 @@ $(document).ready(() => {
|
|||
// this sends the request asynchronously and doesn't wait for result
|
||||
$(window).on('beforeunload', () => { saveNoteIfChanged(); }); // don't convert to short form, handler doesn't like returned promise
|
||||
|
||||
setInterval(saveNoteIfChanged, 5000);
|
||||
setInterval(saveNoteIfChanged, 3000);
|
||||
|
||||
export default {
|
||||
reload,
|
||||
|
|
|
@ -676,3 +676,12 @@ code {
|
|||
div[data-notify="container"] {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#saved-indicator {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 11px;
|
||||
font-size: x-large;
|
||||
color: #777;
|
||||
z-index: 100;
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
<div id="note-detail-wrapper">
|
||||
<span id="saved-indicator" title="All changes have been saved" class="jam jam-check"></span>
|
||||
|
||||
<div id="note-detail-script-area"></div>
|
||||
|
||||
<table id="note-detail-promoted-attributes"></table>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
title="Reset pan & zoom to initial coordinates and magnification"
|
||||
id="relation-map-reset-pan-zoom" style="right: 100px;"></button>
|
||||
|
||||
<div class="btn-group floating-button" style="right: 20px;">
|
||||
<div class="btn-group floating-button" style="right: 40px;">
|
||||
<button type="button"
|
||||
class="btn icon-button jam jam-search-plus"
|
||||
title="Zoom In"
|
||||
|
|
Loading…
Reference in a new issue