Move generation of initial edit summary from setupSaveDialog() to
restoreEditSection().
This allows us to get rid of the properties tracking whether both
halves of the edit section handling had happened, because they're
now in the same method.
Moving setupSaveDialog() down so it runs after restoreEditSection();
this is needed for the communication via this.initialEditSummary
to work correctly.
Change-Id: I06a9c5cf5c752acea8a2ac25d0ffb6ac61cfe986
Add prepareCacheKey() which submits HTML for serialization and saves
the resulting cache key, and tryWithPreparedCacheKey() which uses that
cache key (if available; if pending, it waits for it) for API requests.
Implemented save(), serialize() and showChanges() in terms of
tryWithPreparedCacheKey().
When opening the save dialog, run the conversion, cache it, and fire
off a prepareCacheKey(). Then use the cached conversion for save/diff/
serialize. This means we don't convert multiple times, and it causes
the prepared wikitext to be used.
Bug: 55979
Bug: 56011
Change-Id: I1d56fe88d312e9810a57d56a285ccdf4f1facf42
* parameter.svg had no opacity set
* replace.svg had a document opacity of 80% in addition to the normal 75%
* re-rendered parameter.png (syntaxhighlight doesn't have png's yet)
Change-Id: I9c990fefaf4f5a7536b884b92523408146d7b2c7
initialize() is currently called synchronously, but once the CSS
transplantation code is fixed and it goes back to being async, that'll
cause problems.
* Add this.setupDeferred and use it to defer setupCheckboxes() until
after initialization
* Move code populating the edit summary from ViewPageTarget into
MWSaveDialog and use .setValue() rather than manipulating the
TextInputWidget's DOM. Defer this until after init as well
* Move clearing of the diff from ViewPageTarget into MWSaveDialog,
and don't connect it to the transact event at startup, only when
we've actually shown a diff
* Remove swapPanel( 'save' ) from ViewPageTarget, instead do this
on setup in the dialog itself
Bonus:
* Document events
* Get rid of onFooButtonClick handlers in favor of array syntax
Change-Id: Idcdae5e013340f4519db4387bab507e714d47941
We can't get the directionality from the focused node if there isn't one.
This doesn't add any logic to determine the directionality in creation
mode, filed https://bugzilla.wikimedia.org/show_bug.cgi?id=57421 for that.
Change-Id: I3ff8d48f19c7beef5e24b55712a26d86efa5812a
In order to do this we have to separate out the removal
operation from NDFR, so it becomes newFromDocumentInsertion
(again, although actually, for the first time). As NFDI is
an insertion we can just run fixUpInsertion on the data
part of it.
In order for the removal operation to be a proper removal
we have to allow metadata removal (the default is to merge it).
Change-Id: I16d575b61b9796e7e889f2c27cfe02b4a40b7639
This fixes some of the problems with pasting references.
It's a bit overzealous in that references get renumbered even when
replacing, which is unnecessary but doesn't actually have any
noticeable effect.
Unfortunately, the internal list state depends so much on the converter
having run that we now need to add yet another hack, to set the counter
to the appropriate value.
Change-Id: I3c6514ce600af4f4c037f419554d34b5a5c86a63
Add paction=serializeforcache, which serializes the given HTML, stores
the resulting wikitext in memcached, and returns a cache key. This
cache key can then be passed instead of HTML to paction=diff or
action=visualeditoredit for quick diff/save operations using the
cached wikitext, or to paction=serialize to just retrieve the wikitext.
This lays the groundwork for front-loading serialization in the editor,
and for avoiding the double serialization that occurs when the user
first views the diff, then saves.
Bug: 55979
Bug: 56011
Change-Id: I223b1717890632c39e2509967149551f807119f8
* Use 'this' instead of 'viewPage' in setupSaveDialog()
* Unwrap unnecessary .each() in restoreEditSection()
Change-Id: I45d0c9714d59e195d0c4413ed3dbe9cbabe45e9d
* Fix invalid @param name (mixup of type and param name).
* Fix incorrect reliance on inferred name for ve.Range.
@class uses the below function to guess its name, however
if @property is encountered, the @class block ends. Thus
it was indexed as a nameless class.
* Separate @property definitions because combining them like
that doesn't work (it silently ignored everything after the
first "from" property).
Also:
* Add some missing @static to static methods in ve.Range.
* Remove a few redundant @method while at it.
Change-Id: I8357c30711a4830af0b68b18350352c457a607f3
Us grouping the inheritable static properties that way is an
implementation detail that is polluting the index and makes
it harder to refer to individual identifiers.
It also causes problems under JSDuck 5 because that version is
more strict about defining properties (Foo.static.bar) of which
the parent is not defined in the index (Foo.static), we'd have
to add a sea of `@static @property {Object} this.static` all
over the place. Might as well hide this implementation detail
and just consider them static properties (just like we already
do for "private" properties).
Change-Id: Ibf2ebf7752aabc2b75b6ac6fa00e2284a181a600
setValue() doesn't do anything if this.value === value, but with
sanitization it's possible for that to be true while the value in
the DOM is out of sync and needs to be changed.
The fix is to check for this.value changing and the DOM changing
separately.
Change-Id: I5f571445f5729f5477902c155a4ee9588b7194a8
Previously we had a defaultSortKeyChanged value that lied - it was
possible for the value to be changed A -> B -> A by the user mid-
edit. However, the meta dialog assumed that defaultSortKeyChanged
wasn't lying, so blindly changed the meta item to the new value,
causing an unnecessary meta change if the user had done a no-op.
Now the value is renamed to defaultSortKeyTouched, and we actually
detect for content changes, and only change the meta item if a
change is actually needed (be that a removal, a replacement, or an
insertion).
Change-Id: I13022090bd7561a460a1151013e2b7d2a029f4dd
Also encourage callers to pass plain objects unless they know what
they're doing; it's almost always wrong to pass in a MetaItem.
Change-Id: I8e8ef8ac7f77ec9f929d797e467b9c9d1140d721
This will be used to collect event traces from various IME/browser/OS
combinations that can then be used to drive unit tests.
Change-Id: Id604161b568cd412b44fe9979aff45d1fe7f054a