Commit graph

1603 commits

Author SHA1 Message Date
Bartosz Dziewoński 4f55d8066e Update for deprecation of OOjs UI openWindow/closeWindow promise
Bug: T166729
Change-Id: I95b85a8c0d488993c11da74e1d856fef6cf0ebb4
2017-06-02 00:21:58 +02:00
Timo Tijhof a9ce695f75 mw.DesktopArticleTarget: Use require() for mw.page.watch
Add 'require' to eslint global whitelist for this extension,
since ResourceLoader provides this in all contexts now.

Bug: T166254
Depends-On: I0e6a95bd4fbaba06eae5137ac7af84f62bebf6f0
Change-Id: I6b2fe57317dcff18ec6d9ea0cd9e4eb9c894c169
2017-05-24 21:17:02 +00:00
Ed Sanders 1a577b668d Move getWikitextFragment up to Target from ArticleTarget
Any MW target may want to get a wikitext fragment, not just
ArticleTargets. Requires us to move refreshEditToken up as well.

Change-Id: I27d30e20fefd5ba266d3d8e5f99383e9b4d4993a
2017-05-21 07:57:49 +00:00
jenkins-bot 526d1ba71e Merge "Enable edit tab setup on appropriate Special pages" 2017-05-18 16:18:49 +00:00
Bartosz Dziewoński d687e01208 Do not check for visual editor availability when loading source editor
Follow-up to fefb76eebc. Prior to that
change, the condition for this looked like this:

  // … if on a ?veaction=edit/editsource page
  (
    isViewPage &&
    uri.query.veaction in editModes &&
    (
      uri.query.veaction === 'editsource' ||
      init.isVisualAvailable
    )
  )

In the refactor, the `uri.query.veaction === 'editsource'` check was
lost.

Since that code is pretty messy (probably predating the source editor
and hastily adjusted), instead change the check for `isVisualAvailable`
to just `isAvailable`. If the requested mode turns out to not be
available later, the editor will not load.

Bug: T165146
Change-Id: Idfaf9115dd20cec8f8e044a704b93b07984cdcee
2017-05-16 18:57:56 +02:00
Ed Sanders 63c36c87da Always prefer wikitext for action=edit on non-SET wikis
Ideally we could use the preferred editor, but this breaks
tab switching to the old editor.

Bug: T165238
Change-Id: I5f5ee5566cdd2080ba7c89d43cf127b457537768
2017-05-15 12:48:30 +01:00
Ed Sanders 9342e45f7b Fix action=edit links for NWE
We added support loading NWE from action=edit in I35208cce069
but missed this check in the front-end.

Bug: T165238
Change-Id: I2732eaa81a3f968b34c4e878b2ad36de981dd567
2017-05-15 11:52:06 +01:00
James D. Forrester 57aad56a7b Enable edit tab setup on appropriate Special pages
Using the forthcoming wgRelevantPageIsProbablyEditable.

Bug: T165010
Depends-On: I6c6ca1cfd93e7be917952980f1e1d57aec3a1292
Change-Id: I6c6ca1cfd93e7be917952980f1e1d57aec3a1229
2017-05-15 11:14:29 +01:00
Ed Sanders debcd678b5 Generate visual diff only after switching to visual diff tab
Bug: T164724
Change-Id: I48e49d4b68cc769b3e9d061983de4c78b5ad5c34
2017-05-09 10:09:39 +00:00
Ed Sanders 54fc920622 Captcha improvements
* Fix focus and resize/scroll into view after the
  captcha has loaded (so after the image has loaded
  for FancyCaptch).
* Add margin between input and captcha
* Enable enter-to-submit on captch input field.
* Unify code for simple/math/questy and correctly
  render math as HTML (by looking at the mime type)

Change-Id: I10433cefbfea8569674c120dde5b489570e20966
2017-05-02 17:49:12 +01:00
Ed Sanders 998ae22b2d Follow-up I488fd7e74: Adjust saveFail calls for new function signature
Bug: T164157
Change-Id: I41b946af5a8b80211b0672d7012835f2c9e1dc2b
2017-05-02 16:39:04 +01:00
jenkins-bot 68d00a6a42 Merge "init: Fix checks for required skin elements to avoid false positives" 2017-05-01 22:37:16 +00:00
Bartosz Dziewoński a02e68374e init: Fix checks for required skin elements to avoid false positives
* Do not try to load the editor on protected pages, or if the user
  doesn't have permission to edit pages.
* Move the check for required DOM elements after the check for
  pages without the editor (T162411) and after DOM ready (T163307).

Bug: T162411
Bug: T163307
Change-Id: I8149694ba8155682701f2cda6ca212d60f446caa
2017-05-01 11:24:01 +00:00
Ed Sanders 7c0fc8d3b9 Fix minor lint errors and typos
* Commas that should be semicolons
* Unnecessary 'call's

