Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
51e45ba
Avoid getBlock in block-list/block (#11899)
youknowriad Nov 30, 2018
990f640
Add: Permalink panel toggle mechanism (#12132)
jorgefilipecosta Nov 30, 2018
a92216b
Add: action to set category icon; Fix: Managing block categories docu…
jorgefilipecosta Nov 30, 2018
4178f2d
RichText: Reuse DOM document across calls to createEmpty (#12402)
aduth Nov 30, 2018
459984e
Edit Post: Select blocks only once multiple verified (#12477)
aduth Nov 30, 2018
b650f4a
Parser: Make attribute parsing possessive (#12342)
dmsnell Nov 30, 2018
2094200
RichText: selectionChange: bind on focus, unbind on blur (#12480)
ellatrix Nov 30, 2018
68367b4
Bump the plugin version to 4.6.1 (#12481)
youknowriad Nov 30, 2018
92eab64
Allow links in Plugins group in the More Menu (#12309)
gziolo Dec 3, 2018
522d683
Docs: Stop using `el` variable in edit post docs (#12534)
gziolo Dec 3, 2018
652a662
Remove aria-expanded from RichText. (#12524)
afercia Dec 3, 2018
69b55c7
Restore missing handbook pages after #12411 (#12452)
dd32 Dec 4, 2018
2fc34bc
Docs: Make contributors history links clcikable (#12574)
ntwb Dec 4, 2018
46f789a
Try: fix end 2 end inline tokens test (#12459)
jorgefilipecosta Dec 4, 2018
20edbf2
Editor: Fix regression introduced in CopyHandler (#12543)
gziolo Dec 5, 2018
fccbb4b
Handbook: improve I18N docs (#12576)
swissspidy Dec 5, 2018
12f1ac9
docs: Remove "1440" line (#11882)
tofumatt Dec 5, 2018
47a5e49
Update CONTRIBUTORS.md (#12594)
designsimply Dec 5, 2018
8743217
Testing: add e2e test for the HTML block (#12550)
designsimply Dec 5, 2018
67a67e5
Removed Link from ## User Handbook Section (#12589)
jankimoradiya Dec 5, 2018
5565c56
Docs: Add details on installing/using packages (#12595)
mkaz Dec 5, 2018
f62f336
Docs: Taking a stab at updating FAQ (#12486)
mkaz Dec 5, 2018
387bb77
RichText: fix onSetup doc (#12607)
ellatrix Dec 6, 2018
d7eaeb9
Update broken links (#12660)
cagdasdag Dec 7, 2018
50cafdd
Docs: Update Glossary (#12479)
mkaz Dec 7, 2018
6b8cd54
Add documentation for `safeDecodeURI()` and `filterURLForDisplay()` (…
georgeh Dec 7, 2018
f5b18c2
Update theme-support.md (#12661)
josephchesterton Dec 7, 2018
7f118dd
Fix: Undoing Image Selection in Image Block results in Broken Image (…
jorgefilipecosta Dec 8, 2018
715af6b
Optimize isViewportMatch (#12542)
ellatrix Dec 8, 2018
8e772be
Cache createBlock call in isUnmodifiedDefaultBlock (#12521)
ellatrix Dec 8, 2018
d385f3d
Font Size Picker: Use a menuitemradio role and better labels. (#12372)
afercia Dec 8, 2018
13459da
Set document title for preview interstitial (#12466)
swissspidy Dec 8, 2018
1d5fa32
Fix e2e tests after the WordPress 5.0 upgrade (#12715)
youknowriad Dec 9, 2018
06c4dc3
Meta Boxes: Don't hide disabled meta boxes by modifying DOM (#12628)
noisysocks Dec 9, 2018
29cfa83
Add a word-wrap style to the facebook embed preview screen (#11890)
brentswisher Dec 9, 2018
607c46f
Adding @aldavigdis to the contributors list (#12686)
aldavigdis Dec 9, 2018
85d83ad
Make media & text block placeholder translatable (#12706)
swissspidy Dec 9, 2018
9f6dc6d
Fix: Problems on Media & Text block resizing; Load wp-block-library s…
jorgefilipecosta Dec 9, 2018
779a18e
Get wordcount type from translation (#12586)
miya0001 Dec 9, 2018
a12fcec
Only render InserterWithShortcuts on hover (#12510)
ellatrix Dec 9, 2018
42bf375
Fix issue where default appender has icons overlaying the text (#12536)
jasmussen Dec 9, 2018
2f4317c
Classic Block: set correct focus back after blur (#12415)
ellatrix Dec 9, 2018
f23282b
RichText: only replace range and nodes if different (#12547)
ellatrix Dec 9, 2018
c63bb7d
Mark temporary eslint-config package as private (#12734)
gziolo Dec 9, 2018
4ea5094
When a post is saved, check for tinymce and save any editors. (#12568)
ideadude Dec 9, 2018
4bb3b0c
Rename functions, removing gutenberg_ prefix (#12326)
mkaz Dec 9, 2018
e7fb179
Annotations: Apply annotation className as string (#12741)
aduth Dec 9, 2018
b44a2f1
RichText: Ensure instance is selected before setting back selection (…
ellatrix Dec 9, 2018
47736a4
Fix for #11663 (#12728)
saleehk Dec 10, 2018
8a5486d
Update plugin version to 4.7.0-rc.1 (#12752)
noisysocks Dec 10, 2018
b6949b9
Add an error state to the image block to allow upload errors to displ…
brentswisher Dec 10, 2018
40d1282
Try: JS Console warning for when in Quirks Mode (#12575)
jasmussen Dec 10, 2018
b7e343d
Organizing screenshot assets for the block tutorial inside the design…
terriann Dec 10, 2018
8790bce
Rename backwards compatiblity to backward compatibility (#12751)
mkaz Dec 10, 2018
1a1dc7c
Update node-sass to 4.11.0 to support Node.js 11 (#12541)
swissspidy Dec 11, 2018
0fba129
Add attributes to ServerSideRender readme (#12793)
NateWr Dec 11, 2018
70a48ea
Scripts: Add check-engines script to the package (#12721)
gziolo Dec 12, 2018
0416bae
Move devDependencies to root package.json file (#12720)
gziolo Dec 12, 2018
51583b8
Fix php notice from the recent comments block (#12812)
youknowriad Dec 12, 2018
6c68815
RichText: Fix React warning shown when unmounting a currently selecte…
youknowriad Dec 12, 2018
4dae3bc
Packages: Reimplement ESLint config as plugin (#12763)
aduth Dec 12, 2018
6404578
4.7 (#12819)
youknowriad Dec 12, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Avoid getBlock in block-list/block (WordPress#11899)
* Avoid getBlock in block-list/block

* Update data docs

* Fix unit tests post rebase :)

* Rename props

* Clarify the filter position

* Avoid repeating the selector dependants

* Fix small typo in the docs

* Avoid rerending the current block if the previous block change (WordPress#12379)

* Avoid rerending the current block if the previous block change

* Always show the sibling inserter

* Optimize the insertion point component (WordPress#12384)

* Fix lock file

* Fix linting
  • Loading branch information
youknowriad authored Nov 30, 2018
commit 51e45baa7da6d43017bab9e5763e0c129c79ee0f
14 changes: 14 additions & 0 deletions docs/designers-developers/developers/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,20 @@ Returns whether a block is valid or not.

Is Valid.

### getBlockAttributes

Returns a block's attributes given its client ID, or null if no block exists with
the client ID.

*Parameters*

* state: Editor state.
* clientId: Block client ID.

*Returns*

Block attributes.

### getBlock

Returns a block given its client ID. This is a parsed copy of the block,
Expand Down
31 changes: 8 additions & 23 deletions docs/designers-developers/developers/filters/block-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,6 @@ wp.hooks.addFilter(
);
```

#### `blocks.isUnmodifiedDefaultBlock.attributes`

Used internally by the default block (paragraph) to exclude the attributes from the check if the block was modified.

#### `blocks.switchToBlockType.transformedBlock`

Used to filters an individual transform result from block transformation. All of the original blocks are passed, since transformations are many-to-many, not one-to-one.
Expand Down Expand Up @@ -198,19 +194,13 @@ _Example:_
```js
var el = wp.element.createElement;

var withDataAlign = wp.compose.createHigherOrderComponent( function( BlockListBlock ) {
var withClientIdClassName = wp.compose.createHigherOrderComponent( function( BlockListBlock ) {
return function( props ) {
var newProps = lodash.assign(
{},
props,
{
wrapperProps: lodash.assign(
{},
props.wrapperProps,
{
'data-align': props.block.attributes.align
}
)
classsName: "block-" + props.clientId,
}
);

Expand All @@ -219,27 +209,22 @@ var withDataAlign = wp.compose.createHigherOrderComponent( function( BlockListBl
newProps
);
};
}, 'withAlign' );
}, 'withClientIdClassName' );

wp.hooks.addFilter( 'editor.BlockListBlock', 'my-plugin/with-data-align', withDataAlign );
wp.hooks.addFilter( 'editor.BlockListBlock', 'my-plugin/with-client-id-class-name', withClientIdClassName );

```
{% ESNext %}
```js
const { createHigherOrderComponent } = wp.compose;

const withDataAlign = createHigherOrderComponent( ( BlockListBlock ) => {
const withClientIdClassName = createHigherOrderComponent( ( BlockListBlock ) => {
return ( props ) => {
const { align } = props.block.attributes;

let wrapperProps = props.wrapperProps;
wrapperProps = { ...wrapperProps, 'data-align': align };

return <BlockListBlock { ...props } wrapperProps={ wrapperProps } />;
return <BlockListBlock { ...props } className={ "block-" + props.clientId } />;
};
}, 'withDataAlign' );
}, 'withClientIdClassName' );

wp.hooks.addFilter( 'editor.BlockListBlock', 'my-plugin/with-data-align', withDataAlign );
wp.hooks.addFilter( 'editor.BlockListBlock', 'my-plugin/with-client-id-class-name', withClientIdClassName );
```

{% end %}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 4 additions & 9 deletions packages/blocks/src/api/utils.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
/**
* External dependencies
*/
import { every, has, keys, isEqual, isFunction, isString } from 'lodash';
import { every, has, isFunction, isString } from 'lodash';
import { default as tinycolor, mostReadable } from 'tinycolor2';

/**
* WordPress dependencies
*/
import { applyFilters } from '@wordpress/hooks';
import { Component, isValidElement } from '@wordpress/element';

/**
Expand Down Expand Up @@ -40,14 +39,10 @@ export function isUnmodifiedDefaultBlock( block ) {
}

const newDefaultBlock = createBlock( defaultBlockName );
const blockType = getBlockType( defaultBlockName );

const attributeKeys = applyFilters( 'blocks.isUnmodifiedDefaultBlock.attributes', [
...keys( newDefaultBlock.attributes ),
...keys( block.attributes ),
] );

return every( attributeKeys, ( key ) =>
isEqual( newDefaultBlock.attributes[ key ], block.attributes[ key ] )
return every( blockType.attributes, ( value, key ) =>
newDefaultBlock.attributes[ key ] === block.attributes[ key ]
);
}

Expand Down
36 changes: 21 additions & 15 deletions packages/editor/src/components/block-list/block-invalid-warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
createBlock,
rawHandler,
} from '@wordpress/blocks';
import { withDispatch } from '@wordpress/data';
import { compose } from '@wordpress/compose';
import { withDispatch, withSelect } from '@wordpress/data';

/**
* Internal dependencies
Expand Down Expand Up @@ -96,18 +97,23 @@ const blockToBlocks = ( block ) => rawHandler( {
HTML: block.originalContent,
} );

export default withDispatch( ( dispatch, { block } ) => {
const { replaceBlock } = dispatch( 'core/editor' );
export default compose( [
withSelect( ( select, { clientId } ) => ( {
block: select( 'core/editor' ).getBlock( clientId ),
} ) ),
withDispatch( ( dispatch, { block } ) => {
const { replaceBlock } = dispatch( 'core/editor' );

return {
convertToClassic() {
replaceBlock( block.clientId, blockToClassic( block ) );
},
convertToHTML() {
replaceBlock( block.clientId, blockToHTML( block ) );
},
convertToBlocks() {
replaceBlock( block.clientId, blockToBlocks( block ) );
},
};
} )( BlockInvalidWarning );
return {
convertToClassic() {
replaceBlock( block.clientId, blockToClassic( block ) );
},
convertToHTML() {
replaceBlock( block.clientId, blockToHTML( block ) );
},
convertToBlocks() {
replaceBlock( block.clientId, blockToBlocks( block ) );
},
};
} ),
] )( BlockInvalidWarning );
Loading