Skip to content

Commit

Permalink
Restore priority on embed block for raw transforming (#6572)
Browse files Browse the repository at this point in the history
* Restore priority on embed block for raw transforming

* Add priority to paragraph instead of embed
  • Loading branch information
ellatrix authored May 3, 2018
1 parent 3a37ebc commit 853d4c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions blocks/api/raw-handling/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/**
* External dependencies
*/
import { find, flatMap, filter, compact } from 'lodash';
import { flatMap, filter, compact } from 'lodash';
// Also polyfills Element#matches.
import 'element-closest';

/**
* Internal dependencies
*/
import { createBlock, getBlockTransforms } from '../factory';
import { createBlock, getBlockTransforms, findTransform } from '../factory';
import { getBlockType } from '../registration';
import { getBlockAttributes, parseWithGrammar } from '../parser';
import normaliseBlocks from './normalise-blocks';
Expand Down Expand Up @@ -169,7 +169,7 @@ export default function rawHandler( { HTML = '', plainText = '', mode = 'AUTO',
doc.body.innerHTML = piece;

return Array.from( doc.body.children ).map( ( node ) => {
const rawTransformation = find( rawTransformations, ( { isMatch } ) => isMatch( node ) );
const rawTransformation = findTransform( rawTransformations, ( { isMatch } ) => isMatch( node ) );

if ( ! rawTransformation ) {
warn(
Expand Down
2 changes: 2 additions & 0 deletions core-blocks/paragraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,8 @@ export const settings = {
from: [
{
type: 'raw',
// Paragraph is a fallback and should be matched last.
priority: 20,
selector: 'p',
schema: {
p: {
Expand Down

0 comments on commit 853d4c0

Please sign in to comment.