mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fixes
This commit is contained in:
parent
bae8551652
commit
2f5d3729de
@ -331,8 +331,8 @@ export default class TabManager extends Component {
|
|||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
for (const ntxId in ntxIdsInOrder) {
|
for (const ntxId of ntxIdsInOrder) {
|
||||||
for (const noteContext of this.noteContexts[ntxId].getSubContexts()) {
|
for (const noteContext of this.getNoteContextById(ntxId).getSubContexts()) {
|
||||||
order[noteContext.ntxId] = i++;
|
order[noteContext.ntxId] = i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,17 +35,20 @@ export default class PaneContainer extends FlexContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openNewPaneCommand({ntxId}) {
|
async openNewPaneCommand({ntxId}) {
|
||||||
const noteContext = await appContext.tabManager.openEmptyTab(null, 'root', appContext.tabManager.getActiveContext().ntxId);
|
const noteContext = await appContext.tabManager.openEmptyTab(null, 'root', appContext.tabManager.getActiveMainContext().ntxId);
|
||||||
|
|
||||||
|
// remove the original position of newly created note context
|
||||||
const ntxIds = appContext.tabManager.children.map(c => c.ntxId)
|
const ntxIds = appContext.tabManager.children.map(c => c.ntxId)
|
||||||
.filter(id => id !== noteContext.ntxId);
|
.filter(id => id !== noteContext.ntxId);
|
||||||
|
|
||||||
|
// insert the note context after the originating note context
|
||||||
ntxIds.splice(ntxIds.indexOf(ntxId) + 1, 0, noteContext.ntxId);
|
ntxIds.splice(ntxIds.indexOf(ntxId) + 1, 0, noteContext.ntxId);
|
||||||
|
|
||||||
this.triggerCommand("noteContextReorder", ntxIds);
|
this.triggerCommand("noteContextReorder", ntxIds);
|
||||||
|
|
||||||
|
// move the note context rendered widget after the originating widget
|
||||||
this.$widget.find(`[data-ntx-id="${noteContext.ntxId}"]`)
|
this.$widget.find(`[data-ntx-id="${noteContext.ntxId}"]`)
|
||||||
.insertAfter(this.$widget.find(`[data-ntx-id="${ntxId}"]`))
|
.insertAfter(this.$widget.find(`[data-ntx-id="${ntxId}"]`));
|
||||||
|
|
||||||
await appContext.tabManager.activateNoteContext(noteContext.ntxId);
|
await appContext.tabManager.activateNoteContext(noteContext.ntxId);
|
||||||
|
|
||||||
@ -72,7 +75,7 @@ export default class PaneContainer extends FlexContainer {
|
|||||||
|
|
||||||
for (const ntxId in this.widgets) {
|
for (const ntxId in this.widgets) {
|
||||||
const noteContext = appContext.tabManager.getNoteContextById(ntxId);
|
const noteContext = appContext.tabManager.getNoteContextById(ntxId);
|
||||||
console.log(noteContext, activeNtxId);
|
|
||||||
const widget = this.widgets[ntxId];
|
const widget = this.widgets[ntxId];
|
||||||
widget.toggleExt(show && activeNtxId && [noteContext.ntxId, noteContext.mainNtxId].includes(activeNtxId));
|
widget.toggleExt(show && activeNtxId && [noteContext.ntxId, noteContext.mainNtxId].includes(activeNtxId));
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
this.$widget.on('contextmenu', '.note-tab', e => {
|
this.$widget.on('contextmenu', '.note-tab', e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
const ntxId = $(e.target).closest(".note-tab").attr('data-tab-id');
|
const ntxId = $(e.target).closest(".note-tab").attr('data-ntx-id');
|
||||||
|
|
||||||
contextMenu.show({
|
contextMenu.show({
|
||||||
x: e.pageX,
|
x: e.pageX,
|
||||||
@ -381,7 +381,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addTab(ntxId) {
|
addTab(ntxId) {
|
||||||
const $tab = $(TAB_TPL).attr('data-tab-id', ntxId);
|
const $tab = $(TAB_TPL).attr('data-ntx-id', ntxId);
|
||||||
|
|
||||||
keyboardActionService.updateDisplayedShortcuts($tab);
|
keyboardActionService.updateDisplayedShortcuts($tab);
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
closeActiveTabCommand({$el}) {
|
closeActiveTabCommand({$el}) {
|
||||||
const ntxId = $el.closest(".note-tab").attr('data-tab-id');
|
const ntxId = $el.closest(".note-tab").attr('data-ntx-id');
|
||||||
|
|
||||||
appContext.tabManager.removeNoteContext(ntxId);
|
appContext.tabManager.removeNoteContext(ntxId);
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
setTabCloseEvent($tab) {
|
setTabCloseEvent($tab) {
|
||||||
$tab.on('mousedown', e => {
|
$tab.on('mousedown', e => {
|
||||||
if (e.which === 2) {
|
if (e.which === 2) {
|
||||||
appContext.tabManager.removeNoteContext($tab.attr('data-tab-id'));
|
appContext.tabManager.removeNoteContext($tab.attr('data-ntx-id'));
|
||||||
|
|
||||||
return true; // event has been handled
|
return true; // event has been handled
|
||||||
}
|
}
|
||||||
@ -454,8 +454,8 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTabIdsInOrder() {
|
getNtxIdsInOrder() {
|
||||||
return this.tabEls.map(el => el.getAttribute('data-tab-id'));
|
return this.tabEls.map(el => el.getAttribute('data-ntx-id'));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTitle($tab, title) {
|
updateTitle($tab, title) {
|
||||||
@ -463,11 +463,11 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTabById(ntxId) {
|
getTabById(ntxId) {
|
||||||
return this.$widget.find(`[data-tab-id='${ntxId}']`);
|
return this.$widget.find(`[data-ntx-id='${ntxId}']`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTabId($tab) {
|
getTabId($tab) {
|
||||||
return $tab.attr('data-tab-id');
|
return $tab.attr('data-ntx-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
noteContextRemovedEvent({ntxIds}) {
|
noteContextRemovedEvent({ntxIds}) {
|
||||||
@ -509,7 +509,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
this.draggabillies.push(draggabilly);
|
this.draggabillies.push(draggabilly);
|
||||||
|
|
||||||
draggabilly.on('pointerDown', _ => {
|
draggabilly.on('pointerDown', _ => {
|
||||||
appContext.tabManager.activateNoteContext(tabEl.getAttribute('data-tab-id'));
|
appContext.tabManager.activateNoteContext(tabEl.getAttribute('data-ntx-id'));
|
||||||
});
|
});
|
||||||
|
|
||||||
draggabilly.on('dragStart', _ => {
|
draggabilly.on('dragStart', _ => {
|
||||||
@ -573,7 +573,7 @@ export default class TabRowWidget extends BasicWidget {
|
|||||||
|
|
||||||
tabEl.parentNode.insertBefore(tabEl, beforeEl);
|
tabEl.parentNode.insertBefore(tabEl, beforeEl);
|
||||||
}
|
}
|
||||||
this.triggerEvent('tabReorder', {ntxIdsInOrder: this.getTabIdsInOrder()});
|
this.triggerEvent('tabReorder', {ntxIdsInOrder: this.getNtxIdsInOrder()});
|
||||||
this.layoutTabs();
|
this.layoutTabs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user