Commit graph

95 commits

Author SHA1 Message Date
Roan Kattouw 4f5c27be09 ArticleTargetLoader: Add ve.loadModules hook
This provides a consistent entry point for registering plugins on both
desktop and mobile, without needing to do strange things if the right
ResourceLoader module hasn't loaded yet.

Without this, registering a plugin module in JS requires ugly code,
and on mobile it wasn't possible at all.

Bug: T267692
Change-Id: Ie2c320c33ec2b064fba4fb45ba62545b9211439a
2020-11-10 23:31:07 +00:00
Ed Sanders 6c36e403aa Convert ve.init.mw.DesktopArticleTarget.init-vector.css to LESS
Change-Id: I5e7c56ebf9e68706e8fc39b1bd4bf81be878ffe4
2020-10-14 13:11:48 +01:00
Ed Sanders 5c84f0cd88 Rewrite EducationPopup so it isn't a mixin
Reference images are moved to Cite and used by Citoid.

Bug: T170919
Bug: T171292
Depends-On: I02041246dda1b3d3ad1bcc0b014fa022e8259b62
Change-Id: Id97659ed1fa64a1223a8957fefaf2a149edd0e9c
2020-09-24 21:33:50 +01:00
jdlrobson 29efc96cd5 Fixes: Error: Bad constructor arguments
Change-Id: I2f1146946bfb96d50f9580f2f7a9bd5dcb926ef1
2020-09-17 11:00:41 -07:00
jenkins-bot 4e55aa9488 Merge "Disable ArticleTargetLoader on invalid UTF-8 URIs" 2020-09-09 12:17:55 +00:00
jdlrobson 0d64cd8649 Disable ArticleTargetLoader on invalid UTF-8 URIs
Bug: T106244
Change-Id: Ieb2c7610e9f49fd33df63a920ebf871110f0b2e6
2020-09-08 15:57:59 -07:00
Ed Sanders 4f192c8cca Init: Remove duplicate check for showBetaWelcome
This is already checked in #shouldShowWelcomeDialog

Change-Id: Ic2a5ab94b70a2480b6c0f3bf894db30da249b23a
2020-09-08 11:55:49 +01:00
Ed Sanders fafd0b93ad Init: Reuse isEditPage
Change-Id: I7611c02c72804d0efd7ef699c371b9069b3a60d2
2020-09-08 11:54:17 +01:00
jenkins-bot 6a6cbf40d9 Merge "Fix URL in console warning" 2020-08-25 21:13:55 +00:00
Ammar Abdulhamid e15d1903fa Fix URL in console warning
Remove angle bracket from the url. The closing character is breaking
the hyperlinking and is not necessary anyway. Also bypass redirect.

Bug: T261126
Change-Id: Id9839623f5f77766042a0df0dfdd5f93d6faf625
2020-08-25 12:58:50 +01:00
Ed Sanders d62fc8b49a Use Array.prototype.forEach.call in copyAttributes
Change-Id: I6c890fecf6f6002d44b32f0c85a3193c0c2632e3
2020-08-18 23:17:03 +01:00
C. Scott Ananian 879f006b7b Fix regression when opening save dialog
DOM attributes are not arrays, and so don't have Array#forEach.

Fixed regression introduced in 4545f53245.

Change-Id: I1f0f44747a0f8a376c1fb7cbb8862c096a9d1dc9
2020-08-18 18:10:31 -04:00
Ed Sanders 4545f53245 build: Update eslint-config-wikimedia to 0.17.0
Fix instances of variable shadowing.

Change-Id: I6e2befb020d7d4b506c7b46131eafacd951aa6d1
2020-08-18 13:16:49 +01:00
Sam Wilson 82bfa015ec Ignore non-checkbox fields for page saving dialog
The 'checkbox' part of the edit form is now allowed to contain
non-checkbox form widgets, but these are not yet supported
by VisualEditor. Until they are, this skips them entirely
in order that no broken form field be shown.

Bug: T259546
Change-Id: If62c11b174df235be611b9d32eb28e4759ba5f66
2020-08-07 13:18:41 +08:00
David Lynch deb218aeec Use mw.cookie instead of jquery.cookie
jquery.cookie is no longer maintained, and we're coming up on maybe
running into issues with sameSite which jquery.cookie doesn't support.
Moving to mw.cookie will let us centralize that fix.

Also, removed some dependencies on jquery.cookie in code that doesn't
seem to ever use it.

Bug: T252597
Change-Id: I8634cfd42c2a5ab3c9d712417a7d1a55508274fd
2020-07-30 17:07:40 -05:00
Ed Sanders a87939670c ArticleTargetSaver: Use request action to fetch data from response
In DiscussionTools we will use a different action in the save API.

Change-Id: I587ffe2ead1b0706f6ba04947c55630ab1bb6bda
2020-07-02 11:25:26 +01:00
Volker E 9c9c86613d Use standard WikimediaUI theme styles
Follow-up to change in OOUI v0.39.2.

