Commit graph

904 commits

Author SHA1 Message Date
Alex Monk 86719eb90f Prevent endless error loop if falling back to wikitext (after a load failure) fails.
Change-Id: Id48fa13a33aee9fabf857d20a75d26463c329f44
2016-11-16 18:52:26 +00:00
Ed Sanders ff4761bbd9 Fix handling of failure to load visual mode
Reject the activating deferred making handleLoadFailure
redundant.

Fix logic for switching back to OWE aware of NWE.

Change-Id: I328fc944bb6b9152752742fe35c56b95e3255b88
2016-11-15 12:44:38 +00:00
Ed Sanders b4ff55a38c Always set mode when activating the target
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
2016-11-15 12:44:38 +00:00
Ed Sanders 521c3c8436 Pass isModified when switching from VE to NWE
Bug: T150707
Change-Id: I9ae525aa7a5883bb45f91262db8abc082983ee1b
2016-11-14 23:05:21 +00:00
jenkins-bot 0c1eff31ef Merge "Teardown the toolbar properly" 2016-11-14 17:26:54 +00:00
Ed Sanders f2e0b408b4 Teardown the toolbar properly
Depends-On: I53a86bf5e0322dc9766ae4ddf31ff0ae5568df7e
Change-Id: If9cc876a57272679584ebc653cf2ee8e17ddb821
2016-11-12 14:28:11 +00:00
jenkins-bot cf3c972a3a Merge "Move NWE URL changes into JS" 2016-11-12 00:02:50 +00:00
Ed Sanders b1b6f9836e Remove redundant narrow-threshold calculation
This is done upstream in OOUI.

Change-Id: Icc0e535f9d1113a14d2c1cc275efebbc98e3a38c
2016-11-11 18:54:30 +00:00
Alex Monk 807cb6b54e Move NWE URL changes into JS
Bug: T148077
Change-Id: Ic9b94184a48026254cf4a0a812fe6fc8455841b5
2016-11-11 18:31:22 +00:00
Ed Sanders 6f8e0d9699 Replace confirm with OO.ui.confirm
Also enable no-alert eslint rule to prevent alert/confirm/prompt
being used in the future.

Change-Id: I2851e1f58c1861f75dbb20192e5cf6c343da75db
2016-11-11 13:13:58 +00:00
James D. Forrester 26e7267f02 ArticleTarget: Use an OOUI MessageDialog, not window.alert()
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
2016-11-10 12:55:49 -08:00
jenkins-bot 28787b0f3c Merge "Rename methods used for setting up multiple edit tabs" 2016-11-09 00:45:01 +00:00
jenkins-bot 45a75047fa Merge "Move save dialog checkbox code up from DAT into ArticleTarget" 2016-11-08 17:14:45 +00:00
jenkins-bot efb4133119 Merge "Use onEditTabClick handler in SingleEditTab" 2016-11-08 17:10:06 +00:00
Ed Sanders 55fcded32e Replace non-standard whitespace in comments
This is required to pass eslint:recommended.

Change-Id: If8c4876a366e5c021c414e54328ed1913b679969
2016-11-08 14:15:12 +00:00
Ed Sanders 2fa4cfef16 Rename methods used for setting up multiple edit tabs
Change-Id: I71d6dd0848e9cc3ee8531b0b914c29219b4697bd
2016-11-08 12:47:30 +00:00
Ed Sanders f6a205d77f Use onEditTabClick handler in SingleEditTab
Gives us extra functionality like  checking for
isUnmodifiedLeftClick which makes CTRL+click on SET
not change the current page, as expected.

Change-Id: Icb37d7383374ee63798443659a2bcb2f1545c8c5
2016-11-08 12:39:15 +00:00
Alex Monk e81c6e5b43 Move save dialog checkbox code up from DAT into ArticleTarget
So it applies to MobileArticleTarget.

This shows the checkboxes on mobile.

