mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix ordering of note contexts, fixes #2283
This commit is contained in:
parent
a7d3dafcf1
commit
bcabe5786f
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "trilium",
|
"name": "trilium",
|
||||||
"version": "0.48.2",
|
"version": "0.48.3",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -71,7 +71,13 @@ class NoteContext extends Component {
|
|||||||
|
|
||||||
getMainContext() {
|
getMainContext() {
|
||||||
if (this.mainNtxId) {
|
if (this.mainNtxId) {
|
||||||
return appContext.tabManager.getNoteContextById(this.mainNtxId);
|
try {
|
||||||
|
return appContext.tabManager.getNoteContextById(this.mainNtxId);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
this.mainNtxId = null;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return this;
|
return this;
|
||||||
|
@ -353,7 +353,7 @@ export default class TabManager extends Component {
|
|||||||
const order = {};
|
const order = {};
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
for (const ntxId in ntxIdsInOrder) {
|
for (const ntxId of ntxIdsInOrder) {
|
||||||
order[ntxId] = i++;
|
order[ntxId] = i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,12 @@ export default class SplitNoteContainer extends FlexContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async openNewNoteSplitEvent({ntxId, notePath}) {
|
async openNewNoteSplitEvent({ntxId, notePath}) {
|
||||||
|
if (!ntxId) {
|
||||||
|
logError("empty ntxId!");
|
||||||
|
|
||||||
|
ntxId = appContext.tabManager.getActiveMainContext().ntxId;
|
||||||
|
}
|
||||||
|
|
||||||
const noteContext = await appContext.tabManager.openEmptyTab(null, 'root', appContext.tabManager.getActiveMainContext().ntxId);
|
const noteContext = await appContext.tabManager.openEmptyTab(null, 'root', appContext.tabManager.getActiveMainContext().ntxId);
|
||||||
|
|
||||||
// remove the original position of newly created note context
|
// remove the original position of newly created note context
|
||||||
@ -46,7 +52,7 @@ export default class SplitNoteContainer extends FlexContainer {
|
|||||||
// insert the note context after the originating note context
|
// 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", {ntxIdsInOrder: ntxIds});
|
||||||
|
|
||||||
// move the note context rendered widget after the originating widget
|
// 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}"]`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user