Extension:Proofread Page/Edit-in-Sequence

For end-user help about this feature, see: Help:Extension:ProofreadPage/Edit-in-Sequence.

The Edit-in-Sequence (or EIS) feature of ProofreadPage is a new (as of 2022) user interface that aims to make it quicker to navigate between pages while proofreading. It adds a new toolbar above the normal side-by-side proofreading interface that allows for navigating between pages, previewing, and saving edits to any pages. It means that editors don't have to leave the editing interface at all while proofreading.

This page documents the system administration, and wiki administration, of this feature.

Configuration variables

edit
$wgProofreadPageEnableEditInSequence = true;

Enables the main Edit-in-Sequence tab (next to the read and edit tabs) that is used to launch EIS.

Incompatibilities

edit

Certain userscripts might be incompatible with EditInSequence. Userscripts that rely on the the presence of the "Publish Changes" button (or the Edit summary textbox) might be incompatible with EditInSequence.

Text selection and replacement

edit

User scripts and gadgets that use the vanilla jQuery ($(...).val()) or the vanilla JS method (document.querySelector(...).val = '...';) to manipulate text inside textboxes might encounter edge cases where EditInSequence does not recognize the input. Instead it is recommended to use the jQuery.textSelection(...) API to manipulate code.

For example, for the following code:

var wikitext = $( '#wpTextbox1' ).val();
wikitext = wikitext.replaceAll( 'color', 'colour' );
$( '#wpTextbox1' ).val( wikitext );

should instead be written as the following:

var wikitext = $( '#wpTextbox1' ).textSelection( 'getContents' );
wikitext = wikitext.replaceAll( 'color', 'colour' );
$( '#wpTextbox1' ).textSelection( 'setContents', wikitext );

Image detection

edit

Previously, the following code $( '.prp-page-image' ).find( 'img' ).attr( 'src' ) could be relied upon to give the image for a specific page. However, due to the fact that EditInSequence swaps out the image inplace every time a user navigates to a new page, the same code snippet will not work. Instead, userscripts and gadgets can use the ProofreadPage Openseadragon API to interact with the current image.

For example to replace the following code snippet:

$( '.prp-page-image' ).find( 'img' ).attr( 'src' )

the following can be used

mw.proofreadpage.openseadragon.getCurrentImage()

EIS API

edit

EditInSequence provides/aims to provide a few APIs with which users can hook into the interface and add features.

PageSelection API

edit

The Page selection API allows userscripts to define new Page selection filter that a user can use to navigate between pages (for example: adding a screen that shows a user which pages have lint errors).

 
Page selection screen, EditInSequence

To hook into the API, a userscript must listen for the ext.proofreadpage.page-selection-register-filter event. This passes a pageSelection object. This can be used to register a new page selection filter by calling pageSelection.register( name, { label: label, func: callback } ). This will register a screen with a specific name, a label and a callback that will be called when a user clicks on the filter. A example of how this works is given below, via a toy snippet that highlights pages that have non-number page numbers (ex: title, blank etc)

mw.hook( 'ext.proofreadpage.page-selection-register-filter' ).add( function ( pageSelection ) {
	pageSelection.register( 'only non-number pages', { label: 'Only non-number pages', func: function ( pagelistArray, pageSelectionWidget ) {
        var filter = [];
        for( var i = 0; i < pagelistArray.length; i++ ) { 
            if ( isNaN( Number( pagelistArray[ i ].formattedNumber ) ) ) {
                filter.push( true );
            } else {
                filter.push( false );
            }
        }
        pageSelectionWidget.setHighlightedButtons( filter ); // set all the buttons to highlight
	} } );
} );

Text preloading API

edit

TBD

History

edit

EIS was first developed by User:Alex brollo in October 2016‎ as a gadget on Italian Wikisource.

In 2022 Wikimedia Italia funded the integration of the gadget into this extension, as well as further development of EIS. This work is being undertaken by User:Sohom data.