Commit graph

1631 commits

Author SHA1 Message Date
C. Scott Ananian 9ee713d480 Display LanguageConverter markup in VisualEditor
Implement special node types for language variant markup, so that they
display appropriately based on the currently-selected variant.

(Parsoid uses empty elements to represent this markup, so without this
patch anything in -{ ... }- is alienated and disappears.)

A follow-up patch will implement context items and inspectors to
allow editing these nodes.  This patch is basic "read-only" support.

Depends on I4fcdebc2290ec35ba188f4c2e69d578791fbcd67 in Parsoid to
generate the appropriate markup, but this patch is safe to merge
independently.

Bug: T49411
Change-Id: Ie11e9301d2513bfe4a36036481cee9a047f46d37
2017-07-25 15:26:41 +00:00
David Lynch 420037b3ff LinkCache: parsoid element styling, detect selflink fragments
Selflinks with fragments aren't actually selflinks, and so shouldn't be styled
as such.

Bug: T170943
Change-Id: Icb67c81327769d09af6bcfe593843d9dd2bcc33c
2017-07-19 11:54:00 -05:00
jenkins-bot 8baf524006 Merge "Visual diffs: Use new wgDiffOldId/wgDiffNewId" 2017-07-18 15:40:28 +00:00
Bartosz Dziewoński 6123b452da Visual diffs: Use new wgDiffOldId/wgDiffNewId
This also removes an undeclared dependency on mediawiki.Uri.

Bug: T169574
Depends-On: Ic4abaae6e9c74509f7a114a697cdbb78dd1b89b6
Change-Id: I76803da5f1a52171a1af8de1f3e31ea127a2da78
2017-07-18 15:16:03 +00:00
Ed Sanders 835a775a49 build: Upgrade grunt-eslint from 19.0.0 to 20.0.0
Mostly indent and regex fixes.

Change-Id: Iaf9d02363c78cb71deec5c4cab53a05b67f60600
2017-07-18 12:55:33 +01:00
jenkins-bot 1a2de9c8ad Merge "DesktopArticleTarget.init: more explicit no-welcome-on-protected-pages" 2017-07-17 22:48:21 +00:00
David Lynch c7486ae19b DesktopArticleTarget.init: more explicit no-welcome-on-protected-pages
Bug: T138715
Change-Id: I1d1efe7fb3286bbf85ea2a17356dcad1d3346517
2017-07-17 17:17:07 -05:00
Ed Sanders 1efd8c5a61 Add mw-parser-output class to CE document
Bug: T164790
Change-Id: I14ee60dc3e68aad02a740af06f5749e6b5e3329c
2017-07-17 18:04:52 +01:00
David Lynch a2f8597712 DesktopArticleTarget.init: only show welcome dialog if page editable
"Welcome to wikipedia, anyone can edit, we welcome all improvements. Start
editing!" is a bit out of place when what you'll see after clicking "start
editing" is "you can't edit this page".

Bug: T138715
Change-Id: I9f655a5f12d4e45644bd01631c2d3131375d8e8f
2017-07-12 10:29:54 -05:00
Ed Sanders dd54c9c95d Return truthy object when image info not found
A missing image should return some data to say the
image is missing, not just reject the promise.

