mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master'
This commit is contained in:
		
						commit
						76aa7d1451
					
				| @ -34,9 +34,7 @@ class AppContext extends Component { | |||||||
| 
 | 
 | ||||||
|         this.tabManager.loadTabs(); |         this.tabManager.loadTabs(); | ||||||
| 
 | 
 | ||||||
|         if (utils.isDesktop()) { |         setTimeout(() => bundleService.executeStartupBundles(), 2000); | ||||||
|             setTimeout(() => bundleService.executeStartupBundles(), 2000); |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     showWidgets() { |     showWidgets() { | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ import ScriptContext from "./script_context.js"; | |||||||
| import server from "./server.js"; | import server from "./server.js"; | ||||||
| import toastService from "./toast.js"; | import toastService from "./toast.js"; | ||||||
| import treeCache from "./tree_cache.js"; | import treeCache from "./tree_cache.js"; | ||||||
|  | import utils from "./utils.js"; | ||||||
| 
 | 
 | ||||||
| async function getAndExecuteBundle(noteId, originEntity = null) { | async function getAndExecuteBundle(noteId, originEntity = null) { | ||||||
|     const bundle = await server.get('script/bundle/' + noteId); |     const bundle = await server.get('script/bundle/' + noteId); | ||||||
| @ -25,7 +26,8 @@ async function executeBundle(bundle, originEntity, $container) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| async function executeStartupBundles() { | async function executeStartupBundles() { | ||||||
|     const scriptBundles = await server.get("script/startup"); |     const isMobile = utils.isMobile(); | ||||||
|  |     const scriptBundles = await server.get("script/startup" + (isMobile ? "?mobile=true" : "")); | ||||||
| 
 | 
 | ||||||
|     for (const bundle of scriptBundles) { |     for (const bundle of scriptBundles) { | ||||||
|         await executeBundle(bundle); |         await executeBundle(bundle); | ||||||
|  | |||||||
| @ -104,9 +104,18 @@ function FrontendScriptApi(startNote, currentNote, originEntity = null, $contain | |||||||
|     this.addButtonToToolbar = opts => { |     this.addButtonToToolbar = opts => { | ||||||
|         const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-"); |         const buttonId = "toolbar-button-" + opts.title.replace(/\s/g, "-"); | ||||||
| 
 | 
 | ||||||
|         const button = $('<button class="noborder">') |         let button; | ||||||
|             .addClass("btn btn-sm") |         if (utils.isMobile()) { | ||||||
|             .on('click', opts.action); |             $('#plugin-buttons-placeholder').remove(); | ||||||
|  |             button = $('<a class="dropdown-item" href="#">') | ||||||
|  |                 .on('click', () => { | ||||||
|  |                     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)) | ||||||
|  | |||||||
| @ -13,6 +13,11 @@ const WIDGET_TPL = ` | |||||||
|         top: 8px; |         top: 8px; | ||||||
|         width: 100%; |         width: 100%; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     #plugin-buttons-placeholder { | ||||||
|  |         font-size: smaller; | ||||||
|  |         padding: 5px; | ||||||
|  |     } | ||||||
|     </style> |     </style> | ||||||
| 
 | 
 | ||||||
|     <a data-trigger-command="createNoteIntoInbox" title="New note" class="icon-action bx bx-folder-plus"></a> |     <a data-trigger-command="createNoteIntoInbox" title="New note" class="icon-action bx bx-folder-plus"></a> | ||||||
| @ -21,6 +26,14 @@ const WIDGET_TPL = ` | |||||||
| 
 | 
 | ||||||
|     <a data-trigger-command="scrollToActiveNote" title="Scroll to active note" class="icon-action bx bx-crosshair"></a> |     <a data-trigger-command="scrollToActiveNote" title="Scroll to active note" class="icon-action bx bx-crosshair"></a> | ||||||
| 
 | 
 | ||||||
|  |     <div class="dropdown"> | ||||||
|  |         <a title="Plugin buttons" class="icon-action bx bx-extension dropdown-toggle" data-toggle="dropdown"></a> | ||||||
|  | 
 | ||||||
|  |         <div id="plugin-buttons" class="dropdown-menu dropdown-menu-right"> | ||||||
|  |             <p id="plugin-buttons-placeholder">No plugin buttons loaded yet.</p> | ||||||
|  |         </div> | ||||||
|  |     </div>  | ||||||
|  | 
 | ||||||
|     <div class="dropdown"> |     <div class="dropdown"> | ||||||
|         <a title="Global actions" class="icon-action bx bx-cog dropdown-toggle" data-toggle="dropdown"></a> |         <a title="Global actions" class="icon-action bx bx-cog dropdown-toggle" data-toggle="dropdown"></a> | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -53,9 +53,14 @@ function getBundlesWithLabel(label, value) { | |||||||
|     return bundles; |     return bundles; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getStartupBundles() { | function getStartupBundles(req) { | ||||||
|     if (!process.env.TRILIUM_SAFE_MODE) { |     if (!process.env.TRILIUM_SAFE_MODE) { | ||||||
|         return getBundlesWithLabel("run", "frontendStartup"); |         if (req.query.mobile === "true") { | ||||||
|  |             return getBundlesWithLabel("run", "mobileStartup"); | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             return getBundlesWithLabel("run", "frontendStartup"); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         return []; |         return []; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam