mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	tab styling changes
This commit is contained in:
		| @@ -183,7 +183,7 @@ export default class DesktopLayout { | |||||||
|                 .child(new FlexContainer('row').overflowing() |                 .child(new FlexContainer('row').overflowing() | ||||||
|                     .child(new TabRowWidget()) |                     .child(new TabRowWidget()) | ||||||
|                     .child(new TitleBarButtonsWidget()) |                     .child(new TitleBarButtonsWidget()) | ||||||
|                     .css('height', '36px') |                     .css('height', '40px') | ||||||
|                 ) |                 ) | ||||||
|                 .child(new PaneContainer(() => |                 .child(new PaneContainer(() => | ||||||
|                     new FlexContainer('column') |                     new FlexContainer('column') | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ const TAB_CONTAINER_MIN_WIDTH = 24; | |||||||
| const TAB_CONTAINER_MAX_WIDTH = 240; | const TAB_CONTAINER_MAX_WIDTH = 240; | ||||||
| const NEW_TAB_WIDTH = 32; | const NEW_TAB_WIDTH = 32; | ||||||
| const MIN_FILLER_WIDTH = 50; | const MIN_FILLER_WIDTH = 50; | ||||||
|  | const MARGIN_WIDTH = 5; | ||||||
|  |  | ||||||
| const TAB_SIZE_SMALL = 84; | const TAB_SIZE_SMALL = 84; | ||||||
| const TAB_SIZE_SMALLER = 60; | const TAB_SIZE_SMALLER = 60; | ||||||
| @@ -39,9 +40,7 @@ const TAB_TPL = ` | |||||||
| </div>`; | </div>`; | ||||||
|  |  | ||||||
| const NEW_TAB_BUTTON_TPL = `<div class="note-new-tab" data-trigger-command="openNewTab" title="Add new tab">+</div>`; | const NEW_TAB_BUTTON_TPL = `<div class="note-new-tab" data-trigger-command="openNewTab" title="Add new tab">+</div>`; | ||||||
| const FILLER_TPL = `<div class="tab-row-filler"> | const FILLER_TPL = `<div class="tab-row-filler"></div>`; | ||||||
|     <div class="tab-row-border"></div> |  | ||||||
| </div>`; |  | ||||||
|  |  | ||||||
| const TAB_ROW_TPL = ` | const TAB_ROW_TPL = ` | ||||||
| <div class="note-tab-row"> | <div class="note-tab-row"> | ||||||
| @@ -49,7 +48,6 @@ const TAB_ROW_TPL = ` | |||||||
|     .note-tab-row { |     .note-tab-row { | ||||||
|         box-sizing: border-box; |         box-sizing: border-box; | ||||||
|         position: relative; |         position: relative; | ||||||
|         height: 36px; |  | ||||||
|         width: 100%; |         width: 100%; | ||||||
|         background: var(--main-background-color); |         background: var(--main-background-color); | ||||||
|         overflow: hidden; |         overflow: hidden; | ||||||
| @@ -71,7 +69,6 @@ const TAB_ROW_TPL = ` | |||||||
|     .note-tab-row .note-tab { |     .note-tab-row .note-tab { | ||||||
|         position: absolute; |         position: absolute; | ||||||
|         left: 0; |         left: 0; | ||||||
|         height: 33px; |  | ||||||
|         width: 240px; |         width: 240px; | ||||||
|         border: 0; |         border: 0; | ||||||
|         margin: 0; |         margin: 0; | ||||||
| @@ -82,15 +79,15 @@ const TAB_ROW_TPL = ` | |||||||
|     .note-new-tab { |     .note-new-tab { | ||||||
|         position: absolute; |         position: absolute; | ||||||
|         left: 0; |         left: 0; | ||||||
|         height: 33px; |         width: 40px; | ||||||
|         width: 32px; |         height: 40px; | ||||||
|  |         padding: 3px; | ||||||
|         border: 0; |         border: 0; | ||||||
|         margin: 0; |         margin: 0; | ||||||
|         z-index: 1; |         z-index: 1; | ||||||
|         text-align: center; |         text-align: center; | ||||||
|         font-size: 24px; |         font-size: 24px; | ||||||
|         cursor: pointer; |         cursor: pointer; | ||||||
|         border-bottom: 1px solid var(--main-border-color); |  | ||||||
|         box-sizing: border-box; |         box-sizing: border-box; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -104,13 +101,6 @@ const TAB_ROW_TPL = ` | |||||||
|         -webkit-app-region: drag; |         -webkit-app-region: drag; | ||||||
|         position: absolute; |         position: absolute; | ||||||
|         left: 0; |         left: 0; | ||||||
|         height: 36px; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     .tab-row-filler .tab-row-border { |  | ||||||
|         background: linear-gradient(to right, var(--main-border-color), transparent); |  | ||||||
|         height: 1px; |  | ||||||
|         margin-top: 32px; |  | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     .note-tab-row .note-tab[active] { |     .note-tab-row .note-tab[active] { | ||||||
| @@ -135,19 +125,15 @@ const TAB_ROW_TPL = ` | |||||||
|         bottom: 0; |         bottom: 0; | ||||||
|         left: 0; |         left: 0; | ||||||
|         right: 0; |         right: 0; | ||||||
|         padding: 5px 8px; |         height: 40px; | ||||||
|         border-top-left-radius: 8px; |         padding: 8px 11px; | ||||||
|         border-top-right-radius: 8px; |         border-radius: 8px; | ||||||
|         overflow: hidden; |         overflow: hidden; | ||||||
|         pointer-events: all; |         pointer-events: all; | ||||||
|         background-color: var(--accented-background-color); |         background-color: var(--accented-background-color); | ||||||
|         border-bottom: 1px solid var(--main-border-color); |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     .note-tab-row .note-tab[active] .note-tab-wrapper { |     .note-tab-row .note-tab[active] .note-tab-wrapper { | ||||||
|         background-color: var(--main-background-color); |  | ||||||
|         border: 1px solid var(--main-border-color); |  | ||||||
|         border-bottom: 0; |  | ||||||
|         font-weight: bold; |         font-weight: bold; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -193,8 +179,6 @@ const TAB_ROW_TPL = ` | |||||||
|         flex-shrink: 0; |         flex-shrink: 0; | ||||||
|         border-radius: 50%; |         border-radius: 50%; | ||||||
|         z-index: 100; |         z-index: 100; | ||||||
|         width: 24px; |  | ||||||
|         height: 24px; |  | ||||||
|         text-align: center; |         text-align: center; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -251,9 +235,9 @@ const TAB_ROW_TPL = ` | |||||||
| export default class TabRowWidget extends BasicWidget { | export default class TabRowWidget extends BasicWidget { | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TAB_ROW_TPL); |         this.$widget = $(TAB_ROW_TPL); | ||||||
|  |         this.overflowing(); | ||||||
|  |  | ||||||
|         this.draggabillies = []; |         this.draggabillies = []; | ||||||
|         this.eventListeners = {}; |  | ||||||
|  |  | ||||||
|         this.setupStyle(); |         this.setupStyle(); | ||||||
|         this.setupEvents(); |         this.setupEvents(); | ||||||
| @@ -321,10 +305,11 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|     get tabWidths() { |     get tabWidths() { | ||||||
|         const numberOfTabs = this.tabEls.length; |         const numberOfTabs = this.tabEls.length; | ||||||
|         const tabsContainerWidth = this.$tabContainer[0].clientWidth - NEW_TAB_WIDTH - MIN_FILLER_WIDTH; |         const tabsContainerWidth = this.$tabContainer[0].clientWidth - NEW_TAB_WIDTH - MIN_FILLER_WIDTH; | ||||||
|         const targetWidth = tabsContainerWidth / numberOfTabs; |         const marginWidth = (numberOfTabs - 1) * MARGIN_WIDTH; | ||||||
|  |         const targetWidth = (tabsContainerWidth - marginWidth) / numberOfTabs; | ||||||
|         const clampedTargetWidth = Math.max(TAB_CONTAINER_MIN_WIDTH, Math.min(TAB_CONTAINER_MAX_WIDTH, targetWidth)); |         const clampedTargetWidth = Math.max(TAB_CONTAINER_MIN_WIDTH, Math.min(TAB_CONTAINER_MAX_WIDTH, targetWidth)); | ||||||
|         const flooredClampedTargetWidth = Math.floor(clampedTargetWidth); |         const flooredClampedTargetWidth = Math.floor(clampedTargetWidth); | ||||||
|         const totalTabsWidthUsingTarget = flooredClampedTargetWidth * numberOfTabs; |         const totalTabsWidthUsingTarget = flooredClampedTargetWidth * numberOfTabs + marginWidth; | ||||||
|         const totalExtraWidthDueToFlooring = tabsContainerWidth - totalTabsWidthUsingTarget; |         const totalExtraWidthDueToFlooring = tabsContainerWidth - totalTabsWidthUsingTarget; | ||||||
|  |  | ||||||
|         const widths = []; |         const widths = []; | ||||||
| @@ -332,8 +317,12 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|  |  | ||||||
|         for (let i = 0; i < numberOfTabs; i += 1) { |         for (let i = 0; i < numberOfTabs; i += 1) { | ||||||
|             const extraWidth = flooredClampedTargetWidth < TAB_CONTAINER_MAX_WIDTH && extraWidthRemaining > 0 ? 1 : 0; |             const extraWidth = flooredClampedTargetWidth < TAB_CONTAINER_MAX_WIDTH && extraWidthRemaining > 0 ? 1 : 0; | ||||||
|  |  | ||||||
|             widths.push(flooredClampedTargetWidth + extraWidth); |             widths.push(flooredClampedTargetWidth + extraWidth); | ||||||
|             if (extraWidthRemaining > 0) extraWidthRemaining -= 1; |  | ||||||
|  |             if (extraWidthRemaining > 0) { | ||||||
|  |                 extraWidthRemaining -= 1; | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (this.$filler) { |         if (this.$filler) { | ||||||
| @@ -349,9 +338,11 @@ export default class TabRowWidget extends BasicWidget { | |||||||
|         let position = 0; |         let position = 0; | ||||||
|         this.tabWidths.forEach(width => { |         this.tabWidths.forEach(width => { | ||||||
|             tabPositions.push(position); |             tabPositions.push(position); | ||||||
|             position += width; |             position += width + MARGIN_WIDTH; | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|  |         position -= MARGIN_WIDTH; // last margin should not be applied | ||||||
|  |  | ||||||
|         const newTabPosition = position; |         const newTabPosition = position; | ||||||
|         const fillerPosition = position + 32; |         const fillerPosition = position + 32; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user