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

Pressing Tab inside a table should select all node contents of the next cell #2764

Merged
merged 9 commits into from
Sep 5, 2024

Conversation

Andres-CT98
Copy link
Contributor

@Andres-CT98 Andres-CT98 commented Aug 8, 2024

Description:

When Pressing tab to get to the next cell in a table, #2718, in the case of an empty cell the selection should not delete the segment format.

Fix

The selection should not be done using the method selectNodeContents, instead a custom range using the node's first and last child should be done.

Cases tested:

  1. Create a table bigger than 2x2
  2. Populate the first cell with text
  3. Go to the first cell and press Tab, this should select the next cell
  4. Input some text
  5. Inspect the elements of both the first and second cell.

Before: The texts on each cell have different fonts, the first one being the editor default and the second the browser default.

After: The texts of both cells have the same font, being the editor default.

@Andres-CT98 Andres-CT98 marked this pull request as ready for review August 8, 2024 15:15
@Andres-CT98 Andres-CT98 changed the title Pressing Tab inside a table should select all node contents of the div, not td Pressing Tab inside a table should select all node contents of the next cell Aug 29, 2024
const cellStart = cell.firstChild;
const cellEnd = cell.lastChild || cell.firstChild;
// Get first deepest editable position in the cell
const posStart = normalizePos(cellStart, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

need null check, in case cellStart/cellEnd is null.

If that happens, maybe we need to create a paragraph? Or just simple put focus into the cell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They can not be null.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We cannot make such assumption. At least we need a null check here or it can throw at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The null check is above, after passing it cellStart/cellEnd can not longer be null.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh I see, sorry I missed it.

@Andres-CT98 Andres-CT98 merged commit 865fdc7 into master Sep 5, 2024
7 checks passed
@Andres-CT98 Andres-CT98 deleted the u/acampostams/select-td-div-on-tab branch September 5, 2024 18:01
JiuqingSong added a commit that referenced this pull request Sep 6, 2024
* image-selection

* fixes

* safari fix

* fix drag and drop

* fixes

* fixes

* Add `<del>` elements to default processors and use knownElementProcessor for this type of element. (#2770)

* init

* Use alphabet order

* Dont remove the MarginTop/Bottom from lists when pasting from Word Online (#2778)

* init

* remove unneeded function

* try fix build

* Reconcile table and image selection for cache (#2714)

* Improve cache

* fix build

* improve

* add test

* Cache and entity 2

* Add test

* Reconcile table and image selection for cache

* support reconcile entity delimiter

* fix build

* add test

---------

Co-authored-by: Bryan Valverde U <[email protected]>

* Set segmentFormat text color to black when creating the model of the clipboard content and using Keep source formatting paste type (#2773)

* init

* add a link to tests and make sure it is handled correctly

* fixes image in tables

* Bump webpack from 5.84.1 to 5.94.0 (#2780)

Bumps [webpack](https://github.com/webpack/webpack) from 5.84.1 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.84.1...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Resolve null sheet in convertInlineCss (#2784)

* init

* update

* Update paste code to add a paragraph when the clipboard contains atleast a block element (#2777)

* init

* add a link to tests and make sure it is handled correctly

* init

* try fix build

* fix build

* Fix 300391: [Mail] The numbers will become a continuous sequence after typing enter at the last line of the numbering above (#2782)

Co-authored-by: Bryan Valverde U <[email protected]>

* Pressing Tab inside a table should select all node contents of the next cell (#2764)

* normalise position

* revert

* empty cell check

* select using children

* fix tests

* fix

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Julia Roldi (from Dev Box) <[email protected]>
Co-authored-by: Julia Roldi <[email protected]>
Co-authored-by: Bryan Valverde U <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andres-CT98 <[email protected]>
JiuqingSong added a commit that referenced this pull request Sep 6, 2024
* image-selection

* fixes

* safari fix

* fix drag and drop

* fixes

* fixes

* Add `<del>` elements to default processors and use knownElementProcessor for this type of element. (#2770)

* init

* Use alphabet order

* Dont remove the MarginTop/Bottom from lists when pasting from Word Online (#2778)

* init

* remove unneeded function

* try fix build

* Reconcile table and image selection for cache (#2714)

* Improve cache

* fix build

* improve

* add test

* Cache and entity 2

* Add test

* Reconcile table and image selection for cache

* support reconcile entity delimiter

* fix build

* add test

---------

Co-authored-by: Bryan Valverde U <[email protected]>

* Set segmentFormat text color to black when creating the model of the clipboard content and using Keep source formatting paste type (#2773)

* init

* add a link to tests and make sure it is handled correctly

* fixes image in tables

* Bump webpack from 5.84.1 to 5.94.0 (#2780)

Bumps [webpack](https://github.com/webpack/webpack) from 5.84.1 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.84.1...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Resolve null sheet in convertInlineCss (#2784)

* init

* update

* Update paste code to add a paragraph when the clipboard contains atleast a block element (#2777)

* init

* add a link to tests and make sure it is handled correctly

* init

* try fix build

* fix build

* Fix 300391: [Mail] The numbers will become a continuous sequence after typing enter at the last line of the numbering above (#2782)

Co-authored-by: Bryan Valverde U <[email protected]>

* Pressing Tab inside a table should select all node contents of the next cell (#2764)

* normalise position

* revert

* empty cell check

* select using children

* fix tests

* fix

* Bump version to 9.10.0

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Julia Roldi (from Dev Box) <[email protected]>
Co-authored-by: Julia Roldi <[email protected]>
Co-authored-by: Bryan Valverde U <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andres-CT98 <[email protected]>
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.

2 participants