mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-05 04:31:31 +08:00
feat(sidebar): move similar notes to sidebar
This commit is contained in:
parent
95b2da01b0
commit
b1bb3ad983
@ -191,7 +191,6 @@ export default class DesktopLayout {
|
|||||||
.ribbon(new OwnedAttributeListWidget())
|
.ribbon(new OwnedAttributeListWidget())
|
||||||
.ribbon(new InheritedAttributesWidget())
|
.ribbon(new InheritedAttributesWidget())
|
||||||
.ribbon(new NoteMapRibbonWidget())
|
.ribbon(new NoteMapRibbonWidget())
|
||||||
.ribbon(new SimilarNotesWidget())
|
|
||||||
.ribbon(new NoteInfoWidget())
|
.ribbon(new NoteInfoWidget())
|
||||||
.button(new RevisionsButton())
|
.button(new RevisionsButton())
|
||||||
.button(new NoteActionsWidget())
|
.button(new NoteActionsWidget())
|
||||||
@ -237,6 +236,7 @@ export default class DesktopLayout {
|
|||||||
.child(new NotePathsWidget())
|
.child(new NotePathsWidget())
|
||||||
.child(new TocWidget())
|
.child(new TocWidget())
|
||||||
.child(new HighlightsListWidget())
|
.child(new HighlightsListWidget())
|
||||||
|
.child(new SimilarNotesWidget())
|
||||||
.child(...this.customWidgets.get("right-pane"))
|
.child(...this.customWidgets.get("right-pane"))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -5,6 +5,7 @@ import froca from "../../services/froca.js";
|
|||||||
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
||||||
import type FNote from "../../entities/fnote.js";
|
import type FNote from "../../entities/fnote.js";
|
||||||
import type { EventData } from "../../components/app_context.js";
|
import type { EventData } from "../../components/app_context.js";
|
||||||
|
import RightPanelWidget from "../right_panel_widget.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="similar-notes-widget">
|
<div class="similar-notes-widget">
|
||||||
@ -41,7 +42,7 @@ interface SimilarNote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export default class SimilarNotesWidget extends NoteContextAwareWidget {
|
export default class SimilarNotesWidget extends RightPanelWidget {
|
||||||
|
|
||||||
private $similarNotesWrapper!: JQuery<HTMLElement>;
|
private $similarNotesWrapper!: JQuery<HTMLElement>;
|
||||||
private title?: string;
|
private title?: string;
|
||||||
@ -59,19 +60,14 @@ export default class SimilarNotesWidget extends NoteContextAwareWidget {
|
|||||||
return super.isEnabled() && this.note?.type !== "search" && !this.note?.isLabelTruthy("similarNotesWidgetDisabled");
|
return super.isEnabled() && this.note?.type !== "search" && !this.note?.isLabelTruthy("similarNotesWidgetDisabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitle() {
|
get widgetTitle() {
|
||||||
return {
|
return t("similar_notes.title");
|
||||||
show: this.isEnabled(),
|
|
||||||
title: t("similar_notes.title"),
|
|
||||||
icon: "bx bx-bar-chart"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
doRender() {
|
async doRenderBody() {
|
||||||
this.$widget = $(TPL);
|
this.$body.empty().append($(TPL));
|
||||||
this.contentSized();
|
|
||||||
|
|
||||||
this.$similarNotesWrapper = this.$widget.find(".similar-notes-wrapper");
|
this.$similarNotesWrapper = this.$body.find(".similar-notes-wrapper");
|
||||||
}
|
}
|
||||||
|
|
||||||
async refreshWithNote(note: FNote) {
|
async refreshWithNote(note: FNote) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user