Commit graph

440 commits

Author SHA1 Message Date
Ed Sanders 4545f53245 build: Update eslint-config-wikimedia to 0.17.0
Fix instances of variable shadowing.

Change-Id: I6e2befb020d7d4b506c7b46131eafacd951aa6d1
2020-08-18 13:16:49 +01: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 a8753df147 MWSignatureNode: Don't inherit from TransclusionNode
We don't share much functionality, and we have to do a bunch
of hacks to disable functionality we don't want.

Change-Id: I9861123d8f1cbab1923f1aa5be713c2dadaed53d
2020-07-08 22:18:35 +02:00
jenkins-bot be3ad7d93a Merge "Handle <noinclude> etc. as nodes rather than metaitems" 2020-06-03 13:23:03 +00:00
Ed Sanders 6076708ff3 build: Update eslint-config-wikimedia to 0.16.0
Change-Id: I638e0f82949597e2a2e4ea18fc2f0258f225358c
2020-06-02 21:30:00 +01:00
Bartosz Dziewoński 1fc11e0146 Handle <noinclude> etc. as nodes rather than metaitems
The difference is that metaitems are not visible on the editing
surface, and their exact position is not preserved when the paragraph
containing them is edited.

This behavior is desirable for e.g. categories, but not for
<noinclude> and related tags, which are intentionally placed in
specific places in the text.

Note that we don't really have any editing interface for these nodes
yet. But you can see them (and they come with descriptions and links
to documentation pages), and delete or copy-paste them.

Bug: T250937
Change-Id: I104e7abbd650567df0e59813653c46a66d955d58
2020-06-01 18:47:14 +02: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
Ed Sanders de47496b19 Move MWutils to preinit and rename to parsoid utils
Bring in ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref
and ve.resolveUrl, so that the file has no dependencies on VE.

Change-Id: I03bc455d5484a6c51f3fa2397c64936b829fe7e3
2020-03-24 23:13:16 +01:00
Bartosz Dziewoński 9119e57a2e Improve rendering of audio files (for real this time)
ve.dm.MWImageNode:
* Define sensible scalable properties for audio files. They are now
  scalable to any width but have a fixed height. (Ideally they would
  have no concept of height, but that would require many more changes.)
  This prevents them from resetting to 0x0 when resized.

ve.ce.MWBlockImageNode:
* Remove override for #isResizable, audio files can be resized now.
* Move #updateMediaType to MWImageNode mixin so it applies to
  MWInlineImageNode as well.

ve.ce.MWImageNode:
* Add #updateMediaType from MWBlockImageNode.
* Hide the real image 'src' using CSS rather than changing the
  attribute. It seems the previous solution depended on the order in
  which methods are called, because it stopped working when I moved
  the code here. (This depends on VE/VE change If5b1b5b5d.)

audioPlayer.svg:
* Make the file nicely resizeable. The dimensions of the "play" icon
  and time are fixed, the bar adjusts to the width of the container.

Bug: T206022
Change-Id: Ia0f38ca11e0d55a5b725fd9aeb6c79ec1345376d
2020-02-14 04:18:28 +01:00
Esanders c9b2e8b4d2 Only preserve data-parsoid/RESTBase ID on transclusion nodes
The previous attempt to fix this didn't preserve any attributes
but removing data-parsoid can result in a loss of wikitext formatting.

This reverts commit bdfd4b6d8f.

Bug: T207325
Change-Id: I2a38e651d17262889eddb149c72c9e08b4e56ed0
2020-02-12 22:51:43 +00:00
jenkins-bot 582b99781c Merge "Change gallery structure to match Parsoid" 2020-02-05 00:52:51 +00:00
jenkins-bot 0896917030 Merge "ve.ce.MWGalleryNode: Fix how 'mode', 'class', 'style' changes are applied" 2020-02-04 20:03:29 +00:00
Bartosz Dziewoński 353549003a Change gallery structure to match Parsoid
Bug: T214649
Change-Id: Ia5eb2057a8073488de2228315f08a20656ee946b
2020-02-04 20:02:18 +00:00
Bartosz Dziewoński 98ed2311b6 ve.ce.MWGalleryNode: Fix how 'mode', 'class', 'style' changes are applied
* Changing the 'mode' did not clear the old class, only add a new one.
* Clearing the 'class' or 'style' did not really clear it if the field
  was left empty.

