Skip to content

Commit

Permalink
Rename native editor onboarding properties for clarity (#32739)
Browse files Browse the repository at this point in the history
* Rename native editor onboarding properties for clarity

This rename allows for clearer naming both in this project and the
native apps.

* Revert unintended line removal

* Rename Android capability
  • Loading branch information
dcalhoun authored Jun 22, 2021
1 parent 4daab2c commit 9418b0d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
13 changes: 6 additions & 7 deletions packages/block-editor/src/components/inserter/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ import { store as blockEditorStore } from '../../store';
const VOICE_OVER_ANNOUNCEMENT_DELAY = 1000;

const defaultRenderToggle = ( {
canViewEditorOnboarding,
enableEditorOnboarding,
onToggle,
disabled,
style,
onLongPress,
} ) => (
<ToolbarButton
title={
canViewEditorOnboarding
enableEditorOnboarding
? __( 'Tap to add content' )
: __( 'Add block' )
}
Expand All @@ -51,7 +51,7 @@ const defaultRenderToggle = ( {
color={ style.color }
/>
}
showTooltip={ canViewEditorOnboarding }
showTooltip={ enableEditorOnboarding }
tooltipPosition="top right"
onClick={ onToggle }
extraProps={ {
Expand Down Expand Up @@ -200,7 +200,7 @@ export class Inserter extends Component {
*/
renderInserterToggle( { onToggle, isOpen } ) {
const {
canViewEditorOnboarding,
enableEditorOnboarding,
disabled,
renderToggle = defaultRenderToggle,
getStylesFromColorScheme,
Expand Down Expand Up @@ -247,7 +247,7 @@ export class Inserter extends Component {
return (
<>
{ renderToggle( {
canViewEditorOnboarding,
enableEditorOnboarding,
onToggle: onPress,
isOpen,
disabled,
Expand Down Expand Up @@ -378,8 +378,7 @@ export default compose( [
const insertionIndexEnd = endOfRootIndex;

return {
canViewEditorOnboarding: getBlockEditorSettings()
.canViewEditorOnboarding,
enableEditorOnboarding: getBlockEditorSettings().editorOnboarding,
destinationRootClientId,
insertionIndexDefault: getDefaultInsertionIndex(),
insertionIndexBefore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class GutenbergProps @JvmOverloads constructor(
val translations: Bundle,
val isDarkMode: Boolean,
val htmlModeEnabled: Boolean,
val canViewEditorOnboarding: Boolean
val enableEditorOnboarding: Boolean
) {

fun getInitialProps(bundle: Bundle?) = (bundle ?: Bundle()).apply {
Expand Down Expand Up @@ -49,7 +49,7 @@ data class GutenbergProps @JvmOverloads constructor(
putBoolean(PROP_CAPABILITIES_CAN_ENABLE_UNSUPPORTED_BLOCK_EDITOR, canEnableUnsupportedBlockEditor)
putBoolean(PROP_CAPABILITIES_IS_AUDIO_BLOCK_MEDIA_UPLOAD_ENABLED, isAudioBlockMediaUploadEnabled)
putBoolean(PROP_CAPABILITIES_REUSABLE_BLOCK, enableReusableBlock)
putBoolean(PROP_CAPABILITIES_CAN_VIEW_EDITOR_ONBOARDING, canViewEditorOnboarding)
putBoolean(PROP_CAPABILITIES_EDITOR_ONBOARDING, enableEditorOnboarding)
}

companion object {
Expand Down Expand Up @@ -80,6 +80,6 @@ data class GutenbergProps @JvmOverloads constructor(
const val PROP_CAPABILITIES_CAN_ENABLE_UNSUPPORTED_BLOCK_EDITOR = "canEnableUnsupportedBlockEditor"
const val PROP_CAPABILITIES_IS_AUDIO_BLOCK_MEDIA_UPLOAD_ENABLED = "isAudioBlockMediaUploadEnabled"
const val PROP_CAPABILITIES_REUSABLE_BLOCK = "reusableBlock"
const val PROP_CAPABILITIES_CAN_VIEW_EDITOR_ONBOARDING = "canViewEditorOnboarding"
const val PROP_CAPABILITIES_EDITOR_ONBOARDING = "editorOnboarding"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public enum Capabilities: String {
case canEnableUnsupportedBlockEditor
case isAudioBlockMediaUploadEnabled
case reusableBlock
case canViewEditorOnboarding
case editorOnboarding
}

/// Wrapper for single block data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected Bundle getLaunchOptions() {
capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR, true);
capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_REUSABLE_BLOCK, false);
capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_IS_AUDIO_BLOCK_MEDIA_UPLOAD_ENABLED, true);
capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_CAN_VIEW_EDITOR_ONBOARDING, false);
capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_EDITOR_ONBOARDING, false);
bundle.putBundle(GutenbergProps.PROP_CAPABILITIES, capabilities);
return bundle;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ extension GutenbergViewController: GutenbergBridgeDataSource {
.mediaFilesCollectionBlock: true,
.isAudioBlockMediaUploadEnabled: true,
.reusableBlock: false,
.canViewEditorOnboarding: false
.editorOnboarding: false
]
}

Expand Down

0 comments on commit 9418b0d

Please sign in to comment.