You've already forked DataMate
feat(annotation): 添加保存并跳转到下一段功能
- 新增 SAVE_AND_NEXT_LABEL 常量用于保存并跳转按钮文本 - 添加 saveDisabled 状态控制保存按钮禁用逻辑 - 修改顶部工具栏布局为三列网格结构 - 在工具栏中间位置添加保存并跳转到下一段/下一条按钮 - 调整保存按钮样式移除主色调设置 - 优化保存按钮禁用状态逻辑统一管理 - 修改保存功能区分普通保存和跳转保存操作
This commit is contained in:
@@ -102,6 +102,7 @@ const NO_ANNOTATION_CONFIRM_TITLE = "没有标注任何内容";
|
|||||||
const NO_ANNOTATION_CONFIRM_OK_TEXT = "设为无标注并保存";
|
const NO_ANNOTATION_CONFIRM_OK_TEXT = "设为无标注并保存";
|
||||||
const NOT_APPLICABLE_CONFIRM_TEXT = "设为不适用并保存";
|
const NOT_APPLICABLE_CONFIRM_TEXT = "设为不适用并保存";
|
||||||
const NO_ANNOTATION_CONFIRM_CANCEL_TEXT = "继续标注";
|
const NO_ANNOTATION_CONFIRM_CANCEL_TEXT = "继续标注";
|
||||||
|
const SAVE_AND_NEXT_LABEL = "保存并跳转到下一段/下一条";
|
||||||
|
|
||||||
type NormalizedTaskList = {
|
type NormalizedTaskList = {
|
||||||
items: EditorTaskListItem[];
|
items: EditorTaskListItem[];
|
||||||
@@ -1146,6 +1147,8 @@ export default function LabelStudioTextEditor() {
|
|||||||
}, [message, origin, saveFromExport]);
|
}, [message, origin, saveFromExport]);
|
||||||
|
|
||||||
const canLoadMore = taskTotalPages > 0 && taskPage + 1 < taskTotalPages;
|
const canLoadMore = taskTotalPages > 0 && taskPage + 1 < taskTotalPages;
|
||||||
|
const saveDisabled =
|
||||||
|
!iframeReady || !selectedFileId || saving || segmentSwitching || loadingTaskDetail;
|
||||||
const loadMoreNode = canLoadMore ? (
|
const loadMoreNode = canLoadMore ? (
|
||||||
<div className="p-2 text-center">
|
<div className="p-2 text-center">
|
||||||
<Button
|
<Button
|
||||||
@@ -1209,7 +1212,7 @@ export default function LabelStudioTextEditor() {
|
|||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
{/* 顶部工具栏 */}
|
{/* 顶部工具栏 */}
|
||||||
<div className="flex items-center justify-between px-3 py-2 border-b border-gray-200 bg-white">
|
<div className="grid grid-cols-[1fr_auto_1fr] items-center px-3 py-2 border-b border-gray-200 bg-white">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Button icon={<LeftOutlined />} onClick={() => navigate("/data/annotation")}>
|
<Button icon={<LeftOutlined />} onClick={() => navigate("/data/annotation")}>
|
||||||
返回
|
返回
|
||||||
@@ -1223,7 +1226,18 @@ export default function LabelStudioTextEditor() {
|
|||||||
标注编辑器
|
标注编辑器
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center justify-center">
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
icon={<SaveOutlined />}
|
||||||
|
loading={saving}
|
||||||
|
disabled={saveDisabled}
|
||||||
|
onClick={() => requestExport(true)}
|
||||||
|
>
|
||||||
|
{SAVE_AND_NEXT_LABEL}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 justify-end">
|
||||||
<Button
|
<Button
|
||||||
icon={<ReloadOutlined />}
|
icon={<ReloadOutlined />}
|
||||||
loading={loadingTasks}
|
loading={loadingTasks}
|
||||||
@@ -1232,11 +1246,10 @@ export default function LabelStudioTextEditor() {
|
|||||||
刷新
|
刷新
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
|
||||||
icon={<SaveOutlined />}
|
icon={<SaveOutlined />}
|
||||||
loading={saving}
|
loading={saving}
|
||||||
disabled={!iframeReady || !selectedFileId}
|
disabled={saveDisabled}
|
||||||
onClick={() => requestExport(true)}
|
onClick={() => requestExport(false)}
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user