Bug: T256713
Change-Id: I09e990222b0068b07f59cc4b6449451b9e5df3d2
2020-06-30 20:37:01 +00:00
Ed Sanders 013b7419bf build: Update eslint-config-wikimedia to 0.16.2
Use jsduck config

Change-Id: I5cd7bbcee83b0fa148b8fb8c3b4adcf08f96cefc
2020-06-18 19:16:52 +01:00
Ed Sanders 877d1e3359 Move restbaseId stripping to ve.utils.parsoid
De-duplicates the two implementations we had.

Bug: T253584
Change-Id: If5d15dd4e7e0d3704ca8d75c0a25c529b06f17fb
2020-06-10 20:31:16 +01:00
jenkins-bot fd8265c8ac Merge "Make VisualEditorDisableForAnons only hide the tabs, not disable the editor" 2020-06-10 19:17:58 +00:00
Ed Sanders 9c8195f823 Replace browser blacklist/whitelist with (un)supportedList
Bug: T254646
Change-Id: Iac0fc850520f2a83954d3fac21b38715e2f76a8c
2020-06-10 16:30:57 +01:00
Bartosz Dziewoński f81f34f59d Make VisualEditorDisableForAnons only hide the tabs, not disable the editor
Bug: T253941
Change-Id: Id08514b3827c4315d69651bc2313bf8317ba12fc
2020-06-08 20:05:58 +02:00
jenkins-bot a28a263192 Merge "Drop linting from the VE API" 2020-06-04 17:12:54 +00:00
Ed Sanders f01d4ab35d Drop linting from the VE API
Calling the linter is very slow as the result is not
cached. Extensions needing this (DiscussionTools) should
just call the Linter extension API directly.

Bug: T253799
Change-Id: I994b52ca70c29a32900741a36087f10144396720
2020-06-04 18:51:38 +02:00
Ed Sanders 6076708ff3 build: Update eslint-config-wikimedia to 0.16.0
Change-Id: I638e0f82949597e2a2e4ea18fc2f0258f225358c
2020-06-02 21:30:00 +01:00
jenkins-bot 6dd197a10f Merge "init: Manage education popup state the same way as welcome popup state" 2020-06-01 20:57:40 +00:00
Roan Kattouw 501518cb4d init: Check for disabled welcome dialog again async
The first time we check, it's too early for any code that might have
wanted to call stopShowingWelcomeDialog() to have done so (because we
check synchronously after making that function available).

I'm not sure if checking twice like this is the best solution, or if it
would be better to defer the whole thing and only check once.

Change-Id: If5b88bb50c3becaa3d7931c8b8e4d0faed7b69d2
2020-06-01 13:10:49 -07:00
bkudiess-msft fb2290f032 Fixes edit section being cropped on page with zoom
Bug: T253601
Change-Id: Ifa449d927e69c38ad5fa8fcb004b14417fab5e7d
2020-05-28 21:43:34 +02:00
jenkins-bot dc90695d8c Merge "Refactor getPreferredEditor and expose reusable parts" 2020-05-20 18:48:21 +00:00
jenkins-bot 0410ed44ba Merge "DesktopArticleTarget.init: Set veEditSourceUri in SET mode too" 2020-05-18 23:08:32 +00:00
jenkins-bot d2dd31b805 Merge "Fix #unwrapParsoidSections for pseudo-sections (generated by templates)" 2020-05-18 20:32:28 +00:00
Bartosz Dziewoński 4f70ead440 Fix #unwrapParsoidSections for pseudo-sections (generated by templates)
In 92c3055628 I changed `sectionId > 0`
to `sectionId !== '0'`. That was actually a mistake, as Parsoid's
section IDs can be negative, which indicates pseudo-sections, which
may not have headings.

https://www.mediawiki.org/wiki/Specs/HTML/2.1.0#Headings_and_Sections

Bug: T252238
Change-Id: I9133d4365a71d6db1fa58b69ae3b970166d15c1e
2020-05-18 21:41:13 +02:00
jenkins-bot 38034b1051 Merge "Treat links to diffs and history pages as external links" 2020-05-14 18:54:04 +00:00
jenkins-bot 9e33d28050 Merge "Update toolbar styles for Vector changes" 2020-05-08 20:13:14 +00:00
Bartosz Dziewoński 3866ad7f77 Update toolbar styles for Vector changes
Depends-On: I52938689fc7d99a710510349aaa573a87864a367
Bug: T251648
Change-Id: Ica07cf1dab2cf522532a08fadec599bd2fcade5c
2020-05-08 16:23:57 +02:00
Bartosz Dziewoński 91f3a971f4 DesktopArticleTarget.init: Identify our events on multi section edit links
This is now consistent with all other events.

Needed for I9904e8af4a60b0f5e9a6e263cd4fd8e1e3fd1f98.