Both of these could result in the action not taking effect visually.

* Setting a class unintentionally also removed internal VE classes.
  This doesn't seem to have any negative effects at a glance, but it's
  probably a bad idea.

Change-Id: I304c222a2c8bc9d35b1cfaee401ab1f815251fde
2020-02-04 19:49:01 +00:00
James D. Forrester 2c77e88d2c doc: Bump copyright year for 2020
Change-Id: I30539877543dc2a57bd1428a00d10ac46d8fc294
2020-01-08 09:13:24 -08:00
Ed Sanders e1db46612c Paste plaintext if conversion fails
Change-Id: I3891888f5d1d1de0c47e7bbcb1897d23b49bfa00
Depends-On: I3e9d5e167274440a424a47c266d8af67574c70b5
2019-11-24 09:37:40 +00:00
Ed Sanders 737e9e82f5 Follow-up I83b98e41: Always sanitize when using plain text paste in NWE
Bug: T201561
Change-Id: I0405923b2ebd1b73119d29cb6091f53b8cddc84d
2019-11-07 14:49:57 +00:00
Ed Sanders d71522c463 Set the plain text 'pasteSpecial' flag when using plain text paste in NWE
This means the multiple lines of html (e.g. '<p>a</p><p>b</p>') are
treated as plain text and only separated by one linebreak.

Bug: T201561
Change-Id: I83b98e41bfd92d1848557b58f961abdd0db26294
2019-11-06 19:11:58 +00:00
David Chan 22098d6b16 Convert $.Deferred() to ve.createDeferred(), except in preinit
Follow-up to a8e07e026dea4f54241d1dbb6b7bcdbd8c670db2 in core.

Change-Id: I09333adb4876c6e584a4a6b6a1628227c4cd2616
2019-11-02 13:06:28 +08:00
Ed Sanders ffa3742ce1 build: Update linters
Change-Id: I03d1a8e63b730ad98ec07ad5f630ba82698de5be
2019-11-01 16:20:22 +00: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
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
James D. Forrester 05fb44ae56 build: Upgrade eslint-config-wikimedia from 0.12.0 to 0.13.1
Change-Id: I43f407da92f59a8bf758cc2586e84aa5e18d9ab0
2019-08-02 09:51:07 -07:00
Ed Sanders 89ecd64a55 Make extension body the default description for extension nodes
Change-Id: Ifada2a6a0279e64a1ba82f49e03884e362516a83
2019-07-31 16:38:27 +01:00
Ed Sanders 22f43207fe Apply active external link fix to all skins
Change-Id: Ic66082fca53f803f9ede6c100beb9072b40a0c00
2019-06-18 15:23:10 +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 bee8344efe Fix initial rendering of interwiki links
This does not fix the rendering of new
or modified interwiki links, which will
require an API request.

Bug: T185083
Change-Id: Icb72291e8662456e1a233392bf22d786c7eed1e5
2019-05-07 14:44:18 -05: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 1890530b89 ApiVisualEditor: Remove red-link cache warming
Red-link metadata was added to Parsoid 18 months ago.
On long pages evaluating this information is very slow
(hundreds of milliseconds) and completely redundant.

Bug: T64803
Bug: T209078
Change-Id: I5b6c6da588301ed59fb21e1ce930f5b72db48e67
2019-02-22 17:49:11 +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
jenkins-bot 81c16f6b8a Merge "Don't try to set dimensions on an error image" 2019-02-15 19:01:32 +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
Ed Sanders bc02c44d36 rootNode/documentNode -> attachedRootNode
Change-Id: I56bb10749cac04e17ace2781b4d693ec5f522e7c
2019-02-13 19:03:36 +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 5461c56380 stylelint: Enforce class name pattern
Change-Id: Ia41a08424f840d353eb7fc213815f7992da4a2ef
2019-01-13 15:14:53 +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 add7b4d96f Merge "Change type from 'frame' to 'thumb' when resizing" 2018-09-24 16:07:19 +00:00
jenkins-bot 5a679ed8f4 Merge "Use renamed ve.visibleWhitespaceCharacters utility" 2018-09-24 15:37:03 +00:00
Ed Sanders 985a94777a Change type from 'frame' to 'thumb' when resizing
Bug: T204185
Change-Id: If40c70a074263b870aee4e5c87c3f4b5e98d0c4b
2018-09-24 15:31:58 +01:00