Skip to content

Commit

Permalink
Merge pull request #816 from equalizedigital/william/7965823554/show-…
Browse files Browse the repository at this point in the history
…editor-link-when-fixes-are-saved-from-open-issues-page

Handle editorLink passed via edac_script_vars
  • Loading branch information
pattonwebz authored Nov 22, 2024
2 parents 8df5d07 + d7b4e97 commit 9acd10b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/admin/summary/summary-tab-input-event-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ export const initFixButtonEventHandlers = () => {
if ( ! fixSettings ) {
return;
}
// if this button has a data-editor attribute, then we need to set the value of the fix setting to the value of the data-editor attribute
if ( button.hasAttribute( 'data-editor' ) ) {
window.edac_script_vars.editorLink = button.getAttribute( 'data-editor' );
}

fixSettings.classList.toggle( 'active' );
document.querySelector( 'body' ).classList.add( 'edac-fix-modal-present' );
Expand Down
5 changes: 3 additions & 2 deletions src/common/saveFixSettingsRest.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,11 @@ export const saveFixSettings = ( fixSettingsContainer ) => {
fixSettingsContainer.classList.add( 'edac-fix-settings--saved--success' );
// find the aria-live region and update the text
if ( liveRegion ) {
if ( window?.edacFrontendHighlighterApp?.editorLink?.length ) {
const editLink = window?.edacFrontendHighlighterApp?.editorLink || window?.edac_script_vars?.editorLink;
if ( editLink ) {
liveRegion.innerHTML = sprintf(
__( 'Settings saved successfully. You must %svisit the editor%s and save the post to rescan and remove fixed issues from Accessibility Checker reports.', 'accessibility-checker' ),
`<a href="${ window.edacFrontendHighlighterApp.editorLink }">`,
`<a href="${ editLink }">`,
'</a>'
);
} else {
Expand Down

0 comments on commit 9acd10b

Please sign in to comment.