Commit graph

234 commits

Author SHA1 Message Date
Thiemo Kreuz bc0a34b0ed Add and fix default values in parameter documentation
Same random finds while working on something else. I carefully
checked and made sure these methods are actually called without the
optional parameter.

Change-Id: Iab36fd130258322985b5d6e7f8e1f7b4ee235ba2
2022-02-21 13:19:21 +00:00
jenkins-bot 098791f6c7 Merge "Add vector-body class to diff/previews" 2022-02-07 23:38:15 +00:00
Ed Sanders 5739da585a Add vector-body class to diff/previews
Bug: T287733
Change-Id: I6a4befb2a29489c767df5896a86ef6a607938685
2022-02-05 22:51:05 +00:00
Bartosz Dziewoński 8080bd2f5d Move copyright warning message parsing from RL module to API
Parsing it in the RL module caused the module cache key to depend
on the parse, which is slow and makes ResourceLoader sad. The usual
approach for solving this (I206bb05d28) can't be used, because of
how EditPage generates this message.

Bonus #1:
Generate the message for the correct page title. MediaWiki allows
customizing it per-namespace or even per-title, which we haven't
supported before.

Bonus #2:
Pass the context for message localisation (depends on I5f7c77970d).
EditPage::getCopyrightWarning() was parsing messages without the
interface flag, causing some needless processing elsewhere.

Depends-On: I5f7c77970d0525c0ff394f8bd72c69dcb5d00623
Bug: T298822
Change-Id: Iaa626f0e6379a5a370f9c465cea8528bb5bde7f7
2022-01-24 22:19:04 +00:00
Ed Sanders 2098292318 Use no-jquery/no-html to warn against writing HTML strings to the DOM
This forces us to comment when we are doing this deliberately.

Change-Id: Ide1bcb64f6c6076b48e88f1f27045bd93392f8a0
2021-12-16 01:28:42 +00:00
Ed Sanders 4d13a4f4ed eslint: Enable no-jquery/no-append-html
Prevents accidentally treating plain text or user input
as HTML, which could be an XSS vulnerability.

Change-Id: Id4af48447a0907962a57340cb60aca08df9cc505
2021-12-16 02:04:11 +01:00
Ed Sanders 42b5fddf61 MWSaveDialog: Move header out of mw-body-content
Change-Id: I684e3025b97b546a391a64dd647365246e37d36c
2021-11-12 23:00:02 +00:00
Ed Sanders e111c40d09 MWSaveDialog: Move var declarations inline
Change-Id: I163dc057961e8d530ba394dbb92b97e4d866d867
2021-11-12 22:54:52 +00:00
Bartosz Dziewoński 86583d52e0 Toggle the watchlist-expiry dropdown's disabled state
Using the same logic as mediawiki.action.edit/watchlistExpiry.js
in MediaWiki core.

Bug: T251348
Change-Id: Ic9c67d24b5282d13de2bd496a4cb681dc9b092ac
2021-09-20 10:23:52 +00:00
Arlo Breault 2fd09aaba3 Remove skinning modules when showing preview
Bug: T185284
Change-Id: Ifec8809cd75cb76c79936a69351be0c7779de39e
2021-07-28 10:55:16 -04:00
Ed Sanders 857014fae9 Support watchlist expiry
Bug: T251348
Change-Id: I017a54784c758c5e97fb640721bd456adc0fbab5
2021-06-08 20:14:45 +00:00
Bartosz Dziewoński e04f78d48a Replace use of deprecated CSS class 'mw-ajax-loader'
Bug: T278894
Change-Id: I100bbe06da198f5175366c25b74daf3af986aae3
2021-03-31 20:46:58 +02:00
Bartosz Dziewoński 4cb6842f86 Fix displaying error message when preview fails
Follow-up to 5f1c68945d,
I didn't realize that showPreview() expected strings.

Bug: T277696
Change-Id: I78af5786d211f724728ed81e28170d2d6be6125b
2021-03-18 13:45:07 +01:00
Ed Sanders 87ab649e9d Add mw-content-container, mw-body classes to preview
Bug: T272751
Change-Id: I96440806ec9bce28cfb1b833c8fd913ba6770903
2021-02-18 21:33:36 +00:00
Ed Sanders 1ec49384dc MWSaveDialog: Use MessageWidget (inline, warning) to show save dialog warnings
This is the same style that is recommended for form warnings.

Change-Id: I163f5180c66b9eb165a610184b153bb1da99caab
2021-01-20 19:41:17 +00:00
Ed Sanders e20decc77c MWSaveDialog: Remove wrap option from showMessage
This was used when we used to pass API errors to showMessage, but
is now unused by the two remaining users (missing edit summary, and
"press ctrl+enter to submit").

