Skip to content

Commit

Permalink
Fix: make meta+A behaviour of selecting all blocks work on safari and…
Browse files Browse the repository at this point in the history
… firefox.

On safari and firefox isEntirelySelected( target ) called right after meta+A event is fired without releasing the meta key in the middle returns false but content gets selected anyway. If the target is editable it is safe to assume TinyMCE will make sure all content gets selected so in this cases we set the value to true without calling isEntirelySelected.
  • Loading branch information
jorgefilipecosta committed Aug 1, 2018
1 parent 25f364b commit 4503511
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/editor/src/components/writing-flow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ class WritingFlow extends Component {
}

// Set in case the meta key doesn't get released.
this.isEntirelySelected = isEntirelySelected( target );
// TinyMCE makes sure all content of the editable is select,
// but on some browsers (safari and firefox) calling isEntirelySelected right way still returns false.
// So to make sure we are compatible with this browsers we set is entirely selected to true
// after the first meta+a keypress assuming TinyMCE will make all content entirely selected.
this.isEntirelySelected = target.isContentEditable ? true : isEntirelySelected( target );
}

return;
Expand Down

0 comments on commit 4503511

Please sign in to comment.