Page MenuHomePhabricator

Support custom buttons in New Discussion Tool to insert stock answers (and maybe also in Reply Tool)
Open, Needs TriagePublic

Description

@ppelberg @matmarex Hello, some users at Czech Wikipedia use custom buttons using common.js when adding new topics. Could it be available to add custom buttons to the New discussion tool? See examples down.

Buttons are usually used for warning vandals (template "Experimenty2" warns them – see example down).

When is user longtime problematic (vandal/experimenter), some users use this in headings: {{subst:prvnívelké:{{subst:CURRENTMONTHNAME}}}} {{subst:CURRENTYEAR}} (prvnívelké = ucfirst, in Czech months begin with a lowercase, exception is heading). See example 2 down.

This originally reported David V. to me by private chat and I agree with him. It is really important for patrollers. Buttons facilitate the work of patrollers, just one click adds (not)memorable string and it is fast and easy to use. Btw. you can see his common.js.

Thanks a lot for your work!

Example:

mw.loader.using('user.options', function() {

if(mw.user.options.get('usebetatoolbar')) {
   mw.loader.using('ext.wikiEditor', function() {
     $(function() {
     	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
       section: 'advanced',
       group: 'format',
       tools: {
           buttonId: {
               label: 'Experimenty2',
               type: 'button',
               icon: 'https://upload.wikimedia.org/wikipedia/commons/a/ae/EXPBT2.png',
               action: {
                   type: 'encapsulate',
                   options: {
                       pre: '\x7b\x7bsubst:Experimenty2}}',
                       peri: ,
                       post: '--\x7E\x7E\x7E\x7E'
                   }
               }
           }
       }
     	});
     });
   });
 }

});

Example 2:

mw.loader.using('user.options', function() {

 if(mw.user.options.get('usebetatoolbar')) {
   mw.loader.using('ext.wikiEditor', function() {
     $(function() {
     	$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', {
       section: 'advanced',
       group: 'insert',
       tools: {
           buttonId: {
               label: 'Nadpis aktuálního měsíce a roku',
               type: 'button',
               icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/1/18/Exclamation-orange.svg/5px-Exclamation-orange.svg.png',
               action: {
                   type: 'encapsulate',
                   options: {
                       pre: ,
                       peri: '\x7b\x7bsubst:prvnívelké:\x7b\x7bsubst:CURRENTMONTHNAME}}}} \x7b\x7bsubst:CURRENTYEAR}}',
                       post: 
                   }
               }
           }
       }
     	});
     });
   });
 }
});

Event Timeline

Patriccck renamed this task from Buttons in New Discussion Tools to Buttons in New Discussion Tool (and maybe also in Reply Tool).Jan 28 2021, 11:15 PM
Aklapper renamed this task from Buttons in New Discussion Tool (and maybe also in Reply Tool) to Support custom buttons in New Discussion Tool to insert stock answers (and maybe also in Reply Tool).Feb 5 2021, 12:04 AM