mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-12 09:17:27 +02:00
apply the save shortcut only for the top open modal
This commit is contained in:
1 parent
aa7be1edd1
commit
f58a65e4be
12 files changed
+38
-16
No files matched your search
@@ -421,7 +421,11 @@ function recordUpsertModal(collection, rawRecord, modalSettings) {
|
||||
inert: () => data.isLoading || data.isSaving,
|
||||
onmount: (el) => {
|
||||
el._quickSaveHandler = (e) => {
|
||||
if ((e.ctrlKey || e.metaKey) && e.code == "KeyS") {
|
||||
if (
|
||||
(e.ctrlKey || e.metaKey)
|
||||
&& e.code == "KeyS"
|
||||
&& app.modals.getTop() === el?.closest(".modal")
|
||||
) {
|
||||
e.preventDefault();
|
||||
save(false);
|
||||
}
|
||||
@@ -430,7 +434,7 @@ function recordUpsertModal(collection, rawRecord, modalSettings) {
|
||||
},
|
||||
onunmount: (el) => {
|
||||
if (el?._quickSaveHandler) {
|
||||
window.removeEventListener("keydown", el?._quickSaveHandler);
|
||||
window.removeEventListener("keydown", el._quickSaveHandler);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user