Commit graph

331 commits

Author SHA1 Message Date
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
Bartosz Dziewoński b5aa9e9c72 ve.ce.MWSignatureNode: Fix rendering
The API response format changed in formatversion=2.
Follow-up to 934572cdf7.

Change-Id: I383dfac8b0d10a39b8a9a1b11e11fd595f482619
2019-08-27 17:16:21 +02:00
Bartosz Dziewoński 84d548e7b1 Remove redundant @method annotations
A @method annotation is only necessary when the docblock is not
directly followed by a function declaration (in which case JSDuck
assumes it documents a property), e.g. when defining an abstract
function or referencing a function from another library.

I verified that JSDuck generates exactly the same output before and
after this change (docs/data-<hash>.js files are identical).

Change-Id: I7edf51a8560ab9978b42800ab1026f0b5555c3bf
2019-08-21 23:33:15 +02:00
Ed Sanders 89ecd64a55 Make extension body the default description for extension nodes
Change-Id: Ifada2a6a0279e64a1ba82f49e03884e362516a83
2019-07-31 16:38:27 +01:00
jenkins-bot a0a1f5422e Merge "Fix inheritance of isResizable" 2019-05-13 18:11:44 +00:00
Ed Sanders 4c8346f822 Fix API request for media dialog preview
Regressed with upgrade to apiversion 2.

Change-Id: I257c367b8f639a389002fefcd074e2fffe5a3bd4
2019-05-13 12:51:54 +01:00
Ed Sanders 20f876ca69 Fix inheritance of isResizable
Bug: T223086
Change-Id: Ib57b9a0173903db438120b94ffa391e734aee614
2019-05-13 12:00:05 +01:00
Ed Sanders 258965c8b2 Improve rendering of audio files
Use a static image of an audio player.

Also disable resizeable handle.

Bug: T206022
Change-Id: Ic41f381e65c40c3682f470b9993b2c9dbbb506c5
2019-04-28 23:56:08 +01:00
Ed Sanders 0db4ae6e00 eslint: Enable valid-jsdoc
Change-Id: Ia0d1e57246a1c567d73022ceca9b8c02850f9bc8
2019-04-17 17:13:39 +01:00
Ed Sanders 403b1f97b1 TemplateContext: Filter out empty template descriptions
Change-Id: I1be721c30d92b1da4fc226935a7e0a322f0c4d41
2019-02-25 23:05:51 +00:00
Ed Sanders de2a2ca06f Improve abstraction around template context description
* Separate partDescription from partDescription*s* and use Array#map
* Lookup CE node class of current model, instead of using
  ve.ce.MWTransclusionNode hard-coded.

Change-Id: Ief07b865b4c216dc13408b12e8a1354cd2c28dfe
2019-02-19 13:23:14 +00:00
Ed Sanders e95ec4e24f Don't try to set dimensions on an error image
Bug: T216267
Change-Id: Icbe8cce3e16b2674cb2400f2381f50c71e32f87c
2019-02-15 18:28:03 +00:00
jenkins-bot ca03c085a2 Merge "Revert "Don't preserveHtmlAttributes on transclusion nodes"" 2019-01-17 12:54:58 +00:00
Bartosz Dziewoński bdfd4b6d8f Revert "Don't preserveHtmlAttributes on transclusion nodes"
This reverts commit 48db45df76.

Bug: T213922
Change-Id: I7b0bf081fd5a9ab71db1ede3ce6e149cfb4b675a
2019-01-17 01:42:15 +00:00
Ed Sanders 74f6c4899c build: Update eslint-config-wikimedia to 0.10.0
Change-Id: I63a0ebf0b31a0d5d4e680a4e2a5a0be4850be165
2019-01-08 17:00:09 +00:00
jenkins-bot bebbff8bab Merge "Don't preserveHtmlAttributes on transclusion nodes" 2019-01-02 18:58:13 +00:00
Ed Sanders 48db45df76 Don't preserveHtmlAttributes on transclusion nodes
Bug: T207325
Change-Id: I9c92f18c58c044e7f2257aa6993db227896a1468
2019-01-02 17:11:31 +00:00
James D. Forrester 3c293ea00c doc: Bump copyright year for 2019
Change-Id: I8991b97c980d4149f53eb5601036220ef3c0c440
2019-01-01 13:24:23 +00:00
Ed Sanders f2a9ccd5bd Avoid HTML string parsing
Identified using https://github.com/wikimedia/eslint-plugin-jquery/pull/12

