Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add prop for disabling suggestions button
  • Loading branch information
fluiddot committed May 13, 2022
commit 34743a8a3f7868a43b7954a5f64b13fcfd93d1cb
1 change: 1 addition & 0 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ function removeNativeProps( props ) {
'minWidth',
'maxWidth',
'setRef',
'disableSuggestions',
] );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function RichTextWrapper(
maxWidth,
onBlur,
setRef,
disableSuggestions,
...props
},
forwardedRef
Expand Down Expand Up @@ -635,6 +636,7 @@ function RichTextWrapper(
maxWidth={ maxWidth }
onBlur={ onBlur }
setRef={ setRef }
disableSuggestions={ disableSuggestions }
// Props to be set on the editable container are destructured on the
// element itself for web (see below), but passed through rich text
// for native.
Expand Down
13 changes: 8 additions & 5 deletions packages/rich-text/src/component/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,7 @@ export class RichText extends Component {
baseGlobalStyles,
selectionStart,
selectionEnd,
disableSuggestions,
} = this.props;
const { currentFontSize } = this.state;

Expand Down Expand Up @@ -1230,11 +1231,13 @@ export class RichText extends Component {
onChange={ this.onFormatChange }
onFocus={ () => {} }
/>
<BlockFormatControls>
<ToolbarButtonWithOptions
options={ this.suggestionOptions() }
/>
</BlockFormatControls>
{ ! disableSuggestions && (
<BlockFormatControls>
<ToolbarButtonWithOptions
options={ this.suggestionOptions() }
/>
</BlockFormatControls>
) }
</>
) }
</View>
Expand Down