diff --git a/blocks/editable/format-toolbar/index.js b/blocks/editable/format-toolbar/index.js index 49a45ab9f8f376..af0d89b4ef3f9f 100644 --- a/blocks/editable/format-toolbar/index.js +++ b/blocks/editable/format-toolbar/index.js @@ -12,7 +12,6 @@ import { keycodes } from '@wordpress/utils'; import './style.scss'; import UrlInput from '../../url-input'; import { filterURLForDisplay } from '../../../editor/utils/url'; -import ToggleControl from '../../inspector-controls/toggle-control'; const { ESCAPE, LEFT, RIGHT, UP, DOWN } = keycodes; @@ -48,11 +47,10 @@ const stopKeyPropagation = ( event ) => event.stopPropagation(); class FormatToolbar extends Component { constructor() { super( ...arguments ); + this.state = { isAddingLink: false, isEditingLink: false, - settingsVisible: false, - opensInNewWindow: false, newLinkValue: '', }; @@ -62,8 +60,6 @@ class FormatToolbar extends Component { this.submitLink = this.submitLink.bind( this ); this.onKeyDown = this.onKeyDown.bind( this ); this.onChangeLinkValue = this.onChangeLinkValue.bind( this ); - this.toggleLinkSettingsVisibility = this.toggleLinkSettingsVisibility.bind( this ); - this.setLinkTarget = this.setLinkTarget.bind( this ); } onKeyDown( event ) { @@ -83,8 +79,6 @@ class FormatToolbar extends Component { this.setState( { isAddingLink: false, isEditingLink: false, - settingsVisible: false, - opensInNewWindow: !! nextProps.formats.link && !! nextProps.formats.link.target, newLinkValue: '', } ); } @@ -102,16 +96,6 @@ class FormatToolbar extends Component { }; } - toggleLinkSettingsVisibility() { - this.setState( ( state ) => ( { settingsVisible: ! state.settingsVisible } ) ); - } - - setLinkTarget( event ) { - const opensInNewWindow = event.target.checked; - this.setState( { opensInNewWindow } ); - this.props.onChange( { link: { value: this.props.formats.link.value, target: opensInNewWindow ? '_blank' : '' } } ); - } - addLink() { this.setState( { isEditingLink: false, isAddingLink: true, newLinkValue: '' } ); } @@ -128,7 +112,7 @@ class FormatToolbar extends Component { submitLink( event ) { event.preventDefault(); - this.props.onChange( { link: { value: this.state.newLinkValue, target: this.state.opensInNewWindow ? '_blank' : '' } } ); + this.props.onChange( { link: { value: this.state.newLinkValue } } ); if ( this.state.isAddingLink ) { this.props.speak( __( 'Link added.' ), 'assertive' ); } @@ -140,7 +124,7 @@ class FormatToolbar extends Component { render() { const { formats, focusPosition, enabledControls = DEFAULT_CONTROLS, customControls = [] } = this.props; - const { isAddingLink, isEditingLink, newLinkValue, settingsVisible, opensInNewWindow } = this.state; + const { isAddingLink, isEditingLink, newLinkValue } = this.state; const linkStyle = focusPosition ? { position: 'absolute', ...focusPosition } : null; @@ -156,15 +140,6 @@ class FormatToolbar extends Component { }; } ); - const linkSettings = settingsVisible && ( -