Change-Id: I138e018fdc037d688e055eacddfdc5bfc2cc5abe
2018-11-21 18:47:19 +00:00
jenkins-bot 5a679ed8f4 Merge "Use renamed ve.visibleWhitespaceCharacters utility" 2018-09-24 15:37:03 +00:00
Thalia bbed4307d7 Separate node classes into individual files
Bug: T205231
Change-Id: I84a6f2f7a842ab44e1f7103c0f288deda0451e79
2018-09-24 12:44:45 +01:00
Ed Sanders a2c04973a2 Use renamed ve.visibleWhitespaceCharacters utility
Change-Id: I2df52341009cbc715c801accdf59cc5d5ce2e9ff
2018-09-24 12:41:13 +01:00
David Lynch 26f6429702 TemplateStyles support
MWTransclusionNode will preserve TemplateData <style> in its generated content.

Disable TemplateStyles stylesheets in the original page content, and reenable
them when the surface deactivates.

Remaining TODO: if multiple copies of a template with deduplicated styles are
on the page, and the one containing the actual <style> is removed, all will
lose their styling.

Bug: T197563
Change-Id: Ibd8939eef7d8eb532719f4ee0ce200600449ef81
Depends-On: Ia9f2afcdba5456238e3ef444c202c9b0c78838bf
2018-08-22 17:03:27 +00:00
Ed Sanders 4ee09f75af Replace Bugzilla numbers with Phab numbers
Change-Id: I0e91d63b3872520b8f66002615967b2cfe235bf5
2018-08-09 15:11:27 +01:00
Bartosz Dziewoński a247fd4e90 MWImageNode: Make 'mw' attribute optional again
It contains some rare options that we don't currently make editable,
and we don't set it when creating new image nodes.

We could change our code to always set it, and consider it required,
but that would theoretically be a break in backwards-compatibility.

Bug: T198660
Change-Id: I6e77cce257f733f0f8f6e896b967177ff01658c6
2018-07-03 21:03:46 +02:00
jenkins-bot 4c88fc7ef4 Merge "Pass page parameter for multipage file (PDF, DjVu) thumbnails" 2018-06-29 20:08:55 +00:00
jenkins-bot 611ef4ef1c Merge "Pass video thumbtime to thumbnail metadata request" 2018-06-29 20:07:42 +00:00
Ed Sanders 715d67b564 Pass page parameter for multipage file (PDF, DjVu) thumbnails
Bug: T182392
Change-Id: Ib3bc7b13f24493da27078631a41e9c08bcc6c0f4
2018-06-29 19:26:42 +00:00
Ed Sanders 5cdbc17899 Pass video thumbtime to thumbnail metadata request
Bug: T198150
Change-Id: Ic8895c359a92fcc60ac486e3daf86db02599d3ff
2018-06-28 15:52:50 +01:00
Ed Sanders 6cad6f603d Don't call Resizable constructor conditionally
Change-Id: I3b5caf81b691aebcd50d3339a42bbaf4fe880fac
Depends-On: I19e63c89fa54f8f4bf1ad6795b8b281c4ad4576a
2018-06-12 17:18:12 +01:00
jenkins-bot c04e934361 Merge "Simplify conversion of images" 2018-06-07 20:51:51 +00:00
jenkins-bot 5e45047fe0 Merge "Fix parsing of external links, now Parsoid adds 'external' classes" 2018-06-06 21:28:10 +00:00
Ed Sanders dee50b778c MWTransclusionNode: Remove old createInvisibleIcon override
Bug: T196479
Change-Id: I99aab2e0eee3274305a6877263414ce21049fa5b
2018-06-05 18:50:14 +01:00
Ed Sanders b79c98f1e3 Simplify conversion of images
Assume that images provided by Parsoid will adhere to the DOMspec.

Change-Id: I52eb4f27e6b1e1cd092133c3e27e42021ae83783
2018-06-05 13:05:40 +01:00
Ed Sanders a7049dacea Update language variant node to use new invisible icon API
Bug: T195887
Depends-On: I4eab7b9edf04454ef1a62535656b179480c3054b
Change-Id: I655757b13514e8ff89c312dcc2e1147d188a2718
2018-06-04 17:34:22 +00:00
Ed Sanders cb36c6ded3 Fix parsing of external links, now Parsoid adds 'external' classes
Bug: T196025
Bug: T188656
Change-Id: I89b8ba378108bde6c8db0144ed306cbc8471111b
2018-06-01 08:47:46 +00:00
Ed Sanders ed604c857d Fix ve.ce.MWTransclusionNode#filterRendering to work with non-element nodes
Bug: T194839
Change-Id: I90065720725e8b59bfe4a4a9215b3835179cb2d1
2018-05-17 19:19:40 +01:00
Bartosz Dziewoński deabd6bd51 ve.ce.MWTableNode: Compatibility with new jQuery.makeCollapsible toggle styles
jQuery.makeCollapsible styles now display "fake" expand/collapse
toggles. This is nice, but some bits and pieces clashed with our
styles, this fixes it.

