Skip to content

Commit

Permalink
Feedback Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
karthick-murugan committed Nov 26, 2024
1 parent 52341d1 commit aef8840
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions packages/editor/src/components/collab-sidebar/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '@wordpress/date';
import { Icon, check, published, moreVertical } from '@wordpress/icons';
import { __, _x } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';
import { useSelect, dispatch } from '@wordpress/data';
import { useEntityProp } from '@wordpress/core-data';
import { store as blockEditorStore } from '@wordpress/block-editor';

Expand Down Expand Up @@ -106,22 +106,10 @@ export function Comments( {

const handleThreadClick = ( thread ) => {
const block = findBlockByCommentId( blocksList, thread.id );

if ( block ) {
const blockClientId = block.clientId;
const iframe = document.querySelector(
'iframe[name="editor-canvas"]'
);
const iframeDocument =
iframe.contentDocument || iframe.contentWindow.document;
const blockElement = iframeDocument.getElementById(
'block-' + blockClientId
);

if ( blockElement ) {
blockElement.scrollIntoView( { behavior: 'smooth' } );
setActiveClientId( thread.id );
}
// Select the block in the editor
dispatch( blockEditorStore ).selectBlock( blockClientId );
}
};

Expand Down

0 comments on commit aef8840

Please sign in to comment.