Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f8205a3
move FloatingToolbar to slot-fill architecture
jbinda Apr 6, 2020
0013805
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 6, 2020
f402102
handle proper FloatingToolbar positioning iOS vs Android
jbinda Apr 7, 2020
65340a0
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 9, 2020
79bbb22
fix crash after ungroup or delete block
jbinda Apr 9, 2020
a6095f9
support RTL mode by rotate the icons
jbinda Apr 9, 2020
33a2144
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 14, 2020
e157822
changes after code review
jbinda Apr 15, 2020
89a4f25
move FloatingToolbar to packages/components/src/mobile
jbinda Apr 15, 2020
10b1514
fix lint
jbinda Apr 15, 2020
b6119de
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 16, 2020
f0d2ee9
render FloatingToolbar top on Android bottom on iOS
jbinda Apr 17, 2020
a54973e
apply additional offset to autoscroll on iOS
jbinda Apr 17, 2020
d4c27da
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 17, 2020
64b3718
remove slot-fill architecture from FloatingToolbar
jbinda Apr 17, 2020
7125104
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 17, 2020
f094e64
clean code
jbinda Apr 17, 2020
a976441
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 17, 2020
5f531df
move floating toolbar to block-edit package
jbinda Apr 17, 2020
0e87503
fix lint
jbinda Apr 17, 2020
c80f543
adjust style of FLoatingToolbar
jbinda Apr 20, 2020
16fd886
code review changes
jbinda Apr 20, 2020
66f6ea8
Merge remote-tracking branch 'origin/master' into rnmobile/feat/fixed…
jbinda Apr 20, 2020
8cfd7ff
fix backgroundColor on Android
jbinda Apr 21, 2020
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: 2 additions & 0 deletions packages/base-styles/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ $admin-sidebar-width-collapsed: 36px;
$modal-min-width: 360px;
$spinner-size: 18px;
$mobile-header-toolbar-height: 44px;
$mobile-floating-toolbar-height: 44px;
$mobile-floating-toolbar-margin: 8px;


/**
Expand Down

This file was deleted.

This file was deleted.

33 changes: 0 additions & 33 deletions packages/block-editor/src/components/block-list/block.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import { View, Text, TouchableWithoutFeedback } from 'react-native';
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { ToolbarButton, Toolbar } from '@wordpress/components';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose, withPreferredColorScheme } from '@wordpress/compose';
import {
getBlockType,
__experimentalGetAccessibleBlockLabel as getAccessibleBlockLabel,
} from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand All @@ -23,9 +21,6 @@ import styles from './block.scss';
import BlockEdit from '../block-edit';
import BlockInvalidWarning from './block-invalid-warning';
import BlockMobileToolbar from '../block-mobile-toolbar';
import FloatingToolbar from './block-mobile-floating-toolbar';
import Breadcrumbs from './breadcrumb';
import NavigateUpSVG from './nav-up-icon';

class BlockListBlock extends Component {
constructor() {
Expand Down Expand Up @@ -91,15 +86,11 @@ class BlockListBlock extends Component {
isValid,
order,
title,
parentId,
isDimmed,
isTouchable,
onDeleteBlock,
isStackedHorizontally,
hasParent,
isParentSelected,
onSelect,
showFloatingToolbar,
getStylesFromColorScheme,
marginVertical,
marginHorizontal,
Expand All @@ -124,21 +115,6 @@ class BlockListBlock extends Component {
style={ { flex: 1 } }
accessibilityLabel={ accessibilityLabel }
>
{ showFloatingToolbar && (
<FloatingToolbar>
{ hasParent && (
<Toolbar passedStyle={ styles.toolbar }>
<ToolbarButton
title={ __( 'Navigate Up' ) }
onClick={ () => onSelect( parentId ) }
icon={ NavigateUpSVG }
/>
<View style={ styles.pipe } />
</Toolbar>
) }
<Breadcrumbs clientId={ clientId } />
</FloatingToolbar>
) }
<View
pointerEvents={ isTouchable ? 'auto' : 'box-only' }
accessibilityLabel={ accessibilityLabel }
Expand Down Expand Up @@ -203,7 +179,6 @@ export default compose( [
__unstableGetBlockWithoutInnerBlocks,
getBlockHierarchyRootClientId,
getSelectedBlockClientId,
getBlock,
getBlockRootClientId,
getLowestCommonAncestorWithSelectedBlock,
getBlockParents,
Expand All @@ -224,10 +199,6 @@ export default compose( [
const parentId = parents[ 0 ] || '';

const rootBlockId = getBlockHierarchyRootClientId( clientId );
const rootBlock = getBlock( rootBlockId );
const hasRootInnerBlocks = rootBlock.innerBlocks.length !== 0;

const showFloatingToolbar = isSelected && hasRootInnerBlocks;

const selectedBlockClientId = getSelectedBlockClientId();

Expand All @@ -239,7 +210,6 @@ export default compose( [
? parents[ commonAncestorIndex ]
: parents[ parents.length - 1 ];

const hasParent = !! parentId;
const isParentSelected =
selectedBlockClientId && selectedBlockClientId === parentId;
const isAncestorSelected =
Expand Down Expand Up @@ -277,14 +247,11 @@ export default compose( [
isSelected,
isInnerBlockSelected,
isValid,
parentId,
isParentSelected,
firstToSelectId,
hasParent,
isAncestorSelected,
isTouchable,
isDimmed,
showFloatingToolbar,
};
} ),
withDispatch( ( dispatch, ownProps, { select } ) => {
Expand Down
17 changes: 0 additions & 17 deletions packages/block-editor/src/components/block-list/block.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,6 @@
min-height: 50px;
}

.toolbar {
border-left-width: 0;
margin-right: auto;
padding-left: 2px;
height: 44px;
}

.pipe {
margin-top: auto;
margin-bottom: auto;
margin-left: 2px;
height: 28px;
width: 1px;
background-color: #e9eff3;
opacity: 0.4;
}

.neutralToolbar {
margin-left: -$block-edge-to-content;
margin-right: -$block-edge-to-content;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getBlockType } from '@wordpress/blocks';
/**
* External dependencies
*/
import { View, Text, TouchableOpacity } from 'react-native';
import { View, Text, TouchableOpacity, I18nManager } from 'react-native';