Change-Id: I8a6b4db78d4e451cf3ec85fcdfd8293328aaaa3c
2021-01-16 16:22:23 +00:00
Ed Sanders 598cb943de MWSaveDialog: Restore focus to edit summary widget after resize
Change-Id: I1fc1e43d947e9e8472a470bb5eabf67fda07be5d
2021-01-16 16:18:18 +00:00
Ed Sanders 443eaded40 Move newline-stripping filter into MWEditSummaryWidget
Edit summaries should always strip newlines, wherever
this widget is used.

Change-Id: I37177771fef831037067d6244fb27cba5e06528b
2021-01-16 16:16:49 +00:00
James D. Forrester 8a78603988 Drop support for wgCommentByteLimit, hard-coded null in MW nowadays
Change-Id: I767e0633415568134c46fccbafdaceb1ab76dea3
2020-08-26 20:25:38 +00: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
Ed Sanders 6076708ff3 build: Update eslint-config-wikimedia to 0.16.0
Change-Id: I638e0f82949597e2a2e4ea18fc2f0258f225358c
2020-06-02 21:30:00 +01: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
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 d0c45940d0 ve.ui.MWSaveDialog: Remove meta element filtering from wikitext preview
Once upon a time, we added code to filter <style> and <link> elements
from the rendering of templates in visual editor, because attempting
to cut them would crash Chrome (T52043).

There are at least three reasons why that is not needed here:
* The preview is not editable text, so you can't cut from it
* The Chrome bug was fixed 7 years ago anyway
* We now use TemplateStyles in articles and they work just fine

The code was added here in 9dd638a5ab
without explanation, I think it was just done for consistency.

Bug: T212085
Change-Id: I0712e3a081f04d0b74cda47652fa6eb118dfe7b2
2020-03-05 16:57:51 +01:00
jenkins-bot 9e6a40a827 Merge "Use mw.Api#getErrorMessage instead of custom handling" 2020-01-10 14:22:14 +00:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
Bartosz Dziewoński 5f1c68945d Use mw.Api#getErrorMessage instead of custom handling
Bug: T240519
Depends-On: Ie18666b41f4aff1ab4bcf93f9df6e3000ac7b500
Change-Id: I69d9432162f195dcfe9470485b549a1b007617ff
2019-12-14 17:01:35 +00:00
Bartosz Dziewoński 092d0c332b MWSaveDialog: Fix error handling for diffs
In case of HTTP errors we'd crash and show no message.

Change-Id: Ideeff4ce75e7ca82ce63bf7ede6dff03eaa1c5d7
2019-11-24 09:51:43 +00:00
Ed Sanders b0f4b4c94e Move more code to ArticleTargetSaver
* Add a postWikitext method and split out postContent
  from postHtml
* Move saveSuccess handling into postContent promise
* Connect promise directly to saveComplete instead
* Pass whole response.visualeditoredit object, instead
  of splitting into variadic arguments for saveComplete.
* [DEPRECATION] Make serialize return the postHtml promise
  and deprecate passing a callback.

Change-Id: I905737515578000b2b87214c92e8b9fe9e82f6b7
2019-11-14 14:34:22 +00:00
David Chan 22098d6b16 Convert $.Deferred() to ve.createDeferred(), except in preinit
Follow-up to a8e07e026dea4f54241d1dbb6b7bcdbd8c670db2 in core.

Change-Id: I09333adb4876c6e584a4a6b6a1628227c4cd2616
2019-11-02 13:06:28 +08:00
David Lynch d03db0e4f2 ui.MWSaveDialog: checkbox tracking was getting duplicated on every setup
Bug: T232790
Change-Id: Id19aa59c71432d0179fc06b6a30014d1037074ae
2019-10-03 12:44:43 -05:00
David Lynch 001ed6a88e MWSaveDialog: add more instrumentation
Bug: T229079
Change-Id: I2e5b45a4a28b580fbca872d620df94a61fb8a24a
2019-09-16 10:48:31 -05:00
Ed Sanders 4a8947686d Docs: Standardise "messages used" comments
Change-Id: Ic563901a9439e86ca85ac6210323a35ab34736c3
2019-08-28 16:41:19 +01:00
Bartosz Dziewoński 84d548e7b1 Remove redundant @method annotations
A @method annotation is only necessary when the docblock is not
directly followed by a function declaration (in which case JSDuck
assumes it documents a property), e.g. when defining an abstract
function or referencing a function from another library.

I verified that JSDuck generates exactly the same output before and
after this change (docs/data-<hash>.js files are identical).

