mirror of
				https://github.com/lxsang/antos-frontend.git
				synced 2025-10-31 10:26:16 +01:00 
			
		
		
		
	Fix shortcut bug
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								release/antos-1.2.0.tar.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								release/antos-1.2.0.tar.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -252,11 +252,11 @@ namespace OS { | |||||||
|              * |              * | ||||||
|              * @param {string} fnk meta or modifier key e.g. `CTRL`, `ALT`, `SHIFT` or `META` |              * @param {string} fnk meta or modifier key e.g. `CTRL`, `ALT`, `SHIFT` or `META` | ||||||
|              * @param {string} c a regular key |              * @param {string} c a regular key | ||||||
|              * @param {JQuery.KeyboardEventBase} e JQuery keyboard event |              * @param {JQuery.KeyDownEvent} e JQuery keyboard event | ||||||
|              * @returns {boolean} return whether the shortcut is executed |              * @returns {boolean} return whether the shortcut is executed | ||||||
|              * @memberof BaseApplication |              * @memberof BaseApplication | ||||||
|              */ |              */ | ||||||
|             shortcut(fnk: string, c: string, e: JQuery.KeyUpEvent): boolean { |             shortcut(fnk: string, c: string, e: JQuery.KeyDownEvent): boolean { | ||||||
|                 if (!this.keycomb[fnk]) { |                 if (!this.keycomb[fnk]) { | ||||||
|                     return true; |                     return true; | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -63,6 +63,7 @@ namespace OS { | |||||||
|              */ |              */ | ||||||
|             quit(): void { |             quit(): void { | ||||||
|                 const evt = new BaseEvent("exit", false); |                 const evt = new BaseEvent("exit", false); | ||||||
|  |                 this.onexit(evt); | ||||||
|                 if (!evt.prevent) { |                 if (!evt.prevent) { | ||||||
|                     delete this._observable; |                     delete this._observable; | ||||||
|                     if (this.scheme) { |                     if (this.scheme) { | ||||||
| @@ -71,7 +72,6 @@ namespace OS { | |||||||
|                     if (this.dialog) { |                     if (this.dialog) { | ||||||
|                         return this.dialog.quit(); |                         return this.dialog.quit(); | ||||||
|                     } |                     } | ||||||
|                     this.onexit(evt); |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -43,7 +43,7 @@ namespace OS { | |||||||
|              * |              * | ||||||
|              * @memberof ShortcutType |              * @memberof ShortcutType | ||||||
|              */ |              */ | ||||||
|             [propName: string]: GenericObject<(e: JQuery.KeyUpEvent) => void>; |             [propName: string]: GenericObject<(e: JQuery.KeyDownEvent) => void>; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         /** |         /** | ||||||
| @@ -734,13 +734,13 @@ namespace OS { | |||||||
|          * |          * | ||||||
|          * @export |          * @export | ||||||
|          * @param {string} k the hotkey e.g. `ALT-C` |          * @param {string} k the hotkey e.g. `ALT-C` | ||||||
|          * @param {(e: JQuery.MouseDownEvent) => void} f handle function |          * @param {(e: JQuery.KeyPressEvent) => void} f handle function | ||||||
|          * @param {boolean} force force to rebind the hotkey |          * @param {boolean} force force to rebind the hotkey | ||||||
|          * @returns {void} |          * @returns {void} | ||||||
|          */ |          */ | ||||||
|         export function bindKey( |         export function bindKey( | ||||||
|             k: string, |             k: string, | ||||||
|             f: (e: JQuery.KeyUpEvent) => void, |             f: (e: JQuery.KeyDownEvent) => void, | ||||||
|             force: boolean = true |             force: boolean = true | ||||||
|         ): void { |         ): void { | ||||||
|             const arr = k.toUpperCase().split("-"); |             const arr = k.toUpperCase().split("-"); | ||||||
| @@ -815,7 +815,6 @@ namespace OS { | |||||||
|             if (arr.length > 1) { |             if (arr.length > 1) { | ||||||
|                 tip = arr[1]; |                 tip = arr[1]; | ||||||
|             } |             } | ||||||
|             console.log(el); |  | ||||||
|             const offset = $(el).offset(); |             const offset = $(el).offset(); | ||||||
|             const w = $(el).width(); |             const w = $(el).width(); | ||||||
|             const h = $(el).height(); |             const h = $(el).height(); | ||||||
| @@ -903,7 +902,7 @@ namespace OS { | |||||||
|             $("#wrapper").append(scheme); |             $("#wrapper").append(scheme); | ||||||
|  |  | ||||||
|             announcer.observable.one("sysdockloaded", () => { |             announcer.observable.one("sysdockloaded", () => { | ||||||
|                 $(window).on("keyup", function (event) { |                 $(window).on("keydown", function (event) { | ||||||
|                     const dock = $("#sysdock")[0] as tag.AppDockTag; |                     const dock = $("#sysdock")[0] as tag.AppDockTag; | ||||||
|                     if (!dock) { |                     if (!dock) { | ||||||
|                         return; |                         return; | ||||||
| @@ -924,7 +923,7 @@ namespace OS { | |||||||
|                     if (event.shiftKey) { |                     if (event.shiftKey) { | ||||||
|                         fnk += "SHIFT"; |                         fnk += "SHIFT"; | ||||||
|                     } |                     } | ||||||
|  |                     console.log(fnk, c); | ||||||
|                     if (fnk == "") { |                     if (fnk == "") { | ||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|   | |||||||
| @@ -325,7 +325,13 @@ namespace OS { | |||||||
|                 { |                 { | ||||||
|                     if(!setting.system.startup.pinned) |                     if(!setting.system.startup.pinned) | ||||||
|                             return; |                             return; | ||||||
|                     (this.refs.pinned as GUI.tag.MenuTag).items = setting.system.startup.pinned.map((name) => { |                     (this.refs.pinned as GUI.tag.MenuTag).items =  | ||||||
|  |                     setting.system.startup.pinned | ||||||
|  |                         .filter((el) =>{ | ||||||
|  |                             const app = setting.system.packages[el]; | ||||||
|  |                             return app && app.app | ||||||
|  |                         }) | ||||||
|  |                         .map((name) => { | ||||||
|                             const app = setting.system.packages[name]; |                             const app = setting.system.packages[name]; | ||||||
|                             return {  |                             return {  | ||||||
|                                 icon: app.icon, |                                 icon: app.icon, | ||||||
|   | |||||||
| @@ -361,7 +361,7 @@ namespace OS { | |||||||
|  |  | ||||||
|                 this.bindKey("ALT-N", () => this.menuAction("new")); |                 this.bindKey("ALT-N", () => this.menuAction("new")); | ||||||
|                 this.bindKey("ALT-O", () => this.menuAction("open")); |                 this.bindKey("ALT-O", () => this.menuAction("open")); | ||||||
|                 this.bindKey("CTRL-ALT-F", () => this.menuAction("opendir")); |                 this.bindKey("ALT-F", () => this.menuAction("opendir")); | ||||||
|                 this.bindKey("CTRL-S", () => this.menuAction("save")); |                 this.bindKey("CTRL-S", () => this.menuAction("save")); | ||||||
|                 this.bindKey("ALT-W", () => this.menuAction("saveas")); |                 this.bindKey("ALT-W", () => this.menuAction("saveas")); | ||||||
|  |  | ||||||
| @@ -792,7 +792,7 @@ namespace OS { | |||||||
|                         { |                         { | ||||||
|                             text: __("Open Folder"), |                             text: __("Open Folder"), | ||||||
|                             dataid: "opendir", |                             dataid: "opendir", | ||||||
|                             shortcut: "C-A-F", |                             shortcut: "A-F", | ||||||
|                         }, |                         }, | ||||||
|                         { text: __("Save"), dataid: "save", shortcut: "C-S" }, |                         { text: __("Save"), dataid: "save", shortcut: "C-S" }, | ||||||
|                         { |                         { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user