Skip to content

Commit

Permalink
fixes w3c#987
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad96 committed Apr 18, 2020
1 parent d8ad791 commit 24e84b2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/toolbar/js/FormatToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ FormatToolbar.prototype.init = function () {
this.textarea.style.width = (this.domNode.getBoundingClientRect().width - 12) + 'px';
this.textarea.addEventListener('mouseup', this.selectTextContent.bind(this));
this.textarea.addEventListener('keyup', this.selectTextContent.bind(this));
this.domNode.addEventListener('click', this.handleContainerClick.bind(this));

this.selected = this.textarea.selectText;

Expand Down Expand Up @@ -80,6 +81,11 @@ FormatToolbar.prototype.init = function () {

};

FormatToolbar.prototype.handleContainerClick = function () {
if ( event.target !== this.domNode ) return;
this.setFocusToFirst();
}

FormatToolbar.prototype.selectTextContent = function () {
this.start = this.textarea.selectionStart;
this.end = this.textarea.selectionEnd;
Expand Down

0 comments on commit 24e84b2

Please sign in to comment.