mw.attrs does have a special meaning in this code. Together with
mw.body it reflects 1:1 what was written in the original wikitext
in the <ref …> and <references …> tags. Let's avoid using the same
(or almost same) variable name for other kinds of attributes.
Bug: T363096
Change-Id: I3e599ab910b9639e121f9b9d532b0f57f08f1e73
This can be quite confusing:
* A node does have attributes. One of the attributes is called
"refGroup", another one "mw".
* mw contains a JSON structure with just a few elements, most
notably a "body" and an "attrs" element. These reflect what was
originally written in the wikitext.
* mw.attrs reflects the original properties a.k.a. attributes from
the <ref …> or <references …> tag.
Deleting mw.refGroup doesn't do anything because the attribute is
called <ref group="…"> in the wikitext, not <ref refGroup="…">.
You can actually see this bug in action on all wikis: Go to a page
that uses references in non-standard groups, e.g.
https://en.wikipedia.org/wiki/Historic_Cherokee_settlements
Start VisualEditor. Find e.g. the [notes 1] reference. Edit it
and change the group from "notes" to "General references". Click
"Publish…" and "Review" your changes. The visual diff works because
it apparently uses other information. The wikitext diff is empty.
This is also what's saved: nothing. The edit is lost.
Bug: T359943
Change-Id: I798605d2fd60a6b8f317ec85a4e4d08fd245e084
Some of the annotations were used in a way that confused jsdoc. This
cleans up redundant annotations and uses more canonical tags.
These changes cause all classes to now appear in the generated pages.
Includes linking to external docs.
Bug: T358641
Change-Id: Iaee1dadcc19a70c27839d0d27dfa6a07a70fb46b
I find it very helpful to use the name "mwAttrs" specifically for the
mw.attrs thingy that contains the original key-value pairs from the
wikitext.
An alternative is to use ve.getProp, which is helpful in other
situations.
Change-Id: I3edf0dfe5b9629fcda0bf8cb3b734215377a5c77
ReferencesListNode needs to be registered after
MWTransclusionNode so that it has a higher specificity
when matching.
Change-Id: I93610fac2ec9715a14b34efb76abc55d2d2c6900
As a result, the references are now treated like any other
template-generated reference, e.g. they can't be edited.
Previously they could be edited as if they weren't template-generated,
causing trouble. Editing them had no effect (changes would not be
saved), and copy-pasting them into another page resulted in
"substituted" content (template metadata was lost).
Bug: T209493
Change-Id: I4e75ccd57cd752a726653c725d8c29a09306e83b
Also use ve.dm.nodeFactory.createFromElement
Depends-On: I259face33154b795143c8820abdfb6b4a495f141
Depends-On: I7fc539f75a1c9d672efc139b7884ecdfdff5f301
Change-Id: I032182616c409e65138b16fe7b238e7f7b3a8710
By leaving the viewNode around, it would update itself later
(due to updateDebounced in the constructor), which would
modify $reflist, even though the caller was expecting
this to be some finalised DOM sub-tree.
Change-Id: Ia89a98556af26986f8362f5b352378cc321b6345
This will stop us from showing meaningless diffs (eg
setting responsive to whatever the default already was).
Logically depends on 13a3d0527f.
Change-Id: I0c6a3385d9a493c3854975607cd75d2bf8c1e990
This will allow them to auto-update, and be used in the
visual diff.
We record a templateGenerated attribute to prevent them
being edited, and to ensure they roundtrip back to
templates.
Bug: T52769
Change-Id: I4460d2c98166581e942e35921b20091990f5f6c7
If the user has moved the reflist away from the end of the document, or
changed any properties on it, it shouldn't be treated as autoGenerated any
more.
Bug: T153754
Change-Id: I348601952dbfcf06bfb564e4db9cac820f3b2776
This code has been developed over three years now in the repo of MediaWiki's
integration of VisualEditor. It has grown and developed significantly during
that time, but now is pretty stable. A number of hacks inside the MediaWiki-
VisualEditor code base have been used to prevent this code from being loaded
on wikis where the Cite extension is not deployed, but this state of affairs
is and always was meant to be temporary.
This code is under the MIT licence which is a tad messy, but not impossible.
It's clearly labelled as such. The list of authors has been updated to take
into account the influx of new functionality.
Bug: T41621
Bug: T104928
Change-Id: I39936ed83d5a60471a0a75da753f498e80aef234