#12930 closed enhancement (fixed)
Complete attachment filenames
Reported by: | Peter Suter | Owned by: | Peter Suter |
---|---|---|---|
Priority: | normal | Component: | WikiAutoCompletePlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: |
Description
It would be very helpful to get suggestions for attachment filenames.
(And also for attachment:ticket:123:filename.ext
/ attachment:wiki:pagename:filename.ext` if possible?)
Attachments (0)
Change History (11)
comment:1 Changed 8 years ago by
comment:2 Changed 8 years ago by
Wow, I had a similar patch in the works, but this is much better, thanks!
comment:3 Changed 8 years ago by
Thanks. Additional changes in https://github.com/jun66j5/wikiautocompleteplugin/commit/8c6adf83dd359b5f9ab1ce972ecfdd932b0b5f1d, fixing completion is broken when $
character is in the suggestion (e.g. SandBox/$1
).
comment:8 follow-up: 9 Changed 8 years ago by
Hmm, [[Image()]]
macro with attachment:...
link doesn't work....
Ad hoc patch: complete attachments also when typing [[Image(
. Thoughts?
-
wikiautocomplete/htdocs/js/wikiautocomplete.js
diff --git a/wikiautocomplete/htdocs/js/wikiautocomplete.js b/wikiautocomplete/htdocs/js/wikiautocomplete.js index dac2c4c..6f9f986 100644
a b jQuery(document).ready(function($) { 5 5 6 6 $('textarea.wikitext').textcomplete([ 7 7 { // Attachment 8 match: / \b((?:raw-)?attachment):(\S*)$/,8 match: /(\b(?:raw-)?attachment:|\[\[Image\()(\S*)$/, 9 9 search: function (term, callback) { 10 10 $.getJSON(wikiautocomplete.url + '/attachment', 11 11 { q: term, realm: wikiautocomplete.realm, … … jQuery(document).ready(function($) { 17 17 replace: function (name) { 18 18 if (/\s/.test(name)) 19 19 name = '"' + name + '"'; 20 return '$1 :' + escape_newvalue(name);20 return '$1' + escape_newvalue(name); 21 21 }, 22 22 cache: true 23 23 },
comment:9 follow-up: 10 Changed 8 years ago by
complete attachments also when typing
[[Image(
. Thoughts?
I don't use [[Image()]]
much, but I guess it's quite a common use-case? If only such a small tweak is required, I think it's a good idea.
More general macro arguments completion would be nice, but I don't know how it would work. Unless macros standardize on some formal parameter description.
This overrides the macro description preview, right? (But that is maybe not very important.)
comment:10 Changed 8 years ago by
Replying to psuter:
This overrides the macro description preview, right? (But that is maybe not very important.)
Yes. After the patch, typing [[Image(
would lead to show suggestion for attachments instead of Image
macro's description.
Proposed changes can be found in https://github.com/jun66j5/wikiautocompleteplugin/compare/master...t12930.