Skip to content

Typography editable on cancel event #29371

Closed
@tqwewe

Description

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Typography editable has two events: onStart, onChange, but in my situation, I need an onCancel/onEnd event too.

This is so I can keep track of whether the element is being edited or not.
In my specific use case, I am replacing \n with <br /> only when the text is not being edited. And when it is being edited, I will not replace the \n characters.

What does the proposed API look like?

An example of editable paragraph:

<Typography.Paragraph
  editable={{
    onStart={() => setIsEditing(true)}
    onEnd={() => setIsEditing(false)} // <- This is the new prop
    onChange={() => setIsEditing(false)}
  }}
>

With onEnd property will fire when the user ends the editing of the field. It could also be onCancel which would only fire when they cancel editing.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions