diff --git a/frontend/public/lsf/lsf.html b/frontend/public/lsf/lsf.html
index 101ad8c..d265b29 100644
--- a/frontend/public/lsf/lsf.html
+++ b/frontend/public/lsf/lsf.html
@@ -226,6 +226,29 @@
};
}
+ function isSaveAndNextShortcut(event) {
+ if (!event || event.defaultPrevented || event.isComposing) return false;
+ const key = event.key;
+ const code = event.code;
+ const isEnter = key === "Enter" || code === "Enter" || code === "NumpadEnter";
+ if (!isEnter) return false;
+ if (!(event.ctrlKey || event.metaKey)) return false;
+ if (event.shiftKey || event.altKey) return false;
+ return true;
+ }
+
+ function handleSaveAndNextShortcut(event) {
+ if (!isSaveAndNextShortcut(event) || event.repeat) return;
+ event.preventDefault();
+ event.stopPropagation();
+ try {
+ const raw = exportSelectedAnnotation();
+ postToParent("LS_SAVE_AND_NEXT", raw);
+ } catch (e) {
+ postToParent("LS_ERROR", { message: e?.message || String(e) });
+ }
+ }
+
function initLabelStudio(payload) {
if (!window.LabelStudio) {
throw new Error("LabelStudio 未加载(请检查静态资源/网络)");
@@ -296,6 +319,8 @@
});
}
+ window.addEventListener("keydown", handleSaveAndNextShortcut);
+
window.addEventListener("message", (event) => {
if (event.origin !== ORIGIN) return;
diff --git a/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx b/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx
index a03a3c2..c92f125 100644
--- a/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx
+++ b/frontend/src/pages/DataAnnotation/Annotate/LabelStudioTextEditor.tsx
@@ -865,6 +865,12 @@ export default function LabelStudioTextEditor() {
return;
}
+ if (msg.type === "LS_SAVE_AND_NEXT") {
+ pendingAutoAdvanceRef.current = false;
+ saveFromExport(payload, { autoAdvance: true });
+ return;
+ }
+
if (msg.type === "LS_EXPORT_CHECK_RESULT") {
const pending = exportCheckRef.current;
if (!pending) return;