Skip to content

function to reset the selection if it's invalid #6809

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

swapanmandi
Copy link

fix #6805

This PR fixes an issue where the Slate.js editor in Volto attempts to set the selection to a non-existent path.

Changes Made:
Added Selection Validation

Before setting the selection, the editor checks if the target path exists.
If the path is invalid, it resets the selection to the start of the block.
Ensured Synchronization with defaultSelection

Clears defaultSelection when the block updates to prevent stale references.
Added Debugging Logs for Document Structure

Logs editor.children before applying selection to help debug future issues.

Copy link

boring-cyborg bot commented Mar 5, 2025

Caution

The Volto Team has suspended its review of new pull requests from first-time contributors until the release of Plone 7, which is preliminarily scheduled for the second quarter of 2026.
Read details.

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, read
Plone's Code of Conduct,
Contributing to Plone,
First-time contributors, and
Contributing to Volto,
as this will greatly help the review process.

Welcome to the Plone community! 🎉

@mister-roboto
Copy link

@swapanmandi you need to sign the Plone Contributor Agreement to merge this pull request.

Learn about the Plone Contributor Agreement: https://plone.org/foundation/contributors-agreement

If you have already signed the agreement, please allow a week for your agreement to be processed.
Once it is processed, you will receive an email invitation to join the plone GitHub organization as a Contributor.

If after a week you have not received an invitation, then please contact [email protected].

Copy link

netlify bot commented Mar 5, 2025

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 436642f
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67c7d4113b8b030008f030bf

@sneridagh
Copy link
Member

@swapanmandi if you don't sign the CLA, we will have to close this PR.

@swapanmandi
Copy link
Author

I signed

@stevepiercy
Copy link
Collaborator

@swapanmandi did you receive and accept an invitation, as described in https://6.docs.plone.org/contributing/index.html#sign-and-return-the-plone-contributor-agreement ?

If you didn't receive the invitation, then follow the instructions on that page.

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.

Pressing backspace on paragraph with a previous block with bullets results in error
4 participants