diff --git a/components/typography/Base.tsx b/components/typography/Base.tsx index f29b6cb2a..0ec617ee2 100644 --- a/components/typography/Base.tsx +++ b/components/typography/Base.tsx @@ -17,7 +17,6 @@ import EditOutlined from '@ant-design/icons-vue/EditOutlined'; import { defineComponent, VNodeTypes, - VNode, reactive, ref, onMounted, @@ -170,14 +169,6 @@ const Base = defineComponent({ } }); - function saveTypographyRef(node: VNode) { - contentRef.value = node; - } - - function saveEditIconRef(node: VNode) { - editIcon.value = node; - } - function getChildrenText(): string { return props.ellipsis || props.editable ? props.content : contentRef.value?.$el?.innerText; } @@ -208,6 +199,7 @@ const Base = defineComponent({ } function onEditCancel() { + editable.value.onCancel?.(); triggerEdit(false); } @@ -375,7 +367,7 @@ const Base = defineComponent({ return ( ({ function renderEditInput() { const { class: className, style } = attrs; - const { maxlength, autoSize } = editable.value; + const { maxlength, autoSize, onEnd } = editable.value; return ( ({ onSave={onEditChange} onChange={onContentChange} onCancel={onEditCancel} + onEnd={onEnd} /> ); } @@ -529,13 +522,16 @@ const Base = defineComponent({ return (