Also ensure that the styles are loaded if the page previously had no
collapsible elements on it.

Bug: T194323
Change-Id: If8f0869e6677811147f272337da7d96286792fe0
2018-05-10 21:41:31 +02:00
Ed Sanders 478b0bcbb9 Create getters for localised APIs (getContentApi/getLocalApi)
Pass through the current document when available, otherwise
assume the current surface's document.

Also add a getter for getPageName, so that can vary based
on the target document.

Bug: T193856
Change-Id: Ifdc951fdc6a43b924d102e3fcd7e59e52023757b
2018-05-05 14:32:55 +01:00
Ed Sanders 24ae471fd1 Sortable table header: Account for null entries in table matrix
Bug: T192545
Change-Id: I05bb80a0afce72a8202209499947781efe684584
2018-04-19 14:27:22 +01:00
Ed Sanders 16211cdc09 Abstract API calls to 'parsefragment'
Change-Id: Id0be3207219a6d93cebff2b6b5061cd24898d5cb
2018-04-06 13:49:16 +01:00
jenkins-bot a903f5c1cc Merge "ve.ce.MWInlineImageNode: Fix rendering of non-linked images" 2018-04-04 21:20:59 +00:00
Bartosz Dziewoński 24e828c627 ve.ce.MWInlineImageNode: Fix rendering of non-linked images
The bug is easiest to reproduce with `[[File:Example.jpg|link=]]`,
but it also affected video embeds.

jQuery appendTo() method returns the set of inserted elements.
Because `this.$element` is undefined at this point, the `<img>`
was not actually being inserted anywhere, and an empty set was
returned, causing MWInlineImageNode to have no CE rendering.

This was not an issue prior to c4f93b14, because `this.$element`
was being defined by the parent constructor (OO.ui.Element)

We don't actually want to insert it anywhere, this appendTo()
call was a remnant of wrapping code removed in a22aeafc.

Bug: T191406
Change-Id: If1dbf9fef0e0ac9debfdb3049ebcccac70948515
2018-04-04 21:22:58 +02:00
Ed Sanders ec3c6b65c0 Remove <section> unwrapping code from ve.ce.MWTransclusionNode
Has been fixed upstream in Parsoid.

Bug: T181226
Change-Id: I7dfe228e6d1008c4e66377d501f2e4af72c1813d
2018-03-29 14:05:32 +01:00
Ed Sanders 78ba8bbe3c Use OOUI 'markup' icon instead of local 'alienextension'
Change-Id: Id15596ab0013cb2078480bdb4dde25ef8e7ae50b
2018-03-20 17:27:54 +00: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 26e7728272 ve.ce.MWBlockImageNode: Allow normal CE rendering to handle the caption
Overriding ve.ce.BranchNode#onSplice seems pretty scary, some bug
could cause two captions to be inserted and it wouldn't even be
visible in the editor.

Instead, allow normal splice handling to happen when the caption is
added/removed, and only override the position where it is inserted
(to account for the image node this.$a).

The caption node is already removed from DM/CE if the image type is
changed to one that doesn't have captions, and even if that failed it
is also hidden in CSS, so we don't need to handle this.

Change-Id: I54f52b288118d692708311512dd674cc85d5d9e3
2018-03-10 17:16:16 +00:00
jenkins-bot ad6ded970f Merge "ve.ce.MWBlockImageNode: Fix handling of borders" 2018-03-02 13:15:50 +00:00
jenkins-bot fbbda2a480 Merge "ve.ce.MWBlockImageNode: Remove unnecessary #setupSlugs override" 2018-03-01 18:39:48 +00:00
Bartosz Dziewoński d239b6ee6a ve.ce.MWBlockImageNode: Fix handling of borders
After change 89aecd54ba (2014),
there is no 'border' value for the 'type' attribute, instead
there is a 'borderImage' attribute only present when 'type'
is 'none' or 'frameless'.

Change-Id: Id87ba09b647f5f69b1c9350209e66acdea2c9d69
2018-03-01 01:08:30 +01:00