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
Add `position: relative` to .ext-WikiEditor-realtimepreview-preview`
per this suggestion (T315049#8174670) by Matma Rex.
Bug: T315049
Change-Id: I70813f68ffd74fab4978127ecee9bd557d467ebb
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
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
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
* 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
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
Save the current caret position in the textarea before enabling
or disabling Realtime Preview, and restore it afterwards.
Bug: T311496
Change-Id: Ib906e96e4e8b94b4e1fd82f6201005394c8a27c5
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
* 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
When either the textarea or the preview pane is scrolled, match the
other to the same vertical scroll percentage.
Bug: T294977
Change-Id: Ieda15868162caf06ef9099065ba55cfd8d8bfd0f
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
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
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
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
* 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
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
Add a minimal resize limit on the preview pane (`.ext-WikiEditor-twopanes-pane2`) to 248px
Bug: T307105
Change-Id: If05376571bb0b223edac48adecbe124e01293c7a
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
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
* 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
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
Make the reloadButton into a class member so that it's
accessible in doRealtimePreview().
Bug: T304568
Change-Id: I81c1870becd81884894353921f878653cd690d7a
Decode local page names after the "looks like internal" dialog,
to avoid invalid page names. If it can't be decoded, use the full
page title string.
This doesn't decode text in the ArticlePath, but that sounds like it's
much rarer and could perhaps create other issues.
Bug: T25789
Change-Id: Iac03573515affbc509f674db155767a81bad8b9f
After three slow preview requests, switch to showing a bar at the
top of the preview area that contains a manual 'reload' button.
The manual bar will be hidden when an error message is show, but
re-shown again after the error is dismissed. Closing and
re-opening the preview pane doesn't reset the manual mode.
Bug: T304568
Change-Id: Ia72bd1ceab68fdaed5de53137bd8ac5961db4714
Add a 'reload' button to the right-side preview pane (that shows
on hover, and stays in the same place when the preview is
scrolled), and also an accesskey to trigger the preview. If the
preview is not open when the accesskey is pressed, it'll be
opened.
Bug: T303532
Change-Id: Ifa77ad7cf6d2ed6a8b955f9a324986d1c6f9a993
Change from a pseudoelement ::before the left pane, to its own
element. This is so that when we introduce the top manual-reload
bar the blue bouncing loading bar can be shifted down below it.
Also moves the CSS out of TwoPaneLayout.less and into
RealtimePreview.less where it more properly belongs.
Bug: T304568
Change-Id: I540f68d528d92b7db8594d729985e5dad3d90ac1
For MW installations where BetaFeatures is not available, Realtime
Preview is enabled solely with the $wgWikiEditorRealtimePreview
configuration setting.
Bug: T304596
Change-Id: I880022883bf526a2aef237f4a75e790b0f9bd4e5
Instead of exposing a way of adding event listeners, just expose
the event handler and let consumers (i.e. CodeMirror) add it
to whatever events it wants.
Bug: T303767
Follow-Up: I8c8c25fe56be55a61f4b8d1d2ef8cf74483aa241
Change-Id: Iee4c885f92dd9ec985a3f9fd92a2fafc00f2e9ff
Add two new actions for the 'preview' feature:
* preview-realtime-on – The WikiEditor 'Preview' toolbar button
was clicked to turn the preview panel on.
* preview-realtime-off – The WikiEditor 'Preview' toolbar button
was clicked to turn the preview panel off.
* preview-realtime-inuse – Fired without user interaction when the
WikiEditor preview feature is already on when the editing form is
opened.
This also adds a new hook for the last of these to use and to match
the enable/disable hooks.
Bug: T298218
Change-Id: I1a2545c2b0491c1d07f9508fab70967d03d61594
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
$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
Change the sign (positive/negative) of the change amount (in pixels)
depending on whether the text direction is LTR or RTL.
Bug: T304487
Change-Id: I8f01a92e5e1094c9602d2ff334c730241193cedc
The mistake here was that these are two different fields, but with
variable names that look very similar. Only 2 characters differ. :(
insertLinkLinkTextField.…
insertLinkLinkTypeField.…
Bug: T304476
Change-Id: I459133d3ba5c327e34c689ad0d3c046116f438a9
If a preview is requested before one finishes, one final request is
fired off to ensure the preview is up-to-date.
Bug: T302282
Change-Id: I2399fc7cc08cd0987d2d689ca9f297db1ec5edf0
In “Insert table” dialog, when checking/unchecking “Add header row”,
Example preview first row switches between preview-hidden and
preview-header. Previously, preview-hidden contained 3 TD cells
(while preview-header contains 3 TH cells).
This commit removes the 3 TD to hide the TH instead of replacing with
TD, since, in the generated wikitext, the header row is not included in
row count.
Bug: T303690
Change-Id: I38c1bb081a30e25875de8beaadccc075189ad397
* 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
The main idea is to make the code shorter and easier to read.
One notable change is to use .test() for boolean tests instead of the
actual .match() function.
Change-Id: Ic43442b75f839906b644d4586c907601f4d5d521
Has sat there since the first commit in 2010 (r73055), but not used.
I imagine it was was a design prototype at some point.
Also fix a few minor eslint warnings about line length, and remove the
one-off "ext-" prefix and capitilised "WikiEditor" CSS class name that
the rest of the repo doesn't use.
Change-Id: Id0eeb456fffdb490a6a86974288e57099e53ce71
It looks like `wikieditor-loading` was already commented out in 2010:
9d278e8dee%5E!/#F114
and I couldn't find any usage of `wikieditor-toolbar-loading`.
Change-Id: I07988643ca502dcbd7c3208fb803a84003947d5e
This adds support for the new 'element' tool type to be a function
which returns the HTML for the toolbar widget. It means that it's
possible for the element to access the WikiEditor context object.
Bug: T286759
Change-Id: I6af12075b96d480639f2fc0d97333a6142480c02
Logic under LinkTypeField.setIsExternal() wouldn't emit events about
selection changes, at the mean time TitleInputField.setUrlMode() would
call setIsExternal() and handle everything correctly.
setTouched() is moved forward to actually prevent value being overwritten.
Bug: T302196
Bug: T302201
Change-Id: I5662556394a539073ebf0a17743a260a9d8b0c8c
For some reason, even though jQuery UI dialogs know about their
own buttons, they don't know if the buttons are disabled. This
means that it's still possible to submit the dialog when a button
is disabled.
This change (which is mostly whitespace) adds a check in the click
handler to return early if the 'insert link' button is disabled.
It also gives this button a class name, and so simplifies the other
place that refers to the button.
Bug: T298596
Change-Id: I39fea13b1874f851a68cf08243b3e7ccd355d775
Make sure it works on pages which don't trigger DT, such as full-page
wikitext editing.
Bug: T301497
Change-Id: I244381ee9e47bd3119e341cddb42e2ab38add4a8
The alert text is now added as a red message under the form field
for the link target text, and there's no need to have an additional
alert because the dialog's insert-link button can't be clicked
while there's an invalid internal link anyway.
Bug: T298596
Change-Id: Ib536b51baae24a6cfe7a7426d039fdf11c4cb150
In addition to button, toggle, and select, add an element type of
tool which can be used to insert any HTML content.
Bug: T286759
Change-Id: Ia193308a076a7eaa010269ea0dd7b707c774561d