mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	added plugin buttons to the launcher pane
This commit is contained in:
		| @@ -69,7 +69,11 @@ export default class DesktopLayout { | |||||||
|                     .icon("bx-history") |                     .icon("bx-history") | ||||||
|                     .title("Show recent changes") |                     .title("Show recent changes") | ||||||
|                     .command("showRecentChanges")) |                     .command("showRecentChanges")) | ||||||
|                 .child(new SpacerWidget()) |                 .child(new SpacerWidget(40, 0)) | ||||||
|  |                 .child(new FlexContainer("column") | ||||||
|  |                     .overflowing() | ||||||
|  |                     .id("plugin-buttons")) | ||||||
|  |                 .child(new SpacerWidget(0, 1000)) | ||||||
|                 .child(new ProtectedSessionStatusWidget()) |                 .child(new ProtectedSessionStatusWidget()) | ||||||
|                 .child(new SyncStatusWidget()) |                 .child(new SyncStatusWidget()) | ||||||
|                 .child(new LeftPaneToggleWidget()) |                 .child(new LeftPaneToggleWidget()) | ||||||
| @@ -103,7 +107,7 @@ export default class DesktopLayout { | |||||||
|                                     .overflowing() |                                     .overflowing() | ||||||
|                                     .child(new NoteIconWidget()) |                                     .child(new NoteIconWidget()) | ||||||
|                                     .child(new NoteTitleWidget()) |                                     .child(new NoteTitleWidget()) | ||||||
|                                     .child(new SpacerWidget(1)) |                                     .child(new SpacerWidget(0, 1)) | ||||||
|                                     .child(new ClosePaneButton()) |                                     .child(new ClosePaneButton()) | ||||||
|                                     .child(new CreatePaneButton()) |                                     .child(new CreatePaneButton()) | ||||||
|                                 ) |                                 ) | ||||||
|   | |||||||
| @@ -112,11 +112,6 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|                 .on('click', () => { |                 .on('click', () => { | ||||||
|                     setTimeout(() => $pluginButtons.dropdown('hide'), 0); |                     setTimeout(() => $pluginButtons.dropdown('hide'), 0); | ||||||
|                 }); |                 }); | ||||||
|         } else { |  | ||||||
|             button = $('<button class="noborder">') |  | ||||||
|                 .addClass("btn btn-sm"); |  | ||||||
|         } |  | ||||||
|         button = button.on('click', opts.action); |  | ||||||
|  |  | ||||||
|             if (opts.icon) { |             if (opts.icon) { | ||||||
|                 button.append($("<span>").addClass("bx bx-" + opts.icon)) |                 button.append($("<span>").addClass("bx bx-" + opts.icon)) | ||||||
| @@ -124,6 +119,15 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|             } |             } | ||||||
|  |  | ||||||
|             button.append($("<span>").text(opts.title)); |             button.append($("<span>").text(opts.title)); | ||||||
|  |         } else { | ||||||
|  |             button = $('<span class="button-widget icon-action bx" data-toggle="tooltip" title="" data-placement="right"></span>') | ||||||
|  |                 .addClass("bx bx-" + opts.icon); | ||||||
|  |  | ||||||
|  |             button.attr("title", opts.title); | ||||||
|  |             button.tooltip({html: true}); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         button = button.on('click', opts.action); | ||||||
|  |  | ||||||
|         button.attr('id', buttonId); |         button.attr('id', buttonId); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,14 +3,18 @@ import BasicWidget from "./basic_widget.js"; | |||||||
| const TPL = `<div class="spacer"></div>`; | const TPL = `<div class="spacer"></div>`; | ||||||
|  |  | ||||||
| export default class SpacerWidget extends BasicWidget { | export default class SpacerWidget extends BasicWidget { | ||||||
|     constructor(growIndex = 1000) { |     constructor(baseSize = 0, growIndex = 1000, shrinkIndex = 1000) { | ||||||
|         super(); |         super(); | ||||||
|  |  | ||||||
|  |         this.baseSize = baseSize; | ||||||
|         this.growIndex = growIndex; |         this.growIndex = growIndex; | ||||||
|  |         this.shrinkIndex = shrinkIndex; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|         this.$widget.css("flex-grow", this.growIndex) |         this.$widget.css("flex-basis", this.baseSize); | ||||||
|  |         this.$widget.css("flex-grow", this.growIndex); | ||||||
|  |         this.$widget.css("flex-shrink", this.shrinkIndex); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user