Modify

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#12926 closed defect (fixed)

Suggestion dones't work after submitting with preview button

Reported by: Jun Omae Owned by: Peter Suter
Priority: normal Component: WikiAutoCompletePlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

In post_process_request(), the plugin checks req.method == 'GET'. Therefore, it doesn't work with preview page.

Also, the suggestion works only with wiki and ticket pages.

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by Jun Omae

According to wikitoolbar.js, adds the toolbar to all textarea elements with wikitext class. I think we could call .textcomplete with textarea.wikitext.

  • wikiautocomplete/htdocs/js/wikiautocomplete.js

    diff --git a/wikiautocomplete/htdocs/js/wikiautocomplete.js b/wikiautocomplete/htdocs/js/wikiautocomplete.js
    index 22e1899..ef9be2c 100644
    a b  
    11jQuery(document).ready(function($) {
    2     $('textarea').textcomplete([
     2    $('textarea.wikitext').textcomplete([
    33        { // TracLinks
    44            match: /(^|[^[])\[(\w*)$/,
    55            search: function (term, callback) {
  • wikiautocomplete/web_ui.py

    diff --git a/wikiautocomplete/web_ui.py b/wikiautocomplete/web_ui.py
    index 4afa1f4..33df824 100644
    a b class WikiAutoCompleteModule(Component): 
    4747        return handler
    4848
    4949    def post_process_request(self, req, template, data, content_type):
    50         if (req.path_info.startswith('/wiki') or
    51             req.path_info.startswith('/ticket') or
    52             req.path_info.startswith('/newticket')):
    53             if req.method == 'GET':
    54                 self.env.log.info('Injecting wikiautocomplete javascript')
    55                 add_script_data(req, {
    56                     'wikiautocomplete_url': req.href('wikiautocomplete'),
    57                     })
    58                 add_script(req, 'wikiautocomplete/js/jquery.textcomplete.min.js')
    59                 add_script(req, 'wikiautocomplete/js/wikiautocomplete.js')
    60                 add_stylesheet(req, 'wikiautocomplete/css/jquery.textcomplete.css')
    61         return (template, data, content_type)
     50        if template:
     51            add_script_data(req, {
     52                'wikiautocomplete_url': req.href('wikiautocomplete'),
     53                })
     54            add_script(req, 'wikiautocomplete/js/jquery.textcomplete.min.js')
     55            add_script(req, 'wikiautocomplete/js/wikiautocomplete.js')
     56            add_stylesheet(req, 'wikiautocomplete/css/jquery.textcomplete.css')
     57        return template, data, content_type
    6258
    6359    # IRequestHandler methods
    6460

comment:2 Changed 8 years ago by Peter Suter

Looks good to me, please commit, thanks!

comment:3 Changed 8 years ago by Jun Omae

Resolution: fixed
Status: newclosed

In 15943:

WikiAutoCompletePlugin: fix not working after POST and make it work with all textarea with wikitext class (closes #12926)

comment:4 Changed 8 years ago by Jun Omae

Thanks for the reviewing!

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.