Bug: T169337
Change-Id: Ib41a64a783c1baca88f428417c98e7fb913d14a1
2017-07-03 18:01:33 +00:00
Ed Sanders af25311201 DesktopArticleTarget: Regenerate title in all non-view page scenarios
Bug: T168236
Change-Id: I15f2aeb42b98855512970e2f07396fd7a7c97354
2017-07-01 17:27:07 +00:00
jenkins-bot 05bc265198 Merge "Keep TOC in correct place in document" 2017-06-28 12:31:33 +00:00
jenkins-bot 7f14f854c4 Merge "ve.init.mw.DesktopArticleTarget: Remove some hacks" 2017-06-26 20:27:09 +00:00
jenkins-bot ba3a5d85bd Merge "Show visual diffs on DiffPage" 2017-06-25 03:30:29 +00:00
Ed Sanders fd1adfb3b5 Keep TOC in correct place in document
Change-Id: I6ad8cd8cbd7ef902204408673eb096b7405abd24
2017-06-22 15:16:15 -07:00
Ed Sanders 11e6e25ac6 Clear all diff state when switching editors
Bug: T168618
Change-Id: I19ff5054b87568546bfe1202d67c5d863e1549be
2017-06-22 10:54:04 -07:00
jenkins-bot 7cd5a5d61f Merge "Add newline to end of wikitext documents" 2017-06-21 01:10:57 +00:00
Ed Sanders 09519a24d2 Add newline to end of wikitext documents
Bug: T156609
Change-Id: I80d82ad87464b1c6e0344b29123bb96fcc4cffad
2017-06-20 17:51:51 -07:00
jenkins-bot 115f8e7ae5 Merge "Move preview document filtering into MWSaveDialog" 2017-06-21 00:41:26 +00:00
jenkins-bot fc4e836d4b Merge "Fix getWikitextFragment shortcut to return a promise" 2017-06-21 00:40:46 +00:00
Ed Sanders 9dd638a5ab Move preview document filtering into MWSaveDialog
Also:
* Make mw-content-DIR nest inside mw-body-content
* Use ve.filterMetaElements

Change-Id: Ic70c7dff0f74b81f92b8bd48e8092549947990ba
Depends-On: I478fe1f39164b9fd7e71987b818b8f668d1a7020
2017-06-20 23:50:44 +00:00
Ed Sanders e1b4321b5a Return nothing from styleParsoidElements
The method modifies DOM elements in place, and the return
value is never used.

Change-Id: I6254389dbf8daa67795206cb508038b60e1a4761
2017-06-20 21:03:22 +00:00
Ed Sanders 585cf5f990 Fix getWikitextFragment shortcut to return a promise
Change-Id: Ide5c920332ba9dd0777a7c63e27ebbbc9a391172
2017-06-17 19:42:24 -07:00
Ed Sanders 0e6d8d5fff Show visual diffs on DiffPage
Only shown if VisualEditorEnableDiffPage is set, or query
string param 'visualdiff' is present.

Currently:
* All VE javascript is loaded (could be cut down to just DM code)
* The entire Parsoid HTML of both revisions being compared is loaded
* Both Parsoid HTML docs are parsed into VE DM trees and diffed

Bug: T167508
Change-Id: I151fc9bab3d3032f50c8d11be6b54e45a06fcc34
2017-06-16 19:29:19 +01:00
Bartosz Dziewoński 9dcf6dcddc ve.init.mw.DesktopArticleTarget: Remove some hacks
No longer needed after I2ede6c88be569224c0b2a4e388a133ad98b86a7b
in VisualEditor core.

* 'transform: none' from 049a32c60a
  (that change does not describe what the issue was, but clearly
  it wasn't a complete fix and I see no problems without it).
* 'z-index: 4' from 6fff13b898 (I can't
  reproduce the issue there after removing it).

Bug: T167616
Change-Id: I7e0d603af2668269e5587eaa5e4761166a1b4097
2017-06-14 22:25:25 +02:00
Ed Sanders 75d583a0d9 Use static parseDocument method
Change-Id: I545a58ffcbf1c7c57c197f4858958de835a40394
Depends-On: I5b36e187a5e8bb68b47b2fccf5b46c08b81b01d9
2017-06-08 14:43:09 +01:00
Ed Sanders f178061117 [DEPRECATING CHANGE] Make Target#createModelFromDom static
Change-Id: I019689f87ac0f7f40a8a7600029b5ce1bc92e77f
2017-06-08 14:35:31 +01:00
Ed Sanders 4484f5c316 Don't try to i18n-parse JSON string
Bug: T167051
Change-Id: Idf07ba51d2681f0f5d275f2a732d77cd85e63d03
2017-06-06 11:12:41 +01:00
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