Commit graph

75 commits

Author SHA1 Message Date
Ed Sanders 0b0d8d6266 ApiVisualEditorEdit: Make tryDeflate public and static
So other extensions can use it, e.g. ContentTranslation.
Eventually we could upstream some of these document
editing APIs.

Change-Id: I1e4925c7302fbe90ab4f9380c5efb83c9c379609
2017-09-14 14:48:18 -07:00
Umherirrender 23e7ccb6d4 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
Change-Id: I247c15b8b6c4ef9bfc5b96f1d6553cd186638fbb
2017-06-26 19:18:47 +02:00
James D. Forrester 307a8f0ed7 build: Enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
Change-Id: Id11360a266b5a5269856a9adbf3cd27cda52f178
2017-05-11 08:19:44 -07:00
James D. Forrester 56bfb7828c build: Bump mediawiki-codesniffer to 0.8.0 and make pass
Change-Id: If509e5ba639bcda497fe7898f6eb79265967139d
2017-05-11 08:19:44 -07:00
James D. Forrester a7f56f02e6 Follow-up fa2efb9e5: Also mount the service in ApiVisualEditorEdit
Whoops.

Change-Id: If1eac7fc745e8b21b47fbc6a8d40c3e45f4f52df
2017-05-08 14:42:21 -07:00
WMDE-Fisch 9053906f33 Replace deprecated Context::getStats() with MWServices::getStatsdDataFactory()
Change-Id: If7ef514b625e67268d524477ac43ad9bc3dcae5f
2017-03-17 12:20:35 +01:00
WMDE-Fisch c82d499d48 Replace deprecated suppress warning methods
Change-Id: I7b2452940bfa86ca1b8b882164a996ec6ef74f4b
2017-02-15 14:50:02 +01:00
Timo Tijhof a0739d146b Ensure required modulestyles are loaded on read after save
We already ensure any new regular modules are loaded after saving,
and that any changes to jsconfigvars are applied. But we don't
currently ensure styles-only modules are loaded.

Live Preview in MediaWiki core has always done this properly, but
the VE implementation forgot to consider the other two properties.

Issue was mentioned in otherwise-unrelated T156699.

Change-Id: I2e9fedc6dffcac4385ebac27571cc3e4f6fb1542
2017-02-14 12:39:34 -08:00
James D. Forrester 446b16e71a ApiVisualEditorEdit: Use 'html' format for API errors so we can see them
The Translate extension emits errors when the saved text is in error —

* pt-parse-open,
* pt-parse-close,
* pt-shake-position,
* pt-shake-multiple,
* pt-shake-empty, or
* pt-parse-nested

Switching to 'html' error message format means we pay attention to the top
error, displayed in the user's language. This avoids showing 'editaborted'
generic messages when we can actually help people with specifics.

Change-Id: Id9d7e510e32a3a13cc061648679e01edd68a3868
2017-01-11 16:30:01 -08:00
James D. Forrester 7f7ffbb1be ApiVisualEditorEditor#postData: Use isset on oldid post param
Bug: T154559
Change-Id: I83907f7df9360bb6fcc03615ec9e5d1d5856250b
2017-01-04 22:16:42 +00:00
James D. Forrester 122f49b2dd build: Bump file copyright notices for 2017
Change-Id: I3c20809e71cc0da58123e1b5f29c4f3aac945496
2017-01-03 08:58:33 -08:00
Ed Sanders 5a8106773c Support section=new in NWE
Bug: T150709
Change-Id: I1002b97060d642df0988da15860a36c13712bade
2016-12-13 12:20:55 +00:00
Brad Jorsch 1bcdb0374a ApiVisualEditorEdit: ApiParse ignores 'page' when 'oldid' is supplied
And since Iae0e2ce3 supplying both is an error.

Bug: T152547
Change-Id: Ib1b35c886bbebfe8505c52a944a8252d8174c979
2016-12-07 18:53:54 -08:00
jenkins-bot a04cef294e Merge "Update for API error i18n" 2016-12-06 20:04:24 +00:00
Ed Sanders b9741d1cc2 Allow 'wikitext' to be an empty string in save API
Change-Id: Icdfd60c4a2de6a678cad995d5bcf80d07703537b
2016-11-19 14:09:16 +00:00
Brad Jorsch 26e24c2d09 Update for API error i18n
See Iae0e2ce3. Since VisualEditor master requires core master, this just
depends on the master patch instead of trying to maintain BC.

Depends-On: Iae0e2ce3bd42dd4776a9779664086119ac188412
Change-Id: I0e802a47302725f062334a437bff84e3b2b8b9a6
2016-11-14 12:47:01 -05:00
Ed Sanders dcbbaa79db Factor out getWikitext in ApiVisualEditorEdit
Change-Id: I0f6709f170034263acc94daa41603bcc77897d31
2016-11-01 16:24:40 +00:00
Roan Kattouw 13801bb6d3 ApiVisualEditor: Move diffing and serializing to ApiVisualEditorEdit
These require POST, especially paction=serializeforcachekey because
it calls ApiStashEdit::parseAndStash() which needs a master DB connection.
Move them to the edit module so we can require POST for that one and keep
allowing GET for the main module. This fixes the warnings we currently get
for using parseAndStash() in a module that does not require POST.

