#12929 closed enhancement (fixed)
Upgrade jquery-textcomplete
Reported by: | Peter Suter | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Component: | WikiAutoCompletePlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
This still uses jquery-textcomplete v0.3.3.
Upgrading to a newer version improves e.g. handling of ESC-key. (E.g. dismissed menu remains dismissed when moving cursor position.)
Attachments (1)
Change History (19)
comment:1 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 follow-up: 4 Changed 8 years ago by
After [15953], dropdown is shown in front of typing text. I'm using Firefox 49.
This issue occurs with v1.1.0 but doesn't occur with v1.0.0. Workaround is to add body { margin: 0 !important }
.
Changed 8 years ago by
Attachment: | dropdown-in-front-of-text.png added |
---|
comment:3 follow-up: 10 Changed 8 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Thanks for noticing.
Also TAB-key does not reopen dropdown anymore. Upstream issue filed.
comment:4 Changed 8 years ago by
I'm not good with CSS, but it seems we can drop:
-
wikiautocomplete/htdocs/css/jquery.textcomplete.css
diff -r bcaeadd18c30 wikiautocomplete/htdocs/css/jquery.textcomplete.css
a b 28 28 .dropdown-menu { 29 29 list-style: none; 30 30 padding: 0; 31 margin: 0;32 31 } 33 32 34 33 .dropdown-menu a:hover {
Edit: Disregard this. That's just luck(?)
comment:5 Changed 8 years ago by
It seems fixed in Trac 1.2 with jQuery upgraded from 1.8.3 to 1.11.3. (Something about $('body').offsetParent()
changed and returns the html
or body
element.)
comment:6 Changed 8 years ago by
This issue occurs only with Firefox. Also, it occurs with jQuery 1.8.3 but doesn't with 1.9.0.
Workaround is to add margin-top
of body
element to .dropdown-menu
class.
-
wikiautocomplete/htdocs/js/wikiautocomplete.js
diff --git a/wikiautocomplete/htdocs/js/wikiautocomplete.js b/wikiautocomplete/htdocs/js/wikiautocomplete.js index 0f9e257..f56d42b 100644
a b jQuery(document).ready(function($) { 154 154 appendTo: $('body'), 155 155 maxCount: 10000 156 156 }); 157 158 if (/^1\.[78]\./.test($.fn.jquery) && $.browser.mozilla && 159 navigator.userAgent.indexOf('like Gecko') === -1 /* IE 11 */) 160 { 161 var margin = $('body').css('margin-top'); 162 if (margin && margin !== '0px') { 163 if (!/px$/.test(margin)) 164 margin += 'px'; 165 $('<style type="text/css">.dropdown-menu { margin-top: ' + 166 margin + ' !important }</style>').appendTo('head'); 167 } 168 } 157 169 });
comment:7 Changed 8 years ago by
In general, with this workaround and the activity on this plugin, should it still be tagged as alpha?
comment:10 follow-up: 12 Changed 8 years ago by
Replying to psuter:
Also TAB-key does not reopen dropdown anymore. Upstream issue filed.
I think the reopen after completion is good for source suggestion however it is not good for other strategies. Especially, newline would be unable to be entered when wiki processors is completed with enter key on {{{#!
.
comment:12 follow-up: 13 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
I think the reopen after completion is good for source suggestion
Right, very important there. So I reverted the behavior for the TAB key.
however it is not good for other strategies. Especially, newline would be unable to be entered when wiki processors is completed with enter key on
{{{#!
.
So we leave the ENTER key unchanged for now.
comment:13 follow-up: 14 Changed 8 years ago by
Replying to psuter:
I think the reopen after completion is good for source suggestion
Right, very important there. So I reverted the behavior for the TAB key.
We could use adapter
option without changing jquery-textcomplete.js.
-
wikiautocomplete/htdocs/js/wikiautocomplete.js
diff --git a/wikiautocomplete/htdocs/js/wikiautocomplete.js b/wikiautocomplete/htdocs/js/wikiautocomplete.js index a8285c0..829c13e 100644
a b jQuery(document).ready(function($) { 20 20 return $.htmlEscape(text); 21 21 } 22 22 23 var TextareaAdapter = $.fn.textcomplete.Textarea; 24 function Adapter(element, completer, option) { 25 this.initialize(element, completer, option); 26 } 27 $.extend(Adapter.prototype, TextareaAdapter.prototype, { 28 _skipSearchOrig: TextareaAdapter.prototype._skipSearch, 29 _skipSearch: function (clickEvent) { 30 if (clickEvent.keyCode === 9) 31 return; // do not skip TAB key 32 return this._skipSearchOrig(clickEvent); 33 } 34 }); 35 23 36 $('textarea.wikitext').textcomplete([ 24 37 { // Attachment 25 38 match: /\b((?:raw-)?attachment):(\S*)$/, … … jQuery(document).ready(function($) { 152 165 153 166 ], { 154 167 appendTo: $('body'), 168 adapter: Adapter, 155 169 maxCount: 10000 156 170 }); 157 171
comment:14 Changed 8 years ago by
We could use
adapter
option without changing jquery-textcomplete.js.
Nice!
comment:16 Changed 8 years ago by
v1.8.0 is released. I noticed search is triggered by page up/down and scroll position of dropdown is reset. The issue is fixed in v1.8.0.
[15953]