Commit graph

58 commits

Author SHA1 Message Date
MusikAnimal b8bdd64ee5 Realtime Preview: add as a Beta Feature
For MW installations where BetaFeatures is not available, Realtime
Preview is enabled solely with the $wgWikiEditorRealtimePreview
configuration setting.

Bug: T304596
Change-Id: I880022883bf526a2aef237f4a75e790b0f9bd4e5
2022-04-06 13:45:44 -04:00
Sam Wilson e6b77fb2ab Persist Realtime Preview state in a user preference
Store the current state (enabled/disabled) of Realtime Preview in
a new user preference `wikieditor-realtimepreview` and set it
when enabling or disabling the preview pane.

Bug: T294599
Change-Id: Id5f51c6d77ed0077906d5d5178cbfa785cc04dcf
2022-03-31 21:01:36 +08:00
MusikAnimal fe81f28aae Add Realtime Preview vars to the virtual package's versionCallback
This should fix the caching issue we're seeing on Beta

Follow-Up: Iaf49f076c5a290ab9049267b0aede1e6b13a9136
Change-Id: Ibe2fc1b48f4ccc22138f6c16d8170a74500d68e6
2022-03-30 16:54:16 -04:00
MusikAnimal f1a2ba96eb Realtime Preview: disable if average response time is very slow
$wgWikiEditorRealtimeDisableDuration is introduced which allows
sysadmins to control the average time after which Realtime Preview
should be disabled. For now, this shows a simple error message that is
intentionally not localized. In a future patch, we will force the
user into a 'manual preview' workflow. See T304568 for more.

Bug: T302282
Change-Id: I2f01eef19fe81c19efedcc0073a28884f0055359
2022-03-30 12:28:23 -04:00
MusikAnimal 68e6561857 RealtimePreview: add config setting for debounce time
Change-Id: Iaf49f076c5a290ab9049267b0aede1e6b13a9136
2022-03-24 02:00:19 -04:00
Sam Wilson 411be83bc3 Add toggle button and two-pane layout for realtime preview
* Toolbar button to toggle a two-pane layout on and off.
* Resizable bar for the width of the two panes.
* Resizable bar for the edit box height, even when realtime preview is off.
* Only enabled when $wgWikiEditorRealtimePreview = true.
* Fires JS hooks when enabled, resized, and disabled.

Bug: T293347
Change-Id: Id09d44519249c0b7f5c33d48d524b7c92a5a9106
2022-03-13 07:28:01 +08:00
Reedy 07c823679c Use namespaced EventLogging class
Change-Id: Ia5a0ba6846ee1bd6a5436e003d65be955a06d565
2022-03-06 16:15:32 +00:00
Reedy 51c3fe42bd Swap to AutoloadNamespaces
Change-Id: I4eb121b4e81b4ec4833ce0bea81ae041abbdacc9
Follows-Up: I0be9b88accafce97f7e9b7524ec740fb576fa11c
2022-02-06 13:55:54 +00:00
David Lynch fda6c3c117 New bucket for abtest data
Bug: T291308
Change-Id: I7aa47139e3fe552833798d6b8daacc1b30517915
2022-02-02 15:50:21 -06:00
jenkins-bot 9a065b82ee Merge "build: Load ConfirmEdit as phan dependency" 2021-12-13 09:48:13 +00:00
Ed Sanders b4f144057e Tag WikiEditor edits with a hidden tag
Bug: T249038
Change-Id: Ia4267bc430ba0f12cce496ebf6f8c1773ae355a6
2021-12-07 23:30:27 +00:00
jenkins-bot 7fbd917c15 Merge "Use HookHandlers, implement hook interfaces and inject services" 2021-11-25 22:02:37 +00:00
Fomafix 0d4d037968 Use HookHandlers, implement hook interfaces and inject services
The static function WikiEditorHooks::editPageShowEditFormInitial is
kept for compatibility because there are usages in other extensions.