Change-Id: I64a8ed7305105fa4c46902b99984306a7ff468cc
2016-10-21 15:24:13 -07:00
jenkins-bot d20040aec0 Merge "Section editing in NWE" 2016-10-13 01:51:56 +00:00
Ed Sanders 4040442ad8 Section editing in NWE
Bug: T144654
Change-Id: Ida6e721e0d980b47e3fda6a1f0744cbce1b2235a
2016-10-12 12:55:11 -07:00
Alex Monk 418bd32217 NWE: Use a different change tag to the visual editor
Bug: T147587
Change-Id: If9b466ff8449ceeb0e71f9d36ea0b4ec8c1bae2d
2016-10-12 01:11:15 +01:00
Alex Monk 8a80b5bbc3 Split isAvailable from visual-specific checks
Not fully tested

Bug: T146182
Change-Id: I5d7ae6e49991660ecdc2daf46b319947f83a1018
2016-09-20 23:53:53 +01:00
Brad Jorsch d7247efc90 Remove pre-1.25 API compatibility code
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: Iff2eeb2bbfba15c84a4fcec85b6647c28886e9aa
2016-09-20 15:32:23 -04:00
Ed Sanders c452e134cc Wikitext surface alpha feature
Edit wikitext with the VE interace.

Bug: T104479
Bug: T142138
Change-Id: Ic95b47e0dd378578555c4a2342ca9c87064ed1d5
2016-08-12 18:37:29 +00:00
Ed Sanders f1482627fa Factor out API deflation and change storeInSerializationCache API
Change-Id: I7e2e15a8ba5088e6c370cb035c71f7af18c13b61
2016-08-09 20:08:34 -07:00
Max Semenik 07da2af53f Fix undefined variable
Change-Id: Iba39e0a26a04cad28179aacd4f25b9aef1cfa7fc
2016-07-06 17:05:10 -07:00
jenkins-bot 026848c369 Merge "Fix display of subpage breadcrumbs show after save" 2016-06-29 16:41:05 +00:00
Alex Monk f69cc559b2 Tell the client whether we created a redirect or not properly.
Instead of letting the API formatter set it to empty string if so
or not set it at all if not, have it set to "1" if so or "" if not,
so the JS will handle it correctly.

Bug: T136546
Change-Id: I7308ab1efc1c3060606b61893432b685038192a9
2016-06-15 20:26:11 +01:00
Ed Sanders 216ef78cb0 [DEPRECATING CHANGE] Use canonical namespace names for enabling VE
These are more meaningful and the actual namespace IDs used can
vary, especially for extensions.

Change-Id: I781d484d7525ff09b5d348e79b63b161a7a26997
2016-05-04 18:56:00 +01:00
Alex Monk f6f048f31a Fix display of subpage breadcrumbs show after save
Bug: T97700
Change-Id: Ia576d32d0dd99d22ff2504b0e53cca3b7c82b811
Depends-On: Id27380de9577ad54cb2580b76a4f236e8dd491dd
2016-04-26 17:51:39 +01:00
Alex Monk 83ce0c3db3 Restore original WebRequest after we're finished messing with FlaggedRevs on save
Also mess with title so it actually appears to work again

Bug: T131633
Change-Id: I36229807d15f93879f8699a015d105815047eb6c
2016-04-16 13:25:35 +01:00
James D. Forrester e7a3ec43bf build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"
Change-Id: Ic96081539c2ae98b5b239b59ca9b0362b337e522
2016-02-17 08:18:02 -08:00
James D. Forrester 8063603ca5 [BREAKING CHANGE] Drop MW pre-1.25 PHP API documentation compatibility
getDescription() and getParamDescription() have been replaced by a proper i18n-based
API documentation system since MediaWiki 1.25. Retaining these does not help us with
backwards-compatibility given that the repo already requires MediaWiki 1.27.0-alpha,
so just drop them before they become out of date.

Change-Id: Ic8b87235aeb7e1bcd7b24d5609c7d002658a66ba
2016-02-06 17:43:37 -08:00
James D. Forrester ada58df361 build: Bump file copyright notices for 2016
Change-Id: I3c618c196e504a80ca297a4132a17f1977a24fb7
2016-01-03 14:57:25 -08:00
Alex Monk 85b745666f Allow switching from wikitext to VE
Just by pressing the VE tab for now

Requires a relatively new version of restbase

