diff --git a/examples/toolbar/js/FormatToolbar.js b/examples/toolbar/js/FormatToolbar.js index d9517f7c43..948a4a1335 100644 --- a/examples/toolbar/js/FormatToolbar.js +++ b/examples/toolbar/js/FormatToolbar.js @@ -45,6 +45,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; @@ -82,6 +83,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;