feat(split): improve support for closing any split pane

This commit is contained in:
SiriusXT 2025-11-18 09:14:50 +08:00
parent 13afe33244
commit 6b0bcf93d3

View File

@ -102,12 +102,11 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
if (!ntxId) return;
const contexts = appContext.tabManager.noteContexts;
const currentIndex = contexts.findIndex((c) => c.ntxId === ntxId);
if (currentIndex === -1) return;
const isRemoveMainContext = !contexts[currentIndex].mainNtxId;
if (isRemoveMainContext && currentIndex + 1 <= contexts.length) {
const isRemoveMainContext = contexts[currentIndex].isMainContext();
if (isRemoveMainContext && currentIndex + 1 < contexts.length) {
const ntxIds = contexts.map((c) => c.ntxId).filter((c) => !!c) as string[];
this.triggerCommand("noteContextReorder", {
ntxIdsInOrder: ntxIds,