mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
chore(prettier): fix all files
This commit is contained in:
@@ -8,9 +8,7 @@ import { t } from "../services/i18n.js";
|
||||
|
||||
export default class SharedSwitchWidget extends SwitchWidget {
|
||||
isEnabled() {
|
||||
return super.isEnabled()
|
||||
&& !['root', '_share', '_hidden'].includes(this.noteId)
|
||||
&& !this.noteId.startsWith('_options');
|
||||
return super.isEnabled() && !["root", "_share", "_hidden"].includes(this.noteId) && !this.noteId.startsWith("_options");
|
||||
}
|
||||
|
||||
doRender() {
|
||||
@@ -23,24 +21,24 @@ export default class SharedSwitchWidget extends SwitchWidget {
|
||||
this.$switchOffButton.attr("title", t("shared_switch.toggle-off-title"));
|
||||
|
||||
this.$helpButton.attr("data-help-page", "sharing.html").show();
|
||||
this.$helpButton.on('click', e => utils.openHelp($(e.target)));
|
||||
this.$helpButton.on("click", (e) => utils.openHelp($(e.target)));
|
||||
}
|
||||
|
||||
async switchOn() {
|
||||
await branchService.cloneNoteToParentNote(this.noteId, '_share');
|
||||
await branchService.cloneNoteToParentNote(this.noteId, "_share");
|
||||
|
||||
syncService.syncNow(true);
|
||||
}
|
||||
|
||||
async switchOff() {
|
||||
const shareBranch = this.note.getParentBranches().find(b => b.parentNoteId === '_share');
|
||||
const shareBranch = this.note.getParentBranches().find((b) => b.parentNoteId === "_share");
|
||||
|
||||
if (!shareBranch) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.note.getParentBranches().length === 1) {
|
||||
if (!await dialogService.confirm(t("shared_switch.shared-branch"))) {
|
||||
if (!(await dialogService.confirm(t("shared_switch.shared-branch")))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -51,8 +49,8 @@ export default class SharedSwitchWidget extends SwitchWidget {
|
||||
}
|
||||
|
||||
async refreshWithNote(note) {
|
||||
const isShared = note.hasAncestor('_share');
|
||||
const canBeUnshared = isShared && note.getParentBranches().find(b => b.parentNoteId === '_share');
|
||||
const isShared = note.hasAncestor("_share");
|
||||
const canBeUnshared = isShared && note.getParentBranches().find((b) => b.parentNoteId === "_share");
|
||||
const switchDisabled = isShared && !canBeUnshared;
|
||||
|
||||
this.$switchOn.toggle(!isShared);
|
||||
@@ -61,15 +59,14 @@ export default class SharedSwitchWidget extends SwitchWidget {
|
||||
if (switchDisabled) {
|
||||
this.$widget.attr("title", t("shared_switch.inherited"));
|
||||
this.$switchOff.addClass("switch-disabled");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.$widget.removeAttr("title");
|
||||
this.$switchOff.removeClass("switch-disabled");
|
||||
}
|
||||
}
|
||||
|
||||
entitiesReloadedEvent({loadResults}) {
|
||||
if (loadResults.getBranchRows().find(b => b.noteId === this.noteId)) {
|
||||
entitiesReloadedEvent({ loadResults }) {
|
||||
if (loadResults.getBranchRows().find((b) => b.noteId === this.noteId)) {
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user