Skip to content

Commit

Permalink
Rnmobile/fix link editing on start (#17631)
Browse files Browse the repository at this point in the history
* Don't try to clear links if text is clean.

* Commented LinkUI removal test when no URL.

* Don't try to remove link if we are at start of link and no actual selection is
  • Loading branch information
SergioEstevao committed Oct 1, 2019
1 parent aeaf0a8 commit cf8e9f6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/format-library/src/link/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,15 @@ export const link = {
}

onRemoveFormat() {
const { onChange, speak } = this.props;
const { onChange, speak, value } = this.props;
const startFormat = getActiveFormat( value, 'core/link' );

// If the previous position from start doesn't have the link is because we are at the start
const linkStart = ! find( value.formats[ value.start - 1 ], startFormat );
if ( linkStart && isCollapsed( value ) ) {
return;
}

const linkSelection = this.getLinkSelection();

onChange( removeFormat( linkSelection, name ) );
Expand Down

0 comments on commit cf8e9f6

Please sign in to comment.