Skip to content

Commit

Permalink
Merge branch 'hotfix/20.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
YoastBot committed Mar 2, 2023
2 parents 7d0016e + 55c8ebc commit 6a5ba26
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"typescript": "^4.2.4"
},
"yoast": {
"pluginVersion": "20.2"
"pluginVersion": "20.2.1"
},
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion packages/js/src/helpers/measureTextWidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ export default function measureTextWidth( text ) {
if ( ! element ) {
element = createMeasurementElement();
}
element.innerHTML = text;
element.innerText = text;
return element.offsetWidth;
}
2 changes: 1 addition & 1 deletion packages/yoastseo/src/helpers/createMeasurementElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ export const measureTextWidth = function( text ) {
if ( ! element ) {
element = createMeasurementElement();
}
element.innerHTML = text;
element.innerText = text;
return element.offsetWidth;
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
* @returns {string} The string with single quotes around HTML attributes replaced with double quotes.
*/
export default function( str ) {
const element = document.createElement( "body" );
element.innerHTML = str;
const normalizedHTML = element.innerHTML;
const doc = new DOMParser().parseFromString( str, "text/html" );
const normalizedHTML = doc.body.innerHTML;

// Replace ` ` with an actual non breaking space (U+00A0).
return normalizedHTML.replace( / /g, "\u00A0" );
Expand Down
8 changes: 8 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ Your question has most likely been answered on our help center: [yoast.com/help/

== Changelog ==

= 20.2.1 =

Release date: 2023-03-02

### Bugfix

* Fixes a security issue in the post editor.

= 20.2 =

Release date: 2023-02-28
Expand Down

0 comments on commit 6a5ba26

Please sign in to comment.