Change-Id: I7ba9f56fd3d00d575696f00f9f1c868fa7ad223b
2021-11-25 19:12:16 +00:00
Umherirrender c062d047ce build: Load ConfirmEdit as phan dependency
Bug: T296287
Depends-On: I549a97923fe994820358c65ee1cd725f6d9bba1a
Change-Id: If45b296a24e86d7ef6c581b3d822eb0adfa1f245
2021-11-23 19:30:25 +01:00
Alexander Vorwerk 538e543a32 Fix namespace for ConfirmEditHooks
ConfirmEdit should be added as a phan dependency, so thing like this no
longer happen in the future.

Bug: T296287
Change-Id: Ic9942b3a6d872c0d3c0e3a53d9462df6f82b06c6
2021-11-23 12:09:44 +01:00
Fomafix 4da6f5b3b5 Use namespace MediaWiki\Extension\WikiEditor in PHP
Change-Id: I0be9b88accafce97f7e9b7524ec740fb576fa11c
2021-11-20 09:30:11 +00:00
Sam Wilson 3f275059df Add logging for non-live previews
This isn't strictly WikiEditor business, but other logging is done
here, and soon real-time previewing will be built in WikiEditor,
so it makes sense to keep all the logging for the different types
of preview together.

Bug: T290521
Change-Id: If42697e43c1bec95d743244d0acf96c47df8b681
2021-11-18 08:24:37 +08:00
jenkins-bot fd74287b2f Merge "Replace WebRequest::getVal by WebRequest::getRawVal" 2021-11-12 18:25:38 +00:00
Roman Stolar b76f02e580 Replace usage of ConfirmEdit_ActivateCaptcha random properties.
Use CacheKeyHelper to get a status from SimpleCaptcha instead of it.

Bug: T275710
Depends-On: I7942ccd6b58584f436f872bf7c9deb63ab84482a
Change-Id: Id35ef3bcf30ddc0581c79cc10fa80e54d5352758
2021-11-11 17:11:27 +02:00
Fomafix 05f15dc79f Merge "Use Html::hidden instead of Xml::element" 2021-11-07 17:46:29 +00:00
jenkins-bot c0967dbe3a Merge "Don't add logging-related form inputs if not required" 2021-11-07 13:55:27 +00:00
Fomafix 758d0fb84a Use Html::hidden instead of Xml::element
This change replaces in the HTML

 <input type="hidden" name="wikieditorJavascriptSupport" id="wikieditorJavascriptSupport" value="" />

by

 <input id="wikieditorJavascriptSupport" type="hidden" name="wikieditorJavascriptSupport"/>

but the behavior is still the same.

Change-Id: Icc9b9c9480be3b220148466d3f93746e14de280a
2021-11-05 18:18:35 +00:00
Fomafix fae34607a7 Replace WebRequest::getVal by WebRequest::getRawVal
The UTF-8 normalization of getVal is not needed here.

Also explicit check for !== null instead of truthy because in PHP is
"0" != true.

Change-Id: I77a8a2c149045f677ff2a1f0e42d9ca9dccde321
2021-11-05 17:57:52 +00:00
Sam Wilson d23389cd06 Avoid User::getEditCount() and ::getOption()
The latter is deprecated, and the former is just a wrapper for
UserEditTracker::getUserEditCount().

Bug: T290521
Change-Id: Id3f2b9a007fe299d74d5957cbd3e31b11adb2790
2021-11-05 11:52:00 +08:00
Sam Wilson b980affad6 Don't add logging-related form inputs if not required
Change-Id: I71d7f9b741cb60d0bbb8f0fbd6e8ac0967ee1492
2021-11-03 13:40:19 +08:00
Sam Wilson 0744773321 Fix excluded phpcs rules
Change-Id: Ie0d0a00e2a12dc50bd2ed9ba00b8e7f339227a56
2021-11-02 13:48:27 +08:00
David Lynch 385903a3f0 PHP VisualEditorFeatureUse logging: properly record session id
EditAttemptStep and VisualEditorFeatureUse have this one very annoying
inconsistency.

