mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
feat(split): improve support for closing any split pane
This commit is contained in:
parent
13afe33244
commit
6b0bcf93d3
@ -102,12 +102,11 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
|
|||||||
async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
|
async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
|
||||||
if (!ntxId) return;
|
if (!ntxId) return;
|
||||||
const contexts = appContext.tabManager.noteContexts;
|
const contexts = appContext.tabManager.noteContexts;
|
||||||
|
|
||||||
const currentIndex = contexts.findIndex((c) => c.ntxId === ntxId);
|
const currentIndex = contexts.findIndex((c) => c.ntxId === ntxId);
|
||||||
if (currentIndex === -1) return;
|
if (currentIndex === -1) return;
|
||||||
|
|
||||||
const isRemoveMainContext = !contexts[currentIndex].mainNtxId;
|
const isRemoveMainContext = contexts[currentIndex].isMainContext();
|
||||||
if (isRemoveMainContext && currentIndex + 1 <= contexts.length) {
|
if (isRemoveMainContext && currentIndex + 1 < contexts.length) {
|
||||||
const ntxIds = contexts.map((c) => c.ntxId).filter((c) => !!c) as string[];
|
const ntxIds = contexts.map((c) => c.ntxId).filter((c) => !!c) as string[];
|
||||||
this.triggerCommand("noteContextReorder", {
|
this.triggerCommand("noteContextReorder", {
|
||||||
ntxIdsInOrder: ntxIds,
|
ntxIdsInOrder: ntxIds,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user