mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
display unhoist button on the left of the note title so that it's always visible, #1223
This commit is contained in:
parent
a73733d0fc
commit
ee4ce3ffd8
@ -1,6 +1,7 @@
|
|||||||
import options from './options.js';
|
import options from './options.js';
|
||||||
import appContext from "./app_context.js";
|
import appContext from "./app_context.js";
|
||||||
import treeService from "./tree.js";
|
import treeService from "./tree.js";
|
||||||
|
import treeCache from "./tree_cache.js";
|
||||||
|
|
||||||
function getHoistedNoteId() {
|
function getHoistedNoteId() {
|
||||||
return options.get('hoistedNoteId');
|
return options.get('hoistedNoteId');
|
||||||
@ -9,6 +10,8 @@ function getHoistedNoteId() {
|
|||||||
async function setHoistedNoteId(noteId) {
|
async function setHoistedNoteId(noteId) {
|
||||||
await options.save('hoistedNoteId', noteId);
|
await options.save('hoistedNoteId', noteId);
|
||||||
|
|
||||||
|
await treeCache.loadInitialTree();
|
||||||
|
|
||||||
// FIXME - just use option load event
|
// FIXME - just use option load event
|
||||||
appContext.triggerEvent('hoistedNoteChanged', {noteId});
|
appContext.triggerEvent('hoistedNoteChanged', {noteId});
|
||||||
}
|
}
|
||||||
|
@ -207,7 +207,7 @@ export default class AttributeListWidget extends TabAwareWidget {
|
|||||||
|
|
||||||
async renderInheritedAttributes(attributes, $container) {
|
async renderInheritedAttributes(attributes, $container) {
|
||||||
for (const attribute of attributes) {
|
for (const attribute of attributes) {
|
||||||
const $attr = await attributeRenderer.renderAttribute(attribute, false)
|
const $attr = (await attributeRenderer.renderAttribute(attribute, false))
|
||||||
.on('click', e => this.attributeDetailWidget.showAttributeDetail({
|
.on('click', e => this.attributeDetailWidget.showAttributeDetail({
|
||||||
attribute: {
|
attribute: {
|
||||||
noteId: attribute.noteId,
|
noteId: attribute.noteId,
|
||||||
|
@ -32,7 +32,7 @@ const TPL = `
|
|||||||
.tree {
|
.tree {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 35px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.refresh-search-button {
|
.refresh-search-button {
|
||||||
@ -464,9 +464,11 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
&& node.data.noteId === hoistedNoteService.getHoistedNoteId()
|
&& node.data.noteId === hoistedNoteService.getHoistedNoteId()
|
||||||
&& $span.find('.unhoist-button').length === 0) {
|
&& $span.find('.unhoist-button').length === 0) {
|
||||||
|
|
||||||
const unhoistButton = $('<span> (<a class="unhoist-button">unhoist</a>)</span>');
|
const unhoistButton = $('<span class="unhoist-button-wrapper" title="Unhoist current note to show the whole note tree">[<a class="unhoist-button">unhoist</a>]</span>');
|
||||||
|
|
||||||
$span.append(unhoistButton);
|
// prepending since appending could push out (when note title is too long)
|
||||||
|
// the button too much to the right so that it's not visible
|
||||||
|
$span.prepend(unhoistButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
const note = await treeCache.getNote(node.data.noteId);
|
const note = await treeCache.getNote(node.data.noteId);
|
||||||
|
@ -540,6 +540,11 @@ div[data-notify="container"] {
|
|||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unhoist-button-wrapper {
|
||||||
|
position: relative;
|
||||||
|
top: -4px;
|
||||||
|
}
|
||||||
|
|
||||||
.unhoist-button {
|
.unhoist-button {
|
||||||
text-decoration: underline !important;
|
text-decoration: underline !important;
|
||||||
color: var(--link-color) !important;
|
color: var(--link-color) !important;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user