Commit graph

85 commits

Author SHA1 Message Date
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
Ed Sanders de47496b19 Move MWutils to preinit and rename to parsoid utils
Bring in ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref
and ve.resolveUrl, so that the file has no dependencies on VE.

Change-Id: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
2020-03-24 23:13:16 +01:00
Bartosz Dziewoński e2cb9ce93e Remove incorrect handling for 'T-' prefix in section numbers
When a page is preprocessed for transclusion, sections are numbered
differently, and the 'T-' prefix indicates this. It can't just be
removed.

It seems that all of our other code can handle section "numbers" like
"T-1" just fine.

Bug: T246164
Change-Id: If19a2d48f94411a89525fb605169c7f8dd4b1797
2020-03-18 21:23:38 +01:00
jenkins-bot 39a8ecf890 Merge "Remove X-Parsoid-Variant configuration value, which is no longer needed" 2020-03-17 00:13:39 +00:00
jenkins-bot 2c1383b79e Merge "Move checkbox widget creation to mw.libs.ve" 2020-03-13 18:13:46 +00:00
Ed Sanders e3d3e0869d Move checkbox widget creation to mw.libs.ve
So this can be used other VE API users (e.g. DiscussionTools).

Bug: T245222
Change-Id: I1e0e9bb9da53a62f8a20126e579dcd6300bd2376
2020-03-13 18:00:44 +00:00
C. Scott Ananian ce094c72d4 Remove X-Parsoid-Variant configuration value, which is no longer needed
Reverts Ib1403638b12ec5808f6b81bd114949043aa9ac2e.

Bug: T229074
Change-Id: I9bbc02821d5ee82c9944516ab07d3cb380d2f3a8
2020-03-11 13:24:43 -04:00
jenkins-bot c69b46adfc Merge "Clean up code related to token and bad token handling" 2020-03-05 11:25:58 +00:00
jenkins-bot f2cc6d9fc0 Merge "NWE: Don't change editor preference if visual mode not available" 2020-02-27 17:23:53 +00:00
Ed Sanders 71157aab76 NWE: Don't change editor preference if visual mode not available
Bug: T246259
Change-Id: I1513098be707ca5c1a40a061917487785f5100e8
2020-02-27 16:53:45 +00:00
Derk-Jan Hartman 9655bee7de Fix dimensions of WE2017 switch to VE
Correct dimensions are 32px, not 34px.

Bug: T223155
Change-Id: I74da7fc12b642984a680d58c20af054ebaf2e64c
2020-02-26 14:02:41 +01:00