Change-Id: I11a80702b5396a36e3deecc6e706a397cc354bd8
2017-04-29 12:36:17 +01:00
Ed Sanders cd8b059e7d Synchronise VE availability checks in frontend and backend
Adds better support for NWE loading on action=edit.

Change-Id: I35208cce0696607377378a1b58d426e914a3ba7d
2017-04-28 17:45:27 +01:00
Ed Sanders fefb76eebc Rewrite logic for choosing initial editor
Expanding from a single if-expression lets us make the
code much more readable, and reveals some minor bugs.

Change-Id: I49e57bfc093e019c837a73eab5c25fdbd14de0af
2017-04-26 12:07:51 -07:00
jenkins-bot a93888afd5 Merge "EditModeTool: Use state-describing, not action-describing labels" 2017-04-26 18:42:42 +00:00
Ed Sanders d1017bfd48 EditModeTool: Use state-describing, not action-describing labels
Follows-up 914eb1cde3; reverts the logic to have the label change, but
sticks with new "-current" i18n messages, so the "X editing" instead of
"Switch to X editing"; the old i18n messages are now dropped entirely.

Bug: T162864
Change-Id: Icdad6c5bb06ff86e9b8976840bb1a94b939609a8
2017-04-26 11:33:14 -07:00
David Lynch e1e89e8b14 DesktopArticleTarget: only destroy notices tool if it exists
Bug: T163813
Change-Id: Ib957eac2d3d407f8e683082938ec51d882c2d041
2017-04-26 18:03:39 +00:00
jenkins-bot b268b4f80f Merge "ve.init.mw.ArticleTarget: Only retry once after a 'badtoken' error" 2017-04-24 19:48:35 +00:00
jenkins-bot 67d6ac38e6 Merge "Show a different label for the current mode in the editor mode selector" 2017-04-21 15:56:04 +00:00
jenkins-bot 1862f74f11 Merge "ve.init.mw.ArticleTarget: Use a simpler error message when site is read-only" 2017-04-20 22:34:33 +00:00
Bartosz Dziewoński 371ac353cf ve.init.mw.ArticleTarget: Use a simpler error message when site is read-only
Sites like to customize 'readonlywarning' with things that we can't parse.
Instead, use 'apierror-readonly'. The old message is still shown in edit
notices.

Bug: T163455
Change-Id: I592accde17b256ecee27820df12d9d312499f8f7
2017-04-21 00:08:57 +02:00
jenkins-bot dd6113bb76 Merge "Load notices when switching, just don't show them" 2017-04-20 21:05:40 +00:00
Bartosz Dziewoński 91a75e3fef ve.init.mw.ArticleTarget: Only retry once after a 'badtoken' error
If we retry and get another 'badtoken' error, something is very wrong,
and trying again and again is probably pointless. This behavior also
matches how mw.Api#postWithToken handles bad tokens.

Bug: T163493
Change-Id: I488fd7e74e37922044491695d6c9025a45531281
2017-04-20 22:42:10 +02:00
Ed Sanders c02c529537 Load notices when switching, just don't show them
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
2017-04-20 21:20:10 +01:00
James D. Forrester 914eb1cde3 Show a different label for the current mode in the editor mode selector
Bug: T162864
Change-Id: I2242f85f8c4607411e65b64c8e43181bb139945f
2017-04-20 13:00:34 -07:00
James D. Forrester bef15b7a1e Update VE core submodule to master (bfb35aaef)
New changes:
57f8064b6 tests: Enforce dm unit test coverage at 20% per file and 80% globally
6f757c670 LinkAnnotation: add a getFragment method for consistency with MWInternalLinkAnnotation
c40a3f152 Drop the classList polyfill for IE9
d1af6c6bb Update OOjs UI to v0.21.1
bfb35aaef Localisation updates from https://translatewiki.net.

Bug: T162277
Change-Id: I5146bc421bb88e56bafadccefc7bbdee106504ea
2017-04-20 09:48:46 -07:00
Esanders eeab63d2c7 Revert "Dropping IE9: Remove disableUneditableContent from DesktopArticleTarget"
IE10 also lacks pointer events support.

This reverts commit 5266776953.

Change-Id: I42c9530c45ad98657b403bdb266188368085716b
2017-04-14 13:53:56 +00:00
James D. Forrester d989de5c09 DesktopArticleTarget.init: Don't call setEditorPreference twice
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
2017-04-13 04:38:07 +00:00
David Lynch d5ac18a466 LinkCache: don't treat a link with a fragment as a selflink
This matches the rendered output for the page.

Bug: T162669
Change-Id: I1ea0ab37a2751c0b4669da8a23adf0ce271facea
2017-04-11 12:19:01 -05:00
Ed Sanders a6b4258f47 ArticleTarget: Refactor savedialog/target interaction
* Pass a wikitext promise, instead of wikitext
* Handle writing of content to the dialog from within
  the dialog.
