mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
relocated note paths widget into note title row
This commit is contained in:
parent
076b4a6651
commit
3dbd80d5a6
@ -21,6 +21,7 @@ import FilePropertiesWidget from "../widgets/type_property_widgets/file_properti
|
|||||||
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
import ImagePropertiesWidget from "../widgets/type_property_widgets/image_properties.js";
|
||||||
import NotePropertiesWidget from "../widgets/type_property_widgets/note_properties.js";
|
import NotePropertiesWidget from "../widgets/type_property_widgets/note_properties.js";
|
||||||
import NoteIconWidget from "../widgets/note_icon.js";
|
import NoteIconWidget from "../widgets/note_icon.js";
|
||||||
|
import NotePathsWidget from "../widgets/note_paths.js";
|
||||||
|
|
||||||
export default class DesktopExtraWindowLayout {
|
export default class DesktopExtraWindowLayout {
|
||||||
constructor(customWidgets) {
|
constructor(customWidgets) {
|
||||||
@ -48,6 +49,7 @@ export default class DesktopExtraWindowLayout {
|
|||||||
.overflowing()
|
.overflowing()
|
||||||
.child(new NoteIconWidget())
|
.child(new NoteIconWidget())
|
||||||
.child(new NoteTitleWidget())
|
.child(new NoteTitleWidget())
|
||||||
|
.child(new NotePathsWidget().hideInZenMode())
|
||||||
.child(new NoteTypeWidget().hideInZenMode())
|
.child(new NoteTypeWidget().hideInZenMode())
|
||||||
.child(new NoteActionsWidget().hideInZenMode())
|
.child(new NoteActionsWidget().hideInZenMode())
|
||||||
)
|
)
|
||||||
|
@ -149,7 +149,6 @@ export default class DesktopMainWindowLayout {
|
|||||||
.filling()
|
.filling()
|
||||||
.child(new SidePaneContainer('left')
|
.child(new SidePaneContainer('left')
|
||||||
.hideInZenMode()
|
.hideInZenMode()
|
||||||
.child(new TabCachingWidget(() => new NotePathsWidget()))
|
|
||||||
.child(appContext.mainTreeWidget)
|
.child(appContext.mainTreeWidget)
|
||||||
.child(...this.customWidgets.get('left-pane'))
|
.child(...this.customWidgets.get('left-pane'))
|
||||||
)
|
)
|
||||||
@ -160,6 +159,7 @@ export default class DesktopMainWindowLayout {
|
|||||||
.overflowing()
|
.overflowing()
|
||||||
.child(new NoteIconWidget())
|
.child(new NoteIconWidget())
|
||||||
.child(new NoteTitleWidget())
|
.child(new NoteTitleWidget())
|
||||||
|
.child(new NotePathsWidget().hideInZenMode())
|
||||||
.child(new NoteTypeWidget().hideInZenMode())
|
.child(new NoteTypeWidget().hideInZenMode())
|
||||||
.child(new NoteActionsWidget().hideInZenMode())
|
.child(new NoteActionsWidget().hideInZenMode())
|
||||||
)
|
)
|
||||||
|
@ -4,53 +4,25 @@ import linkService from "../services/link.js";
|
|||||||
import hoistedNoteService from "../services/hoisted_note.js";
|
import hoistedNoteService from "../services/hoisted_note.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="note-paths-widget">
|
<div class="dropdown note-paths-widget">
|
||||||
<style>
|
<style>
|
||||||
.note-paths-widget {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
padding: 3px 0px 3px 10px;
|
|
||||||
margin-top: 8px;
|
|
||||||
border-bottom: 1px dashed var(--main-border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-path-list a.current {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-path-list-button {
|
.note-path-list-button {
|
||||||
padding: 0;
|
font-size: 120% !important;
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
margin-left: 5px;
|
|
||||||
position: relative;
|
|
||||||
top: -2px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.note-path-list-button::after {
|
.note-path-list-button::after {
|
||||||
display: none !important; // disabling the standard caret
|
display: none !important; // disabling the standard caret
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-path {
|
|
||||||
flex-grow: 1;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
.note-path-list {
|
.note-path-list {
|
||||||
max-height: 600px;
|
max-height: 600px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div class="current-path"></div>
|
<button class="btn dropdown-toggle note-path-list-button bx bx-collection" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Note paths"></button>
|
||||||
|
|
||||||
<div class="dropdown hide-in-zen-mode">
|
|
||||||
<button class="btn btn-sm dropdown-toggle note-path-list-button bx bx-caret-down" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
|
|
||||||
<ul class="note-path-list dropdown-menu dropdown-menu-right" aria-labelledby="note-path-list-button">
|
<ul class="note-path-list dropdown-menu dropdown-menu-right" aria-labelledby="note-path-list-button">
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
export default class NotePathsWidget extends TabAwareWidget {
|
export default class NotePathsWidget extends TabAwareWidget {
|
||||||
@ -58,52 +30,8 @@ export default class NotePathsWidget extends TabAwareWidget {
|
|||||||
this.$widget = $(TPL);
|
this.$widget = $(TPL);
|
||||||
this.overflowing();
|
this.overflowing();
|
||||||
|
|
||||||
this.$currentPath = this.$widget.find('.current-path');
|
this.$notePathList = this.$widget.find(".note-path-list");
|
||||||
this.$dropdown = this.$widget.find(".dropdown");
|
this.$widget.on('show.bs.dropdown', () => this.renderDropdown());
|
||||||
this.$dropdownToggle = this.$widget.find('.dropdown-toggle');
|
|
||||||
|
|
||||||
this.$notePathList = this.$dropdown.find(".note-path-list");
|
|
||||||
|
|
||||||
this.$dropdown.on('show.bs.dropdown', () => this.renderDropdown());
|
|
||||||
}
|
|
||||||
|
|
||||||
async refreshWithNote(note) {
|
|
||||||
const noteIdsPath = treeService.parseNotePath(this.notePath);
|
|
||||||
|
|
||||||
this.$currentPath.empty();
|
|
||||||
|
|
||||||
let parentNoteId = 'root';
|
|
||||||
let curPath = '';
|
|
||||||
|
|
||||||
let passedHoistedNote = false;
|
|
||||||
|
|
||||||
for (let i = 0; i < noteIdsPath.length; i++) {
|
|
||||||
const noteId = noteIdsPath[i];
|
|
||||||
|
|
||||||
curPath += (curPath ? '/' : '') + noteId;
|
|
||||||
|
|
||||||
if (noteId === hoistedNoteService.getHoistedNoteId()) {
|
|
||||||
passedHoistedNote = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (passedHoistedNote && (noteId !== hoistedNoteService.getHoistedNoteId() || noteIdsPath.length - i < 3)) {
|
|
||||||
this.$currentPath.append(
|
|
||||||
$("<a>")
|
|
||||||
.attr('href', '#' + curPath)
|
|
||||||
.attr('data-note-path', curPath)
|
|
||||||
.addClass('no-tooltip-preview')
|
|
||||||
.text(await treeService.getNoteTitle(noteId, parentNoteId))
|
|
||||||
);
|
|
||||||
|
|
||||||
if (i !== noteIdsPath.length - 1) {
|
|
||||||
this.$currentPath.append(' / ');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
parentNoteId = noteId;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$dropdownToggle.dropdown('hide');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async renderDropdown() {
|
async renderDropdown() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user