Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
fix(TCMention): add autoHideOnBlurDelay to options
Browse files Browse the repository at this point in the history
* closes #3
  • Loading branch information
tomchentw committed Nov 11, 2015
1 parent 6ea3a7c commit 2227777
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,16 @@ export const TCMention = MediumEditor.Extension.extend({
"@": `medium-editor-mention-at`,
},

autoHideOnBlurDelay: 300,

init () {
this.mentionPanel = this.createPanel();

this.getEditorOption(`elementsContainer`).appendChild(this.mentionPanel);

this.subscribe(`editableKeydown`, ::this.handleKeydown);
this.subscribe(`editableBlur`, ::this.handleBlur);
this.subscribe(`focus`, ::this.handleFocus);
//
// instance variables
this.trigger = null;
Expand Down Expand Up @@ -159,7 +162,11 @@ Your mention implementation
},

handleBlur (event) {
this.hidePanel();
this.autoHideTimeoutId = setTimeout(::this.hidePanel, this.autoHideOnBlurDelay);
},

handleFocus (event) {
clearTimeout(this.autoHideTimeoutId);
},

handleTriggerKeydown (trigger, event) {
Expand Down

0 comments on commit 2227777

Please sign in to comment.