From 690eb1c61d82101dd80901d31e1f0deac174152d Mon Sep 17 00:00:00 2001 From: iseulde Date: Tue, 12 Feb 2019 22:23:23 +0100 Subject: [PATCH] Fix padding --- lib/client-assets.php | 6 +++--- .../src/test/__snapshots__/to-dom.js.snap | 15 +++++++++++++++ packages/rich-text/src/test/helpers/index.js | 14 +++++++------- packages/rich-text/src/to-tree.js | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/lib/client-assets.php b/lib/client-assets.php index e2a6cd048467d2..e2fabf1b18cf95 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -525,10 +525,10 @@ function gutenberg_preload_api_request( $memo, $path ) { * @since 0.1.0 */ function gutenberg_register_vendor_scripts() { - $suffix = SCRIPT_DEBUG ? '' : '.min'; + $suffix = true ? '' : '.min'; // Vendor Scripts. - $react_suffix = ( SCRIPT_DEBUG ? '.development' : '.production' ) . $suffix; + $react_suffix = ( true ? '.development' : '.production' ) . $suffix; gutenberg_register_vendor_script( 'react', @@ -540,7 +540,7 @@ function gutenberg_register_vendor_scripts() { 'https://unpkg.com/react-dom@16.6.3/umd/react-dom' . $react_suffix . '.js', array( 'react' ) ); - $moment_script = SCRIPT_DEBUG ? 'moment.js' : 'min/moment.min.js'; + $moment_script = true ? 'moment.js' : 'min/moment.min.js'; gutenberg_register_vendor_script( 'moment', 'https://unpkg.com/moment@2.22.1/' . $moment_script, diff --git a/packages/rich-text/src/test/__snapshots__/to-dom.js.snap b/packages/rich-text/src/test/__snapshots__/to-dom.js.snap index aa797ec0630c7d..fb3b73750a1f94 100644 --- a/packages/rich-text/src/test/__snapshots__/to-dom.js.snap +++ b/packages/rich-text/src/test/__snapshots__/to-dom.js.snap @@ -133,12 +133,18 @@ exports[`recordToDom should create a value without formatting 1`] = ` exports[`recordToDom should create an empty value 1`] = ` +
`; exports[`recordToDom should create an empty value from empty tags 1`] = ` +
`; @@ -214,6 +220,9 @@ exports[`recordToDom should handle empty list value 1`] = `
  • +
  • `; @@ -222,6 +231,9 @@ exports[`recordToDom should handle empty multiline value 1`] = `

    +

    `; @@ -431,6 +443,9 @@ exports[`recordToDom should preserve non breaking space 1`] = ` exports[`recordToDom should remove padding 1`] = ` +
    `; diff --git a/packages/rich-text/src/test/helpers/index.js b/packages/rich-text/src/test/helpers/index.js index 2828b36718ca71..5b6b038c767475 100644 --- a/packages/rich-text/src/test/helpers/index.js +++ b/packages/rich-text/src/test/helpers/index.js @@ -420,7 +420,7 @@ export const spec = [ endContainer: element.querySelector( 'ol > li' ).firstChild, } ), startPath: [ 0, 0, 0 ], - endPath: [ 0, 1, 1, 1, 0, 0, 1 ], + endPath: [ 0, 2, 1, 2, 0, 0, 1 ], record: { start: 0, end: 9, @@ -459,8 +459,8 @@ export const spec = [ endOffset: 0, endContainer: element.querySelector( 'ul > li' ), } ), - startPath: [ 0, 0, 0, 0, 0 ], - endPath: [ 0, 0, 0, 0, 0 ], + startPath: [ 0, 0, 0, 2, 0 ], + endPath: [ 0, 0, 0, 2, 0 ], record: { start: 1, end: 1, @@ -479,8 +479,8 @@ export const spec = [ endOffset: 0, endContainer: element.firstChild.nextSibling, } ), - startPath: [ 1, 0, 0 ], - endPath: [ 1, 0, 0 ], + startPath: [ 1, 2, 0 ], + endPath: [ 1, 2, 0 ], record: { start: 1, end: 1, @@ -498,8 +498,8 @@ export const spec = [ endOffset: 0, endContainer: element.lastChild, } ), - startPath: [ 1, 0, 0 ], - endPath: [ 1, 0, 0 ], + startPath: [ 1, 2, 0 ], + endPath: [ 1, 2, 0 ], record: { start: 4, end: 4, diff --git a/packages/rich-text/src/to-tree.js b/packages/rich-text/src/to-tree.js index 50923e949c3299..9cb2edab4733e6 100644 --- a/packages/rich-text/src/to-tree.js +++ b/packages/rich-text/src/to-tree.js @@ -253,7 +253,7 @@ export function toTree( { if ( isEditableTree && ( nextCharacter === LINE_SEPARATOR || ! nextCharacter ) && - i !== text.length + ( i !== text.length || ! text.length ) ) { append( getParent( pointer ), padding ); }