Bug: T148914
Change-Id: Ib6559d5601004e58b72903805059e04f42acc85f
2016-11-05 06:24:49 +00:00
Alex Monk 7c80976f5b Remove 'vesection' parameter
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
2016-11-05 02:08:13 +00:00
jenkins-bot b6d3dabfbf Merge "Add binding for when only tab is new wikitext editor" 2016-11-02 21:36:21 +00:00
jenkins-bot 65236ae67f Merge "Try to make client and server code to get last editor work the same" 2016-11-02 20:07:07 +00:00
jenkins-bot 254e77a296 Merge "Set section to null when switching from NWE to VE" 2016-11-02 19:45:14 +00:00
Ed Sanders 3fb757c307 Add binding for when only tab is new wikitext editor
Bug: T149796
Change-Id: I675c5876fbb9ca8427983e9d4252cccda35775f9
2016-11-02 19:10:28 +00:00
Ed Sanders 56679dfb35 Set section to null when switching from NWE to VE
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
2016-11-02 15:53:29 +00:00
Ed Sanders 7db58ab3d8 Fix binding of onEditTabClick to section links in SET
Bug: T149797
Change-Id: I0f753718ccddb9c2b68cdc82ff379bd59d7006ad
2016-11-02 15:50:30 +00:00
Ed Sanders e655880d14 eslint: Remove unused exception and fix documentation errors
Don't enable valid-jsdoc yet though, due to @chainable bug.

Change-Id: I4d2a6de19c72c6e4c20733446616d8046419d431
2016-10-28 12:02:36 -07:00
James D. Forrester 36befda61c build: Replace jscs and jshint with eslint
It's new, it's fresh, it's amazing, it's here.

Change-Id: I5dc784411f704685ed5cc763a2b2b1c5d3e5a610
2016-10-28 18:33:15 +00:00
James D. Forrester c45c79eca2 ve.init.mw.DesktopArticleTarget: Fix missing '&&'
Change-Id: I0e91cde3d38d3f5bdd7dde790093db21d8a64036
2016-10-27 16:53:55 -07:00
Ed Sanders 244eeb9ea1 Update VE core submodule to master (e4c8003)
New changes:
e4c8003 Bring in target 'mode' property from MW

Local changes:
Use upstream Target#setMode functionality

Depends-On: I9d501cb77c714fbd299b5816d302b0bdde7833cd
Change-Id: I2fcda6ca7d82d880101d9ba2a027d4ef066aa238
2016-10-27 16:12:31 -07:00
Ed Sanders fad3b429c8 Make meta dialog tools visibile but disabled in NWE
Following our unwritten rule of trying to keep the interface
as consistent as possible.

Change-Id: I58668acb5bac12de73b7b8f52e670f68336c399f
2016-10-27 14:48:51 -07:00
Ed Sanders dc902b4c93 Pass edit token when saving/diffing in new wikitext editor
Change-Id: Ia14a4d204e367a3d0d46165a51b0cdc6fc3d57e7
2016-10-26 17:39:14 -07:00
jenkins-bot 3c443724e2 Merge "Follow-up I64a8ed73: Fix NWE getWikitextFragment" 2016-10-26 23:57:44 +00:00
Alex Monk 53f8aac0d5 Follow-up I64a8ed73: Fix NWE getWikitextFragment
Also fix the rejection Deferred line if things go wrong

Change-Id: I8f060de1972dd0ae79c81162c61efd5956e48955
2016-10-27 00:37:22 +01:00
jenkins-bot 3750081797 Merge "Don't show confirm dialog when switching to NWE" 2016-10-26 21:48:15 +00:00
jenkins-bot 60565711ff Merge "Fix handling of API responses" 2016-10-26 20:42:35 +00:00
jenkins-bot 035987b9be Merge "Create init.isWikitextAvailable and add page content check" 2016-10-26 20:42:06 +00:00
jenkins-bot b5317b694f Merge "Fix edit source links for NWE" 2016-10-26 00:25:22 +00:00
Ed Sanders 460df1f25f Don't show confirm dialog when switching to NWE
Bug: T148099
Change-Id: Icd756dc31ef8628795915ea972bb0ded385532ed
2016-10-25 17:20:16 -07:00
Ed Sanders de2f07d523 Fix handling of API responses
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
2016-10-25 17:20:16 -07:00
jenkins-bot b341e3406a Merge "Fix arguments passed to requestPageData when switching" 2016-10-26 00:04:34 +00:00
Ed Sanders 7b9229f5b8 Fix toolbar transition
The contents of the bar to should appear to move in to place, not
just be revealed.