Bug: T281409
Depends-On: I96e07e10943d330efcf47e0a2989ea3b73bae428
Change-Id: I3bddd3096625466fc5b6c88b64a570a389b87a05
2021-05-12 19:46:36 +00:00
David Lynch cb1c5d49aa Log whether Javascript was supported on saveSuccess
Adds a hidden field to the edit page form, with JS that will set its
value. Server-side then checks for that value and logs whether it was
correctly set.

Bug: T263505
Change-Id: I8be06385aa6d97e5536cfc252d34297e1c000a32
2021-04-30 17:45:40 -05:00
jenkins-bot 5791ee3d51 Merge "Update save failure logging for EditAttemptStep schema" 2021-02-01 18:17:59 +00:00
David Lynch 36a58b5599 Logging init mechanism for new section direct navigation
Support the `url-new` mechanism so we can distinguish between
new/existing sections in direct navigation.

Bug: T272544
Change-Id: I2c431592035c7ccedbbe612bc97f63141fc4dab7
Depends-On: I3cee7a3a4c4b646692dce4a1180c4ba18a61f4bc
2021-01-29 20:56:14 -06:00
David Lynch e052e46f94 Log the DiscussionTools a/b test bucket for relevant schemas
If someone is enrolled the DT a/b test, we want to know about their
editing here as well.

Bug: T273096
Change-Id: If2bb04011c8ca54e8c7ffd073e21bec45e92460c
2021-01-29 20:56:14 -06:00
Bartosz Dziewoński dc93bf1b37 Parse alternative magic word translations when prefilling image fields
In some languages, image options like 'alt' or 'thumb' can have
multiple synonyms. They were only handled for English (and were
hard-coded).

Change-Id: Ib03932d3d85a5540bea325f2717da3365756a90e
2021-01-22 22:15:16 +01:00
Ammar Abdulhamid ab287ade14 Allow specifying alt-text in File dialog
* Also add expandable help message to explain the alt text field

Bug: T260006
Change-Id: If16ff742d7a8dee4917884e73e9c95bf76350773
2021-01-22 21:37:17 +01:00
Bartosz Dziewoński 334618d0b2 Update save failure logging for EditAttemptStep schema
* Use the error code from the API for 'save_failure_message', instead
  of the key of the localisation message shown to the user.

  Although this editor is not using the API, and doesn't use those
  error codes, we still want to use them in logging for consistency
  with all the other editing tools.

  We can easily generate the error codes from the Status we do have.

* Copy 'save_failure_type' map from VisualEditor.

Bug: T272162
Change-Id: Ia9eeea14e3d4a6a691f84628a27ffc0c3bf061c1
2021-01-15 20:17:25 +01:00
jenkins-bot b2f709e5ff Merge "Replace use of old $wgVersion constant with MW_VERSION" 2020-05-13 22:16:53 +00:00
James D. Forrester 4551332586 Replace use of old $wgVersion constant with MW_VERSION
Change-Id: I31e524694ca2e7399b235b89aeeb779a4d13811d
2020-05-13 15:02:38 -07:00
BAGArt e366cc041f Use WikiPage::exists instead hard-deprecated Article::exists
Bug: T251278
Change-Id: Ib617a144279e63c2905d6a0c1048bba65a19115c
2020-04-28 19:20:18 +03:00
Reedy d5d3104a41 WikimediaEventHooks was namespaced
Change-Id: Ic33ec8f08b6fc755e4749e34f734831b8f519be1
2020-04-20 00:24:13 +01:00
DannyS712 d43e91726a Remove use of WikiPage::getRevision
Bug: T249393
Change-Id: I26dc2f750bc1a6315865c5bbfab54799c6b18486
2020-04-07 23:37:53 +00:00
Umherirrender 8af7b2df71 Improve param docs
Change-Id: I0fa1d6aef74f434306d665f39085cd41f710bed1
2020-02-29 22:18:42 +01:00
Derk-Jan Hartman 4906ff1c8c Remove usage of EditPageBeforeEditToolbar
As noted by Jack Phoenix in I07b0e0e030217d74f06bb2b6fc278bd2e28e34b5
the core toolbar has not been present since 1.32 and this hook is
therefore rather pointless.

