mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-05 12:42:04 +08:00
feat(sidebar): port note info widget
This commit is contained in:
parent
b16c2ee1be
commit
b7b5e2c0ee
@ -190,7 +190,6 @@ export default class DesktopLayout {
|
|||||||
.ribbon(new BasicPropertiesWidget())
|
.ribbon(new BasicPropertiesWidget())
|
||||||
.ribbon(new OwnedAttributeListWidget())
|
.ribbon(new OwnedAttributeListWidget())
|
||||||
.ribbon(new InheritedAttributesWidget())
|
.ribbon(new InheritedAttributesWidget())
|
||||||
.ribbon(new NoteInfoWidget())
|
|
||||||
.button(new RevisionsButton())
|
.button(new RevisionsButton())
|
||||||
.button(new NoteActionsWidget())
|
.button(new NoteActionsWidget())
|
||||||
)
|
)
|
||||||
@ -238,6 +237,7 @@ export default class DesktopLayout {
|
|||||||
.child(new BacklinksWidget())
|
.child(new BacklinksWidget())
|
||||||
.child(new NoteMapRibbonWidget())
|
.child(new NoteMapRibbonWidget())
|
||||||
.child(...this.customWidgets.get("right-pane"))
|
.child(...this.customWidgets.get("right-pane"))
|
||||||
|
.child(new NoteInfoWidget())
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -5,6 +5,7 @@ import server from "../../services/server.js";
|
|||||||
import utils from "../../services/utils.js";
|
import utils from "../../services/utils.js";
|
||||||
import type { EventData } from "../../components/app_context.js";
|
import type { EventData } from "../../components/app_context.js";
|
||||||
import type FNote from "../../entities/fnote.js";
|
import type FNote from "../../entities/fnote.js";
|
||||||
|
import RightPanelWidget from "../right_panel_widget.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="note-info-widget">
|
<div class="note-info-widget">
|
||||||
@ -78,7 +79,7 @@ interface MetadataResponse {
|
|||||||
dateModified: number;
|
dateModified: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class NoteInfoWidget extends NoteContextAwareWidget {
|
export default class NoteInfoWidget extends RightPanelWidget {
|
||||||
|
|
||||||
private $noteId!: JQuery<HTMLElement>;
|
private $noteId!: JQuery<HTMLElement>;
|
||||||
private $dateCreated!: JQuery<HTMLElement>;
|
private $dateCreated!: JQuery<HTMLElement>;
|
||||||
@ -90,6 +91,10 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
|
|||||||
private $subTreeSize!: JQuery<HTMLElement>;
|
private $subTreeSize!: JQuery<HTMLElement>;
|
||||||
private $calculateButton!: JQuery<HTMLElement>;
|
private $calculateButton!: JQuery<HTMLElement>;
|
||||||
|
|
||||||
|
get widgetTitle() {
|
||||||
|
return t("note_info_widget.title");
|
||||||
|
}
|
||||||
|
|
||||||
get name() {
|
get name() {
|
||||||
return "noteInfo";
|
return "noteInfo";
|
||||||
}
|
}
|
||||||
@ -102,29 +107,20 @@ export default class NoteInfoWidget extends NoteContextAwareWidget {
|
|||||||
return !!this.note;
|
return !!this.note;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitle() {
|
async doRenderBody() {
|
||||||
return {
|
this.$body.empty().append($(TPL));
|
||||||
show: this.isEnabled(),
|
|
||||||
title: t("note_info_widget.title"),
|
|
||||||
icon: "bx bx-info-circle"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
doRender() {
|
this.$noteId = this.$body.find(".note-info-note-id");
|
||||||
this.$widget = $(TPL);
|
this.$dateCreated = this.$body.find(".note-info-date-created");
|
||||||
this.contentSized();
|
this.$dateModified = this.$body.find(".note-info-date-modified");
|
||||||
|
this.$type = this.$body.find(".note-info-type");
|
||||||
|
this.$mime = this.$body.find(".note-info-mime");
|
||||||
|
|
||||||
this.$noteId = this.$widget.find(".note-info-note-id");
|
this.$noteSizesWrapper = this.$body.find(".note-sizes-wrapper");
|
||||||
this.$dateCreated = this.$widget.find(".note-info-date-created");
|
this.$noteSize = this.$body.find(".note-size");
|
||||||
this.$dateModified = this.$widget.find(".note-info-date-modified");
|
this.$subTreeSize = this.$body.find(".subtree-size");
|
||||||
this.$type = this.$widget.find(".note-info-type");
|
|
||||||
this.$mime = this.$widget.find(".note-info-mime");
|
|
||||||
|
|
||||||
this.$noteSizesWrapper = this.$widget.find(".note-sizes-wrapper");
|
this.$calculateButton = this.$body.find(".calculate-button");
|
||||||
this.$noteSize = this.$widget.find(".note-size");
|
|
||||||
this.$subTreeSize = this.$widget.find(".subtree-size");
|
|
||||||
|
|
||||||
this.$calculateButton = this.$widget.find(".calculate-button");
|
|
||||||
this.$calculateButton.on("click", async () => {
|
this.$calculateButton.on("click", async () => {
|
||||||
this.$noteSizesWrapper.show();
|
this.$noteSizesWrapper.show();
|
||||||
this.$calculateButton.hide();
|
this.$calculateButton.hide();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user