From 9cea38f67be0dd3765d1684fbf5c9b962bc159bf Mon Sep 17 00:00:00 2001 From: Jorge Date: Wed, 3 Jan 2018 19:56:18 +0000 Subject: [PATCH] Fixed matches sorting in shortcodeConverter. It looks like the algorithm to compute the return array is dependent on ascending sorting of the matches and the sorting was not ascending causing a series of bugs. --- blocks/api/raw-handling/shortcode-converter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/api/raw-handling/shortcode-converter.js b/blocks/api/raw-handling/shortcode-converter.js index 040b08a9c83cf9..dcc6b42a49594a 100644 --- a/blocks/api/raw-handling/shortcode-converter.js +++ b/blocks/api/raw-handling/shortcode-converter.js @@ -60,7 +60,7 @@ export default function( HTML ) { let negativeI = 0; // Sort the matches and return an array of text pieces and blocks. - return Object.keys( matches ).sort().reduce( ( acc, index ) => { + return Object.keys( matches ).sort( ( a, b ) => a - b ).reduce( ( acc, index ) => { const match = matches[ index ]; acc = [