Commit graph

672 commits

Author SHA1 Message Date
Umherirrender 3c57553f83 Add missing @param in jquery.wikiEditor.js
Change-Id: Ia6922e71075b9fc24d5b194f02131d42642954e3
2023-08-10 00:35:04 +02:00
samtar 9c56922e25
RealtimePreview: Set tabindex on realtimepreview-preview
Set tabindex="1" on `ext-WikiEditor-realtimepreview-preview`

Bug: T317108
Change-Id: I06847674ebccf05e8cb45492056222e13cd00ef8
2023-07-12 13:36:31 +01:00
Jon Harald Søby dbdc003abb Add deprecation log message for autoMsg
Add a deprecation log message for the autoMsg and autoSafeMsg
functions in WikiEditor. The console output details what needs
to change, and adds a link to on-wiki search for the affected
string.

Depends-On: I2835341867df85552579ea6927cd39a6f889fa6b
Change-Id: I2aea96c8a4097f34b02301083f9db0be95042243
2023-07-11 19:45:59 +00:00
Jon Harald Søby 499c71114a Stop using autoMsg and use mw.messages directly instead
WikiEditor has a clever functionality where you can enter a message
key directly by using [key]Msg syntax in the object definition. While
that may have been a clever approach, it led to tons of messages
in this extension having to be marked as RawHtmlMessages because
they could potentially be parsed as HTML. Thus I am replacing all
of these instances with using mw.message explicitly instead, with
the necessary method attached.

The autoMsg (and its cloned autoSafeMsg) functions have had FIXME
comments attached since 2018 saying that these methods are
unnecessarily complex and should be replaced with using mw.messages
directly.

This solves a lot of problems for translators in Translatewiki, and
hopefully makes the code more straightforward and easier to understand
for those reading it down the line.

I would like to remove the autoMsg and autoSafeMsg functions
altogether, but their functionality is still in use in a few
extensions (and potentially on-wiki code), so we would have to
clean up that first.

Bug: T154891
Bug: T294760
Change-Id: I2835341867df85552579ea6927cd39a6f889fa6b
2023-07-06 10:39:24 +02:00
Jon Harald Søby 5c18abff00 Move reference-specific settings to the Cite extension
These config settings were specific to the Cite extension,
and are misleading on wikis that don't have that extension
installed. Move the functionality to the Cite extension
instead.

Bug: T339973
Depends-On: Ib3fdc897dd3330f69c5832003d4c3cb1e6dba2f3
Change-Id: Ib619706ddfca724990e1db2d51f12a2eb05f6a72
2023-06-22 14:07:29 +02:00
DLynch 3e568552b6 Revert "Remove hacks that avoid duplicate event logging with MobileFrontend"
This reverts commit 929e8463fb.

Reason for revert: we're still seeing double-logging of some events, so this is apparently still needed until we can track down what's causing that.

Change-Id: Ifc32dfc7aa2ca67169759ecd8c278f1aea2dbef8
2023-06-09 15:20:01 -05:00
Bartosz Dziewoński 929e8463fb Remove hacks that avoid duplicate event logging with MobileFrontend
This reverts 843efa2f46,
no longer needed after I6028fa4a34916a6cd20161009cf5893492286c2d.

Bug: T334263
Depends-On: I6028fa4a34916a6cd20161009cf5893492286c2d
Change-Id: Ie4506d46d350fb53d6d0264763c2d55fc142997e
2023-04-06 22:49:06 +00:00
Umherirrender 6b9eeb34d8 stylelint: Enable selector-pseudo-element-colon-notation
Via stylelint --fix

Change-Id: I5a9835a0faf610d8401b4bb80bae08999d7b9a0e
2023-03-30 01:14:34 +02:00
Volker E 58e69d97b9 styles: Replace 'mediawiki.ui/variables' call with skin variables
Replacing 'mediawiki.ui/variables.less' @import with
new skin-aware 'mediawiki.skin.variables.less' standard.
Also
- replacing several static values with new Codex design token featuring
  skin variables.
- reinstate static values only on resizeable drag bar. This is not a
  standardized component yet and will be revisited with further Codex
  component definitions in future.
Bump required MediaWiki core version to v1.41.0.

Bug: T319381
Bug: T332541
Change-Id: I323561894ddf23aa89f51439fc9df2b7642eaca5
2023-03-27 11:26:24 -07:00
jenkins-bot 71f6366371 Merge "Centralize EditAttemptStep logging code in WikimediaEvents" 2023-03-27 15:30:41 +00:00
Umherirrender cb002bfb9d build: Remove unneeded inline stylelint-disable-next-line
modules/ext.wikiEditor.toolbar.styles.less
 21:2  ✖  Needless disable for "plugin/no-unsupported-browser-features"
