@@ -17,7 +17,6 @@ import EditOutlined from '@ant-design/icons-vue/EditOutlined';
17
17
import {
18
18
defineComponent ,
19
19
VNodeTypes ,
20
- VNode ,
21
20
reactive ,
22
21
ref ,
23
22
onMounted ,
@@ -170,14 +169,6 @@ const Base = defineComponent<InternalBlockProps>({
170
169
}
171
170
} ) ;
172
171
173
- function saveTypographyRef ( node : VNode ) {
174
- contentRef . value = node ;
175
- }
176
-
177
- function saveEditIconRef ( node : VNode ) {
178
- editIcon . value = node ;
179
- }
180
-
181
172
function getChildrenText ( ) : string {
182
173
return props . ellipsis || props . editable ? props . content : contentRef . value ?. $el ?. innerText ;
183
174
}
@@ -208,6 +199,7 @@ const Base = defineComponent<InternalBlockProps>({
208
199
}
209
200
210
201
function onEditCancel ( ) {
202
+ editable . value . onCancel ?.( ) ;
211
203
triggerEdit ( false ) ;
212
204
}
213
205
@@ -375,7 +367,7 @@ const Base = defineComponent<InternalBlockProps>({
375
367
return (
376
368
< Tooltip key = "edit" title = { tooltip === false ? '' : title } >
377
369
< TransButton
378
- ref = { saveEditIconRef }
370
+ ref = { editIcon }
379
371
class = { `${ prefixCls . value } -edit` }
380
372
onClick = { onEditClick }
381
373
aria-label = { ariaLabel }
@@ -418,7 +410,7 @@ const Base = defineComponent<InternalBlockProps>({
418
410
419
411
function renderEditInput ( ) {
420
412
const { class : className , style } = attrs ;
421
- const { maxlength, autoSize } = editable . value ;
413
+ const { maxlength, autoSize, onEnd } = editable . value ;
422
414
423
415
return (
424
416
< Editable
@@ -432,6 +424,7 @@ const Base = defineComponent<InternalBlockProps>({
432
424
onSave = { onEditChange }
433
425
onChange = { onContentChange }
434
426
onCancel = { onEditCancel }
427
+ onEnd = { onEnd }
435
428
/>
436
429
) ;
437
430
}
@@ -529,13 +522,16 @@ const Base = defineComponent<InternalBlockProps>({
529
522
return (
530
523
< ResizeObserver onResize = { resizeOnNextFrame } disabled = { ! rows } >
531
524
< Typography
532
- ref = { saveTypographyRef }
525
+ ref = { contentRef }
533
526
class = { [
534
- { [ `${ prefixCls . value } -${ type } ` ] : type } ,
535
- { [ `${ prefixCls . value } -disabled` ] : disabled } ,
536
- { [ `${ prefixCls . value } -ellipsis` ] : rows } ,
537
- { [ `${ prefixCls . value } -ellipsis-single-line` ] : cssTextOverflow } ,
538
- { [ `${ prefixCls . value } -ellipsis-multiple-line` ] : cssLineClamp } ,
527
+ {
528
+ [ `${ prefixCls . value } -${ type } ` ] : type ,
529
+ [ `${ prefixCls . value } -disabled` ] : disabled ,
530
+ [ `${ prefixCls . value } -ellipsis` ] : rows ,
531
+ [ `${ prefixCls . value } -single-line` ] : rows === 1 ,
532
+ [ `${ prefixCls . value } -ellipsis-single-line` ] : cssTextOverflow ,
533
+ [ `${ prefixCls . value } -ellipsis-multiple-line` ] : cssLineClamp ,
534
+ } ,
539
535
className ,
540
536
] }
541
537
style = { {
0 commit comments