-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more information to unsupported blocks on native (#14577)
* Expose required methods for better unsupported blocks * Show unsupported block title/icon when possible * Remove native variant of editor package * Refactor mobile blocks to fix circle dependencies * Fix styles for unsupported block * Remove UnsupportedBlock in favor of core/missing
- Loading branch information
Showing
24 changed files
with
157 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { View, Text } from 'react-native'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Icon } from '@wordpress/components'; | ||
import { coreBlocks } from '@wordpress/block-library'; | ||
import { normalizeIconObject } from '@wordpress/blocks'; | ||
import { Component } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './style.scss'; | ||
|
||
export default class UnsupportedBlockEdit extends Component { | ||
render() { | ||
const { originalName } = this.props.attributes; | ||
const blockType = coreBlocks[ originalName ]; | ||
const title = blockType ? blockType.settings.title : __( 'Unsupported' ); | ||
const icon = blockType ? normalizeIconObject( blockType.settings.icon ) : 'admin-plugins'; | ||
|
||
return ( | ||
<View style={ styles.unsupportedBlock }> | ||
<Icon className="unsupported-icon" icon={ icon && icon.src ? icon.src : icon } /> | ||
<Text style={ styles.unsupportedBlockMessage }>{ title }</Text> | ||
</View> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,8 @@ | |
color: #87a6bc; | ||
fill: currentColor; | ||
} | ||
|
||
.unsupported-icon { | ||
color: $gray-dark; | ||
fill: currentColor; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import * as UnsupportedBlock from './mobile/unsupported-block'; | ||
|
||
// Post Related Components | ||
export { default as PostTitle } from './post-title'; | ||
export { default as EditorHistoryRedo } from './editor-history/redo'; | ||
export { default as EditorHistoryUndo } from './editor-history/undo'; | ||
export { default as BottomSheet } from './mobile/bottom-sheet'; | ||
export { default as Picker } from './mobile/picker'; | ||
|
||
// Mobile Editor Related Components | ||
export { UnsupportedBlock }; | ||
|
||
export * from './deprecated'; |
24 changes: 0 additions & 24 deletions
24
packages/editor/src/components/mobile/unsupported-block/edit.js
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
packages/editor/src/components/mobile/unsupported-block/index.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters