diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-10-13 18:36:58 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-10-13 18:36:58 +0200 |
commit | 8bbc69616f91e9d09302d8a00f845b74e37d535f (patch) | |
tree | 50519e1012c6aaa06a502aca48ed7f6b4fa5398f /client/components/main | |
parent | e504ac28940f614652f8e414aa0a67f60985bb89 (diff) | |
download | wekan-8bbc69616f91e9d09302d8a00f845b74e37d535f.tar.gz wekan-8bbc69616f91e9d09302d8a00f845b74e37d535f.tar.bz2 wekan-8bbc69616f91e9d09302d8a00f845b74e37d535f.zip |
Abstract the jquery-textcomplete integration with EscapeActions
We now can re-use this integration in multiple places, this will be
useful for #342 for instance.
Diffstat (limited to 'client/components/main')
-rw-r--r-- | client/components/main/editor.js | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/client/components/main/editor.js b/client/components/main/editor.js index 1d88fe74..67b65bec 100644 --- a/client/components/main/editor.js +++ b/client/components/main/editor.js @@ -1,11 +1,9 @@ -let dropdownMenuIsOpened = false; - Template.editor.onRendered(() => { const $textarea = this.$('textarea'); autosize($textarea); - $textarea.textcomplete([ + $textarea.escapeableTextComplete([ // Emojies { match: /\B:([\-+\w]*)$/, @@ -44,30 +42,8 @@ Template.editor.onRendered(() => { index: 1, }, ]); - - // Since commit d474017 jquery-textComplete automatically closes a potential - // opened dropdown menu when the user press Escape. This behavior conflicts - // with our EscapeActions system, but it's too complicated and hacky to - // monkey-pach textComplete to disable it -- I tried. Instead we listen to - // 'open' and 'hide' events, and create a ghost escapeAction when the dropdown - // is opened (and rely on textComplete to execute the actual action). - $textarea.on({ - 'textComplete:show'() { - dropdownMenuIsOpened = true; - }, - 'textComplete:hide'() { - Tracker.afterFlush(() => { - dropdownMenuIsOpened = false; - }); - }, - }); }); -EscapeActions.register('textcomplete', - () => {}, - () => dropdownMenuIsOpened -); - // XXX I believe we should compute a HTML rendered field on the server that // would handle markdown, emojies and user mentions. We can simply have two // fields, one source, and one compiled version (in HTML) and send only the |