mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
hoisting improvements
This commit is contained in:
parent
9889166afc
commit
61f30373d4
@ -546,6 +546,11 @@ class NoteShort {
|
|||||||
const labels = this.getLabels('cssClass');
|
const labels = this.getLabels('cssClass');
|
||||||
return labels.map(l => l.value).join(' ');
|
return labels.map(l => l.value).join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getHoistedCssClass() {
|
||||||
|
const labels = this.getLabels('hoistedCssClass');
|
||||||
|
return labels.map(l => l.value).join(' ');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default NoteShort;
|
export default NoteShort;
|
||||||
|
@ -78,7 +78,7 @@ function goToLink(e) {
|
|||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
if ((e.which === 1 && e.ctrlKey) || e.which === 2) {
|
if ((e.which === 1 && e.ctrlKey) || e.which === 2) {
|
||||||
appContext.tabManager.openTabWithNote(notePath);
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||||
}
|
}
|
||||||
else if (e.which === 1) {
|
else if (e.which === 1) {
|
||||||
const activeTabContext = appContext.tabManager.getActiveTabContext();
|
const activeTabContext = appContext.tabManager.getActiveTabContext();
|
||||||
@ -127,7 +127,7 @@ function linkContextMenu(e) {
|
|||||||
],
|
],
|
||||||
selectMenuItemHandler: ({command}) => {
|
selectMenuItemHandler: ({command}) => {
|
||||||
if (command === 'openNoteInNewTab') {
|
if (command === 'openNoteInNewTab') {
|
||||||
appContext.tabManager.openTabWithNote(notePath);
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||||
}
|
}
|
||||||
else if (command === 'openNoteInNewWindow') {
|
else if (command === 'openNoteInNewWindow') {
|
||||||
appContext.triggerCommand('openInWindow', {notePath});
|
appContext.triggerCommand('openInWindow', {notePath});
|
||||||
|
@ -193,6 +193,24 @@ export default class TabManager extends Component {
|
|||||||
return tabContext;
|
return tabContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the requested notePath is within current note hoisting scope then keep the note hoisting also for the new tab.
|
||||||
|
*/
|
||||||
|
async openTabWithNoteWithHoisting(notePath) {
|
||||||
|
const tabContext = this.getActiveTabContext();
|
||||||
|
let hoistedNoteId = 'root';
|
||||||
|
|
||||||
|
if (tabContext) {
|
||||||
|
const resolvedNotePath = await treeService.resolveNotePath(notePath);
|
||||||
|
|
||||||
|
if (resolvedNotePath.includes(tabContext.hoistedNoteId)) {
|
||||||
|
hoistedNoteId = tabContext.hoistedNoteId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.openTabWithNote(notePath, false, null, hoistedNoteId);
|
||||||
|
}
|
||||||
|
|
||||||
async openTabWithNote(notePath, activate, tabId, hoistedNoteId) {
|
async openTabWithNote(notePath, activate, tabId, hoistedNoteId) {
|
||||||
const tabContext = await this.openEmptyTab(tabId, hoistedNoteId);
|
const tabContext = await this.openEmptyTab(tabId, hoistedNoteId);
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class TreeContextMenu {
|
|||||||
const notePath = treeService.getNotePath(this.node);
|
const notePath = treeService.getNotePath(this.node);
|
||||||
|
|
||||||
if (command === 'openInTab') {
|
if (command === 'openInTab') {
|
||||||
appContext.tabManager.openTabWithNote(notePath);
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||||
}
|
}
|
||||||
else if (command === "insertNoteAfter") {
|
else if (command === "insertNoteAfter") {
|
||||||
const parentNoteId = this.node.data.parentNoteId;
|
const parentNoteId = this.node.data.parentNoteId;
|
||||||
|
@ -181,7 +181,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
const notePath = treeService.getNotePath(node);
|
const notePath = treeService.getNotePath(node);
|
||||||
|
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
appContext.tabManager.openTabWithNote(notePath);
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
@ -311,7 +311,7 @@ export default class NoteTreeWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
else if (event.ctrlKey) {
|
else if (event.ctrlKey) {
|
||||||
const notePath = treeService.getNotePath(node);
|
const notePath = treeService.getNotePath(node);
|
||||||
appContext.tabManager.openTabWithNote(notePath);
|
appContext.tabManager.openTabWithNoteWithHoisting(notePath);
|
||||||
}
|
}
|
||||||
else if (data.node.isActive()) {
|
else if (data.node.isActive()) {
|
||||||
// this is important for single column mobile view, otherwise it's not possible to see again previously displayed note
|
// this is important for single column mobile view, otherwise it's not possible to see again previously displayed note
|
||||||
|
@ -32,9 +32,9 @@ export default class OwnedAttributeListWidget extends TabAwareWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderTitle(note) {
|
renderTitle(note) {
|
||||||
const ownedNotes = note.getAttributes().filter(attr => attr.noteId === this.noteId)
|
const ownedAttrs = note.getAttributes().filter(attr => attr.noteId === this.noteId && !attr.isAutoLink)
|
||||||
|
|
||||||
this.$title.text(`Owned attrs (${ownedNotes.length})`);
|
this.$title.text(`Owned attrs (${ownedAttrs.length})`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: true,
|
show: true,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -190,7 +190,7 @@ export default class RelationMapTypeWidget extends TypeWidget {
|
|||||||
const noteId = this.idToNoteId($noteBox.prop("id"));
|
const noteId = this.idToNoteId($noteBox.prop("id"));
|
||||||
|
|
||||||
if (command === "openInNewTab") {
|
if (command === "openInNewTab") {
|
||||||
appContext.tabManager.openTabWithNote(noteId);
|
appContext.tabManager.openTabWithNoteWithHoisting(noteId);
|
||||||
}
|
}
|
||||||
else if (command === "remove") {
|
else if (command === "remove") {
|
||||||
const confirmDialog = await import('../../dialogs/confirm.js');
|
const confirmDialog = await import('../../dialogs/confirm.js');
|
||||||
|
@ -18,6 +18,7 @@ const BUILTIN_ATTRIBUTES = [
|
|||||||
{ type: 'label', name: 'hidePromotedAttributes' },
|
{ type: 'label', name: 'hidePromotedAttributes' },
|
||||||
{ type: 'label', name: 'readOnly' },
|
{ type: 'label', name: 'readOnly' },
|
||||||
{ type: 'label', name: 'autoReadOnlyDisabled' },
|
{ type: 'label', name: 'autoReadOnlyDisabled' },
|
||||||
|
{ type: 'label', name: 'hoistedCssClass' },
|
||||||
{ type: 'label', name: 'cssClass' },
|
{ type: 'label', name: 'cssClass' },
|
||||||
{ type: 'label', name: 'iconClass' },
|
{ type: 'label', name: 'iconClass' },
|
||||||
{ type: 'label', name: 'keyboardShortcut' },
|
{ type: 'label', name: 'keyboardShortcut' },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user