Commit graph

90 commits

Author SHA1 Message Date
Bartosz Dziewoński 91291d3e98 Parse relative hrefs on image nodes like on regular links (try 2)
Previous, reverted attempt: da9b6fffbd.
This attempt also includes 6037fefbe0,
and fixes minor conflicts with other changes.

* In normal images, parse relative 'href' attributes instead of
  expanding them to absolute. This resolves Parsoid generating
  |link= options for copy-pasted images (T193253).

  Keep them in the underscore-form to avoid causing dirty diffs like
  T237040 again. Unlike in the previous attempt, we don't need to be
  super-careful about the 'resource' attribute, thanks to the Parsoid
  changes in T108504.

* In gallery images stuff, prefix the 'resource' attribute with './',
  same as normal images do. This causes no functional changes, but it
  makes updating tests easier, and the consistency is probably good.

* Update test examples to also prefix 'resource' and relative 'href'
  attributes with './', like the real Parsoid does.

Bug: T193253
Change-Id: I91131728a87c9406bf069d46d3c94c9a8905a003
2021-01-27 11:53:15 +00:00
Arlo Breault 2402f430b4 Preserve inline media tag name in galleries across edits
Follow up to I37799076852fa6f062c9d85bcebb15998fb44a80

Hat tip to Bartosz for pointing this out.

Change-Id: Ic2968240a015bac2f831203e586535d2f9574963
2020-12-16 17:28:51 -05:00
Ed Sanders 42c7096dbf Gallery: Handle invalid titles
Items which are invalid titles will still get discarded if
the gallery is edited, but this is better than crashing.

Bug: T260584
Change-Id: I5dc20c233fd9ab41bdf48531829bddca2c5b25df
2020-08-17 18:22:42 +00:00
Ed Sanders 69d8a195e5 Follow-up I0a1a889: Show user uploads in gallery dialog
Gallery dialog should behave the same as media dialog.

Bug: T62398
Change-Id: I601df9370b82868ba981e415fe24bd4f29399cdb
2020-07-30 17:01:04 +01:00
Ed Sanders 651756c4fc eslint: Enable the mediawiki/class-doc rule and make pass
Also minor other adjustments

Change-Id: I9ee48359e3e53799f2f6240e44b53972283ce328
2020-04-17 22:59:11 +01:00
Bartosz Dziewoński 734c929ea0 Add some accessibility labels to buttons on mobile
Various buttons have a label on desktop, but only an icon on mobile.
We should still use the label for accessibility.

Change-Id: I2b49a80e174dc30ae997a69662643b28b428263a
2020-03-06 15:09:44 +01:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
Ed Sanders 4c86c54e46 Replace $.when with ve.promiseAll
Add linting guards, except in preinit

Change-Id: I999641eddb0e0f5b112ec2259dbafc1e816e3437
2019-11-04 22:06:54 +08:00
Bartosz Dziewoński 00eb79d4d7 Revert "Parse relative hrefs on image nodes like on regular links"
This reverts commit 6037fefbe0.
This reverts commit da9b6fffbd.

Bug: T237040
Change-Id: Id6ea5784512e4d4c3cb00927b859d713c3814f89
2019-10-31 22:40:42 +01:00
Ed Sanders 4da31e7c9e Update VE core submodule to master (3075d3f8c)
New changes:
4af3f84f7 Mark surface as "showAsDeactivated" when opening a window
79eb0e4e5 ve.ce.Surface: Guard against focusing a un-initialized surface
4124c275e [BREAKING CHANGE] ve.ui.TargetWidget: Construct a real target inside the widget

Local changes:
* Use new target widget
* Remove calls to deprecated methods
* 'surfaceReady' event was upstreamed

Bug: T236400
Change-Id: I765d657c172d96c3b2e2ae5998083e4926a31f15
2019-10-25 17:16:17 +02:00
Bartosz Dziewoński da9b6fffbd Parse relative hrefs on image nodes like on regular links
* In normal images, parse relative 'href' attributes instead of
  expanding them to absolute, and parse 'resource' to keep it
  identical to 'href' if they refer to the same page (including
  same percent-encoding and space/underscore). This resolves Parsoid
  generating |link= options for copy-pasted images (T193253).

* In gallery images stuff, prefix the 'resource' attribute with './',
  same as normal images do. This causes no functional changes, but it
  makes updating tests easier, and the consistency is probably good.

