fixed ctrl+s not getting triggered in the editor field
This commit is contained in:
@@ -101,6 +101,25 @@
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
function replaceOriginal(newOriginal) {
|
||||
original = newOriginal || new Record();
|
||||
uploadedFilesMap = {};
|
||||
deletedFileIndexesMap = {};
|
||||
|
||||
// to avoid layout shifts we replace only the file and non-schema fields
|
||||
const skipFields = collection?.schema?.filter((f) => f.type != "file")?.map((f) => f.name) || [];
|
||||
for (let k in newOriginal.$export()) {
|
||||
if (skipFields.includes(k)) {
|
||||
continue;
|
||||
}
|
||||
record[k] = newOriginal[k];
|
||||
}
|
||||
|
||||
originalSerializedData = JSON.stringify(record);
|
||||
|
||||
deleteDraft();
|
||||
}
|
||||
|
||||
function draftKey() {
|
||||
return "record_draft_" + (collection?.id || "") + "_" + (original?.id || "");
|
||||
}
|
||||
@@ -170,13 +189,16 @@
|
||||
request
|
||||
.then((result) => {
|
||||
addSuccessToast(isNew ? "Successfully created record." : "Successfully updated record.");
|
||||
|
||||
deleteDraft();
|
||||
|
||||
if (hidePanel) {
|
||||
confirmClose = false;
|
||||
hide();
|
||||
} else {
|
||||
show(result);
|
||||
replaceOriginal(result);
|
||||
}
|
||||
|
||||
dispatch("save", result);
|
||||
})
|
||||
.catch((err) => {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import { pageTitle } from "@/stores/app";
|
||||
import { addSuccessToast } from "@/stores/toasts";
|
||||
import PageWrapper from "@/components/base/PageWrapper.svelte";
|
||||
import Field from "@/components/base/Field.svelte";
|
||||
import SettingsSidebar from "@/components/settings/SettingsSidebar.svelte";
|
||||
import TokenField from "@/components/settings/TokenField.svelte";
|
||||
|
||||
@@ -13,13 +12,13 @@
|
||||
{ key: "recordVerificationToken", label: "Auth record email verification token" },
|
||||
{ key: "recordPasswordResetToken", label: "Auth record password reset token" },
|
||||
{ key: "recordEmailChangeToken", label: "Auth record email change token" },
|
||||
{ key: "recordFileToken", label: "Records private file access token" },
|
||||
{ key: "recordFileToken", label: "Records protected file access token" },
|
||||
];
|
||||
|
||||
const adminTokensList = [
|
||||
{ key: "adminAuthToken", label: "Admins auth token" },
|
||||
{ key: "adminPasswordResetToken", label: "Admins password reset token" },
|
||||
{ key: "adminFileToken", label: "Admins private file access token" },
|
||||
{ key: "adminFileToken", label: "Admins protected file access token" },
|
||||
];
|
||||
|
||||
$pageTitle = "Token options";
|
||||
|
||||
@@ -1324,6 +1324,16 @@ export default class CommonHelper {
|
||||
|
||||
input.click();
|
||||
},
|
||||
setup: (editor) => {
|
||||
editor.on('keydown', (e) => {
|
||||
// propagate save shortcut to the parent
|
||||
if (e.ctrlKey && e.code == "KeyS" && editor.formElement) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
editor.formElement.dispatchEvent(new KeyboardEvent("keydown", e));
|
||||
}
|
||||
})
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user