* Handle diff errors within the dialog.
* Never disable the 'Return to save form' (approve) button
* Remove redundant messages

Change-Id: Ibd76e8951998f751abfb4f407682202c2f73ac7e
2017-04-10 10:29:41 -07:00
jenkins-bot 4110bdfd26 Merge "VisualDiff: Fetch original doc from Parsoid if fromEditedState" 2017-04-10 17:09:46 +00:00
jenkins-bot 77987b976d Merge "Remove #wpTextbox1 fallback from ArticleTargetLoader#requestPageData" 2017-04-10 17:05:03 +00:00
jenkins-bot edb911ef71 Merge "Dropping IE9: Remove disableUneditableContent from DesktopArticleTarget" 2017-04-10 16:50:59 +00:00
jenkins-bot 40265bd807 Merge "stylelint: Drop no-unsupported-browser-features references" 2017-04-10 16:49:15 +00:00
jenkins-bot c0361ab40e Merge "Update VE core submodule to master (da9c49395)" 2017-04-10 16:49:13 +00:00
Ed Sanders 5266776953 Dropping IE9: Remove disableUneditableContent from DesktopArticleTarget
Bug: T162277
Change-Id: Ibb38284573078098c2173232239e9836a8161f56
2017-04-10 08:37:03 -07:00
James D. Forrester f51a6d5020 stylelint: Drop no-unsupported-browser-features references
The rule hasn't been applied for a while, as it was deprecated upstream.

Change-Id: I7877d0e3bdcd05a609d61add2dc62d7598e348cb
2017-04-10 08:36:37 -07:00
James D. Forrester d1c24ce226 Update VE core submodule to master (da9c49395)
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
2017-04-10 08:32:51 -07:00
Ed Sanders 939a1f4005 VisualDiff: Fetch original doc from Parsoid if fromEditedState
Bug: T160741
Change-Id: Ied0641cc868a8dd4cf540eba75e1b248277a96b0
2017-04-09 22:28:53 +01:00
Ed Sanders ddf6a89c72 Remove #wpTextbox1 fallback from ArticleTargetLoader#requestPageData
Makes the API clearer and the method re-usable.

Change-Id: If79afb262e0c8c8e2193c07fef6bb0712496a4d9
2017-04-09 22:28:03 +01:00
Ed Sanders 97f6bdd79a Make Target#getVisualDiff async
This will be required later when we have to fetch the original
document from the server before running a visual diff.

Change-Id: I351688f4d1fec892bc297f40c209939cbb2ccf95
2017-04-09 13:26:22 +01:00
Ed Sanders 981dd6c250 Don't set oldid if it is equal to curId
Change-Id: I0fff55ab1e8d9c5c24b39526aa5d8a893cd99a2a
2017-04-07 11:49:30 +01:00
Roan Kattouw 1e7e9044c9 MWVESwitchPopup: Follow-up 445f8b76a0: apply adjustment to anchor instead
Otherwise the anchor isn't correctly aligned below the icon.

Change-Id: I73a9db9be63354f1fa459e844eb40be1d3130189
2017-04-06 16:33:53 -07:00
Roan Kattouw 445f8b76a0 MWVESwitchPopupWidget: Fix alignment by removing margin
Since the PopupWidget rewrite, margins for aligning popup anchors
should be set on the anchor itself, not on the popup.

Change-Id: If8237ae5edbc2e8c5cb99147f392aae52e642765
2017-04-06 11:50:43 -07:00
jenkins-bot d4438549e5 Merge "ArticleTarget: building summary in source mode, strip links from section titles" 2017-04-05 23:57:18 +00:00
Bartosz Dziewoński c45ad46433 Allow loading progress bar to appear on skins other than Vector and MonoBook
The styles are not specific to the Vector and MonoBook skins, but rather
to the MediaWiki and Apex themes of OOjs UI. Rename them to reflect that.

Change-Id: I757e8d96625feb8290cbf7837b5d801961cda344
2017-04-05 20:13:28 +02:00
David Lynch 758b2fd689 ArticleTarget: building summary in source mode, strip links from section titles
Bug: T162017
Change-Id: I76e96d1e36f7bad0b3e17d8bb842c6ad1172f8cc
2017-04-05 11:16:11 -05:00
James D. Forrester 8463524e18 MWSaveDialog: Run links through a render function for preview & visual diff
Provide a utility funcition in ve.init.mw.LinkCache to do this.

Also use this in ve.ce.MWTransclusionNode/ve.ui.MWPreviewElement, and
introduce to ve.ce.MWExtenionNode

Bug: T73900
Bug: T153535
Change-Id: Ieb9a0274b8c5ae1932c431546f09d18000fa6dd9
2017-03-31 10:51:35 +01:00