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

Delete existing empty spans when leaving text edit mode #4266

Merged
merged 10 commits into from
Oct 2, 2023

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Sep 28, 2023

Fixes #4265

Problem:

When leaving text edit mode, new elements are deleted, but existing ones are kept.

Fix:

Update the behavior so it also removes existing empty elements if:

  1. the element is a span
  2. and it does not have event handlers

@github-actions
Copy link
Contributor

github-actions bot commented Sep 28, 2023

Try me

@relativeci
Copy link

relativeci bot commented Sep 28, 2023

Job #8320: Bundle Size — 62.7MiB (~+0.01%).

d6cba5c(current) vs 5957b21 master#8318(baseline)

⚠️ Bundle contains 64 duplicate packages

Metrics (2 changes)
                 Current
Job #8320
     Baseline
Job #8318
Initial JS 34.96MiB(~+0.01%) 34.96MiB
Initial CSS 0B 0B
Cache Invalidation 18.37% 19.35%
Chunks 27 27
Assets 31 31
Modules 3970 3970
Duplicate Modules 422 422
Duplicate Code 30.83% 30.83%
Packages 409 409
Duplicate Packages 64 64
Total size by type (1 change)
                 Current
Job #8320
     Baseline
Job #8318
CSS 0B 0B
Fonts 0B 0B
HTML 11.43KiB 11.43KiB
IMG 0B 0B
JS 62.69MiB (~+0.01%) 62.68MiB
Media 0B 0B
Other 0B 0B

View job #8320 reportView fix/delete-existing-empty-spans branch activity

@github-actions
Copy link
Contributor

github-actions bot commented Sep 28, 2023

Performance test results:
(Chart1)
(Chart2)

Copy link
Contributor

@balazsbajorics balazsbajorics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the try me link and something is very broken, the Enter acts like a delete button for divs that don't already contain text, and text insertion also immediately quits.

Bug aside, I think for non-new elements we should be more careful, and make sure it's a span and not a div and/or that it doesn't have dimensions, backgroundColor, etc. So in general, we want the feature to clean up invisible leftover, but do not cause a headache if you have something selected and you accidentally press Enter.

@ruggi
Copy link
Contributor Author

ruggi commented Sep 29, 2023

I tried the try me link and something is very broken, the Enter acts like a delete button for divs that don't already contain text, and text insertion also immediately quits.

Bug aside, I think for non-new elements we should be more careful, and make sure it's a span and not a div and/or that it doesn't have dimensions, backgroundColor, etc. So in general, we want the feature to clean up invisible leftover, but do not cause a headache if you have something selected and you accidentally press Enter.

Updated - the behavior only triggers for span elements without styling nor event handlers!

@ruggi ruggi merged commit bd67af2 into master Oct 2, 2023
10 checks passed
@ruggi ruggi deleted the fix/delete-existing-empty-spans branch October 2, 2023 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Delete empty text elements when leaving text edit mode
3 participants