Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text transformation: Allow reverting by pressing backspace #10413

Closed
Reinmar opened this issue Aug 25, 2021 · 5 comments · Fixed by #10499
Closed

Text transformation: Allow reverting by pressing backspace #10413

Reinmar opened this issue Aug 25, 2021 · 5 comments · Fixed by #10499
Assignees
Labels
package:typing squad:core Issue to be handled by the Core team. type:improvement This issue reports a possible enhancement of an existing feature.

Comments

@Reinmar
Copy link
Member

Reinmar commented Aug 25, 2021

📝 Provide a description of the improvement

Currently, we allow reverting an automatic transformation result by pressing undo. It's a separate undo step.

However, it's common among other editors to also allow reverting text transformation by pressing backspace immediately after transformation happened.

It works this way in GDocs and Word:

  1. Type "1/2"
  2. Type space
  3. It gets converted to "½ "
  4. Press backspace
  5. You get: "1/2 "

Note: It's super smart in Word where this 1/2 never gets converted back to a fraction again, even if you remove that space and type it again. However, GDocs doesn't implement this mechanism and you can again trigger transformation again by typing another space. We can do KISS as both options make some sense, plus going in a Word-like direction would require more work.


If you'd like to see this improvement implemented, add a 👍 reaction to this post.

@Reinmar Reinmar added type:improvement This issue reports a possible enhancement of an existing feature. package:typing squad:core Issue to be handled by the Core team. labels Aug 25, 2021
@Reinmar
Copy link
Member Author

Reinmar commented Aug 25, 2021

Note: In GDocs and Word backspace behaves like undo – this is – you can redo that change.

Note: What about autolinking, auto media embed, etc.

@Reinmar
Copy link
Member Author

Reinmar commented Aug 26, 2021

  • Features to work this way (included in the scope of this ticket):
    • Text transformation
    • Auto linking
    • Auto media embed (pasting a URL to embed)
    • Auto image
    • Autoformat (??? we're not sure about this one)
  • Flow:
    • A certain feature (the one that does the transformation) sets the flag (probably via a method) on the Delete plugin. It needs to be set in a way that it's not going to be reverted immediately, in the same batch of changes that are caused by the transformation itself.
    • The Delete plugin takes care of resetting that flag back to false on the next model change (including the selection).
    • If it's still true upon Backspace, trigger the undo command (and reset the flag). This should be handled by the Delete plugin.
  • Scope:
    • The logic mentioned above.
    • Covering all 5 features.
    • Integration tests in all 5 features.
  • Other funky remarks:
    • Chained transformations

Resolves: #2364.

Also: will resolve the same issue on Mobile where undo may not be that easily available.

@arkflpc
Copy link
Contributor

arkflpc commented Sep 9, 2021

Are we sure about Autoformat yet?

@Reinmar
Copy link
Member Author

Reinmar commented Sep 9, 2021

I'd go without autoformat for now because this will be safer. But, it'd be good to test how this works with autoformat to see whether the UX is good or confusing.

Hence, if you could create a PR for the features that we want to cover and then a second draft PR (based on that former PR) for autoformat?

niegowski added a commit that referenced this issue Sep 10, 2021
…text-transformation

Feature (typing, image, link, media-embed): Allows using backspace to undo automatic transformations. Closes #10413.
@arkflpc
Copy link
Contributor

arkflpc commented Sep 14, 2021

PR to test autoformat: #10508

oleq added a commit that referenced this issue Sep 15, 2021
…autoformat

Feature (autoformat): Allowed undoing automatic [Markdown-like formatting](https://ckeditor.com/docs/ckeditor5/latest/features/autoformat.html) by pressing <kbd>Backspace</kbd>. See #10413.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:typing squad:core Issue to be handled by the Core team. type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants