mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-05 23:21:54 +08:00
feat(client): handle read-only database
This commit is contained in:
parent
2427addf65
commit
923316e14e
@ -254,6 +254,10 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.is("databaseReadonly")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.note.isLabelTruthy("readOnly")) {
|
if (this.note.isLabelTruthy("readOnly")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import { t } from "../../services/i18n.js";
|
|||||||
import LoadResults from "../../services/load_results.js";
|
import LoadResults from "../../services/load_results.js";
|
||||||
import type { AttributeRow } from "../../services/load_results.js";
|
import type { AttributeRow } from "../../services/load_results.js";
|
||||||
import FNote from "../../entities/fnote.js";
|
import FNote from "../../entities/fnote.js";
|
||||||
|
import options from "../../services/options.js";
|
||||||
|
|
||||||
export default class EditButton extends OnClickButtonWidget {
|
export default class EditButton extends OnClickButtonWidget {
|
||||||
isEnabled(): boolean {
|
isEnabled(): boolean {
|
||||||
@ -27,6 +28,10 @@ export default class EditButton extends OnClickButtonWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note: FNote): Promise<void> {
|
async refreshWithNote(note: FNote): Promise<void> {
|
||||||
|
if (options.is("databaseReadonly")) {
|
||||||
|
this.toggleInt(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
|
if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
|
||||||
this.toggleInt(false);
|
this.toggleInt(false);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user