mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 21:11:30 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/stable'
This commit is contained in:
		
						commit
						ac4e6077bd
					
				
							
								
								
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										6
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -3345,9 +3345,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "electron": { |     "electron": { | ||||||
|       "version": "9.0.0-beta.22", |       "version": "9.0.0-beta.24", | ||||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.22.tgz", |       "resolved": "https://registry.npmjs.org/electron/-/electron-9.0.0-beta.24.tgz", | ||||||
|       "integrity": "sha512-dfqAf+CXXTKcNDj7DU7mYsmx+oZQcXOvJnZ8ZsgAHjrE9Tv8zsYUgCP3JlO4Z8CIazgleKXYmgh6H2stdK7fEA==", |       "integrity": "sha512-25L3XMqm/1CCaV5CgU5ZkhKXw9830WeipJrTW0+VC5XTKp/3xHwhxyQ5G1kQnOTJd7IGwOamvw237D6e1YKnng==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "requires": { |       "requires": { | ||||||
|         "@electron/get": "^1.0.1", |         "@electron/get": "^1.0.1", | ||||||
|  | |||||||
| @ -78,7 +78,7 @@ | |||||||
|     "yazl": "^2.5.1" |     "yazl": "^2.5.1" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "electron": "9.0.0-beta.22", |     "electron": "9.0.0-beta.24", | ||||||
|     "electron-builder": "22.6.0", |     "electron-builder": "22.6.0", | ||||||
|     "electron-packager": "14.2.1", |     "electron-packager": "14.2.1", | ||||||
|     "electron-rebuild": "1.10.1", |     "electron-rebuild": "1.10.1", | ||||||
|  | |||||||
| @ -8,6 +8,7 @@ import contextMenu from "./services/context_menu.js"; | |||||||
| import DesktopMainWindowLayout from "./layouts/desktop_main_window_layout.js"; | import DesktopMainWindowLayout from "./layouts/desktop_main_window_layout.js"; | ||||||
| import glob from "./services/glob.js"; | import glob from "./services/glob.js"; | ||||||
| import DesktopExtraWindowLayout from "./layouts/desktop_extra_window_layout.js"; | import DesktopExtraWindowLayout from "./layouts/desktop_extra_window_layout.js"; | ||||||
|  | import zoomService from './services/zoom.js'; | ||||||
| 
 | 
 | ||||||
| glob.setupGlobs(); | glob.setupGlobs(); | ||||||
| 
 | 
 | ||||||
| @ -133,9 +134,11 @@ if (utils.isElectron()) { | |||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         const zoomLevel = zoomService.getCurrentZoom(); | ||||||
|  | 
 | ||||||
|         contextMenu.show({ |         contextMenu.show({ | ||||||
|             x: params.x, |             x: params.x / zoomLevel, | ||||||
|             y: params.y, |             y: params.y / zoomLevel, | ||||||
|             items, |             items, | ||||||
|             selectMenuItemHandler: ({command, spellingSuggestion}) => { |             selectMenuItemHandler: ({command, spellingSuggestion}) => { | ||||||
|                 if (command === 'replaceMisspelling') { |                 if (command === 'replaceMisspelling') { | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ import DialogCommandExecutor from "./dialog_command_executor.js"; | |||||||
| import Entrypoints from "./entrypoints.js"; | import Entrypoints from "./entrypoints.js"; | ||||||
| import options from "./options.js"; | import options from "./options.js"; | ||||||
| import utils from "./utils.js"; | import utils from "./utils.js"; | ||||||
| import ZoomService from "./zoom.js"; | import zoomService from "./zoom.js"; | ||||||
| import TabManager from "./tab_manager.js"; | import TabManager from "./tab_manager.js"; | ||||||
| import treeService from "./tree.js"; | import treeService from "./tree.js"; | ||||||
| import Component from "../widgets/component.js"; | import Component from "../widgets/component.js"; | ||||||
| @ -73,7 +73,7 @@ class AppContext extends Component { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (utils.isElectron()) { |         if (utils.isElectron()) { | ||||||
|             this.child(new ZoomService()); |             this.child(zoomService); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.triggerEvent('initialRenderComplete'); |         this.triggerEvent('initialRenderComplete'); | ||||||
|  | |||||||
| @ -81,24 +81,29 @@ function goToLink(e) { | |||||||
|         } |         } | ||||||
|         else if (e.which === 1) { |         else if (e.which === 1) { | ||||||
|             const activeTabContext = appContext.tabManager.getActiveTabContext(); |             const activeTabContext = appContext.tabManager.getActiveTabContext(); | ||||||
|             activeTabContext.setNote(notePath) |             activeTabContext.setNote(notePath); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         const address = $link.attr('href'); |         if (e.which === 1) { | ||||||
|  |             const address = $link.attr('href'); | ||||||
| 
 | 
 | ||||||
|         if (address && address.startsWith('http')) { |             if (address && address.startsWith('http')) { | ||||||
|             window.open(address, '_blank'); |                 window.open(address, '_blank'); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         else { | ||||||
|  |             return false; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function newTabContextMenu(e) { | function linkContextMenu(e) { | ||||||
|     const $link = $(e.target).closest("a"); |     const $link = $(e.target).closest("a"); | ||||||
| 
 | 
 | ||||||
|     const notePath = getNotePathFromLink($link); |     const notePath = getNotePathFromLink($link); | ||||||
| @ -113,7 +118,7 @@ function newTabContextMenu(e) { | |||||||
|         x: e.pageX, |         x: e.pageX, | ||||||
|         y: e.pageY, |         y: e.pageY, | ||||||
|         items: [ |         items: [ | ||||||
|             {title: "Open note in new tab", command: "openNoteInNewTab", uiIcon: "arrow-up-right"}, |             {title: "Open note in new tab", command: "openNoteInNewTab", uiIcon: "empty"}, | ||||||
|             {title: "Open note in new window", command: "openNoteInNewWindow", uiIcon: "window-open"} |             {title: "Open note in new window", command: "openNoteInNewWindow", uiIcon: "window-open"} | ||||||
|         ], |         ], | ||||||
|         selectMenuItemHandler: ({command}) => { |         selectMenuItemHandler: ({command}) => { | ||||||
| @ -155,18 +160,20 @@ $(document).on('mousedown', '.note-detail-text a', function (e) { | |||||||
| 
 | 
 | ||||||
| $(document).on('mousedown', '.note-detail-book a', goToLink); | $(document).on('mousedown', '.note-detail-book a', goToLink); | ||||||
| $(document).on('mousedown', '.note-detail-render a', goToLink); | $(document).on('mousedown', '.note-detail-render a', goToLink); | ||||||
| $(document).on('mousedown', '.note-detail-text.ck-read-only a,.note-detail-text a.reference-link', goToLink); | $(document).on('mousedown', '.note-detail-text a.reference-link', goToLink); | ||||||
|  | $(document).on('mousedown', '.note-detail-readonly-text a', goToLink); | ||||||
| $(document).on('mousedown', 'a.ck-link-actions__preview', goToLink); | $(document).on('mousedown', 'a.ck-link-actions__preview', goToLink); | ||||||
| $(document).on('click', 'a.ck-link-actions__preview', e => { | $(document).on('click', 'a.ck-link-actions__preview', e => { | ||||||
|     e.preventDefault(); |     e.preventDefault(); | ||||||
|     e.stopPropagation(); |     e.stopPropagation(); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| $(document).on('contextmenu', 'a.ck-link-actions__preview', newTabContextMenu); | $(document).on('contextmenu', 'a.ck-link-actions__preview', linkContextMenu); | ||||||
| $(document).on('contextmenu', '.note-detail-text a', newTabContextMenu); | $(document).on('contextmenu', '.note-detail-text a', linkContextMenu); | ||||||
| $(document).on('contextmenu', "a[data-action='note']", newTabContextMenu); | $(document).on('contextmenu', '.note-detail-readonly-text a', linkContextMenu); | ||||||
| $(document).on('contextmenu', ".note-detail-render a", newTabContextMenu); | $(document).on('contextmenu', "a[data-action='note']", linkContextMenu); | ||||||
| $(document).on('contextmenu', ".note-paths-widget a", newTabContextMenu); | $(document).on('contextmenu', ".note-detail-render a", linkContextMenu); | ||||||
|  | $(document).on('contextmenu', ".note-paths-widget a", linkContextMenu); | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|     getNotePathFromUrl, |     getNotePathFromUrl, | ||||||
|  | |||||||
| @ -170,7 +170,7 @@ function connectWebSocket() { | |||||||
| 
 | 
 | ||||||
| async function sendPing() { | async function sendPing() { | ||||||
|     if (Date.now() - lastPingTs > 30000) { |     if (Date.now() - lastPingTs > 30000) { | ||||||
|         console.log(utils.now(), "Lost websocket connection to the backend"); |         console.log(utils.now(), "Lost websocket connection to the backend. If you keep having this issue repeatedly, you might want to check your reverse proxy (nginx, apache) configuration and allow/unblock WebSocket."); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (ws.readyState === ws.OPEN) { |     if (ws.readyState === ws.OPEN) { | ||||||
|  | |||||||
| @ -5,11 +5,13 @@ import utils from "../services/utils.js"; | |||||||
| const MIN_ZOOM = 0.5; | const MIN_ZOOM = 0.5; | ||||||
| const MAX_ZOOM = 2.0; | const MAX_ZOOM = 2.0; | ||||||
| 
 | 
 | ||||||
| export default class ZoomService extends Component { | class ZoomService extends Component { | ||||||
|     constructor() { |     constructor() { | ||||||
|         super(); |         super(); | ||||||
| 
 | 
 | ||||||
|         this.setZoomFactor(options.getFloat('zoomFactor')); |         options.initializedPromise.then(() => { | ||||||
|  |             this.setZoomFactor(options.getFloat('zoomFactor')); | ||||||
|  |         }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     setZoomFactor(zoomFactor) { |     setZoomFactor(zoomFactor) { | ||||||
| @ -46,3 +48,7 @@ export default class ZoomService extends Component { | |||||||
|         this.setZoomFactorAndSave(zoomFactor); |         this.setZoomFactorAndSave(zoomFactor); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | const zoomService = new ZoomService(); | ||||||
|  | 
 | ||||||
|  | export default zoomService; | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ | |||||||
|     <link rel="shortcut icon" href="favicon.ico"> |     <link rel="shortcut icon" href="favicon.ico"> | ||||||
|     <title>Trilium Notes</title> |     <title>Trilium Notes</title> | ||||||
| </head> | </head> | ||||||
| <body class="desktop theme-<%= theme %>" style="display: none; --main-font-size: <%= mainFontSize %>%; --tree-font-size: <%= treeFontSize %>%; --detail-font-size: <%= detailFontSize %>%;"> | <body class="desktop theme-<%= theme %>" style="--main-font-size: <%= mainFontSize %>%; --tree-font-size: <%= treeFontSize %>%; --detail-font-size: <%= detailFontSize %>%;"> | ||||||
| <noscript>Trilium requires JavaScript to be enabled.</noscript> | <noscript>Trilium requires JavaScript to be enabled.</noscript> | ||||||
| 
 | 
 | ||||||
| <div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div> | <div id="toast-container" class="d-flex flex-column justify-content-center align-items-center"></div> | ||||||
| @ -82,9 +82,5 @@ | |||||||
| 
 | 
 | ||||||
| <link rel="stylesheet" type="text/css" href="libraries/boxicons/css/boxicons.min.css"> | <link rel="stylesheet" type="text/css" href="libraries/boxicons/css/boxicons.min.css"> | ||||||
| 
 | 
 | ||||||
| <script> |  | ||||||
|     $("body").show(); |  | ||||||
| </script> |  | ||||||
| 
 |  | ||||||
| </body> | </body> | ||||||
| </html> | </html> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam