mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
touch protected session during note update
This commit is contained in:
parent
ac608b9334
commit
71d248cd87
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.41.4-beta",
|
"version": "0.41.5",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -39,9 +39,16 @@ function touchProtectedSession() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function touchProtectedSessionIfNecessary(note) {
|
||||||
|
if (note && note.isProtected && isProtectedSessionAvailable()) {
|
||||||
|
touchProtectedSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setProtectedSessionId,
|
setProtectedSessionId,
|
||||||
resetProtectedSession,
|
resetProtectedSession,
|
||||||
isProtectedSessionAvailable,
|
isProtectedSessionAvailable,
|
||||||
touchProtectedSession
|
touchProtectedSession,
|
||||||
|
touchProtectedSessionIfNecessary
|
||||||
};
|
};
|
@ -69,10 +69,7 @@ class TabContext extends Component {
|
|||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
if (this.note.isProtected && protectedSessionHolder.isProtectedSessionAvailable()) {
|
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
||||||
// FIXME: there are probably more places where this should be done
|
|
||||||
protectedSessionHolder.touchProtectedSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (triggerSwitchEvent) {
|
if (triggerSwitchEvent) {
|
||||||
this.triggerEvent('tabNoteSwitched', {
|
this.triggerEvent('tabNoteSwitched', {
|
||||||
|
@ -57,7 +57,10 @@ class BasicWidget extends Component {
|
|||||||
for (const key in this.attrs) {
|
for (const key in this.attrs) {
|
||||||
if (key === 'style') {
|
if (key === 'style') {
|
||||||
if (this.attrs[key]) {
|
if (this.attrs[key]) {
|
||||||
$widget.attr(key, $widget.attr('style') + ';' + this.attrs[key]);
|
let style = $widget.attr('style');
|
||||||
|
style = style ? `${style}; ${this.attrs[key]}` : this.attrs[key];
|
||||||
|
|
||||||
|
$widget.attr(key, style);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -61,6 +61,8 @@ export default class NoteDetailWidget extends TabAwareWidget {
|
|||||||
const dto = note.dto;
|
const dto = note.dto;
|
||||||
dto.content = this.getTypeWidget().getContent();
|
dto.content = this.getTypeWidget().getContent();
|
||||||
|
|
||||||
|
protectedSessionHolder.touchProtectedSessionIfNecessary(note);
|
||||||
|
|
||||||
await server.put('notes/' + noteId, dto, this.componentId);
|
await server.put('notes/' + noteId, dto, this.componentId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ export default class NoteTitleWidget extends TabAwareWidget {
|
|||||||
this.spacedUpdate = new SpacedUpdate(async () => {
|
this.spacedUpdate = new SpacedUpdate(async () => {
|
||||||
const title = this.$noteTitle.val();
|
const title = this.$noteTitle.val();
|
||||||
|
|
||||||
|
protectedSessionHolder.touchProtectedSessionIfNecessary(this.note);
|
||||||
|
|
||||||
await server.put(`notes/${this.noteId}/change-title`, {title});
|
await server.put(`notes/${this.noteId}/change-title`, {title});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user