Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#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:2 Changed 8 years ago by Peter Suter

Wow, I had a similar patch in the works, but this is much better, thanks!

comment:3 Changed 8 years ago by Jun Omae

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:4 Changed 8 years ago by anonymous

Good catch!

comment:5 in reply to:  4 Changed 8 years ago by Peter Suter

Good catch!

(I forgot to log in.)

comment:6 Changed 8 years ago by Jun Omae

Resolution: fixed
Status: newclosed

In 15947:

WikiAutoCompletePlugin: complete attachment filenames on attachment: and raw-attachment: links (closes #12930)

comment:7 Changed 8 years ago by Jun Omae

Thanks for the reviewing! Committed in [15947].

comment:8 Changed 8 years ago by Jun Omae

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($) { 
    55
    66    $('textarea.wikitext').textcomplete([
    77        { // Attachment
    8             match: /\b((?:raw-)?attachment):(\S*)$/,
     8            match: /(\b(?:raw-)?attachment:|\[\[Image\()(\S*)$/,
    99            search: function (term, callback) {
    1010                $.getJSON(wikiautocomplete.url + '/attachment',
    1111                          { q: term, realm: wikiautocomplete.realm,
    jQuery(document).ready(function($) { 
    1717            replace: function (name) {
    1818                if (/\s/.test(name))
    1919                    name = '"' + name + '"';
    20                 return '$1:' + escape_newvalue(name);
     20                return '$1' + escape_newvalue(name);
    2121            },
    2222            cache: true
    2323        },

comment:9 in reply to:  8 ; Changed 8 years ago by Peter Suter

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 in reply to:  9 Changed 8 years ago by Jun Omae

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.

comment:11 Changed 8 years ago by Jun Omae

In 15962:

WikiAutoCompletePlugin: suggest attachments on typing [[Image( (refs #12930)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Peter Suter.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.