Change-Id: I01a85e3455462cf70b6c3f25a236ab6cb82c706c
2016-10-25 15:55:41 -07:00
Ed Sanders 702f931ef2 Fix arguments passed to requestPageData when switching
Change-Id: I890d782829fd077096be364c26a41b56ec4a2df3
2016-10-25 15:52:52 -07:00
Ed Sanders e977ca4336 Fix edit source links for NWE
We fixed these to use vesection instead of section.

Change-Id: I0aa6530b6707239c41216421394379301b0878a7
2016-10-25 15:50:14 -07:00
Ed Sanders 751853942f Create init.isWikitextAvailable and add page content check
Bug: T149007
Change-Id: I2e16c6361c32f3c1ebd2ae7c9f41089d56b67b06
2016-10-24 15:36:44 -07:00
jenkins-bot 50e102da0c Merge "Send RB errors through the normal error handling process" 2016-10-20 23:01:02 +00:00
jenkins-bot 0f566448ed Merge "Switch to the wikitext editor if VE fails to load" 2016-10-20 23:01:01 +00:00
Ed Sanders 2dfdd82317 Prevent edit source from acting twice
Bug: T148309
Change-Id: I5ef3f4b7cbc7298e89aa531c174657b1d1bccdf6
2016-10-16 19:06:06 -07:00
jenkins-bot 23eb869d9d Merge "Get rid of ?venotify= from URL post-save" 2016-10-14 23:30:16 +00:00
Alex Monk b5815e9ffd Send RB errors through the normal error handling process
Change-Id: I230ff6d3c9a6a183fb483f5adfd7ccdc025a07af
2016-10-14 11:17:56 -07:00
Alex Monk 39aa3021a7 Switch to the wikitext editor if VE fails to load
Also kill some dead HACK code in DesktopWikitextArticleTarget#switchToWikitextEditor

Bug: T135748
Change-Id: Ie5aaa0f3c3bd20755abaac9b86af015b71eb777b
2016-10-14 18:15:16 +00:00
jenkins-bot 246e2ebb4e Merge "Tidy up DAT load failure handling" 2016-10-14 00:32:30 +00:00
Alex Monk 70bf00e9b0 More NWE-SET integration fixes
Also stop calling $skin->getUser() so much, store the result

Change-Id: Ic91a660bc4b97a82f1d2b0bffb55425564696da1
2016-10-13 22:46:16 +01:00
Alex Monk 49283f7250 Fix typo in DAT.init.js
Change-Id: I75f7de16ea06d62a1bdfa0e04294fef5560fd5c9
2016-10-13 22:22:57 +01:00
Alex Monk 6b87b2671e Fix another case where we need to pass the section
Bug: T144654
Change-Id: I5f91b9329525ceaeb971d02f93c959d908d748f7
2016-10-13 20:28:21 +01:00
Ed Sanders 4040442ad8 Section editing in NWE
Bug: T144654
Change-Id: Ida6e721e0d980b47e3fda6a1f0744cbce1b2235a
2016-10-12 12:55:11 -07:00
Kunal Mehta 6c93a49244 Get rid of ?venotify= from URL post-save
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
2016-10-12 11:05:12 -07:00
Ed Sanders 4fc2904a87 Follow-up I9547dfd: Only enable VE tabs if VE is available
Otherwise VE is launched on namespaces where it is disabled
(but NWE is enabled).

Bug: T147890
Change-Id: I62f4ff96b991553a4eb0be9efb2e84bc80ca2bb4
2016-10-11 14:19:36 -07:00
Ed Sanders 605f7b625b Hid category links in source edit mode
Change-Id: Ib44e393d3a8d070a4ced002a11cb26f58447e67c
2016-10-07 16:24:23 -04:00
jenkins-bot 7551b0e788 Merge "Use createTextNode in wikitext converter" 2016-10-06 23:20:21 +00:00
Ed Sanders 01ed8e954e Use createTextNode in wikitext converter
Has better browser support. innerText is for getting the
text as rendered.

Bug: T147584
Change-Id: Ie2cf732d537aa4053d5b45d85c2d678a0d338017
2016-10-06 14:50:08 -04:00
Ed Sanders aa7da97f2d Use safer batchPush in converter
Some older browsers may fail with >1024 arguments. This
does not have a noticeable effect on performance.