Change-Id: Ibcf4400237dbf3b195e2bc6a8efee9f1b1527e6d
2020-01-25 17:18:42 +01:00
James D. Forrester d47d0c41b1 Drop back-compat. for MagicWordFactory, this extension requires 1.34+ anyway
Change-Id: I159c168642b3c7315da2de44fb191845c53b399c
2020-01-09 14:26:25 -08:00
Roan Kattouw 253adb8fe8 EditAttemptStep: Allow session ID to be overridden through query string
The editingStatsId POST data parameter was already used to propagate the
session ID within a session; also allow it to be read on GET requests,
to allow the initial session ID to be overridden.

Similarly, propagate the oversampling state and allow it to be set in
the query string using ?editingStatsOversample=1 .

Bug: T238249
Change-Id: Ib4586607b4acb69bdfbd6a8de0f320b90969209a
2019-11-14 11:11:01 -08:00
Umherirrender 13661d374b build: Updating mediawiki/mediawiki-phan-config to 0.8.0
Bug: T235049
Change-Id: I4b5653d9ada66f3458f588e1db9b6da0802348e5
2019-11-05 20:24:04 +01:00
Bartosz Dziewoński d80d4275eb Update SpamBlacklist error logging
The error message key has changed in I4ca8e67e03726696a428093cc9fb547a6daa1492.

Bug: T232687
Change-Id: Id2154bae7ce2f33df63fcf9f7545fb93d38b656e
2019-09-13 01:11:16 +02:00
Roan Kattouw d23d096281 Convert ext.wikiEditor module to packageFiles
This allows us to bundle the wgWikiEditorMagicWords and
mw.msg.wikiEditor(?!) config vars that were previously exported globally
in the startup module.

This code is old and crufty, so this is a somewhat minimal conversion:
* Use require() for jquery.wikiEditor.{dialogs,toolbar}.config.js,
  and for jquery.wikiEditor.{dialogs,toolbar}.js
* Don't attempt to convert jquery.wikiEditor.js to something
  require-based, instead just run it and let it set the $.wikiEditor and
  $.fn.wikiEditor globals
* Consolidate ext.wikiEditor.{dialogs,toolbars}.js into
   ext.wikiEditor.js

Bug: T222828
Change-Id: Ia75d685cbde786e8fceb6db36f2436b2beea1499
2019-08-05 22:24:56 +00:00
Timo Tijhof 14db0b965a Remove unused 'wgWikiEditorEnabledModules' var
This is an internal variable that hasn't been used since 2017
with commit be36244c70. It was kept for back-compat with
regards to caching, which as churned long since.

Bug: T219342
Change-Id: I7c71956e34c1d4312037f9a8d26f81125ab82577
2019-03-29 02:02:52 +00:00
James D. Forrester ebe89e3c7d Replace use of deprecated ResourceLoaderTestModules hook
Use the new extension.json attribute instead.

Bug: T214211
Change-Id: I79c45c6923fd19f6f9f068492b3bd6548161dd04
Depends-On: I27ecebe27d7aaebe6d1317bc5eaea9cca368b45d
2019-02-13 15:24:38 -08:00
Derick Alangi 44b1c8418d Remove "return true" legacy behavior from hook handler functions
Change-Id: I314261115be187d77c3e9f9f30585090eea4718e
2019-02-02 21:21:59 +01:00
jenkins-bot e75c1a53b8 Merge "Re-label preference now that the 2006 wikitext editor doesn't exist" 2018-11-06 15:53:27 +00:00