Commit graph

694 commits

Author SHA1 Message Date
thiemowmde 918aa229b5 JSDoc: convert @cfg to @param
Bug: T307415
Change-Id: I6a13002daa97dd7a7f19edcbb73105da08423223
2024-05-28 10:21:21 +02:00
libraryupgrader 15d85a37db build: Updating eslint-config-wikimedia to 0.27.0
Change-Id: I93cd056771246ee4956b6843b0dbabacf75bbfd6
2024-04-20 01:49:20 +00:00
thiemowmde eb5d3aa089 Remove non-helpful whitespace from "Headings" help panel
The help panel is rather cramped, only 125px high. Previewing the
actual margins above and below each heading is not really helpful.
It's also that no other element in the help panel does have this
whitespace.

Also remove a bit of redundancy from some selectors. Saying that
something is for the table "cells" is more than enough. Adding the
"td" doesn't make it better, just longer.

Change-Id: I11bbd5b8ceee709c3a51b20fb06d2315bb4d9316
2024-04-17 11:52:08 +00:00
Sam Wilson d50b6ee867 Set toolbar z-index to 7, to be above other UI elements
This is already being set in CodeMirror, where it was added in
I16598fcdbeee51e6fae88376ec81f1c8552b383d to keep the toolbar
above the CM scrollbar. It is of general use though, so should
be set in WikiEditor.

Bug: T360084
Change-Id: I85ca9727b00e884b74316bd540ddced7f87e112d
2024-03-14 09:43:16 +08:00
jenkins-bot b7a78685ef Merge "RealtimePreview: Add drop shadow to floating button" 2024-03-13 23:55:07 +00:00
jenkins-bot f31fc338ed Merge "RealtimePreview: Use LESS nesting in ResizingDragBar" 2024-03-13 23:46:00 +00:00
jenkins-bot ccd8760ac0 Merge "Fix overlap between preview button and edit switcher" 2024-03-13 23:45:58 +00:00
jenkins-bot daf81ae37a Merge "ResizingDragBar: force CodeMirror to have 100% height" 2024-03-13 23:35:36 +00:00
jenkins-bot a29a4dba26 Merge "Remove redundant closure for all modules with packageFiles" 2024-03-13 16:37:46 +00:00
Ed Sanders aab2a44fd9 RealtimePreview: Add drop shadow to floating button
In general, floating elements use a subtle dropdown
e.g. "Return to reply" button in DiscussionTools.

Change-Id: If3363557e3f85bbb3000b75e98d5130be1017e2f
2024-03-12 11:19:01 -07:00
Ed Sanders 864f39b359 RealtimePreview: Use LESS nesting in ResizingDragBar
Change-Id: I47b9840291907d764036c7917e3b2bad908ba7af
2024-03-12 11:19:01 -07:00
Ed Sanders 7837e3952c Fix overlap between preview button and edit switcher
These buttons can appear in any order depending on when
the code loads. Remove the default OOUI button negative
margin.

Replace group padding with margin now there is no negative
margin on the buttons.

Change-Id: Id2ebf7aa0b27da1d03d56f59e8a9a96f7656106d
2024-03-12 11:18:50 -07:00
Ed Sanders 008e2c5a94 Tweak monobook padding for realtimepreview-button
Change-Id: I6756a65d9b654ed2a23b168c88b7c80ded9f952f
2024-03-11 17:55:16 -07:00
MusikAnimal 178a731b6e ResizingDragBar: force CodeMirror to have 100% height
The ResizingDragBar makes the editor resizable, so we need to set the
CodeMirror height to 100%. Previous attempts to fix this at
Ib49d1d9e71 and I4deeda192b suffered from race conditions based on
which modules loaded first. We can avoid this by simply putting the CSS
rule here in WikiEditor.

Bug: T357794
Follow-Up: I4deeda192bdc233101ba61739a636f8fd143c1de
Change-Id: Ia5e9767e0814eac29d58bc0d9c1023344a29dd84
2024-03-07 16:38:45 -05:00
Fomafix b799a886ca Remove redundant closure for all modules with packageFiles
Modules loaded with packageFiles are always executed in module scope
(with a closure), even in debug mode.

The behaviour of non-packageFiles debug mode is the only reason files
have closures.

https: //www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Closure
Change-Id: Idd7ffde7900adbca914c43a6bf7cb1b3fbf92bfa
2024-03-06 15:07:43 +00:00
Sam Wilson 23e4ebd244 Use flexbox for toolbar group items
Most toolbar items don't need this because they're inline-block
buttons and spans etc., but items of type 'element' can be block
elements (for example, the Realtime Preview button) and switching
them to flex items means they don't have to do anything special
to ensure their own layout.

This will make it easier to switch VisualEditor to use the
standard system of adding to the toolbar (in
Ic307f9dc7ad976862c8d8c6551ed29e6071f655f ).

Bug: T308423
Change-Id: Iff6d80628ebb5ec5685136fa02c2345eb5b49d42
2024-01-31 06:43:59 +03:00
Sam Wilson f1bcbe75c3 Realtime Preview: also trigger on form.reset()
If the form is reset, make sure that the preview is re-run.
There isn't actually any reset button in the normal edit
form, but Edit Recovery uses reset() to remove any
recovered data, and if RTP is open when that's done the preview
needs to be updated.

Bug: T351821
Depends-On: I1ec757d5ddd9f0db66496c6aaef70747d93a5c83
Change-Id: I30481edae4c071e8586ac1dc7d587bd550965967
2023-12-08 16:00:04 +00:00
Ed Sanders e02c689cdd Fix remaining uses of 'parent'->'super'
Bug: T120821
Change-Id: Ie3b14562b045cee98ffb241e604b5b234cafd699
2023-11-02 17:11:24 +00:00
thiemowmde ac8c355e20 Fix unrelated elements flickering during realtime preview
Steps to reproduce:
* Start making changes to a page in the classic editor.
* Use the normal "Show preview" or "Show diff" button at the bottom
  of the editor. The page reloads and now shows a preview/diff at
  the top, above the editor.
* Now start using the realtime preview feature on the right side of
  the editor.

You will notice that the preview/diff above the editor starts to
flicker, but is never updated. (There is no need to update it. The
realtime preview that is updated is the one in the right pane.)

The original code was added via T293347. I believe the flicker
exists since then. It's effectively a misconfiguration. I hope the
comments make this clear.

This is also a direct follow up to T307046 where the diff view was
fixed (it just disappeared before), but flickers since then.

Bug: T293347
Bug: T307046
Change-Id: I481610389cec902268a8fd09f6b0452131752d54
2023-09-13 11:17:12 +00:00
jenkins-bot dccaad391b Merge "build: Update linters" 2023-08-21 21:11:18 +00:00
Fomafix 483ebc7259 Add missing space before closing parenthesis
Change-Id: Ib44cb31d63fb05e28364e3dd396e96e185097c20
2023-08-17 09:52:11 +00:00
Ed Sanders 6b074036b4 build: Update linters
Change-Id: Id75edd20f605550f21266164c29e2c5f52254cbb
2023-08-16 17:10:28 +01:00
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