Change-Id: I8c85f43425997735bbbe08d27374b79502e02ecf
2016-10-06 13:19:00 -04:00
Alex Monk d2dd3689cf Tidy up DAT load failure handling
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
2016-10-06 00:52:28 +01:00
jenkins-bot c8f3474f3d Merge "Fix styling of categories now they are editable" 2016-10-05 21:33:49 +00:00
jenkins-bot 6604a6a3a9 Merge "Use a proper error message when VE fails to load due to not being able to connect" 2016-10-05 18:29:28 +00:00
jenkins-bot 80596f9f22 Merge "Disable switch-to-VE button in NWE if VE is unavailable, don't hide it" 2016-10-05 18:29:26 +00:00
jenkins-bot eae2305269 Merge "Allow NWE on non-VE namespaces" 2016-10-05 18:22:56 +00:00
Ed Sanders a0dd888485 Use a streamlined 'converter' in wikitext mode
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
2016-10-05 16:40:28 +00:00
Alex Monk f860bd0d36 Use a proper error message when VE fails to load due to not being able to connect
Not just 'HTTP 0'

Change-Id: Icd1b5b64ca8ea4af80e3cf32f8502d8fb0d11ae2
2016-10-05 16:39:27 +00:00
Alex Monk aeaa49f9b2 Disable switch-to-VE button in NWE if VE is unavailable, don't hide it
Bug: T146182
Change-Id: I9d5095147288a78e2ba7dbddd3d7e6673c97859f
2016-10-04 18:41:11 +01:00
Alex Monk d15034011f Allow NWE on non-VE namespaces
Bug: T146182
Change-Id: I9547dfd591ad1e68e045b4928765a95895e37737
2016-10-03 22:20:18 +01:00
Ed Sanders 1ce3a81c63 Fix styling of categories now they are editable
Bug: T147084
Change-Id: I8c2acf507c72f6a35aadf595bad0c8c378140a0b
2016-10-02 15:43:17 -04:00
Alex Monk d0abe11aca NWE: Don't show button to switch to VE if it isn't available
Bug: T146182
Change-Id: I4bd039726ebccfd4351ecc68e6d7662752412d1b
2016-09-24 02:43:38 +01:00
Alex Monk 8a80b5bbc3 Split isAvailable from visual-specific checks
Not fully tested

Bug: T146182
Change-Id: I5d7ae6e49991660ecdc2daf46b319947f83a1018
2016-09-20 23:53:53 +01:00
jenkins-bot 089e22ff6c Merge "(attempt to) make NWE work with SET" 2016-09-20 22:45:14 +00:00
jenkins-bot f6b7c64e92 Merge "Open meta dialog to edit categories when user clicks on the category footer" 2016-09-20 00:58:29 +00:00
Alex Monk 0c07caafc7 Open meta dialog to edit categories when user clicks on the category footer
Bug: T145267
Change-Id: Ie88c4d9c6327baffdb83c1affbc0515a68c0fc03
2016-09-19 21:35:45 +01:00
jenkins-bot 376a4520ea Merge "Use correct switch type when opening welcome dialog on NWE" 2016-09-19 18:16:59 +00:00
Roan Kattouw cc8ca8e738 DesktopArticleTarget: Save scroll position before transformPage
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
2016-09-17 00:12:39 -07:00
Alex Monk edf5b60368 (attempt to) make NWE work with SET
Ugh.

Bug: T143578
Change-Id: I71e08508eb0914be9d624202b13a4369df512b80
2016-09-17 03:36:47 +01:00
Alex Monk 926212dbae Use correct switch type when opening welcome dialog on NWE
Bug: T145225
Change-Id: I032652733576d1a9797cc3dbb3dd24ca69cb30e5
2016-09-15 01:30:01 +01:00
jenkins-bot 9721998763 Merge "Provide the new wikitext editor as a beta feature" 2016-09-13 00:56:48 +00:00
James D. Forrester 1d64e3280c Provide the new wikitext editor as a beta feature
Still needs to be de-feature-flagged later.

