Commit graph

652 commits

Author SHA1 Message Date
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
jenkins-bot 9f0a13b3b0 Merge "URI-decode external link page names when turning them into local links" 2022-06-10 13:35:01 +00:00
Sam Wilson 9a5e7dd919 Realtime preview: allow loading as a gadget
* Prevent the realtimepreview module loading on anything
  other than wikitext pages (as is already done PHP-side
  but that is bypassed when loaded as a gadget).
* Give the #wpTextbox1 a class so we don't always style it.

Bug: T307039
Bug: T308176
Bug: T309330
Change-Id: I26111a61c8cf37520b3619faf09d76445973edd3
2022-06-09 17:27:24 +08:00
Sam Wilson e575822c73 Realtime preview: match scroll positions between textarea and preview
When either the textarea or the preview pane is scrolled, match the
other to the same vertical scroll percentage.

Bug: T294977
Change-Id: Ieda15868162caf06ef9099065ba55cfd8d8bfd0f
2022-06-09 12:57:54 +08:00
Sam Wilson 4fc6cb53b8 Realtime preview: keep original scroll position when enabling/disabling
Because the DOM and layout changes reset the scroll position of the
editing text area, it must be manually saved before enabling/disabling
and reset afterwards.

Bug: T294977
Change-Id: I7722213e682401d29b6b53d672a487da042be6a9
2022-06-01 10:41:54 +00:00
Sam Wilson 4ff946aea4 Realtime Preview onboarding popup
Add a pulsating blue dot to the Realtime Preview toolbar button
that displays an onboarding popup when clicked and disappears
forever when dismissed.

Bug: T294589
Change-Id: I7f4dd0858349b0e7c4f4bedea5c7a62a51c6fa3a
2022-06-01 14:11:49 +08:00
David Lynch ce2ecf084f Update schema logging of bucket for new DiscussionTools A/B test
Bug: T304030
Depends-On: I5e57bb9b7958576f3a04373748331a86f4626fb5
Change-Id: I084d26c95d5be78eddb4edd1b42aa52eef909356
2022-05-19 09:50:04 -05:00
samtar b49e0a9d6c Realtime preview: Visual adjustments on handlebars
Set both drag element lengths to 52px (@affordance-length)
Set the margin on (.ext-WikiEditor-ResizingDragBar span) to 2px
Set (.ext-WikiEditor-ResizingDragBar-ew) background-color to
@colorGray15 (i.e. #F8F9FA)
Remove legacy comment.

Bug: T307105
Change-Id: If0087398920c7ad92e5a2cd1ee5c178644f8d95b
2022-05-11 10:00:42 +01:00
samtar 45501cfd92 Realtime preview: Suppress reopening pane
Change the handling of the manual reload button's accessKey to
only refresh the preview if the pane is currently open.
Duplicate change to ManualWidget's handler.

Bug: T307805
Change-Id: I0f07ff346eef4bd93d13d55548381a71c0f660d3
2022-05-07 01:21:40 +01:00
Sam Wilson be4ee228aa Realtime Preview: show and hide preview and error areas appropriately
* Always hide the error message after a successful preview.
* Before previewing, make sure the preview node is un-hidden, in
  case it was previously hidden by showError().
* Stop checkResponseTimes() from hiding any error (it only handles the
  manual mode).
* Stop showError() from hiding the manual bar (it's okay to see both).

Bug: T306965
Change-Id: Ic2ad52fea41070adb196ef2fbd740e808d373e5e
2022-05-06 08:23:50 +08:00
Sam Wilson 96c905f1dc Realtime Preview: Make whole manual-loading bar clickable
Make the manual-mode loading bar clickable by turing it all into
an anchor element with various mixins for functionality.

Also adds a tooltip to the whole bar, and makes the same accesskey
work (including when the preview pane is closed).

Bug: T306590
Bug: T306906
Bug: T306880
Change-Id: I915a430300c75256d89b929e3925d0ea714807bb
2022-05-06 07:32:37 +08:00
samtar 755f984335 Realtime preview: set minimal resize limit
Add a minimal resize limit on the preview pane (`.ext-WikiEditor-twopanes-pane2`) to 248px

Bug: T307105
Change-Id: If05376571bb0b223edac48adecbe124e01293c7a
2022-05-05 19:53:40 +00:00
jenkins-bot 19f784233a Merge "Add JSDoc configuration and test" 2022-05-05 19:50:46 +00:00
jenkins-bot 6a91c1f3ea Merge "Realtime preview: improve toolbar button style" 2022-05-04 11:31:57 +00:00
Sam Wilson 9921163d54 Add JSDoc configuration and test
Bug: T307415
Change-Id: I770677608b5d2e4532528467d1c4141019dd01e4
2022-05-03 15:28:02 +08:00
Sam Wilson 42192e75c9 Invert RealtimePreview.setEnabled parameter meaning
To make it clearer that setEnabled(true) enables the feature, and
setEnabled(false) disables it, invert the function of the first
parameter. Also improve jsDoc parameter documentation.

Follow-up: I4615f629a0c97fb325721bbddee5c9eb074c3a5c
Change-Id: Icb84bcf0624774b9a7002110f1fac31bf48ebd1d
2022-05-03 13:18:05 +08:00
hmonroy 090929cf1d Realtime preview: disable preview when screen is small
Disable preview functionality when screen is less than 600px.

Bug: T293337
Change-Id: I4615f629a0c97fb325721bbddee5c9eb074c3a5c
2022-05-02 15:26:20 -07:00
Sam Wilson 37836d7fcc Realtime preview: don't show reload button on error message
When the error layout is shown, hide the hover reload button,
and only re-show it if the preview is successful.

Bug: T306866
Change-Id: I5e72295069ee9e8279c5786c3959db5902da0e25
2022-04-26 16:23:51 +08:00
Sam Wilson 3ab9a863a2 Realtime preview: improve toolbar button style
* Add hover and active styles to match normal toolbar state styling.
* Move border from right to left on `.section-secondary .group`.
* Add a skinStyle for MonoBook so it doesn't get the button style,
  because it provides its own.

Bug: T303991
Change-Id: I6f08906156a9768729d779b6c50c9e804f51fb98
2022-04-26 15:08:28 +08:00
jenkins-bot 06cda6ee49 Merge "Remove all unused "loading" code, messages and animations" 2022-04-22 16:15:39 +00:00
Thiemo Kreuz 7573a7dbad Remove all unused "loading" code, messages and animations
The CSS was already unused when the extension was created in 2010.
A comment that still mentioned the CSS class was removed via
I0798864 in 2022.

The message is unused since I9fb7e66, that was in 2021.

Change-Id: I25cd31efc4ee61ff3f857c280b5cd18c3ae4bd00
2022-04-21 15:29:15 +02:00