-
-
Notifications
You must be signed in to change notification settings - Fork 788
Fixed issue of merging block contents upon pressing backspace at start of second block with some content #7373
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
aryan7081
wants to merge
16
commits into
plone:main
Choose a base branch
from
aryan7081:7263-fix-slate-backspace-merge
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b6a03a6
Fixed issue of merging block contents upon pressing backspace at star…
aryan7081 f85324a
Fix: Merge second block into first on backspace at block start
aryan7081 cb899e7
Merge branch 'main' into 7263-fix-slate-backspace-merge
aryan7081 7f85aff
Merge branch 'main' into 7263-fix-slate-backspace-merge
aryan7081 68376e4
Fix(editor): prevent new line when merging slate blocks
aryan7081 5e61ca8
Merge branch 'main' into 7263-fix-slate-backspace-merge
aryan7081 c33fdfc
fix(editor): placed cursor correctly when merging inline
aryan7081 4462e75
Updated: pressing Enter at the merge point now restores the split int…
aryan7081 dcd4a8d
Updated file name with PR number
aryan7081 c4dd44f
Add internal changelog for Cypress test in volto
aryan7081 d8b33ad
Merge branch 'main' into 7263-fix-slate-backspace-merge
aryan7081 f4345f9
fix(volto-slate): improve backspace behavior after multiple Enter pre…
aryan7081 4d13eed
Fix: Utilised mergeSlateWithBlockBackward for consistent block mergin…
aryan7081 6e596bc
Fixed linting error
aryan7081 be85234
refactor: replace barrel import with direct module import
aryan7081 fadcca1
Merge branch 'main' into 7263-fix-slate-backspace-merge
aryan7081 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/volto/cypress/tests/core/blocks/blocks-slate-backspace.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
describe('Slate Backspace Behavior', () => { | ||
beforeEach(() => { | ||
cy.intercept('GET', `/**/*?expand*`).as('content'); | ||
cy.intercept('GET', '/**/Document').as('schema'); | ||
|
||
cy.autologin(); | ||
cy.createContent({ | ||
contentType: 'Document', | ||
contentId: 'my-page', | ||
contentTitle: 'My Page', | ||
}); | ||
cy.visit('/my-page'); | ||
cy.wait('@content'); | ||
|
||
cy.navigate('/my-page/edit'); | ||
cy.wait('@schema'); | ||
}); | ||
|
||
it('Backspace at start of second block deletes it and merges content into first block', () => { | ||
cy.getSlateEditorAndType('First block text'); | ||
|
||
cy.addNewBlock('slate'); | ||
cy.getSlateEditorAndType('Second block text'); | ||
|
||
cy.getSlate().setCursorBefore('Second').type('{backspace}'); | ||
|
||
cy.get('.content-area .slate-editor [contenteditable=true]') | ||
.should('have.length', 1) | ||
.should('contain', 'First block text') | ||
.should('contain', 'Second block text'); | ||
}); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why weren't the changes made to
mergeSlateWithBlockBackward
? Have you considered whether the code there is needed? Even if it isn't needed, the implementation can be done there to make the code more modular and separate.mergeSlateWithBlockBackward
is only used here.