* Update test examples to also prefix 'resource' and relative 'href'
  attributes with './', like the real Parsoid does.

Bug: T193253
Change-Id: If2d7f080d9d693568054f8311c1e1b15ca27ea5c
2019-09-25 00:25:04 +02:00
tcreusc 57317a20e4 Make page title the target title
There are cases where the page title and the real/desired page name
are not the same. Fixing that also fixes the suggestions that appear
in dialogs (see related bug).

Bug: T193132
Change-Id: Iafa84c05bea08ebb061ee6d1323eb50945b39815
2019-07-15 17:22:17 +00:00
Ed Sanders 0db4ae6e00 eslint: Enable valid-jsdoc
Change-Id: Ia0d1e57246a1c567d73022ceca9b8c02850f9bc8
2019-04-17 17:13:39 +01:00
Ed Sanders 72df5f690f Update VE core submodule to master (f039957f3)
New changes:
f039957f3 [BREAKING CHANGE] Use keyed objects for importRules blacklists

Local changes: Use extendObject to set importRules

This allows us to inherit the ruleset from the parent
so we don't have to worry about keeping it up to date.
(For example alienTableCell from upstream was missing
in MW).

Media/Gallery dialogs: Add missing mwTable types.

Change-Id: I366a091ff4def66cc25200b3d1b2c23ba6b716f7
Depends-On: I8ff7e8242c8db235a0f9e11e2e52f90d62d368a0
2019-04-09 16:58:26 -07:00
Ed Sanders c04d3da853 Add more read-only implementations
* Gallery:
  - Disable add/remove image buttons in read-only mode
  - Make image list undraggable
* Template: Disable outline controls
* Transclusion: Add/remove buttons on template pages
* MagicLinkNodeInspector: Disable input (e.g. ISBN links)

Bug: T210142
Change-Id: Ibb03ab0bfd55ef5bf7d7558c217c779d7904a134
2019-02-25 20:01:11 +00:00
Ed Sanders 18907dde5a Implementations for read-only mode
Depends-On: Ifaa74be266c048d87f94b4ae2df59cafc7aa155f
Change-Id: Iedd1bd9ce17750ad8528c1a053293c4a7321c5de
2019-02-22 18:20:51 +00:00
Ed Sanders e21d4fab3f Update VE core submodule to master (2951e9378)
New changes:
202adf904 [BREAKING CHANGE] Unify FragmentInspector/Dialog behaviour

Local changes:
* Update dialogs to use common actions & FragmentWindow

Change-Id: Ib744b8996db48d1ee58bc873120400566c490e88
2019-02-22 01:13:36 +01:00
Bartosz Dziewoński c91047b129 ve.ui.MWGalleryDialog: Allow normal tools in gallery captions
PHP parser and Parsoid now both allow normal wikitext in gallery captions.

Bug: T187958
Change-Id: I3470ec1f81493c58e4c2bdad00d5d78af8b4a10b
2019-02-01 19:51:35 -08:00
Ed Sanders 5461c56380 stylelint: Enforce class name pattern
Change-Id: Ia41a08424f840d353eb7fc213815f7992da4a2ef
2019-01-13 15:14:53 +00:00
Ed Sanders 0f1a8b9eb9 Default originalGalleryGroupItems to empty array
Bug: T212809
Change-Id: I29e95be677d1d7fcc96bbf20efb7d5724d71b0de
2019-01-03 15:13:15 +00:00
James D. Forrester 3c293ea00c doc: Bump copyright year for 2019
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
2019-01-01 13:24:23 +00:00
Bartosz Dziewoński 79e16e218f ve.ui.MWGalleryDialog: Improve modification checks
Undoing the changes to an image caption or alt text, or to the gallery
caption, or to the order of images, or removing a previously added
image, will now disable the "Apply" button again.

The following cases will *not* disable the button again, and it is not
feasible to implement them:
* Re-adding a previously removed image with identical options
* Changing any caption to the old value by other means than "Undo"
* Changing image caption or alt text to the old value after switching
  to a different image and then back

Bug: T206534
Change-Id: I7c19600e741211a6ba61837513497facbafc5cef
2018-11-15 22:16:26 +01:00
Bartosz Dziewoński a66f57643c ve.ui.MWGalleryDialog: Update "Apply" button when image added
Use 'change' event instead of 'reorder' to respond to this event.
This also covers removing images now, so delete that code.

