chore(client/ts): port basic_properties

This commit is contained in:
Elian Doran 2025-03-04 17:18:17 +02:00
parent e930ae5f40
commit c0c85e96ce
No known key found for this signature in database

View File

@ -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">
@ -50,6 +51,14 @@ const TPL = `
</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));
} }