Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Another paragraph is inserted, inside InnerBlocks. (#10733)
Currently, we have a bug even if a block has a paragraph as the last block of the template if no locking exists another paragraph is inserted. This happens because, before the template is processed the parent block is empty and DefaultBlockApppender is rendered right away. DefaultBlockApppender inserts blocks when it gets focused. The parent block has a mechanism to focus the first table and if InnerBlocks were not yet processed and the parent block does not contain inputs the DefaultBlockApppender is going to get the focus. Before the template is processed we don't know what blocks will exist so during this phase DefaultBlockApppender should not be rendered. This PR makes sure that we don't render DefaultBlockApppender right after the block is inserted before the template is processed. This behavior was noticed in #9416. ## How has this been tested? I added the test block available in https://gist.github.com/jorgefilipecosta/edafb2422ef41020d75619adf31d725e. I checked that after inserting the first paragraph specified in the template gets focused and no other paragraph is created. I checked the blocks depending on the behavior of DefaultBlockApppender inserting a block (columns) continue to work as before. ## Screenshots <!-- if applicable --> test block: https://gist.github.com/jorgefilipecosta/edafb2422ef41020d75619adf31d725e ``` var TEMPLATE = [ [ 'core/paragraph', { placeholder: 'Paragraph 1', customFontSize: 35 } ], ]; ``` After: <img width="568" alt="screen shot 2018-10-18 at 13 07 03" src="https://user-images.githubusercontent.com/11271197/47153548-e36a5b80-d2d7-11e8-83a6-33a9b39d97ce.png"> <img width="700" alt="screen shot 2018-10-18 at 13 06 54" src="https://user-images.githubusercontent.com/11271197/47153560-e9f8d300-d2d7-11e8-8086-cfa2e2252432.png"> Before: <img width="675" alt="screen shot 2018-10-18 at 13 17 27" src="https://user-images.githubusercontent.com/11271197/47153679-30e6c880-d2d8-11e8-82b4-d4e7c19fa0b9.png"> <img width="656" alt="screen shot 2018-10-18 at 13 17 21" src="https://user-images.githubusercontent.com/11271197/47153683-33e1b900-d2d8-11e8-80da-7afc0294d311.png">
- Loading branch information