Skip to content

Commit 31bd83c

Browse files
Build "Merge pull request #3474 from Parsely/develop" (f52f113)
1 parent b49a58f commit 31bd83c

File tree

14 files changed

+411
-160
lines changed

14 files changed

+411
-160
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [3.20.1](https://github.com/Parsely/wp-parsely/compare/3.20.0...3.20.1) - 2025-06-19
9+
10+
### Fixed
11+
12+
- Fix outbound link highlights in Traffic Boost ([#3469](https://github.com/Parsely/wp-parsely/pull/3469))
13+
814
## [3.20.0](https://github.com/Parsely/wp-parsely/compare/3.19.3...3.20.0) - 2025-06-18
915

1016
### Changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Parse.ly
22

3-
Stable tag: 3.20.0
3+
Stable tag: 3.20.1
44
Requires at least: 6.0
55
Tested up to: 6.8
66
Requires PHP: 7.4
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => 'd32bef74f4fde0b9ec6b');
1+
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-element', 'wp-escape-html', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-url'), 'version' => '1584528d4b5b04a117a7');

build/content-helper/dashboard-page.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wp-parsely",
3-
"version": "3.20.0",
3+
"version": "3.20.1",
44
"private": true,
55
"description": "The Parse.ly plugin facilitates real-time and historical analytics to your content through a platform designed and built for digital publishing.",
66
"author": "parsely, hbbtstar, jblz, mikeyarce, GaryJ, parsely_mike, acicovic, mehmoodak, vaurdan",

src/content-helper/dashboard-page/pages/traffic-boost/preview/components/link-counter.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* WordPress dependencies
33
*/
44
import { Button } from '@wordpress/components';
5-
import { useDispatch } from '@wordpress/data';
5+
import { useDispatch, useSelect } from '@wordpress/data';
66
import { useEffect, useState } from '@wordpress/element';
77
import { __, sprintf } from '@wordpress/i18n';
88

@@ -67,6 +67,7 @@ export const LinkCounter = ( {
6767
smart: 0,
6868
} );
6969

70+
const storePreviewLinkType = useSelect( ( select ) => select( TrafficBoostStore ).getPreviewLinkType(), [] );
7071
const { setPreviewLinkType } = useDispatch( TrafficBoostStore );
7172

7273
useEffect( () => {
@@ -108,6 +109,17 @@ export const LinkCounter = ( {
108109
setPreviewLinkType( initialSelectedLinkType );
109110
}, [ initialSelectedLinkType, setPreviewLinkType ] );
110111

112+
/**
113+
* Updates the selected link type when changed externally via the store.
114+
*
115+
* @since 3.20.1
116+
*/
117+
useEffect( () => {
118+
if ( storePreviewLinkType !== selectedLinkType ) {
119+
setSelectedLinkType( storePreviewLinkType );
120+
}
121+
}, [ selectedLinkType, storePreviewLinkType ] );
122+
111123
/**
112124
* Handles click events on link type buttons.
113125
*

src/content-helper/dashboard-page/pages/traffic-boost/preview/components/preview-iframe.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { TextSelection } from '../preview';
1919
import { getContentArea, isExternalURL } from '../utils';
2020
import { PreviewActions } from './preview-actions';
2121
import { TextSelectionTooltip } from './text-selection-tooltip';
22+
import { useExistingLinkHighlight } from '../hooks/use-existing-link-highlight';
2223

2324
/**
2425
* Props structure for PreviewIframe.
@@ -92,16 +93,18 @@ export const PreviewIframe = ( {
9293
}, [ previewUrl ] );
9394

9495
// Create an actions bar to be mounted in the iframe with useIframeHighlight().
95-
const actionsBar = <PreviewActions
96-
activeLink={ activeLink }
97-
onAccept={ onAccept }
98-
onDiscard={ onDiscard }
99-
onUpdateLink={ onUpdateLink }
100-
onRemove={ onRemove }
101-
onRestoreOriginal={ onRestoreOriginal }
102-
selectedText={ selectedText ?? null }
103-
iframeRef={ iframeRef }
104-
/>;
96+
const actionsBar = useMemo( () => (
97+
<PreviewActions
98+
activeLink={ activeLink }
99+
onAccept={ onAccept }
100+
onDiscard={ onDiscard }
101+
onUpdateLink={ onUpdateLink }
102+
onRemove={ onRemove }
103+
onRestoreOriginal={ onRestoreOriginal }
104+
selectedText={ selectedText ?? null }
105+
iframeRef={ iframeRef }
106+
/>
107+
), [ activeLink, onAccept, onDiscard, onUpdateLink, onRemove, onRestoreOriginal, selectedText, iframeRef ] );
105108

106109
/**
107110
* Highlights the smart link in the iframe.
@@ -111,7 +114,6 @@ export const PreviewIframe = ( {
111114
const {
112115
injectHighlightStyles,
113116
highlightSmartLink,
114-
highlightLinkType,
115117
removeSmartLinkHighlights,
116118
} = useIframeHighlight( {
117119
iframeRef,
@@ -123,6 +125,15 @@ export const PreviewIframe = ( {
123125
actionsBar,
124126
} );
125127

128+
const {
129+
injectExistingLinkHighlightStyles,
130+
highlightExistingLinkType,
131+
} = useExistingLinkHighlight( {
132+
iframeRef,
133+
contentAreaRef,
134+
activeLink,
135+
} );
136+
126137
/**
127138
* Hides the admin bar from the iframe if the preview is in frontend mode.
128139
*
@@ -298,6 +309,7 @@ export const PreviewIframe = ( {
298309
}
299310

300311
injectHighlightStyles( iframe );
312+
injectExistingLinkHighlightStyles( iframe );
301313

302314
// Updates the content area ref to the iframe's content area.
303315
const contentArea = getContentArea( iframe.contentDocument );
@@ -311,19 +323,17 @@ export const PreviewIframe = ( {
311323
}
312324

313325
hideAdminBar( iframe );
314-
highlightLinkType( iframe, selectedLinkType );
315326
disableNavigation( iframe );
316327

317328
onLoadingChange( false );
318329
jumpToSmartLink( iframe );
319330
}, [ contentAreaRef,
320331
disableNavigation,
321332
hideAdminBar,
322-
highlightLinkType,
323333
injectHighlightStyles,
334+
injectExistingLinkHighlightStyles,
324335
jumpToSmartLink,
325336
onLoadingChange,
326-
selectedLinkType,
327337
] );
328338

329339
/**
@@ -399,8 +409,8 @@ export const PreviewIframe = ( {
399409
return;
400410
}
401411

402-
highlightLinkType( iframe, selectedLinkType );
403-
}, [ contentAreaRef, highlightLinkType, isLoading, selectedLinkType ] );
412+
highlightExistingLinkType( iframe, selectedLinkType );
413+
}, [ contentAreaRef, highlightExistingLinkType, isLoading, selectedLinkType ] );
404414

405415
return (
406416
<div className="wp-parsely-preview">

0 commit comments

Comments
 (0)