--report-needless-disables

modules/jquery.wikiEditor.toolbar.less
 243:4  ✖  Needless disable for "plugin/no-unsupported-browser-features"
--report-needless-disables

modules/realtimepreview/RealtimePreview.less
 14:2  ✖  Needless disable for "plugin/no-unsupported-browser-features"
--report-needless-disables

Follow-Up: I2b9cdca89e4e14e22a6a467efe00d51643962c08
Change-Id: Ied9f6b951380c38dfef3ca4674f5568a338ca01e
2023-03-25 22:21:44 +01:00
Umherirrender 330df284d8 build: Remove unneeded inline stylelint-disable-next-line
modules/realtimepreview/RealtimePreview.less
 57:3  ✖  Needless disable for "plugin/no-unsupported-browser-features"
--report-needless-disables

modules/realtimepreview/TwoPaneLayout.less
  4:2  ✖  Needless disable for "plugin/no-unsupported-browser-features"
--report-needless-disables
 11:3  ✖  Needless disable for "plugin/no-unsupported-browser-features"
--report-needless-disables

Change-Id: I2b9cdca89e4e14e22a6a467efe00d51643962c08
2023-03-21 23:02:20 +01:00
Bartosz Dziewoński 414037f7a6 Centralize EditAttemptStep logging code in WikimediaEvents
PHP EditAttemptStep logging code is not moved.

* Use the new mw.track() handlers from WikimediaEvents
* Ensure that 'integration' and 'editor_interface' are set on all
  events, since they're not hard-coded in the handler any more
  (and there are no client-side init events that add defaults)

This must be merged together with WikimediaEvents change
Iace4d53a972396ca5b8713000570cc47c9986034 (but we can't use
Depends-On, because CI requires code here to be removed first).

Bug: T332438
Change-Id: I0ef0a96aafdf89a4ebe32131a85b18c25744bb2c
2023-03-18 13:57:06 +00:00
Sam Wilson 56b4ba8476 Realtime Preview: remove Beta Feature and onboarding popup
Delete almost all code realting to the onboarding popup (blue
pulsating dot) and Beta Feature. Leave only one line to delete
any existing localStorage item that was used to remember the
dismissal of the onboarding popup.

Bug: T327515
Change-Id: I8d05e143858a2269dd6f3302dcc6cee6b0855ffd
2023-03-17 15:22:32 +08:00
David Lynch 843efa2f46 Don't do logging if MobileFrontend is active for the current page
Visiting a ?action=edit URL can, depending on user settings, result in
the MobileFrontend overlay appearing on top of WikiEditor. In these
cases, don't log anything.

Bug: T320281
Change-Id: Ib98d2cd6f2e541423e5aeebd3093bad97d6fcc4f
2023-03-07 11:58:43 -06:00
Wandji69 e97ae24dcd Styles: Replaces deprecated mixins prefixes with unprefixed CSS property
Bug: T308351
Change-Id: I42abaff93661bdab234faacb5830bedc6ec725be
2023-01-29 10:33:01 +01:00
David Lynch 5b6226841d Log token for the DiscussionTools mobile a/b test
Bug: T321961
Change-Id: If06ba42491ea1ca58aec48a85d0b4a0187702123
2022-12-16 14:46:11 -06:00
jenkins-bot 613df636a1 Merge "ext.wikiEditor: Also log EditAttemptStep events via Metrics Platform" 2022-12-02 09:14:01 +00:00
David Lynch 429ab31cb5 Move logging hook registrations for realtime preview into document-ready
There were analytics validation errors because events were being logged
without a session ID. The session ID is only set on document-ready, as
it's fetched from a hidden input on the document.

Change-Id: Iaa24d430b780eaad54b78cb0d2ef0670fa2e32b1
2022-11-17 09:39:43 -06:00
Sam Smith f39dddaee5 ext.wikiEditor: Also log EditAttemptStep events via Metrics Platform
The EditAttemptStep instrument is a candidate for migration to the
Metrics Platform [0]. The first step of the migration is to log events
both using the Event Platform (i.e. via mw.eventLog.submit()) and using
the Metrics Platform Client (i.e. via mw.eventLog.dispatch()).

The Metrics Platform Client can mix in additional information -
so-called context attributes [1] - based on the stream configuration.
The majority of the default values mixed into each event via the
mw.eventLog.Schema defaults mechanism are already known to the Metrics
Platform Client.

Note well that the Metrics Platform Client will not log an event without
one or more streams being configured to receive that event. Therefore,
this change is a NOP.

An example stream configuration is given in [2].