Change-Id: I7edf51a8560ab9978b42800ab1026f0b5555c3bf
2019-08-21 23:33:15 +02:00
David Lynch ac471d47e9 MWSaveDialog: On mobile show a back button rather than an x
Bug: T230058
Change-Id: I370fedddf8475e5688ac4ce53f9ccd7d6137705b
2019-08-14 11:38:38 -05:00
Ed Sanders 348c880cbe MWSaveDialog: Don't pretend saveButtonLabel is optional
Change-Id: I7cfc5bfbf8893fa4808f2823b37efae7b9e520ac
2019-08-05 21:16:21 +01:00
Ed Sanders 0b1f0a0eda Use MobileFrontend license message on mobile when available
Bug: T229579
Change-Id: I861f0d997607a34ca04727afd55771cbf14e253b
2019-08-02 16:29:54 -05:00
Ed Sanders 085764ddd6 SaveDialog: Hide options bar when empty
Since I7f6fd7ee9 it is now possible for the options bar to be
completely empty if the user is logged out. In this case hide
it and only show it again when the character limit needs to be
show.

Ideally we wouldn't have the height change, but it is quite rare
that a user gets to 400 chars and is logged out.

Bug: T228165
Change-Id: Ifbdf352afcbf4e549889e04fdb70fd30ce233aad
2019-07-16 14:28:25 +01:00
Bartosz Dziewoński f259bb9c02 MWSaveDialog: Use close flag for close actions, move 'back' button
When previewing/reviewing changes, the "Return to save form" button
now replaces the "Resume editing" button in the top-left corner (and
receives the 'back' flag). Effectively, you tap 'back' once to go back
to the edit summary, and twice to go back to editing. This seems to me
like a much more natural interaction than two separate buttons.

Bug: T225021
Bug: T227049
Bug: T227857
Change-Id: Id27ccf06923c8aa86b1c1a9292bc43bb825ce6c8
2019-07-12 20:33:02 +00:00
Ed Sanders e83e80f42e Show edit summary on preview page
Bug: T199582
Change-Id: Ia8c2322706e8e635498c447dddb3b4b98040e27e
2019-06-21 12:54:13 +01:00
Ed Sanders a424bc3da5 SaveDialog: Move iOS Safari hack to avoid losing focus
Bug: T222859
Change-Id: I07b530573a8f5b900bdb5cbc15314f5758baf36a
2019-05-13 11:50:55 +01:00
Ed Sanders 5346acc175 Fix edit summary preview
API version 2 doesn't use the '*' property.

Bug: T222999
Change-Id: I4da49dfd6f1e7ffe682fb803bb256ab7ec2aad61
2019-05-11 21:24:43 +01:00
Bartosz Dziewoński c31cf00432 ve.ui.MWSaveDialog: More save panel disappearing on iOS Safari
Bug: T221289
Change-Id: I6ec40bd78f5c36a6033e800466124fcbb4f6446d
2019-05-01 22:43:49 +02:00
jenkins-bot d39c28ca69 Merge "ve.ui.MWSaveDialog: Work around save panel disappearing on iOS Safari as well" 2019-04-24 22:25:59 +00:00
Bartosz Dziewoński 11673b21ad ve.ui.MWSaveDialog: Work around save panel disappearing on iOS Safari as well
Same thing as Ifb49ede450cabdcd8303b298b62f2ac632809b53, for
a slightly different case that we missed.

Bug: T221289
Change-Id: I0ca287af87e1058620fbed75a50d40f01513a567
2019-04-24 15:56:58 +02:00
Bartosz Dziewoński 5b0bb28323 ve.ui.MWSaveDialog: Fix preview of redirects
Incorrect order of operations caused all metadata to be removed before
we looked for the 'mw:PageProp/redirect' metadata item.

Bug: T221686
Change-Id: Ifcf210ad772babe1019fd0cfbaa7bd60d0e7e5fe
2019-04-23 23:02:24 +02:00
Bartosz Dziewoński b7f7cf3734 ve.ui.MWSaveDialog: Work around review panel disappearing on iOS Safari
No idea what causes it, but I've seen a similar issue when working on
Ic35f084d019afd1782292c831765ceb1444fb14a (in OOUI) and this hack
worked there too.

Bug: T219680
Change-Id: Ifb49ede450cabdcd8303b298b62f2ac632809b53
2019-04-10 22:56:08 +02:00
Ed Sanders 1ffb574450 Edit summary autocomplete
Bug: T50274
Change-Id: Ida462f3dea325902459546af97e66cd9d0c86166
2019-03-09 14:03:27 +00:00
Bartosz Dziewoński 043a59a9bd ve.ui.MWSaveDialog: Fix fragment links in visual diff too
Follow-up to a22b9c8ea3.

Bug: T212554
Change-Id: Id7a16505c11a25f7a61f1394e9d9d1372cbb3d23
2019-02-22 22:51:30 +01:00
Bartosz Dziewoński ab8ae002af ve.ui.MWSaveDialog: Target links in visual diff to new window
Needed after change I6c988c012730d36d60629864a436e4a1700684c5
in VE core.

Change-Id: I7f0e836bd105a925f8dc62d52f081ee9051765fd
2019-02-22 22:50:55 +01:00