Unfortunately mw.Api#parse doesn't provide us with that part of the
response, so we have to manually construct the parameters.
Bug: T241193
Change-Id: Ie91d5ebc2ef483a69524b838dd3cb852e7c85cd2
The hook 'wikipage.content' fires whenever new "page content" is added
dynamically (e.g. after a VisualEditor edit). It's used by the code
for sortable tables, collapsible content, etc., to ensure they behave
correctly after the page content is changed without reloading the page.
We use this hook to add our "Reply" links. However, VisualEditor (and
NWE) also fires this hook for the contents of the edit notices box (to
support collapsible boxes there: T179315). Our code was crashing
because it could not find talk page content inside of that, and this
crashed VisualEditor as well.
Use .each() to handle any number of results (0, 1 or more), instead of
assuming there is always 1.
Bug: T241396
Change-Id: I877b1ae06bf1d7cd585ec6f9c1fb596cc3b86e7e
And actually discard the contents when they confirm.
For now this uses the generic editor message, but that can
be tweaked later.
Bug: T240271
Change-Id: I2dfa19b2cc7ac49d7efea37ac8c9429c75934a91
* Query parameters for the API must be in lowercase.
* Also, 'starttimestamp' was misspelled.
Bug: T240643
Change-Id: I6497770dfc3a9512af063b846c3f73aa5603b637
Method can be used by preview logic later. Whitespace trimming
avoids sig ending up on newline in a <pre>.
Change-Id: If6f06f17395af0c6645082c1b9493be87422c059
The packageFiles system makes it easier to export site config data
from PHP to JS, which we need a lot of, but it's awkward when mixing
it with defining and accessing classes via a namespace like mw.dt.
The only thing remaining in mw.dt is mw.dt.pageThreads, which is
described to be "for debugging", so we should keep it easy to type.
Also we still use the namespace for documenting classes.
Everything else can be reached by require()'ing a ResourceLoader
module, for example instead of `mw.dt.ui.ReplyWidget`
you'd do `require( 'ext.discussionTools.ReplyWidget' )`.
(When debugging from browser console, use `mw.loader.require` instead.)
Change-Id: I6496abcf58c21658d6fd0f3fc1db1f7380a89df7
Possible use cases:
* Matching comments between PHP and Parsoid HTML [implemented here]
* Finding the same comment in a different revision of a page
(e.g. while resolving an edit conflict, or to allow resuming
composition of autosaved comments) [implemented for highlighting
user's own posted comment only]
* Permanent links to comments [future]
The reasoning for this form of ID is:
* _Timestamp_ by itself is a nearly unique identifier, so it's a good
thing to start with
* Users may post multiple comments in one edit (or in many edits in
one minute), so we need the _sequential number_ to distinguish them
* _Username_ is probably not required, but it may reduce the need
for sequential numbers, and will help with human-readability if we
add permanent links
The ID remains stable when a new comment is added anywhere by anyone
(excepts comments within the same minute by the same user), or when a
section is renamed.
It's not always stable when a comment is moved or when an entire
section is moved or deleted (archived), but you can't have everything.
Change-Id: Idaae6427d659d12b82e37f1791bd03833632c7c0
(And rebuild them using this method, the properties are in different
order, it's actually nice for readability to have 'replies' last)
Change-Id: Ib586e1081fa36cb9125db1b0b1d41f092350641c
Otherwise the rest of the page may shift if hiding the link changes
line-wrapping. It felt super confusing when it happened to me while
I was testing an unrelated thing.
https://phabricator.wikimedia.org/F31254175
Change-Id: I53aecdbf3bfba579b48875532d251de0f1c81d6c