/**
* Internal dependencies
Expand Down Expand Up @@ -50,7 +50,10 @@ const BlockBreadcrumb = ( {
fill={ styles.icon.color }
/>,
<View key="subdirectory-icon" style={ styles.arrow }>
<SubdirectorSVG fill={ styles.arrow.color } />
<SubdirectorSVG
fill={ styles.arrow.color }
isRTL={ I18nManager.isRTL }
/>
</View>,
] }
<Icon
Expand Down Expand Up @@ -79,7 +82,7 @@ export default compose( [

const blockName = getBlockName( clientId );
const blockType = getBlockType( blockName );
const blockIcon = blockType.icon;
const blockIcon = blockType ? blockType.icon : {};

const rootClientId = getBlockRootClientId( clientId );

Expand All @@ -91,7 +94,7 @@ export default compose( [
}
const rootBlockName = getBlockName( rootClientId );
const rootBlockType = getBlockType( rootBlockName );
const rootBlockIcon = rootBlockType.icon;
const rootBlockIcon = rootBlockType ? rootBlockType.icon : {};

return {
clientId,
Expand Down
25 changes: 23 additions & 2 deletions packages/block-editor/src/components/block-list/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,17 @@ export class BlockList extends Component {
shouldShowInsertionPointAfter,
marginVertical = styles.defaultBlock.marginTop,
marginHorizontal = styles.defaultBlock.marginLeft,
isFloatingToolbarVisible,
isStackedHorizontally,
horizontalAlignment,
} = this.props;

const { blockToolbar, blockBorder, headerToolbar } = styles;
const {
blockToolbar,
blockBorder,
headerToolbar,
floatingToolbar,
} = styles;

const forceRefresh =
shouldShowInsertionPointBefore || shouldShowInsertionPointAfter;
Expand All @@ -134,7 +140,12 @@ export class BlockList extends Component {
extraScrollHeight={
blockToolbar.height + blockBorder.width
}
inputAccessoryViewHeight={ headerToolbar.height }
inputAccessoryViewHeight={
headerToolbar.height +
( isFloatingToolbarVisible
? floatingToolbar.height
: 0 )
}
Comment on lines +144 to +148

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will add additional space for FloatingToolbar when autoscroll to text base blocks

keyboardShouldPersistTaps="always"
scrollViewStyle={ [
{ flex: isRootList ? 1 : 0 },
Expand Down Expand Up @@ -274,6 +285,7 @@ export default compose( [
getBlockInsertionPoint,
isBlockInsertionPointVisible,
getSettings,
getBlockHierarchyRootClientId,
} = select( 'core/block-editor' );

const isStackedHorizontally =
Expand Down Expand Up @@ -308,6 +320,14 @@ export default compose( [

const isReadOnly = getSettings().readOnly;

const rootBlockId = getBlockHierarchyRootClientId(
selectedBlockClientId
);
const hasRootInnerBlocks = !! getBlockCount( rootBlockId );

const isFloatingToolbarVisible =
!! selectedBlockClientId && hasRootInnerBlocks;

return {
blockClientIds,
blockCount: getBlockCount( rootClientId ),
Expand All @@ -317,6 +337,7 @@ export default compose( [
selectedBlockClientId,
isReadOnly,
isRootList: rootClientId === undefined,
isFloatingToolbarVisible,
isStackedHorizontally,
};
} ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@
height: $mobile-block-toolbar-height;
}

.floatingToolbar {
height: $mobile-floating-toolbar-height + 2 * $mobile-floating-toolbar-margin;
}

.horizontal {
flex-direction: row;
flex-wrap: wrap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
*/
import { SVG, Path } from '@wordpress/components';

const Subdirectory = ( { ...extraProps } ) => (
const Subdirectory = ( { isRTL, ...extraProps } ) => (
<SVG
xmlns="http://www.w3.org/2000/svg"
width={ 14 }
height={ 14 }
viewBox="0 0 20 20"
{ ...extraProps }
>
<Path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" />
<Path
d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z"
transform={ isRTL ? 'scale(-1,1) translate(-20,0)' : undefined }
/>
</SVG>
);
export default Subdirectory;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.floatingToolbarOffset {
top: 0;
margin-top: 8px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.floatingToolbarOffset {
top: - ($mobile-floating-toolbar-height + $mobile-floating-toolbar-margin);
}
Loading