Change-Id: If52aa9d619eac08456874fc75c0f6e1adff01246
2020-05-07 21:42:56 +02:00
Ed Sanders 50db102c4d Refactor getPreferredEditor and expose reusable parts
Separate out logic specific to edit pages

Change-Id: I5b3b47feeeca2085fcd283d55d7e9ceafa73be70
2020-05-07 14:33:21 +01:00
Bartosz Dziewoński b1f40f4f9f DesktopArticleTarget.init: Set veEditSourceUri in SET mode too
Bug: T192974
Change-Id: I1a2485e6f6ba3cb21d669e5f675ce50e4ba81d8f
2020-05-06 19:56:28 +00:00
Roan Kattouw 31db495bcf init: Manage education popup state the same way as welcome popup state
And factor out the common code for using a preference with a fallback to
localStorage or a cookie.

Bug: T235566
Change-Id: Ibb983319edcd2987225fe89677fd10e3ff8f9df6
2020-05-01 19:12:30 -07:00
jenkins-bot e4fe634201 Merge "ApiVisualEditor: Add option to return lint errors from Parsoid" 2020-04-24 10:03:40 +00:00
Bartosz Dziewoński ae86f7290b ApiVisualEditor: Add option to return lint errors from Parsoid
Depends-On: I6bbe2fc5aea07c65eb99768f2c44ed42601792a3
Depends-On: I6bdf5635763ef8a44d44a031c64cd7f289261a32
Change-Id: I723ec766d1244d117f8d624440026fe5af0d3403
2020-04-21 22:49:29 +02:00
Roan Kattouw ab763f37df DesktopArticleTarget.init: Add mw.libs.ve.disableWelcomeDialog()
This allows code in other extensions to suppress the welcome dialog
temporarily (just for that one page view), without touching the user's
preferences.

Bug: T235566
Change-Id: Ief6545289cf59fda851aa944b059994abd90253e
2020-04-21 11:43:36 -07:00
Roan Kattouw e0125e3e9d DesktopArticleTarget: Move shouldShowWelcomeDialog() to init
Move shouldShowWelcomeDialog() and stopShowingWelcomeDialog() from
DesktopArticleTarget to DesktopArticleTarget.init, and use them to
deduplicate code in init that manages the wikitext welcome dialog.

Look for both the vehidebetadialog and hidewelcomedialog URL params.
The code in DesktopArticleTarget used vehidebetadialog, but the code in
init for the wikitext welcome dialog used hidewelcomedialog.

Bug: T249954
Change-Id: I19f1a2da36bc65addb52811c3d3c73c1259bc8f5
2020-04-21 11:41:59 -07:00
Ed Sanders 651756c4fc eslint: Enable the mediawiki/class-doc rule and make pass
Also minor other adjustments

Change-Id: I9ee48359e3e53799f2f6240e44b53972283ce328
2020-04-17 22:59:11 +01:00
Sohom Datta d16d93ccf7 Treat links to diffs and history pages as external links
Wrote code such that only redlinks and normal page urls
 using the script path are treated as internal links.

Bug: T248076
Change-Id: Ie476bf7f4b389a659899eab4351c912fc6b24bee
2020-04-17 22:48:14 +05:30
Roan Kattouw de2baff16d DesktopArticleTarget.init: Also extend existing URL in SET mode
This unbreaks the use of ?vehidebetadialog=1 on page views (i.e. without
action=edit) in single edit tab mode.

Bug: T249957
Change-Id: I0109f5d95cebbb3e585d25b7623764cc7350cda0
2020-04-14 17:01:23 -07:00
Akinwale Alagbe 3b7a567bfc Fix: Adding label to source editor switch editor tool
Change-Id: I7cd90bbbd0f65c0a5b0588fd337e922a63b618b5
2020-04-06 18:10:26 +00:00
jenkins-bot 443cb0fe55 Merge "Overwrite "edit source" link only when needed" 2020-04-01 21:51:56 +00:00
Bartosz Dziewoński 92c3055628 Fix issues with treating section "numbers" as integers
In MediaWiki, section numbers may be prefixed with 'T-' if they refer
to sections on a transcluded page, so they are not really numbers.

Change e2cb9ce93e caused us to treat them as strings most of the time,
but it looks like there are several places where we treated them as
integer numbers, which I missed when making that patch.

The first two changes in ArticleTarget#restoreEditSection fix T248795
and T248968/T249112, respectively. The other changes are cleanup.

Bug: T248795
Bug: T248968
Bug: T249112
Change-Id: I8373a7ab515595769ce6f3051a182c922415b643
2020-04-01 21:41:17 +02:00
MtMNC fd0b145db3 Overwrite "edit source" link only when needed
Prevent JS from overwriting the contents of the "edit source" link
if the change is unnecessary as it can break third-party skins.

Bug: T248025
Change-Id: Ica1e45488813877583efadabc72526544e8943ac
2020-03-27 12:20:33 -07:00