diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index 03665a6f1d..b37b6d9508 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -49,6 +49,7 @@ export interface EditConfig { tooltip?: boolean; onStart?: () => void; onChange?: (value: string) => void; + onSave?: (value: string) => void; onCancel?: () => void; onEnd?: () => void; maxlength?: number; @@ -219,6 +220,11 @@ const Base = defineComponent({ } function onEditChange(value: string) { + const { onSave } = editable.value; + if (value !== props.content) { + emit('save', value); + onSave?.(value); + } onContentChange(value); triggerEdit(false); } diff --git a/components/typography/demo/interactive.vue b/components/typography/demo/interactive.vue index 50c8f84f35..1b5c735d5a 100644 --- a/components/typography/demo/interactive.vue +++ b/components/typography/demo/interactive.vue @@ -15,7 +15,7 @@ title: Provide additional interactive capacity of editable and copyable.