Skip to content
This repository was archived by the owner on Jul 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion gutenberg
Submodule gutenberg updated 75 files
+10 −1 docs/designers-developers/developers/data/data-core-blocks.md
+14 −0 docs/designers-developers/developers/data/data-core-editor.md
+24 −25 docs/designers-developers/developers/filters/block-filters.md
+1 −1 gutenberg.php
+7 −7 package-lock.json
+1 −1 package.json
+4 −0 packages/block-library/CHANGELOG.md
+1 −1 packages/block-library/package.json
+0 −1 packages/block-library/src/button/test/__snapshots__/index.js.snap
+1 −1 packages/block-library/src/categories/index.php
+0 −1 packages/block-library/src/heading/test/__snapshots__/index.js.snap
+0 −1 packages/block-library/src/list/test/__snapshots__/index.js.snap
+0 −1 packages/block-library/src/paragraph/test/__snapshots__/index.js.snap
+0 −1 packages/block-library/src/preformatted/test/__snapshots__/index.js.snap
+0 −1 packages/block-library/src/pullquote/test/__snapshots__/index.js.snap
+0 −1 packages/block-library/src/quote/test/__snapshots__/index.js.snap
+0 −2 packages/block-library/src/text-columns/test/__snapshots__/index.js.snap
+0 −1 packages/block-library/src/verse/test/__snapshots__/index.js.snap
+2 −0 packages/block-serialization-default-parser/CHANGELOG.md
+1 −1 packages/block-serialization-default-parser/package.json
+7 −1 packages/block-serialization-default-parser/parser.php
+44 −2 packages/block-serialization-default-parser/src/index.js
+2 −0 packages/block-serialization-spec-parser/CHANGELOG.md
+1 −1 packages/block-serialization-spec-parser/package.json
+9 −0 packages/block-serialization-spec-parser/shared-tests.js
+2 −0 packages/blocks/CHANGELOG.md
+1 −1 packages/blocks/package.json
+10 −0 packages/blocks/src/api/categories.js
+1 −0 packages/blocks/src/api/index.js
+4 −9 packages/blocks/src/api/utils.js
+16 −0 packages/blocks/src/store/actions.js
+31 −4 packages/blocks/src/store/reducer.js
+83 −0 packages/blocks/src/store/test/reducer.js
+2 −0 packages/components/CHANGELOG.md
+1 −1 packages/components/package.json
+4 −0 packages/edit-post/CHANGELOG.md
+505 −0 packages/edit-post/README.md
+1 −1 packages/edit-post/package.json
+0 −431 packages/edit-post/src/README.md
+35 −0 packages/edit-post/src/components/header/plugin-more-menu-item/index.js
+44 −0 packages/edit-post/src/components/header/plugin-more-menu-item/test/__snapshots__/index.js.snap
+54 −0 packages/edit-post/src/components/header/plugin-more-menu-item/test/index.js
+9 −14 packages/edit-post/src/components/header/plugin-sidebar-more-menu-item/index.js
+1 −0 packages/edit-post/src/components/options-modal/index.js
+4 −0 packages/edit-post/src/components/options-modal/test/__snapshots__/index.js.snap
+4 −2 packages/edit-post/src/components/sidebar/post-link/index.js
+4 −0 packages/edit-post/src/editor.js
+1 −1 packages/edit-post/src/hooks/validate-multiple-use/index.js
+1 −0 packages/edit-post/src/index.js
+17 −0 packages/edit-post/src/prevent-event-discovery.js
+5 −1 packages/editor/CHANGELOG.md
+1 −1 packages/editor/package.json
+21 −15 packages/editor/src/components/block-list/block-invalid-warning.js
+169 −120 packages/editor/src/components/block-list/block.js
+22 −29 packages/editor/src/components/block-list/insertion-point.js
+75 −0 packages/editor/src/components/default-block-appender/index.native.js
+14 −0 packages/editor/src/components/default-block-appender/style.native.scss
+1 −0 packages/editor/src/components/index.native.js
+12 −21 packages/editor/src/components/rich-text/index.js
+5 −2 packages/editor/src/components/rich-text/tinymce.js
+5 −6 packages/editor/src/hooks/align.js
+9 −15 packages/editor/src/hooks/test/align.js
+34 −10 packages/editor/src/store/selectors.js
+4 −0 packages/format-library/CHANGELOG.md
+1 −1 packages/format-library/package.json
+2 −0 packages/list-reusable-blocks/CHANGELOG.md
+1 −1 packages/list-reusable-blocks/package.json
+2 −0 packages/nux/CHANGELOG.md
+1 −1 packages/nux/package.json
+6 −0 packages/rich-text/CHANGELOG.md
+15 −3 packages/rich-text/src/create-element.js
+2 −2 packages/rich-text/src/test/to-dom.js
+12 −4 packages/rich-text/src/to-dom.js
+1 −1 test/e2e/specs/adding-inline-tokens.test.js
+35 −0 test/e2e/specs/sidebar-permalink-panel.test.js
5 changes: 3 additions & 2 deletions src/app/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ describe( 'App', () => {
.forEach( ( blockHolder ) => {
if ( 'core/code' === blockHolder.props.name ) {
// TODO: hardcoded indices are ugly and error prone. Can we do better here?
const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ];
const blockHolderContainer = blockHolder.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
const contentComponent = blockHolderContainer.children[ 0 ];
const inputComponent =
contentComponent.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ]
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];
.children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ].children[ 0 ];

expect( inputComponent.type ).toBe( 'TextInput' );
}
} );
Expand Down
1 change: 1 addition & 0 deletions src/app/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class AppContainer extends React.Component<PropsType> {
render() {
return (
<MainApp
rootClientId={ this.props.rootClientId }
blocks={ this.props.blocks }
showHtml={ this.props.showHtml }
onChange={ this.onChange }
Expand Down
48 changes: 38 additions & 10 deletions src/block-management/block-holder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import React from 'react';
import { View, Text, TouchableWithoutFeedback } from 'react-native';
import InlineToolbar from './inline-toolbar';

import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';

import type { BlockType } from '../store/types';

import styles from './block-holder.scss';
Expand All @@ -15,20 +18,21 @@ import styles from './block-holder.scss';
import { BlockEdit } from '@wordpress/editor';

type PropsType = BlockType & {
isSelected: boolean,
showTitle: boolean,
onChange: ( clientId: string, attributes: mixed ) => void,
onReplace: ( blocks: Array<Object> ) => void,
onInlineToolbarButtonPressed: ( button: number, clientId: string ) => void,
onBlockHolderPressed: ( clientId: string ) => void,
onSelect: void => void,
insertBlocksAfter: ( blocks: Array<Object> ) => void,
mergeBlocks: ( forward: boolean ) => void,
canMoveUp: boolean,
canMoveDown: boolean,
};

export default class BlockHolder extends React.Component<PropsType> {
export class BlockHolder extends React.Component<PropsType> {
renderToolbarIfBlockFocused() {
if ( this.props.focused ) {
if ( this.props.isSelected ) {
return (
<InlineToolbar
clientId={ this.props.clientId }
Expand All @@ -47,16 +51,16 @@ export default class BlockHolder extends React.Component<PropsType> {
return (
<BlockEdit
name={ this.props.name }
isSelected={ this.props.isSelected }
attributes={ { ...this.props.attributes } }
// pass a curried version of onChanged with just one argument
setAttributes={ ( attrs ) =>
this.props.onChange( this.props.clientId, { ...this.props.attributes, ...attrs } )
}
onFocus={ this.props.onBlockHolderPressed.bind( this, this.props.clientId ) }
onFocus={ this.props.onSelect }
onReplace={ this.props.onReplace }
insertBlocksAfter={ this.props.insertBlocksAfter }
mergeBlocks={ this.props.mergeBlocks }
isSelected={ this.props.focused }
/>
);
}
Expand All @@ -73,15 +77,39 @@ export default class BlockHolder extends React.Component<PropsType> {
const { focused } = this.props;

return (
<TouchableWithoutFeedback
onPress={ this.props.onBlockHolderPressed.bind( this, this.props.clientId ) }
>
<TouchableWithoutFeedback onPress={ this.props.onSelect } >
<View style={ [ styles.blockHolder, focused && styles.blockHolderFocused ] }>
{ this.props.showTitle && this.renderBlockTitle() }
<View style={ styles.blockContainer }>{ this.getBlockForType.bind( this )() }</View>
{ this.renderToolbarIfBlockFocused.bind( this )() }
<View style={ styles.blockContainer }>{ this.getBlockForType() }</View>
{ this.renderToolbarIfBlockFocused() }
</View>
</TouchableWithoutFeedback>
);
}
}

export default compose( [
withSelect( ( select, { clientId } ) => {
const {
isBlockSelected,
} = select( 'core/editor' );
const isSelected = isBlockSelected( clientId );

return {
isSelected,
};
} ),
withDispatch( ( dispatch, { clientId } ) => {
const {
clearSelectedBlock,
selectBlock,
} = dispatch( 'core/editor' );

return {
onSelect: () => {
clearSelectedBlock();
selectBlock( clientId );
},
};
} ),
] )( BlockHolder );
6 changes: 4 additions & 2 deletions src/block-management/block-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ import KeyboardAvoidingView from '../components/keyboard-avoiding-view';

// Gutenberg imports
import { createBlock } from '@wordpress/blocks';
import { DefaultBlockAppender } from '@wordpress/editor';

import EventEmitter from 'events';

const keyboardDidShow = 'keyboardDidShow';
const keyboardDidHide = 'keyboardDidHide';

export type BlockListType = {
rootClientId: ?string,
onChange: ( clientId: string, attributes: mixed ) => void,
focusBlockAction: string => void,
moveBlockUpAction: string => mixed,
Expand Down Expand Up @@ -211,6 +214,7 @@ export default class BlockManager extends React.Component<PropsType, StateType>
);
return (
<KeyboardAvoidingView style={ { flex: 1 } } parentHeight={ this.state.rootViewHeight }>
<DefaultBlockAppender rootClientId={ this.props.rootClientId } />
{ list }
<BlockToolbar
onInsertClick={ () => {
Expand Down Expand Up @@ -272,10 +276,8 @@ export default class BlockManager extends React.Component<PropsType, StateType>
<BlockHolder
key={ value.item.clientId }
onInlineToolbarButtonPressed={ this.onInlineToolbarButtonPressed }
onBlockHolderPressed={ this.props.focusBlockAction }
onChange={ this.props.onChange }
showTitle={ false }
focused={ value.item.focused }
clientId={ value.item.clientId }
canMoveUp={ canMoveUp }
canMoveDown={ canMoveDown }
Expand Down