[0] https://wikitech.wikimedia.org/wiki/Metrics_Platform
[1] https://gerrit.wikimedia.org/g/mediawiki/libs/metrics-platform/+/aed6738b845/js/src/StreamConfig.d.ts#31
[2] https://phabricator.wikimedia.org/T309013#7953227

Bug: T309013
Bug: T320281
Change-Id: Ia08bac484fb3a2209879531def859a01290120fd
2022-11-14 08:40:35 +00:00
jenkins-bot 6575890975 Merge "[Realtime Preview] Only clone part of the #wikiPreview element" 2022-10-05 10:55:22 +00:00
hmonroy ff38ef2400 [Realtime Preview] Disable when screen is narrow on load
When realtime preview first loads set `enabled` to false when screen is too narrow.

Bug: T313210
Change-Id: I555c5c2115ad09ef51ec9d7f1143a445b23144ca
2022-09-15 17:04:40 -07:00
Sam Wilson e979df2036 [Realtime Preview] Only clone part of the #wikiPreview element
The #wikiPreview element can contain other child elements such
as the already-removed one of .previewnote but also (on category
pages) category lists, which we don't want.

This changes to only clone the specific content element. We could
just create this in JS, but don't at this point have access to
the lang direction.

Bug: T315558
Change-Id: Ifcd02e9cf005e00c8dd69df162893fb673117231
2022-09-12 14:29:10 +08:00
samtar 15a64e2faa RealtimePreview.less: Add position: relative to preview class
Add `position: relative` to .ext-WikiEditor-realtimepreview-preview`
per this suggestion (T315049#8174670) by Matma Rex.

Bug: T315049
Change-Id: I70813f68ffd74fab4978127ecee9bd557d467ebb
2022-08-29 04:43:56 +00:00
samtar 4a49cefbca
RealtimePreview.js: Respect prefers-reduced-motion
Set inManualMode to the result of the current prefers-reduced-motion
setting.
Add another property (reducedMotion) for later UI/message work

Bug: T314787
Change-Id: Ifeb8b996430830499945e73eca2dcfe0355c8046
2022-08-12 22:49:14 +01:00
hmonroy 08c4dd35a4 Realtime Preview: add event tracking to load action
Trigger preview-realtime-loaded when the realtime preview pain loads.

Bug: T306176
Change-Id: If66c3db20a48ae8882412c068a0253f8cccfc1d3
2022-08-03 16:24:41 -07:00
Dayllan Maza a4b3e8b32b RealtimePreview: Let doRealtimePreview handle manualWidget visibility
After I010c80cf9f2b619a41fb1111f7750e8f9e804698 `doRealtimePreview`
will always handle manualWidget visibility

Folow-Up: I0e9698faebd3f4df41221d6ba0b0f5f82ae3ae5b
Bug: T307240
Change-Id: I7b009729287fbfffc96a77a7a5faf230321f1a7c
2022-07-29 16:24:15 -04:00
Dayllan Maza 267338d4e0 RealtimePreview: force update when reloading from error message
Bug: T313381
Change-Id: I010c80cf9f2b619a41fb1111f7750e8f9e804698
2022-07-29 12:16:07 -04:00
jenkins-bot 09a56edaff Merge "Add more conditions for re-showing the manual bar" 2022-07-29 15:52:29 +00:00
jenkins-bot b82686d364 Merge "Invert RealtimePreview.setEnabled parameter meaning" 2022-07-28 15:30:10 +00:00
Sam Wilson 6fb1395f44 Add more conditions for re-showing the manual bar
Because the manual-mode bar gets hidden when an error message
is displayed, it's necessary to re-show it after the preview
is reloaded from the error message. This was done in the
below patch, but that didn't account for all conditions.

Follow-Up: I26150c190a9d3816e35ba369536e6d0ac11e4b1a
Bug: T307240
Change-Id: I0e9698faebd3f4df41221d6ba0b0f5f82ae3ae5b
2022-07-28 11:47:02 +00:00
jenkins-bot 2f1e4604ee Merge "Realtime Preview: add event tracking to triggered events" 2022-07-27 07:19:40 +00:00
hmonroy 45474e1e26 Realtime Preview: add event tracking to triggered events
Add following logging events:
  * preview-realtime-error-stopped: triggered when realtime preview
auto-load is stopped.
  * preview-realtime-reload-error:  triggered when realtime preview pane
shows an error message and the reload button shown in this message is clicked.
  * preview-realtime-reload-hover:  triggered when the reload button
that shows on hover in the realtime preview pane is clicked.
  * preview-realtime-reload-manual: triggered when the reload button in
the realtime preview pane manual bar is clicked.

Bug: T306176
Change-Id: I0785b0a8e88125a9bb30ff5c64c8a7c50b556c63
2022-07-26 12:06:04 -07:00
MusikAnimal 770277689a Realtime Preview: scroll to cursor when opening/closing RTP
Bug: T311684
Follow-Up: I377fb3a122cda360e016716e3beb9c34983b8e10
Change-Id: Ic5c56f71589c944b15b83b49362fc250cb337c46
2022-07-25 21:17:12 -04:00
Sam Wilson 296ffc58f8 Realtime Preview: don't show error message and manual-mode bar at the same time
Hide the manual widget when showing an error.

Bug: T307240
Change-Id: I26150c190a9d3816e35ba369536e6d0ac11e4b1a
2022-07-22 13:15:46 +08:00
MusikAnimal 8ae9eff956 Realtime Preview: make ResizingDragBar's max width match the CSS
Bug: T313376
Change-Id: I8fadf2f9f997ff889a8582d5f24babd96fb8fcb9
2022-07-21 12:31:57 -04:00
MusikAnimal 9f3d4f0fd9 Realtime Preview: hide onboarding popup when screen is too narrow
Bug: T313377
Change-Id: Ied9385fbbbda9857042ae38eb97be072edbc5e09
2022-07-21 00:29:40 -04:00
Sam Wilson 9ff5caacbd Realtime Preview: better construction of OnboardingPopup
* Call the parent constructor.
* Add CSS class to the widget's existing $element, rather than
  creating a new one. Doesn't really change anything, just looks
  neater.

Change-Id: I67a72b5e2ef0912c7c7f7a44c87b31c08e1f7fcb
2022-07-21 11:20:57 +08:00
jenkins-bot b49fe580d0 Merge "Realtime Preview: fix display when toggling content in manual mode" 2022-07-20 06:19:46 +00:00
hmonroy 2b43b3cb0d Realtime Preview: fix display when toggling content in manual mode
Preserve content when links that toggle content are clicked in manual
mode.

Bug: T306877
Change-Id: I8b494e84feb4ecdb4b346f78f911f6ae9ba8dce3
2022-07-19 13:42:37 -07:00
MusikAnimal 96b3b46861 Realtime Preview: preserve caret position when opening/closing RTP
Bug: T311684
Change-Id: I377fb3a122cda360e016716e3beb9c34983b8e10
2022-07-19 15:00:25 -04:00
jenkins-bot fb8dfd0e31 Merge "Realtime Preview: only add window-resize handler if toolbar button is used" 2022-07-11 04:00:49 +00:00
MusikAnimal 7f329a7453 Realtime Preview: don't hide diff view on refresh
Bug: T307046
Change-Id: I77379a323b7532595685494de10b89be65e49954
2022-07-07 19:53:24 +00:00
Sam Wilson cff0089326 Realtime Preview: only add window-resize handler if toolbar button is used
Move the resize handler from the RealtimePreview constructor to the
getToolbarButton() method, to prevent it being used when the button
is not used (e.g. if the gadget is misconfigured).

Bug: T309330
Change-Id: I7abc335112648605404785528b37a81d946e900e
2022-07-07 13:21:23 +08:00
Sam Wilson b815fa6bd1 Realtime Preview: prevent lose of textarea selection when toggling
Save the current caret position in the textarea before enabling
or disabling Realtime Preview, and restore it afterwards.

Bug: T311496
Change-Id: Ib906e96e4e8b94b4e1fd82f6201005394c8a27c5
2022-06-28 20:15:54 +08:00
jenkins-bot 0ca47fea6f Merge "RealtimePreview: Don't update when wikitext is unmodified" 2022-06-27 14:42:39 +00:00
Ed Sanders bb21ea052c Use 100ms opacity transition for revealing "Reload" button on hover
We usually use a 100ms transition when revelaing/hiding elements.

Change-Id: I114febf126d1ea6c2a461356ce497cd4614de7c0
2022-06-27 14:03:11 +01:00
Ed Sanders 7f768f748a RealtimePreview: Don't update when wikitext is unmodified
Bug: T311406
Change-Id: I29afb5b7740ec26f3ba9c435729d9df0df46bf8b
2022-06-27 13:58:27 +01:00
Sam Wilson 623e6e7a46 Realtime Preview: remove the scroll linking between source and preview
It doesn't work well when there are infoboxes etc. and the actual
scroll behaviour is jerky and not very pleasing.

Bug: T294977
Change-Id: I8fbba61ddd902c16b3c63b41fc361afb5d1c1a1b
2022-06-17 11:09:04 +08:00
jenkins-bot 82e7d45aa5 Merge "Realtime preview: match scroll positions between textarea and preview" 2022-06-10 19:42:50 +00:00