Expanding from a single if-expression lets us make the
code much more readable, and reveals some minor bugs.
Change-Id: I49e57bfc093e019c837a73eab5c25fdbd14de0af
Previously we completely disabled the loading of notices
when switching, instead of just not showing them (so they
don't clash with the "switched" popup).
Bug: T162812
Change-Id: I3f8e787630e196cee1dbb1aa449b3558b74fcd04
This is run after the targetPromise completes (via the platform-agnostic
setDefaultMode proxy), which is the correct time to do so. We should not
do this twice, and we definitely shouldn't do this before the target has
successfully loaded, lest a user ends up with us setting their option to
"prefer" an editor that they actually can't load. Whoops.
Bug: T156316
Change-Id: Icf4b5ddd9c8265ade55f43328f807344b41db350
New changes:
dc0cad28c tests: Factor out ve.dm.TestRebaseClient/Server into their own files
98061108b Convert RebaseServer tests to data provider
3e746a51b Update OOjs to v2.0.0
16231a812 [BREAKING CHANGE] Drop support for Internet Explorer 9
64daeb4b5 Localisation updates from https://translatewiki.net.
3310e876c Update DOMPurify to 0.8.5
579033a83 Follow-up 16231a81: Drop IE9 support in createDocumentFromHtmlUsingIframe
Bug: T162277
Change-Id: If17c6a3fac0920db29f80069f344ffd6be46c3c9
The bare minimum of elements that must be present on the page for
VisualEditor to start and mostly work is:
* '#content' to attach our interface (toolbar etc.)
* '#mw-content-text' to replace with the editing surface
* '#ca-edit' to start up the editor
When those elements are missing (and we expect them to be present,
e.g. we're not on a special page), we print a console warning.
For example, VisualEditor now launches on Timeless and CologneBlue.
It does not launch and prints a warning on Modern and Erudite.
(It is actually possible to edit and save pages on CologneBlue,
although various pieces of the interface look funny.)
This does not change which skins we claim to support: these are still
currently only Vector, MonoBook and Apex. But it allows third-party
skin developers to more easily test the editor and fiddle with their
CSS to make it look right.
Bug: T161373
Change-Id: I97c786f3c8c795c238b10bef332a129ea26f86c2
The element has both the class and the id set to 'catlinks'. This is
just for consistency, I have no preference on which to use.
Change-Id: Ic96b0f21fe790d0aa03bfd6366ba246e8493a038
Redirect pages have two extra things not present on normal pages:
* Redirect subtitle: the "Redirect page" shown under the page heading.
* Redirect page content header: the "↳ Foo" at the beginning of content.
Our handling was pretty messy and had some bugs (T161614).
Notable behavior changes:
* Update 'wgIsRedirect' in mw.config after saving the page.
* Use #mw-content-text rather than .mw-jump for inserting the fake .redirectMsg.
.mw-jump is not guaranteed to exist on the page (it's a skin feature).
* Never replace the real .redirectMsg existing on the page, except by the
new HTML after a page is saved. Our fake is separate now.
Bug: T161614
Change-Id: I96a5e45a71bf10bf6a2b501dc0cf81e6c37060ec
To reproduce: start editing a page, turn it into a redirect,
cancel editing and go back to view mode. The "Redirect page"
subtitle under the page title should disappear.
Note that #redirectsub is correctly spelled all lowercase,
unlike #contentSub.
This reverts commit 0e1bc7309b
and fixes the code instead.
Change-Id: Ibacd73122dfec63268a77794bc77c4b88876d3ee
As it happens, #redirectsub is correctly spelled all lowercase,
unlike #contentSub. This line does nothing. We remove #redirectsub
correctly elsewhere; I don't think this was ever meant to be here.
Follows-up 96421b283c.
Change-Id: I3e4c6eb2ff94f363b488477b3ddd248e571e723a
Running setNotices( [] ) makes MWNoticesTool run this.destroy() to avoid taking
up extra space in the toolbar when not needed.
Also, make setNotices() bail earlier.
Change-Id: I492fd59a1e15e8f296bf7f03d9b0035c40dafa59
This avoids an OOui deprecation warning for trying to toggle a popup which
isn't connected to anything.
Bug: T160161
Change-Id: I9ad97785f0de4ecf81d189985459689644e25923
Distinguish between the initial summary state, and a value stored from the
summary when switching modes. This lets us avoid overwriting a stored value
when section-editing, or assuming a stored value after a switch was never
edited.
Bug: T159686
Change-Id: Ie7640538140a14bbafd539b3a45928f5c55cf804
Switching from visual to source reruns setupUnloadHandlers, which caused an
infinite loop where it thought it was its own fallback pre-existing handler.
Bug: T153346
Change-Id: I8df55a5395ede02fc34ec47a94f2c780dc08595f
Since December, the handler now expects to be passed the mode we're switching
to. Since we're filtering for just the edit link and not edit source, we can
hardcode 'visual' here.
Bug: T159374
Change-Id: I160045dd59ff1b4c2d180dbbe37280a1839886df
Pencil is the icon we use for 'edit' elsewhere in the UI.
Use the eye icon for the VE tool to specify 'visual'.
Bug: T116417
Change-Id: I12b6bab2a52758685abde04579b274a32d651174
This will make it easier for third parties to load the required
modules for an article-like target.
Also cleanup mobileArticleTarget to better match desktopArticleTarget.
Change-Id: Idb75e2bd99d8cf2c298e101cf92e8af4f85f5ad5
These are now computed upstream based on position of toolbar.
The menu tool now needs its indicator explicitly hidden.
Change-Id: Id2280f70553e1e45f3a42af45684c5808797925c
As for the Translate extension this will read a global set by the
TwoColConflict extension to disable the VisualEditor and its hooks
on the modified edit conflict page there.
Bug: T156251
Change-Id: I164d1546c9d98d8715650e13c63a01d06c76315d
When switching from the old wikitext editor to VE, we stored "editing..." as
the original page title. Then restored that when saving / switching to "read".
Instead, detect if we're on top of the classic editor, and use the pagename
message to make a plausibly-correct title.
Bug: T126077
Change-Id: Ib0289de71c3ae947ca0a3e45fe1e620378689c35
This wasn't such a big deal in VE because we load the full
page anyway, but in NWE it is more annoying if you reload the
page and are dumped in a different edit area.
Change-Id: If49569cbe1a2759d8cbbd7ee42dd1b88da39a946
Provide a common function to parsing, and always pass
section to the target, instead of having the target
re-compute it itself.
Change-Id: If9fc24ffa51507cd969fa1b4dfc1519a0b50a572
This has to go to the API, because it's skinnable. Also, separates out a few
of the initial page setup functions so they can be re-applied to the new
content inserted.
Bug: T151651
Change-Id: I8d5a6504edc2e0486a0b4f016d8ee6d9a6228de9
Create a new MWSaveDialogAction, which can be hooked up to triggers. Switch
the existing save dialog accesskey to just use the trigger system.
(Maintaining all the accesskey logic, so we don't change the shortcut on
people.)
Bug: T149914
Change-Id: I9b4ef8504148703556f802b266a517dd5098c06b
New changes:
f58ddea DiffElement: Use document slices with full internal lists
83800c0 DebugBar: Remove hard-coded i18n
b4f89e1 Update OOjs UI to v0.18.1
40c7bf6 Factor out active node functionality from SectionNode for captions
2d967be Move 'mode' property to surface, rename target property to 'defaultMode'
5d8c214 wrapAllNodes in sourcefragment
dd3d9e5 Refactor ve.dm.Transaction
9d61aca Use canonical ve.dm.TransactionBuilder.static.newFrom* methods
df4f72a Make table caption node an active node
b79f72d Core source mode
7533ac4 Localisation updates from https://translatewiki.net.
ae30d71 SourceSurfaceFragment: Check range is not collapsed
Local changes:
Get edit mode from surface where possible
Depends-On: Iec758c1892d518ad4bc2c0d1aaf6ca00fa354323
Change-Id: Ifaf6a26078b2731b374aaad2cb40c08928de9c84
This is set to 'true' in mw.Target#setupSurface(), but not initialised or
used there in that class.
It was previous initialised in an indirect subclass (DesktopArticleTarget).
Move this to the parent class instead for clarity.
Change-Id: Ie3e12d254aa4b689fdce64620e110164311bc60a
Reject the activating deferred making handleLoadFailure
redundant.
Fix logic for switching back to OWE aware of NWE.
Change-Id: I328fc944bb6b9152752742fe35c56b95e3255b88
Otherwise if the target was already loaded the mode will
not be changed, which can cause the wrong editor to load
in multi edit tab mode.
Change-Id: I64071dfdfc8511cce51bda20b9c62d7fc126c528
We should avoid using alert()s as much as possible due to their unhealthy
interaction patterns with any other open tabs or user tasks.
Change-Id: Ib6a217c988322ad17bc7e649c3281eb053b54bbc
Gives us extra functionality like checking for
isUnmodifiedLeftClick which makes CTRL+click on SET
not change the current page, as expected.
Change-Id: Icb37d7383374ee63798443659a2bcb2f1545c8c5
Just use the normal section parameter, haven't been able to figure out why VE
would need to be special about that.
Bug: T149958
Change-Id: I9338d0f1498fbb579fa8c340d6e7274c6d48155b
This prevents the discard warning from being shown if the user
switches back to NWE then back to VE, as by this point they
have left section editing.
Change-Id: I734684c54a8900aab3332ed8421cb42f7f845738
New changes:
e4c8003 Bring in target 'mode' property from MW
Local changes:
Use upstream Target#setMode functionality
Depends-On: I9d501cb77c714fbd299b5816d302b0bdde7833cd
Change-Id: I2fcda6ca7d82d880101d9ba2a027d4ef066aa238
NWE can return data in 'visualeditoredit' instead of
'visualeditor'. We may want to change this later.
Also restore removed hack code that popuplates missing
VE API data when requesting wikitext.
Change-Id: I9a782a85444d37a3e21c071db7e175ee9b0b1c4f
Use history.replaceState if available to get rid of the venotify query
parameter to avoid polluting URLs.
Ideally this would just use a cookie like the core post-edit
notification.
Change-Id: I6ce142012053e2fc18dd44fd0f7b82914acea076
Some older browsers may fail with >1024 arguments. This
does not have a noticeable effect on performance.
Change-Id: I8c85f43425997735bbbe08d27374b79502e02ecf
Get rid of the 504 Gateway Timeout handling while we're here, in preparation
for bug T135748 where that kind of thing will be made normal.
Change-Id: Ia4abb1a68ff7ab7ff365c7348bf4d2ad35c43a27
Converting a document we know contains just plain text paragraphs
is slower than it needs to be. The speeds up the conversion of
[[Barack Obama]] from ~2000ms to <100ms.
Change-Id: I2081858d835286b48db0627696a9eb5294317c2e
transformPage() makes significant changes to the DOM, so measuring the
scroll position synchronously right after that results in a slow forced reflow.
Instead, measure the scroll position before reorganizing half the DOM.
Change-Id: I3baee5c11ca228696ddbfb30789745f5f0faa20a
Instead of getting wikitext from the HTML, which is probably
slower and leads to issues with the whitespace stripping hack,
override getDocToSave and get text from the linmod directly.
Bug: T144621
Change-Id: I6b6cf16ee8f3720398ba8f5c85e7715c2e68329f