Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
fix(FormattingToolbar): keep selection on double click - I199
Browse files Browse the repository at this point in the history
Signed-off-by: irmerk <[email protected]>
  • Loading branch information
jolanglinais committed Nov 22, 2019
1 parent 023b91d commit a6cca7e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/FormattingToolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ export default class FormatToolbar extends React.Component {
const { document, selection } = value;
const isLinkBool = action.hasLinks(this.props.editor);
const selectedInlineHref = document.getClosestInline(selection.anchor.path);
const selectedText = this.props.editor.value.document
.getFragmentAtRange(this.props.editor.value.selection).text;

return (
<Ref innerRef={(node) => {
Expand All @@ -385,7 +387,7 @@ export default class FormatToolbar extends React.Component {
placeholder='Text'
name='text'
defaultValue={
isLinkBool
(isLinkBool && !selectedText)
? this.props.editor.value.focusText.text
: this.props.editor.value.fragment.text
}
Expand Down

0 comments on commit a6cca7e

Please sign in to comment.