mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 19:13:55 +08:00
chore(client/ts): port basic_properties
This commit is contained in:
parent
e930ae5f40
commit
c0c85e96ce
@ -6,6 +6,7 @@ import BookmarkSwitchWidget from "../bookmark_switch.js";
|
|||||||
import SharedSwitchWidget from "../shared_switch.js";
|
import SharedSwitchWidget from "../shared_switch.js";
|
||||||
import { t } from "../../services/i18n.js";
|
import { t } from "../../services/i18n.js";
|
||||||
import TemplateSwitchWidget from "../template_switch.js";
|
import TemplateSwitchWidget from "../template_switch.js";
|
||||||
|
import type FNote from "../../entities/fnote.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="basic-properties-widget">
|
<div class="basic-properties-widget">
|
||||||
@ -16,12 +17,12 @@ const TPL = `
|
|||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.basic-properties-widget > * {
|
.basic-properties-widget > * {
|
||||||
margin-top: 9px;
|
margin-top: 9px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.basic-properties-widget > * > :last-child {
|
.basic-properties-widget > * > :last-child {
|
||||||
margin-right: 30px;
|
margin-right: 30px;
|
||||||
}
|
}
|
||||||
@ -31,25 +32,33 @@ const TPL = `
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="note-type-container">
|
<div class="note-type-container">
|
||||||
<span>${t("basic_properties.note_type")}:</span>
|
<span>${t("basic_properties.note_type")}:</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="protected-note-switch-container"></div>
|
<div class="protected-note-switch-container"></div>
|
||||||
|
|
||||||
<div class="editability-select-container">
|
<div class="editability-select-container">
|
||||||
<span>${t("basic_properties.editable")}:</span>
|
<span>${t("basic_properties.editable")}:</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="bookmark-switch-container"></div>
|
<div class="bookmark-switch-container"></div>
|
||||||
|
|
||||||
<div class="shared-switch-container"></div>
|
<div class="shared-switch-container"></div>
|
||||||
|
|
||||||
<div class="template-switch-container"></div>
|
<div class="template-switch-container"></div>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
||||||
|
|
||||||
|
private noteTypeWidget: NoteTypeWidget;
|
||||||
|
private protectedNoteSwitchWidget: ProtectedNoteSwitchWidget;
|
||||||
|
private editabilitySelectWidget: EditabilitySelectWidget;
|
||||||
|
private bookmarkSwitchWidget: BookmarkSwitchWidget;
|
||||||
|
private sharedSwitchWidget: SharedSwitchWidget;
|
||||||
|
private templateSwitchWidget: TemplateSwitchWidget;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -73,7 +82,7 @@ export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
getTitle() {
|
getTitle() {
|
||||||
return {
|
return {
|
||||||
show: !this.note.isLaunchBarConfig(),
|
show: !this.note?.isLaunchBarConfig(),
|
||||||
title: t("basic_properties.basic_properties"),
|
title: t("basic_properties.basic_properties"),
|
||||||
icon: "bx bx-slider"
|
icon: "bx bx-slider"
|
||||||
};
|
};
|
||||||
@ -91,8 +100,11 @@ export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
|||||||
this.$widget.find(".template-switch-container").append(this.templateSwitchWidget.render());
|
this.$widget.find(".template-switch-container").append(this.templateSwitchWidget.render());
|
||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note) {
|
async refreshWithNote(note: FNote) {
|
||||||
await super.refreshWithNote(note);
|
await super.refreshWithNote(note);
|
||||||
|
if (!this.note) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.$widget.find(".editability-select-container").toggle(this.note && ["text", "code"].includes(this.note.type));
|
this.$widget.find(".editability-select-container").toggle(this.note && ["text", "code"].includes(this.note.type));
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user