Bug: T206534
Bug: T209451
Change-Id: I9eda383be2ca7f02b42814d43e6b42961b9b96e7
2018-11-15 20:56:39 +01:00
Thalia 70c3bc65d9 ve.ui.MWGalleryDialog: Improve how dialog actions are enabled
Enable the Apply changes/Done action if (i) the current contents
of the dialog inputs would change the gallery node or (ii) if the
user has interacted with inputs that alter the gallery caption or
images (including dragging/dropping or removing an image).

Bug: T206534
Change-Id: Ia6c1cc60d4f32ac66778e6973e2d400491f74128
2018-11-13 19:14:33 +00:00
Ed Sanders 1f7b239fbb Reset scroll and tab state when closing dialogs
Bug: T205948
Depends-On: I993455b648b62b97164f55146c75a53da70c322b
Change-Id: I30336caf76e8ff4de4c4dbd3728211c9a58d724e
2018-11-01 04:11:28 +00:00
Thalia 88875b1b8f Improve the gallery dialog layout for mobile
Bug: T203477
Change-Id: I0adc851b71362267d1d06d9a8b5483c1ee114c26
2018-10-12 16:58:48 +01:00
Ed Sanders bb369a0b48 Wrap editPanel & searchPanel in a StackLayout
Change-Id: Ib069a41c7855647b1cd85546fc83b30d65b27443
2018-10-05 22:17:14 +01:00
jenkins-bot 95eb279cc6 Merge "ve.ui.MWGalleryDialog: Fix setting of expanded/scrollable panels" 2018-10-04 21:45:24 +00:00
jenkins-bot c43f1589d4 Merge "ve.ui.MWGalleryDialog: Switch innerMenuPanel/innerContentPanel" 2018-10-04 21:38:41 +00:00
Ed Sanders 485b257278 ve.ui.MWGalleryDialog: Fix setting of expanded/scrollable panels
There are 4 scrollable panels:
* Image list content
* Edit panel
* Search panel
* Options panel

Remove non-existent 'expandable' property.

Change-Id: Ia0d0a66be8a2bcb243a39ef632151d7fb99486ef
2018-10-04 21:23:10 +00:00
Ed Sanders 61cfce8c32 ve.ui.MWGalleryDialog: Switch innerMenuPanel/innerContentPanel
These two panels were named the wrong way around.

Also change 'inner' prefix to 'imageList'.

Change-Id: Ie1c3e2160c81b898795fb1fd4d0a027e8f06c4d4
2018-10-04 21:22:05 +00:00
Thalia f422ae2dcc Use correct OOUI hierarchy in gallery dialog
Make sure fieldset layouts contain field layouts. Also remove
meaningless parameter icons.

Bug: T205615
Change-Id: Ia104cd60ffa9f5d636bee5611f265a2bb5ac0051
2018-10-03 22:22:25 +01:00
Bartosz Dziewoński 86f2057c81 Always generate empty wrapper paragraph inside image captions (slugs begone!)
While all of the following are valid in the model:

1. <mwBlockImage></mwBlockImage>
   Image with no caption. Must use the media dialog to insert one.
2. <mwBlockImage><mwImageCaption></mwImageCaption></mwBlockImage>
   Image with empty caption. There is a slug to insert a paragraph.
3. <mwBlockImage><mwImageCaption><paragraph></paragraph></mwImageCaption></mwBlockImage>
   Image with caption with empty paragraph. Nice and intuitive!

(Same for <mwGalleryImage> / <mwGalleryImageCaption>.)

The third option is the most convenient for the user. We should always
generate that when converting documents from HTML and from the editing
tools (MWGalleryDialog, MWMediaDialog/MWImageModel).

Previously, the editing tools generated option 2 if no caption text
was entered, and the converter generated option 2 if there was no
caption node or if it was empty. Curiously, option 1 was never used.

Wikitext for manual testing:

```
[[File:Foo.png|thumb]]
[[File:Foo.png|thumb|]]
[[File:Foo.png|thumb|Caption]]

<gallery mode="packed">
File:Foo.png
File:Foo.png|
File:Foo.png|Caption
</gallery>
```

Bug: T200387
Change-Id: Ie82fb339f6bd8ae1b289235bf5402490722d9a7c
2018-08-01 05:40:57 +02:00
Bartosz Dziewoński 13675e4a81 Fix confusion between #getSetupProcess and #getReadyProcess
The #getReadyProcess method should be used pretty much only to focus
a field inside the dialog after it is opened. It runs after the window
opening animation finishes, so if you add stuff to the window here,
that will be visibly delayed.