Bug: T142644
Change-Id: I8e2588909ff95085b5a4d58f4394d9bc805f5598
2016-09-08 00:38:08 +00:00
Ed Sanders d0bb5511a5 Cleanup getDocToSave API and use in source mode
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
2016-09-07 12:09:41 -07:00
Ed Sanders 3c25f3aede Switch from NWE to VE using 'Edit' tab
Bug: T143577
Change-Id: I19d942c879c9ccf70e95beb5f8de589eb6363039
2016-09-06 17:23:24 -07:00
jenkins-bot 06ca8ea7ba Merge "Disable veaction=editsource if NWE is disabled" 2016-09-06 15:52:27 +00:00
Ed Sanders 7b3deab5a1 Disable veaction=editsource if NWE is disabled
Bug: T144651
Change-Id: I6a1e42b2da267bc42adeee0c818046eab0b387f8
2016-09-02 17:55:37 -07:00
Ed Sanders edadf530e1 Make VE<->NWE switching progress bars non-cancellable and labelled
Soft dependency on Ifa41578164 in core to support the
non-cancellable flag.

Bug: T143582
Change-Id: I886a8f5ca90737938e4c0fedb2b456d851a12326
2016-09-02 16:47:17 -07:00
jenkins-bot feb756dfb1 Merge "Update tab and history state when switching between NWE & VE" 2016-09-02 20:43:32 +00:00
Ed Sanders e3dcf029ce Update tab and history state when switching between NWE & VE
Bug: T143577
Change-Id: I729c0f4a8131f54f81be2d776bddf3020a21e704
2016-09-02 19:31:35 +00:00
jenkins-bot dcbb8e2e90 Merge "Fix restoration of redirect HTML after exiting without saving" 2016-09-01 16:12:05 +00:00
Alex Monk d907e973fd DesktopWikitextArticleTarget#switchToVisualEditor: Use correct revision ID property
So we ensure we send the actual revision ID, not potentially undefined, to the
method. If we send undefined, it'll give us an etag for revision number 0...
And that will cause issues when we later attempt (in a future editor switch) to
pass an etag for revision 0 along with the correct revision.

Bug: T143920
Change-Id: I0c27956abdd26ae4f5f1b91010a5eab8ee0354ab
2016-09-01 02:45:22 +01:00
jenkins-bot 572e7375d7 Merge "Preserve data when switching from NWE to VE" 2016-08-30 23:33:43 +00:00
James D. Forrester ba4532aa9d Rename EditButtonPublishNotSave to EditSubmitButtonLabelPublish
Depends-On: I4fbe54876095378a476399bf5e336c8df3e91e14
Change-Id: Iface24f77775216a0ab9eb464e7e10624af7719d
2016-08-29 10:46:49 -07:00
jenkins-bot f071b0380d Merge "Vary the 'save' labels to 'publish' for public wikis" 2016-08-25 21:36:41 +00:00
jenkins-bot 3063a9f23e Merge "init: Discard attempts to activate while we're already activating" 2016-08-25 20:12:45 +00:00
Ed Sanders 134b62eb09 Preserve data when switching from NWE to VE
Bug: T143917
Change-Id: I910e731914bd71fdb131dae79d233d4306facc5d
2016-08-25 11:06:40 -07:00
James D. Forrester deef47414a Vary the 'save' labels to 'publish' for public wikis
Bug: T131132
Change-Id: I4a497265661d5ce0f6144988b514509dfa1bddfd
Depends-On: I56634ed223778a0650cf36ac7256151b13c494f1
2016-08-25 09:37:52 -07:00
David Lynch c1a065295f init: Discard attempts to activate while we're already activating
Perhaps in the future we could enhance this so that clicking a different edit
link queues that up for after the current activation finishes / aborts the
current activation cleanly.

Also, error-checking on setting an invalid progress state when loading.

Bug: T143160
Change-Id: I6c78cb19953df6fb564c06bac807e6897b63df19
2016-08-24 19:57:47 -05:00
James D. Forrester b7c7d06968 Show a different label for buttons on create vs. modify
To align with the linked patch in MediaWiki core. Taking advantage of
the opportunity to use core's messages for these, and remove some dead
wood old messages that were never used like "restore" items in mobile.

Bug: T139033
Depends-On: Ie81b5edd275963a965cd44d0fd325cae9ee2f1a6
Change-Id: Ie00e94cc77cb750a7e8d1104366bb3dad65af8a4
2016-08-24 16:01:11 -07:00
David Lynch 11a4e4e6b9 init: port in isUnModifiedLeftClick without any VE core dependencies
Bug: T143467
Change-Id: I4c0ecf80ecfff04472e136801264d50dafe39575
2016-08-22 14:40:34 -05:00