diff --git a/apps/frontend/src/pages/tasks.[id].samples.[id]/index.tsx b/apps/frontend/src/pages/tasks.[id].samples.[id]/index.tsx index 02890a4b1..86ee33519 100644 --- a/apps/frontend/src/pages/tasks.[id].samples.[id]/index.tsx +++ b/apps/frontend/src/pages/tasks.[id].samples.[id]/index.tsx @@ -233,6 +233,13 @@ const AnnotationPage = () => { [config, task], ); + const handleLabelChange = useCallback((label: ILabel) => { + // 缓存当前标签 + localStorage.setItem('annotator::label', label.value); + }, []); + + const selectedLabel = localStorage.getItem('annotator::label'); + if (task?.media_type === MediaType.IMAGE) { content = ( { editingSample={editingSample} config={config} requestEdit={requestEdit} + onLabelChange={handleLabelChange} + selectedLabel={selectedLabel} preAnnotationLabels={preAnnotationConfig} preAnnotations={preAnnotations} /> @@ -259,6 +268,8 @@ const AnnotationPage = () => { toolbarRight={topActionContent} renderSidebar={renderSidebar} requestEdit={requestEdit} + onLabelChange={handleLabelChange} + selectedLabel={selectedLabel} preAnnotationLabels={preAnnotationConfig} preAnnotations={preAnnotations} /> @@ -274,6 +285,8 @@ const AnnotationPage = () => { toolbarRight={topActionContent} renderSidebar={renderSidebar} requestEdit={requestEdit} + onLabelChange={handleLabelChange} + selectedLabel={selectedLabel} preAnnotationLabels={preAnnotationConfig} preAnnotations={preAnnotations} />