@@ -133,6 +133,7 @@ function addToolbarButton(toolbar) {
133133
134134 // Find the toolbar group to add our button to
135135 const isNewToolbar = toolbar . getAttribute ( 'aria-label' ) === 'Formatting tools' ;
136+ const isReactReviewToolbar = / T o o l b a r - m o d u l e _ _ t o o l b a r / . test ( toolbar . className || '' ) ;
136137 let toolbarGroup ;
137138
138139 if ( isNewToolbar ) {
@@ -142,6 +143,9 @@ function addToolbarButton(toolbar) {
142143 if ( groups . length >= 2 ) {
143144 toolbarGroup = groups . at ( - 2 ) ; // Second to last group, before the divider
144145 }
146+ } else if ( isReactReviewToolbar ) {
147+ // React-rendered "Finish your comments" review dialog
148+ toolbarGroup = toolbar ;
145149 } else {
146150 // Old GitHub style
147151 toolbarGroup = select ( '.ActionBar-item-container, .toolbar-group' , toolbar ) ||
@@ -232,8 +236,8 @@ function addToolbarButton(toolbar) {
232236 }
233237
234238 // Add the button at the end of the toolbar
235- if ( isNewToolbar ) {
236- // For new GitHub style, add to the end of the toolbar
239+ if ( isNewToolbar || isReactReviewToolbar ) {
240+ // For new GitHub style and React review dialog , add to the end of the toolbar
237241 toolbar . append ( button ) ;
238242 } else {
239243 // For old GitHub style, add at the end
@@ -283,7 +287,7 @@ async function init() {
283287
284288 // Add buttons to existing toolbars
285289 // Use a selector that matches both new and old GitHub styles
286- const toolbarSelector = '[aria-label="Formatting tools"]:not(.ghg-has-gif-button), markdown-toolbar:not(.ghg-has-gif-button)' ;
290+ const toolbarSelector = '[aria-label="Formatting tools"]:not(.ghg-has-gif-button), markdown-toolbar:not(.ghg-has-gif-button), [class*="Toolbar-module__toolbar"]:not(.ghg-has-gif-button) ' ;
287291 const existingToolbars = select . all ( toolbarSelector ) ;
288292 debugLog ( 'Found existing toolbars:' , existingToolbars . length ) ;
289293
0 commit comments