The #getSetupProcess method should be used pretty much for everything
else that depends on the opening `data`. It runs before the window
opening animation, so if you add stuff to the window here, it will be
visible while animating it.

Bug: T185944
Change-Id: I71ea5b6e1e1947c1cf8fd749100e854953a8ef3c
2018-07-11 23:47:55 +02:00
Ed Sanders f80b029444 Fix doc in GalleryDialog and add todo
Change-Id: I4e1ad8ec3d7a1c85a600bf1dafc449054c115203
2018-07-09 22:03:52 +01:00
James D. Forrester 3c6ca93b92 build: Enable and make pass no-prototype-builtins
Including a spectacular whoops in MWGalleryDialog.

Change-Id: Id9863f6dc3701cb0df6684380fa5ecac4526d37d
2018-07-06 10:58:18 -07:00
Thalia 12cc56400b Make gallery dialog work with native gallery implementation
Updates the model and re-renders the gallery.

Bug: T150621
Bug: T149602
Bug: T149596
Change-Id: I1e93c3af02eeeff1fcdaa5549cccc61ea755ee04
2018-03-19 23:55:17 +01:00
Bartosz Dziewoński 3c676013f8 ve.ui.MWGalleryDialog: Dedupe code for saving properties of each image
Currently this only handles the caption, but there will be more.

Change-Id: Ia8a25de89375d0ba873f4891b053c7aceab15534
2018-03-10 17:16:16 +00:00
Bartosz Dziewoński 3d422bac2a ve.ui.MWGalleryDialog: Handle galleries with 0 items
We still don't allow inserting such galleries, but we can handle them
in existing content.

Bug: T75230
Change-Id: I5d7350f00871ac295b0ebc00a633b44570347d85
2018-02-21 22:11:41 +01:00
Ed Sanders 0169701257 getSelectedItem() -> findSelectedItem()
Change-Id: Idf90335d06800b690063c7b2a781e822f0ee7ba9
2018-01-17 13:39:13 +00:00
James D. Forrester 0a7a845a42 doc: Bump copyright year
Change-Id: I0b299c840ede1a1b8552cecfc70c5760ab036181
2018-01-03 17:45:07 +00:00
Ed Sanders 8a356b19d7 Enable spellchecking on media caption inputs
Bug: T182393
Change-Id: I23d3f1b37225f9e5a9a9651b6e7b590d38dc99b3
2017-12-12 16:42:55 +00:00
David Lynch 7777f69e7b Use rel="noopener" on links targeted at new windows
Bug: T180932
Change-Id: I93bda6aaebf97727a187774cccbeba4f27fcddd5
2017-11-30 13:15:38 -06:00
jenkins-bot 1809344c8a Merge "URL decode file names in gallery, as in PHP parser" 2017-09-13 18:00:56 +00:00
Ed Sanders a6ac6d0cec Fix typos in gallery attribute names
The MW attributes are 'style' and 'class'. The plural
forms are used internally only to avoid JS keywords.

Change-Id: I1b7d14872aab4b6b3882d00165924fd1639e1744
2017-09-13 14:06:44 +01:00
Ed Sanders 280696ad3f URL decode file names in gallery, as in PHP parser
Bug: T175816
Change-Id: I3ec9c1f6db57798cdc1b5a787dd0bd9b4d3beef1
2017-09-13 14:03:20 +01:00
Ed Sanders 835a775a49 build: Upgrade grunt-eslint from 19.0.0 to 20.0.0
Mostly indent and regex fixes.

Change-Id: Iaf9d02363c78cb71deec5c4cab53a05b67f60600
2017-07-18 12:55:33 +01:00
jenkins-bot 16f5bc609e Merge "TextInputWidgets: update for deprecated multiline behavior" 2017-07-03 21:21:20 +00:00
David Lynch cfe1d6c0c9 TextInputWidgets: update for deprecated multiline behavior
Remove config option `multiline` and change to MultilineTextInputWidget as
appropriate.

Bug: T169272
Change-Id: I45565f01de76a88d64d7b0691d1e7279354f375d
2017-07-03 22:09:58 +01:00
Ed Sanders dd54c9c95d Return truthy object when image info not found
A missing image should return some data to say the
image is missing, not just reject the promise.

Bug: T169337
Change-Id: Ib41a64a783c1baca88f428417c98e7fb913d14a1
2017-07-03 18:01:33 +00:00