mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 13:39:01 +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[]) {
 | 
			
		||||
    let targetNtxIds = findKeyByNtxId(ntxIds[0]);
 | 
			
		||||
 | 
			
		||||
    if (targetNtxIds) {
 | 
			
		||||
        noteSplitMap.get(targetNtxIds)?.destroy();
 | 
			
		||||
        noteSplitMap.delete(targetNtxIds);
 | 
			
		||||
        targetNtxIds = targetNtxIds.filter(id => !ntxIds.includes(id));
 | 
			
		||||
    if (!targetNtxIds) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    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);
 | 
			
		||||
        createSplitInstance(targetNtxIds);
 | 
			
		||||
    }
 | 
			
		||||
@ -133,15 +135,12 @@ function delNoteSplitResizer(ntxIds: string[]) {
 | 
			
		||||
 | 
			
		||||
function moveNoteSplitResizer(ntxId: string) {
 | 
			
		||||
    const targetNtxIds = findKeyByNtxId(ntxId);
 | 
			
		||||
 | 
			
		||||
    if (targetNtxIds) {
 | 
			
		||||
        noteSplitMap.get(targetNtxIds)?.destroy();
 | 
			
		||||
        noteSplitMap.set(targetNtxIds, undefined);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (targetNtxIds) {
 | 
			
		||||
        createSplitInstance(targetNtxIds);
 | 
			
		||||
    if (!targetNtxIds) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    noteSplitMap.get(targetNtxIds)?.destroy();
 | 
			
		||||
    noteSplitMap.set(targetNtxIds, undefined);
 | 
			
		||||
    createSplitInstance(targetNtxIds);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function createSplitInstance(targetNtxIds: string[]) {
 | 
			
		||||
 | 
			
		||||
@ -102,8 +102,6 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
 | 
			
		||||
    async closeThisNoteSplitCommand({ ntxId }: CommandListenerData<"closeThisNoteSplit">) {
 | 
			
		||||
        if (ntxId) {
 | 
			
		||||
            await appContext.tabManager.removeNoteContext(ntxId);
 | 
			
		||||
            
 | 
			
		||||
            splitService.delNoteSplitResizer([ntxId]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user