mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 11:02:27 +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 { t } from "../../services/i18n.js";
|
||||
import TemplateSwitchWidget from "../template_switch.js";
|
||||
import type FNote from "../../entities/fnote.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="basic-properties-widget">
|
||||
@ -50,6 +51,14 @@ const TPL = `
|
||||
</div>`;
|
||||
|
||||
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() {
|
||||
super();
|
||||
|
||||
@ -73,7 +82,7 @@ export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
||||
|
||||
getTitle() {
|
||||
return {
|
||||
show: !this.note.isLaunchBarConfig(),
|
||||
show: !this.note?.isLaunchBarConfig(),
|
||||
title: t("basic_properties.basic_properties"),
|
||||
icon: "bx bx-slider"
|
||||
};
|
||||
@ -91,8 +100,11 @@ export default class BasicPropertiesWidget extends NoteContextAwareWidget {
|
||||
this.$widget.find(".template-switch-container").append(this.templateSwitchWidget.render());
|
||||
}
|
||||
|
||||
async refreshWithNote(note) {
|
||||
async refreshWithNote(note: FNote) {
|
||||
await super.refreshWithNote(note);
|
||||
if (!this.note) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$widget.find(".editability-select-container").toggle(this.note && ["text", "code"].includes(this.note.type));
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user