-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Selecting on a comment should scroll to the block #66873
Open
karthick-murugan
wants to merge
22
commits into
WordPress:trunk
Choose a base branch
from
karthick-murugan:feature/block-comments-scroll
base: trunk
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 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
912ec5a
Scroll editor blocks based on comments
karthick-murugan 154c273
Update blockClientId
karthick-murugan 52341d1
Update Iframe
karthick-murugan aef8840
Feedback Changes
karthick-murugan 0c34d4e
Merge branch 'trunk' into feature/block-comments-scroll
karthick-murugan dad8215
Site Editor: Unify layout with posts dataviews (#67162)
youknowriad cd730bb
Scroll editor blocks based on comments
karthick-murugan 583632d
Feedback Changes
karthick-murugan 499cfd8
Feedback Changes
karthick-murugan d71c1c6
Remove unnecessary changes
karthick-murugan 07c85f6
Feedback Changes
karthick-murugan a7693d4
Merge branch 'trunk' of github.com:karthick-murugan/gutenberg into fe…
karthick-murugan 8367a44
Linting issues fixed
karthick-murugan 9d60b44
Feedback Changes updated
karthick-murugan e5d379b
Feedback updates
karthick-murugan 939f2f5
Feedback updates
karthick-murugan 68568d9
Feedback updates
karthick-murugan 13194c1
Feedback and site editor updates
karthick-murugan e9b0e4b
Updating feedback changes
karthick-murugan cc4c27a
Merge branch 'trunk' into feature/block-comments-scroll
karthick-murugan de2c602
Reverting comment header
karthick-murugan 07453a5
Merge branch 'feature/block-comments-scroll' of github.com:karthick-m…
karthick-murugan 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 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
This file contains 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
This file contains 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 |
---|---|---|
|
@@ -7,3 +7,21 @@ | |
export function sanitizeCommentString( str ) { | ||
return str.trim(); | ||
} | ||
|
||
export const getBlockByCommentId = ( blocks, commentId ) => { | ||
for ( const block of blocks ) { | ||
if ( block.attributes.blockCommentId === commentId ) { | ||
return block; | ||
} | ||
if ( block.innerBlocks && block.innerBlocks.length > 0 ) { | ||
const foundBlock = getBlockByCommentId( | ||
block.innerBlocks, | ||
commentId | ||
); | ||
if ( foundBlock ) { | ||
return foundBlock; | ||
} | ||
} | ||
} | ||
return blocks ? getBlockByCommentId( blocks, commentId ) : null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this fallback? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Mamaduka - I have updated the condition now. |
||
}; |
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.
What's the reason for switching to
useEntityBlockEditor
? This reverts the suggestion from #66873 (comment).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.
@Mamaduka - used
useEntityBlockEditor
for the functionality to work in Site Editor. Before it was not.