refactor: 抽取共享 getFullFormValues 表单读取工具
This commit is contained in:
1 parent
29116678aa
commit
aa2b6f35b0
7 files changed
+20
-8
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
} from "../../lib/presentation/presentation-bindings.js";
|
||||
import { fieldTargetTitle } from "./presentation-editor-helpers.js";
|
||||
import type { PreviewTarget } from "./preview-selection.js";
|
||||
import { getFullFormValues } from "../../lib/form-values.js";
|
||||
|
||||
interface PresentationFormPanelProps {
|
||||
form: FormInstance<PresentationValues>;
|
||||
@@ -44,7 +45,7 @@ export function PresentationFormPanel({
|
||||
layout="vertical"
|
||||
initialValues={initialValues}
|
||||
onValuesChange={onValuesChange}
|
||||
onFinish={() => save.mutate(form.getFieldsValue(true) as PresentationValues)}
|
||||
onFinish={() => save.mutate(getFullFormValues<PresentationValues>(form))}
|
||||
className="presentation-editor__form"
|
||||
>
|
||||
<div className="presentation-editor__form-body">
|
||||
|
||||
@@ -11,6 +11,7 @@ import type {
|
||||
TrustContent,
|
||||
} from "@personal-brand/api-client";
|
||||
import { createApiClient } from "../../lib/api.js";
|
||||
import { getFullFormValues } from "../../lib/form-values.js";
|
||||
import {
|
||||
applyBrandPreviewValues,
|
||||
applyPresentationValues,
|
||||
@@ -161,7 +162,7 @@ export function useBrandPreviewDraft({
|
||||
const handleValuesChange = (changed: PresentationValues, allValues: PresentationValues) => {
|
||||
onDirty();
|
||||
const synchronized: PresentationValues = {
|
||||
...(form.getFieldsValue(true) as PresentationValues),
|
||||
...getFullFormValues<PresentationValues>(form),
|
||||
...allValues,
|
||||
};
|
||||
for (const section of sections) {
|
||||
|
||||
Reference in new issue
Block a user