Commit graph

17 commits

Author SHA1 Message Date
WMDE-Fisch 5db2622939 Remove test and doc leftovers from ReferencePreviews
The code for that is implemented in the Cite extension now.

Bug: T355194
Change-Id: Id0bb508e6a7dbc56ef5e5717aa84eb7f63285c02
2024-10-07 19:28:53 +02:00
WMDE-Fisch 694b96a19f Set a global when reference previews are visible.
Used for tracking baseline stats in the Cite extension.

Also fixed the wireing of the Reference Preview type constant so
that the settings can be tracked. Not sure where this should go
best in the new code.

Bug: T353798
Change-Id: I1c434f0098ae23bd62256686a658e3d5ef7f70b9
2024-01-17 16:19:09 -08:00
Jon Robson 9ee816a919 When extract is a string treat it as HTML
According to the docs:
The Element.append() method inserts a set of Node objects or string
objects after the last child of the Element.
String objects are inserted as equivalent Text nodes.

When given a string we want to treat these as HTML

Also fix the storybook which hinted at this being a problem
(incorrectly fixed in 504eefcc1)

Bug: T341318
Change-Id: I415c9821a6a37b45cf0f8a65f58a41bc7d0a042d
2023-07-07 10:09:28 -07:00
Jon Robson 504eefcc18 Fix storybook stories
This was broken when we switched from jQuery to native JavaScript

Change-Id: I318a51a7d8836370f795b1008b8a89b6ca0edb35
2023-06-30 09:41:53 -07:00
Jon Robson ec50f3f6ff Fix storybook integration
Broken by If2b4073115d9082829e4917c87c167d18f5431d9
Change import to directly hit the Codex library
This should also allow web team to respond to Codex upgrades
at their own pace (via package.json)

Render functions must now be registered in storybook for
them to display. Follow up to
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4

Change-Id: Iac9dede15f4de3a4d584f1e505e379764af6dcbf
2023-03-30 15:36:05 -07:00
jdlrobson 497feaf77d Fix cog alignment
Bug: T289362
Change-Id: Id5efc685f8df2a71f465156932eca67c9c633141
2021-08-31 14:53:38 -07:00
jdlrobson 27e171d9a5 Design spec dimensions should be documented in storybook
Bug: T284643
Change-Id: I17995d48c57140f9243cadbc0e4cef29cb41e447
2021-08-24 14:17:49 -07:00
jdlrobson a0754c8cf9 Storybook: Fix RTL
Provide containers for page previews examples

In storybook we avoid position absolute but this deviation from
how they behave in reality could lead to subtle differences that impact
the rendering of previews. It also doesn't allow to see the preview
in the context of the link which is an important part of visually
verifying the position of the pokey arrow.

This also allows us to rethink the broken RTL mode. We now scope
LTR rules to a LTR class that is present on the container, and use
the CSSJanus parsed stylesheet for RTL.

Change-Id: I189019824ddd6aa759790fd162ffcd543619a953
2021-08-06 14:40:10 +00:00
jdlrobson f97d29923b Add reference previews to storybook
Change-Id: I8e9e2db66fa94b33abcf7c9cbaff8defe5003ef6
2021-07-22 23:59:26 +00:00
Jan Drewniak 1e04551b1c [Storybook] Removing custom CSS grid and addons from Storybook
Removes the following add-ons and their configuration from Storybook:

- addon-cssresources
- addon-knobs
- addon-options

This will hopefully ease the upgrade to Storybook 6.

Removes the custom CSS grid used to position previews within the Storybook
instance in favour of a flexbox layout. This simplifies the creation
of previews for Storybook.

This change requires us to to add relative positioning to
`.mwe-popups-container` so that the footer is correctly positioned in the
popup without absolute positioning. This positioning has been moved to
be Storybook specific to avoid an regressions in production.

Bug: T271763
Change-Id: I9a97291cb4bca7d4cc60dad232a60f6f92c0adea
2021-07-14 12:54:55 +02:00
jdlrobson 9adf023eee Fix storybook IMG assets
When we changed the thumbnail size we changed the URIs to images
but didn't update the local storybook assets.

Bug: T266797
Change-Id: Iea4de1524a2f60cc759d59338882fe236e409bd2
2021-01-05 19:50:40 +00:00
Noam Rosenthal 4492b54a44 Performance optimization for popup rendering
Reduce layout/style thrashing by measuring all required geometries
at event handler, not waiting for delays/redux/style changes.

Use CSS bottom instead of top, to avoid having to measure the popup
before positioning it, if it's placed above the link ("flippedY").

Disable some test cases that relied on implementation detail of using
"top" CSS.

Change-Id: Id0cbf506009b824d0fb6af4d6fe220e2f69aaaad
2020-11-30 17:33:07 +02:00
Ed Sanders 2687d12c52 eslint: Remove valid-jsdoc override
Change-Id: I6a9936743a74afb528713f21e016838947fa1914
2019-08-15 08:00:24 +00:00
Thiemo Kreuz 4792151769 Split PreviewModel documentation into subclasses
See T218105 for discussion.

Bug: T218105
Change-Id: I0fde5de6e573e219f0937797bf10c20a01021a6a
2019-03-19 14:56:21 +01:00
Thiemo Kreuz fb5b120515 Minor fix-ups to type hints in JavaScript code
This patch also removes misplaced empty lines at the beginning of a
scope. In PHP code we even have a sniff for these. In JavaScript we
don't, but I suggest to be consistent about this.

Change-Id: Ic104ae8fe176da1dafa9bc783402adecb71de1f0
2019-02-14 11:15:01 +01:00
WMDE-Fisch 5f602c985c Fixed typo
Change-Id: I9c61f3dcf059884ec7ea16f601009d72b26e0cda
2019-02-04 12:37:16 +00:00
Jan Drewniak 83a28d177f Storybook.js for Popups
Storybook.js provides a framework for
viewing and working with UI components.
https://storybook.js.org/

This patch adds the Storybook.js UI library to Popups for
the purposes of viewing multiple previews at once.
This enables viewing page previews in the following states:

- with thumbnails
- without thumbnails
- with SVG thumbnails
- with narrow thumbnails
- with white background thumbnails
- in RTL languages
- in non-latin languages
- disambiguation popups

Storybook also allows users to change the image or text
of a popup through a GUI.

This patch sets up Storybook as a "mini" repo inside
the.storybook folder with a seperate package.json file
to avoid incompatibilities with the current webpack/babel
(or even Node) versions used in the Popups repo.

Storybook requires at least Node v8.3 to run.
(an .nvmrc file with 11.3.0 has been added to the .stories dir).

To start:
`cd .storybook && npm install && npm run start`.

Bug: T205989
Change-Id: I041e46c4f0cf173950015067e2dce81c023d3fdd
2019-01-08 14:19:00 +01:00