mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 23:18:59 +01:00
feat: Make splits resizable
This commit is contained in:
parent
88b748e67b
commit
5436011f8e
@ -119,13 +119,15 @@ function setupNoteSplitResizer(ntxIds: string[]) {
|
|||||||
|
|
||||||
function delNoteSplitResizer(ntxIds: string[]) {
|
function delNoteSplitResizer(ntxIds: string[]) {
|
||||||
let targetNtxIds = findKeyByNtxId(ntxIds[0]);
|
let targetNtxIds = findKeyByNtxId(ntxIds[0]);
|
||||||
|
if (!targetNtxIds) {
|
||||||
if (targetNtxIds) {
|
return;
|
||||||
noteSplitMap.get(targetNtxIds)?.destroy();
|
|
||||||
noteSplitMap.delete(targetNtxIds);
|
|
||||||
targetNtxIds = targetNtxIds.filter(id => !ntxIds.includes(id));
|
|
||||||
}
|
}
|
||||||
if (targetNtxIds && targetNtxIds.length >= 2) {
|
|
||||||
|
noteSplitMap.get(targetNtxIds)?.destroy();
|
||||||
|
noteSplitMap.delete(targetNtxIds);
|
||||||
|
targetNtxIds = targetNtxIds.filter(id => !ntxIds.includes(id));
|
||||||
|
|
||||||
|
if (targetNtxIds.length >= 2) {
|
||||||
noteSplitMap.set(targetNtxIds, undefined);
|
noteSplitMap.set(targetNtxIds, undefined);
|
||||||
createSplitInstance(targetNtxIds);
|
createSplitInstance(targetNtxIds);
|
||||||
}
|
}
|
||||||
@ -133,15 +135,12 @@ function delNoteSplitResizer(ntxIds: string[]) {
|
|||||||
|
|
||||||
function moveNoteSplitResizer(ntxId: string) {
|
function moveNoteSplitResizer(ntxId: string) {
|
||||||
const targetNtxIds = findKeyByNtxId(ntxId);
|
const targetNtxIds = findKeyByNtxId(ntxId);
|
||||||
|
if (!targetNtxIds) {
|
||||||
if (targetNtxIds) {
|
return;
|
||||||
noteSplitMap.get(targetNtxIds)?.destroy();
|
|
||||||
noteSplitMap.set(targetNtxIds, undefined);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targetNtxIds) {
|
|
||||||
createSplitInstance(targetNtxIds);
|
|
||||||
}
|
}
|
||||||
|
noteSplitMap.get(targetNtxIds)?.destroy();
|
||||||
|
noteSplitMap.set(targetNtxIds, undefined);
|
||||||
|
createSplitInstance(targetNtxIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createSplitInstance(targetNtxIds: string[]) {
|
function createSplitInstance(targetNtxIds: string[]) {
|
||||||
|
|||||||
@ -102,8 +102,6 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
|
|||||||
async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
|
async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
|
||||||
if (ntxId) {
|
if (ntxId) {
|
||||||
await appContext.tabManager.removeNoteContext(ntxId);
|
await appContext.tabManager.removeNoteContext(ntxId);
|
||||||
|
|
||||||
splitService.delNoteSplitResizer([ntxId]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user