Bug: T49779
Change-Id: I2a5294345f5e0f469c1dd1bdd29dbce211571a4e
2015-11-02 20:55:19 +00:00
Alex Monk 82b62896e1 Change a bunch of parsoid references to acknowledge that RESTBase is sometimes in the middle
Bug: T112339
Change-Id: I0eac521a89fc399de168408ef55c9143c0db742a
2015-09-14 21:18:01 +01:00
Frédéric Bolduc 0ce3baf66d mw.Target: Add jsconfigvars and modules to the save mechanism
* On save, VE will now fetch and append modules and jsconfigvars to the save
  event, which respectively contains necessary JS config module data and the
  list of required modules to be added on the page.
* The jsconfigvars are now properly added to mw.config on edit save.
* If any new modules are now required by the page after an edit, they will be
  loaded by ResourceLoader through mw.loader.load.

Change-Id: Ib3990078a22ad9e46debf3ce174e7cf27b86d944
2015-08-04 19:00:09 -07:00
Alex Monk ea34d938c8 Revert "Revert "Replace wgVisualEditorNamespaces with an associative array""
This reverts commit 7ca1afbbd2.

Bug: T104898
Change-Id: I061c1fd9ab8ec6b2afac92feef888ba207e1a9b1
2015-08-02 23:13:24 +01:00
Alex Monk 7ca1afbbd2 Revert "Replace wgVisualEditorNamespaces with an associative array"
This reverts commit 647a5597bb.

Change-Id: Idaf4960f5df2fbb426162830a15383ecfc96118e
2015-07-31 04:41:28 +01:00
jenkins-bot 4d95b6ea45 Merge "Replace wgVisualEditorNamespaces with an associative array" 2015-07-23 23:59:51 +00:00
Alex Monk 82fb5f609a Parse SpamBlacklist error on the server-side
The client won't be able to deal with templates etc.

Bug: T99830
Change-Id: I78611a3f061b1afd73de052aa9ddff48dc368f2d
2015-07-23 18:49:42 +00:00
Alex Monk 647a5597bb Replace wgVisualEditorNamespaces with an associative array
Bug: T104898
Change-Id: Ibf4812caeaa9290959bc757fc49a151854bff337
2015-07-23 18:49:21 +00:00
James D. Forrester 2b3dfdfe13 Set file permissions correctly for *.php files
Non-executable files should have permissions set to 644 – touching:

	ApiVisualEditorEdit.php
	VisualEditor.hooks.php
	VisualEditor.php

Bug: T104044
Change-Id: I73fcee410fa1d538e05a7f494871f20531665701
2015-06-26 18:41:01 -07:00
Aaron Schulz a948624dda Use more appropriate RecentChange_save hook for tagging
* At this point the IDs are all known so there is no need
  to re-query what was written in the transaction
* This works when recent change insertion is deferred
* Also deferred tagging in ApiVisualEditorEdit to after
  the RC row is saved

Bug: T100439
Change-Id: Ic4c7d8d89b8cfeee57eda867c0ff74fa9682ffc8
2015-05-27 13:28:01 -07:00
Brad Jorsch ccd2091f5d Further cleanup for core API change
PS25 and later changed things around a fair bit, meaning the previous update
needs some further updating. In some cases additional cleanup is also necessary
for future core API changes.

Bug: T96595
Change-Id: Iaac674f77079d29d42813fd69620bdce8905730f
2015-04-20 14:41:29 -04:00
Roan Kattouw 25c718bc96 Explicitly pass oldid to ApiParse after saving
If we don't explicitly pass the revid of the new revision we
just created, ApiParse will be lazy and get the latest revid
from the slave DB, which will probably be out of date.

Bug: T95466
Bug: T94367
Change-Id: I2149c7a710075eff9292d0c25ca40d10b325ad44
2015-04-08 13:48:30 -07:00
Roan Kattouw 25afae342a Move parseWikitext from ApiVisualEditor.php to ApiVisualEditorEdit.php
It's only actually being called in the latter.

Change-Id: Ifbf568738f38aa52878197813ec458c34bee5d5b
2015-03-14 00:27:11 +01:00
Roan Kattouw 237bb053d6 Remove the sanity check
It's slow, especially on large pages, and it's triggered
very infrequently these days, and only for known bugs.

In the future we should replace this with a debugging
interface that displays the DOM diff between the original
DOM and the round-tripped DOM, as opposed to the boolean
interface we have now.

By extension, this also means the visualeditor-needcheck
tag won't be applied to new edits any more, although
its registration and messages are kept around because
edits with this tag still exist in page histories.

Bug: T87161
Change-Id: I909153492a5786b4b69fccd42ce3c1d4bdb3a059
2015-02-17 17:14:34 -08:00
James D. Forrester 2f8b3e0d96 build: Bump copyright notices to 2015
Change-Id: Ie92dab7411116d3410195c3fb0a3513c664c0c30
2015-01-12 20:34:19 -08:00
Brad Jorsch c891a8e8b4 Update ApiResult handling for mediawiki/core change I7b37295e
Change I7b37295e for mediawiki/core deprecates several methods, and more
importantly changes the format of the data returned from
ApiResult::getData(). This change should handle these differences in a
backwards-compatible manner.

Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678e
2015-01-08 12:47:56 -05:00