mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
widgets can have a help link with title
This commit is contained in:
parent
76f3e87790
commit
f5228f87f0
@ -6,6 +6,13 @@ import StandardWidget from "./standard_widget.js";
|
|||||||
class AttributesWidget extends StandardWidget {
|
class AttributesWidget extends StandardWidget {
|
||||||
getWidgetTitle() { return "Attributes"; }
|
getWidgetTitle() { return "Attributes"; }
|
||||||
|
|
||||||
|
getHelp() {
|
||||||
|
return {
|
||||||
|
title: "Attributes are key-value records owned by assigned to this note.",
|
||||||
|
url: "https://github.com/zadam/trilium/wiki/Attributes"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getHeaderActions() {
|
getHeaderActions() {
|
||||||
const $showFullButton = $("<a>").append("show dialog").addClass('widget-header-action');
|
const $showFullButton = $("<a>").append("show dialog").addClass('widget-header-action');
|
||||||
$showFullButton.click(async () => {
|
$showFullButton.click(async () => {
|
||||||
|
@ -6,6 +6,12 @@ import treeCache from "../services/tree_cache.js";
|
|||||||
class EditedNotesWidget extends StandardWidget {
|
class EditedNotesWidget extends StandardWidget {
|
||||||
getWidgetTitle() { return "Edited notes on this day"; }
|
getWidgetTitle() { return "Edited notes on this day"; }
|
||||||
|
|
||||||
|
getHelp() {
|
||||||
|
return {
|
||||||
|
title: "This contains a list of notes created or updated on this day."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getMaxHeight() { return "200px"; }
|
getMaxHeight() { return "200px"; }
|
||||||
|
|
||||||
async isEnabled() {
|
async isEnabled() {
|
||||||
|
@ -11,6 +11,13 @@ const TPL = `
|
|||||||
class LinkMapWidget extends StandardWidget {
|
class LinkMapWidget extends StandardWidget {
|
||||||
getWidgetTitle() { return "Link map"; }
|
getWidgetTitle() { return "Link map"; }
|
||||||
|
|
||||||
|
getHelp() {
|
||||||
|
return {
|
||||||
|
title: "Link map shows incoming and outgoing links from/to the current note.",
|
||||||
|
url: "https://github.com/zadam/trilium/wiki/Link-map"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getHeaderActions() {
|
getHeaderActions() {
|
||||||
const $showFullButton = $("<a>").append("show full").addClass('widget-header-action');
|
const $showFullButton = $("<a>").append("show full").addClass('widget-header-action');
|
||||||
$showFullButton.click(async () => {
|
$showFullButton.click(async () => {
|
||||||
|
@ -9,6 +9,13 @@ const TPL = `
|
|||||||
class NoteRevisionsWidget extends StandardWidget {
|
class NoteRevisionsWidget extends StandardWidget {
|
||||||
getWidgetTitle() { return "Note revisions"; }
|
getWidgetTitle() { return "Note revisions"; }
|
||||||
|
|
||||||
|
getHelp() {
|
||||||
|
return {
|
||||||
|
title: "Note revisions track changes in the note across the time.",
|
||||||
|
url: "https://github.com/zadam/trilium/wiki/Note-revisions"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getHeaderActions() {
|
getHeaderActions() {
|
||||||
const $showFullButton = $("<a>").append("show dialog").addClass('widget-header-action');
|
const $showFullButton = $("<a>").append("show dialog").addClass('widget-header-action');
|
||||||
$showFullButton.click(async () => {
|
$showFullButton.click(async () => {
|
||||||
|
@ -6,6 +6,12 @@ import treeCache from "../services/tree_cache.js";
|
|||||||
class SimilarNotesWidget extends StandardWidget {
|
class SimilarNotesWidget extends StandardWidget {
|
||||||
getWidgetTitle() { return "Similar notes"; }
|
getWidgetTitle() { return "Similar notes"; }
|
||||||
|
|
||||||
|
getHelp() {
|
||||||
|
return {
|
||||||
|
title: "This list contains notes which might be similar to the current note based on textual similarity of note title."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getMaxHeight() { return "200px"; }
|
getMaxHeight() { return "200px"; }
|
||||||
|
|
||||||
async doRenderBody() {
|
async doRenderBody() {
|
||||||
|
@ -3,10 +3,14 @@ import optionsService from "../services/options.js";
|
|||||||
const WIDGET_TPL = `
|
const WIDGET_TPL = `
|
||||||
<div class="card widget">
|
<div class="card widget">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
|
<div>
|
||||||
<button class="btn btn-sm widget-title" data-toggle="collapse" data-target="#[to be set]">
|
<button class="btn btn-sm widget-title" data-toggle="collapse" data-target="#[to be set]">
|
||||||
Collapsible Group Item
|
Collapsible Group Item
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<a class="widget-help external no-arrow jam jam-help"></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="widget-header-actions"></div>
|
<div class="widget-header-actions"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -39,6 +43,8 @@ class StandardWidget {
|
|||||||
|
|
||||||
getHeaderActions() { return []; }
|
getHeaderActions() { return []; }
|
||||||
|
|
||||||
|
getHelp() { return {}; }
|
||||||
|
|
||||||
getMaxHeight() { return null; }
|
getMaxHeight() { return null; }
|
||||||
|
|
||||||
getPosition() { return this.widgetOptions.position; }
|
getPosition() { return this.widgetOptions.position; }
|
||||||
@ -68,8 +74,25 @@ class StandardWidget {
|
|||||||
this.$widget.on('shown.bs.collapse', () => this.renderBody());
|
this.$widget.on('shown.bs.collapse', () => this.renderBody());
|
||||||
this.$widget.on('shown.bs.collapse', () => this.ctx.stateChanged());
|
this.$widget.on('shown.bs.collapse', () => this.ctx.stateChanged());
|
||||||
this.$widget.on('hidden.bs.collapse', () => this.ctx.stateChanged());
|
this.$widget.on('hidden.bs.collapse', () => this.ctx.stateChanged());
|
||||||
|
|
||||||
this.$title = this.$widget.find('.widget-title');
|
this.$title = this.$widget.find('.widget-title');
|
||||||
this.$title.text(this.getWidgetTitle());
|
this.$title.text(this.getWidgetTitle());
|
||||||
|
|
||||||
|
this.$help = this.$widget.find('.widget-help');
|
||||||
|
const help = this.getHelp();
|
||||||
|
|
||||||
|
if (help.title) {
|
||||||
|
this.$help.attr("title", help.title);
|
||||||
|
this.$help.attr("href", help.url || "javascript:");
|
||||||
|
|
||||||
|
if (!help.url) {
|
||||||
|
this.$help.addClass('no-link');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.$help.hide();
|
||||||
|
}
|
||||||
|
|
||||||
this.$headerActions = this.$widget.find('.widget-header-actions');
|
this.$headerActions = this.$widget.find('.widget-header-actions');
|
||||||
this.$headerActions.append(...this.getHeaderActions());
|
this.$headerActions.append(...this.getHeaderActions());
|
||||||
|
|
||||||
|
@ -6,6 +6,12 @@ class WhatLinksHereWidget extends StandardWidget {
|
|||||||
|
|
||||||
getMaxHeight() { return "200px"; }
|
getMaxHeight() { return "200px"; }
|
||||||
|
|
||||||
|
getHelp() {
|
||||||
|
return {
|
||||||
|
title: "This list contains all notes which link to this note through links and relations."
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
getHeaderActions() {
|
getHeaderActions() {
|
||||||
const $showFullButton = $("<a>").append("show link map").addClass('widget-header-action');
|
const $showFullButton = $("<a>").append("show link map").addClass('widget-header-action');
|
||||||
$showFullButton.click(async () => {
|
$showFullButton.click(async () => {
|
||||||
|
@ -386,6 +386,15 @@ body {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.note-detail-sidebar .widget-help {
|
||||||
|
color: var(--main-text-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.note-detail-sidebar .widget-help.no-link:hover {
|
||||||
|
cursor: default;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
.note-detail-sidebar .card-body {
|
.note-detail-sidebar .card-body {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
@ -790,7 +790,7 @@ div[data-notify="container"] {
|
|||||||
border-radius: 0.2rem;
|
border-radius: 0.2rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
a.external:after, a[href^="http://"]:after, a[href^="https://"]:after {
|
a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href^="https://"]:not(.no-arrow):after {
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
content: "\2197";
|
content: "\2197";
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user