Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { hasFeatures, onChangeSectionAction, section } = this.props
const isBlockquote = block === 'blockquote'
const hasBlockquote = clone(section.body).includes('<blockquote>')
if (!hasFeatures && isBlockquote) {
return 'handled'
}
if (hasFeatures && isBlockquote) {
if (hasBlockquote) {
onChangeSectionAction('layout', null)
} else {
return this.toggleBlockQuote()
}
}
this.onChange(RichUtils.toggleBlockType(editorState, block))
this.setState({ showMenu: false })
return 'handled'
}
</blockquote>
toggleBlock(type: string, e: Event) {
const { editorState } = this.state
this.onChange(RichUtils.toggleBlockType(editorState, type))
e.preventDefault()
}
const toggleBlockType = (blockType: string) => {
setEditorState(
RichUtils.toggleBlockType(
editorState,
blockType
)
)
}
_toggleBlockType(blockType) {
this.onChange(
RichUtils.toggleBlockType(
this.props.editorState,
blockType
)
);
}
var toggleBlockType = function toggleBlockType() {
return setEditorState(RichUtils.toggleBlockType(editorState, blockType));
};
applyBlockTypeControl (type) {
this.props.onChange(RichUtils.toggleBlockType(this.props.editorState, type))
}
const handleClearFormat = () => {
const selectionInfo = getSelectionInfo(editorState)
let newEditorState = editorState
selectionInfo.inlineStyle.forEach((effect) => {
if (effect) {
newEditorState = RichUtils.toggleInlineStyle(newEditorState, effect)
}
})
newEditorState = RichUtils.toggleBlockType(newEditorState, selectionInfo.blockType)
setEditorState(newEditorState)
}
toggleBlockType = blockType => {
this.onChange(
RichUtils.toggleBlockType(
this.state.editorState,
blockType
)
);
}
_toggleBlockType(blockType) {
this.onChange(
RichUtils.toggleBlockType(
this.state.editorState,
blockType
)
);
}
_handleToggleBlockType = (blockType) => {
this._handleChange(
RichUtils.toggleBlockType(
this.state.editorState,
blockType
)
)
}