Commit graph

233 commits

Author SHA1 Message Date
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
Jforrester 16437646fe Merge "Update VE core submodule to master (ca771b8bc)" 2018-03-06 13:14:21 +00:00
James D. Forrester d144599cea Update VE core submodule to master (ca771b8bc)
New changes:
7551f6c66 [BREAKING CHANGE] Rename class ve.dm.IndexValueStore->ve.dm.HashValueStore

Local changes:
Follow-through rename of IndexValueStore->HashValueStore

Bug: T188900
Change-Id: If60d0c637fe92f0e7afe916c064fafb17980d063
2018-03-06 12:55:30 +00:00
jenkins-bot eb125877e2 Merge "Revert "For empty / whitespace-only headings, output <p> instead of <h#>"" 2018-03-06 12:22:31 +00:00
Ed Sanders a274bdb8f7 Revert "For empty / whitespace-only headings, output <p> instead of <h#>"
Parsoid now handles empty headings for us in
scrub_wikitext mode (which we use).

This reverts commit 884f301aa0.

Bug: T187913
Change-Id: I8690bbced64be76622929f78f9c9e0d8f85d4be8
2018-03-05 23:27:52 +00:00
David Lynch 795b428477 MWNumberedExternalLinkNode: set an explicit type
This lets copy-paste between documents retain the numbered status rather than
falling back on pasting "<a>[3]</a>".

Update the part of LinkCache which selects on mw:ExtLink, so it will handle
possible multiple values in the link rel.

Bug: T188429
Change-Id: Ia5e4c9fa45e94da9cbfcd2a42d017d0fda1c511f
2018-03-05 11:59:41 -06:00
Bartosz Dziewoński 98a1bb09c0 Centralize Parsoid resource name parsing logic
Let's keep the ugly regexp and the comments about why we do this in a
single place.

This is mostly without behavior changes, with three exceptions:
* ve.dm.MWImageModel#attachScalable now passes a title with spaces
  instead of underscores to the Scalable (this doesn't matter because
  it's normalized to use spaces later anyway).
* ve.dm.MWImageNode#getFilename now returns a title with spaces
  instead of underscores. This is used in some API queries and when
  rendering thumbnails for missing files, and this format is actually
  more correct for both of these.
* ve.dm.MWTemplateModel now URI-decodes the template title. This
  actually fixes a bug where trying to edit a template transclusion
  whose title contains a '?' would throw an exception about invalid
  title.

Also, clarify that the return value of ve.dm.MWImageModel#getFilename
and ve.dm.MWImageNode#getFilename is different :(

Change-Id: I8e09015cea82308017ed925ec755b7231518126e
2018-02-28 03:01:05 +01:00
Ed Sanders d17121d1f3 MWImageNode: getHashObject -> getHashObjectForRendering
The latter was introduced for this very purpose: defining
which attributes affect the rendering (in this case the
thumbnail URL). getHashObject should be reserved for making
full semantic comparisons.

Bonus: Don't distinguish between block/inline images
for URL caching purposes.

Change-Id: I6e6d2547a0d110f07c4d18b8179c168d8c251059
2018-02-24 12:44:53 +00:00
James D. Forrester 0a7a845a42 doc: Bump copyright year
Change-Id: I0b299c840ede1a1b8552cecfc70c5760ab036181
2018-01-03 17:45:07 +00:00
jenkins-bot 0357252601 Merge "Use figure-inline instead of span for inline media" 2017-09-19 16:11:58 +00:00
Bartosz Dziewoński 98351fbcf3 Do not "resolve attributes" in toDomElements() overrides
Resolving attributes means turning 'href' and 'src' URLs from possibly
relative to absolute, so that they don't depend on the base URI of the
document.

This is necessary when rendering for clipboard (and in some other
cases), but at the point when toDomElements() is called, the document
these elements are in does not necessary have a sane base URI set,
giving us hrefs pointing to nonexistent pages.

Don't do it here; it will happen later when we know what the right
document (and right base URI) is, e.g. in ve.ce.Surface#onCopy or
ve.ui.PreviewElement#replaceWithModelDom.

Bug: T169675
Bug: T175157
Change-Id: Ie0a5d6e1c57b8efdbbfba0c24f31ca91d156e200
2017-09-07 14:06:24 +02:00
Arlo Breault 3e96d8ed5a Use figure-inline instead of span for inline media
Bug: T118520
Depends-On: I0681c39301e52a3368b53d38ed518ac66e18f0d6
Change-Id: Id8ec5b77207f43fc7c379b35859dc09f264e2c04
2017-09-05 12:17:14 -04:00
jenkins-bot 6f12d066d1 Merge "Rename LanguageConverter markup fields" 2017-08-11 14:28:11 +00:00
C. Scott Ananian 4ff740fe21 Rename LanguageConverter markup fields
Avoid confusion by using `twoway` instead of `bidir`, which could be
confused with the Unicode bidirectional layout algorithm.

Depends-On: Ib59dff22e64f235e30778a5a5b3e525e4fc7fdd3
Change-Id: I7efb35245d48125b167dc0f0ef8f12aa0fff94e5
2017-08-10 10:59:57 -04:00
Roan Kattouw 448944de3b Standardize on /^(\.\.?\/)*/ for interpreting Parsoid hrefs
We used (\.+\/)* instead of (\.\.?\/)* in some places,
but that doesn't make much sense since we won't and shouldn't
ever see stuff like '.../'

Change-Id: I9efcff2d2a34499ca57321dfbae29392ecb422d7
2017-08-02 21:30:31 +00:00
Ed Sanders 539a1cab43 Compare template names when diffing, not just type
As type is always 'mwTransclusionInline/Block'.

Bug: T166801
Change-Id: I76cdf0add780d556206c439797cfcca19133d94d
Depends-On: I0f24d9d81b5491a8f09bc59e5f544f99751fd506
2017-07-28 21:32:32 +01:00
C. Scott Ananian 9ee713d480 Display LanguageConverter markup in VisualEditor
Implement special node types for language variant markup, so that they
display appropriately based on the currently-selected variant.

(Parsoid uses empty elements to represent this markup, so without this
patch anything in -{ ... }- is alienated and disappears.)

A follow-up patch will implement context items and inspectors to
allow editing these nodes.  This patch is basic "read-only" support.

Depends on I4fcdebc2290ec35ba188f4c2e69d578791fbcd67 in Parsoid to
generate the appropriate markup, but this patch is safe to merge
independently.

Bug: T49411
Change-Id: Ie11e9301d2513bfe4a36036481cee9a047f46d37
2017-07-25 15:26:41 +00: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
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
Ed Sanders b3d44c1ccd Normalize to template namespace when comparing
Bug: T169307
Change-Id: Ic3524819fb026713b27b193e4a03338fffd97229
2017-07-03 16:41:08 +00:00
Bartosz Dziewoński 624211a60f Use Parsoid data for template names rather than detect from wikitext
We were incorrectly handling transclusions with trailing
newlines after the template name.

This also improves handling of non-template transclusions,
e.g. parser functions like `{{int:mainpage}}`, which are
no longer mangled as if they were page names.

ve.dm.MWTransclusionNode#isSingleTemplate will now match
a template even if it's name is itself template-generated.

Logic for turning Parsoid's hrefs into page names stolen
from ve.dm.MWImageNode.prototype.getFilename.

Bug: T167613
Change-Id: Ibecf71338eb37bb3da81a7372e4ed41140a9af57
2017-06-14 23:15:18 +00:00
Ed Sanders 9ccdf15695 dm.MWTransclusionNode: Move mixin comment, remove duplicated static property
Change-Id: Id8f8205db92a70dde7ba22b39e90e37590efb3d1
2017-06-06 16:28:01 +01:00
David Lynch 07e4d5fd17 dm.MWTransclusionNode: remove TableCellableNode mixin
Change-Id: Ic08c7ba03ad2bee35a96a750377450475d0efeed
2017-05-19 20:55:14 +02:00
Ed Sanders 153f7b034d Allow extension nodes to convert to a specified type of dataElement
Sub-classes want to dynamically change type, e.g. inlineFoo/blockFoo,
but doing this after storeGeneratedContents invalidates the cache,
so ensure this is done as soon as the element is generated.

Bug: T151130
Change-Id: I80e2f2587cff8e9d9fe6ded5d8581263268deaa8
2017-05-19 16:08:01 +02:00
jenkins-bot cfa8de994e Merge "MWTransclusionNode: Implement MWTransclusionTableCell" 2017-05-15 18:05:01 +00:00
David Lynch 0eb6b94b4c MWTransclusionNode: Implement MWTransclusionTableCell
Back in de98382a55, references to MWTransclusionTableCell were introduced,
but weren't followed through on. So, actually add it. Have cellable
Transclusions use it as their type.

Bug: T144122
Depends-On: I054f12f4218102a12d7a9ea843f9c61e8825c52c
Change-Id: I367f878bfd1c58e20b62368cb78120604b48d791
2017-05-15 12:09:11 -05:00
jenkins-bot 75b762d5c4 Merge "Specify suggested parent node types for tables" 2017-05-04 18:50:48 +00:00
Ed Sanders 9d83efc747 Specify suggested parent node types for tables
This won't do anything useful until T164017 is resolved.

Bug: T164016
Change-Id: I39bffe2dc59a97888b81bdbe990e55ba95b0dd94
2017-05-04 14:50:49 +00:00
Ed Sanders 8e6105fec8 Allow headings in divs
Bug: T164453
Change-Id: I986b1b376a592095c94d29a102278d4fde0a621f
2017-05-04 12:43:36 +01:00
Ed Sanders 7c0fc8d3b9 Fix minor lint errors and typos
* Commas that should be semicolons
* Unnecessary 'call's

Change-Id: I11a80702b5396a36e3deecc6e706a397cc354bd8
2017-04-29 12:36:17 +01:00
Ed Sanders 0c2bb3da9c Add basic support for Parsoid HTML5 video/audio
Change-Id: I30b787261c57e912e571170d8aa2d04726b6aa3a
2017-04-28 14:08:18 +01:00
Ed Sanders f20b9b0aa0 doc: Tag mixin inheritance hacks with bug
Also mixin dm.MWResiazble to dm.MWImage (already done
in CE).

Bug: T92540
Change-Id: I32215873993a7e9a7f775ce3f39e2d378e0f31cd
2017-04-13 11:00:17 -07:00
Ed Sanders 55368c1170 VisualDiff: Ignore changes to originalMw
Can happen when switching edit modes.

Also fix typo in describeChanges.

Change-Id: I2c02adc34aef975b9f6f902a74907d24b7edc54a
2017-04-10 21:22:16 +01:00
Ed Sanders d50f49de82 MWExtension describeChanges: Actually return value of parent
Bug: T161357
Change-Id: I7a81ab68dc2f632bd6f380caafef2cba326ad0ef
2017-04-03 22:57:49 +02:00
James D. Forrester c70526f0a2 ve.dm.MWImageNode#describeChanges: Ignore borderImage noise from the model
Also follow-up 335b56728a by adding the visualeditor-changedesc-align
i18n which was missed.

Change-Id: I801f66c0028f71cf2cdbcb8f1675ba1f5a3cde31
2017-03-22 17:28:41 -07:00
Ed Sanders 9cd8faea8b VisualDiff: Add custom messages for change descriptions
Bug: T151403
Change-Id: I469a3c7897f2417c1850364f65da51c0deca2386
2017-03-16 14:36:09 -07:00
Bartosz Dziewoński 49f603c703 Update <pre> support for Parsoid changes
After 79ccfb9372cb57afa569036ef39ead13abfba673, MediaWiki's `<pre>`
tags get rendered as `<pre typeof="mw:Extension/pre">` in Parsoid HTML.
MediaWiki's indent-pre syntax (block indented by a single space) is
still rendered as `<pre>` in Parsoid HTML, however.

Indent-pre is still handled by MWPreformattedNode (no changes).
Introducing MWPreNode, which will handle `<pre>` extension tags,
and MWPreDialog to change its contents (and allow converting
to MWPreformattedNode).

Pieces copied from MWGalleryNode, MWLinkNodeInspector, CommentInspector.

Possible future improvements:
* Add a specific icon for MWPreContextItem
* Avoid API roundtrips for rendering (but rendering wikitext <pre>
  is not as simple as it looks)
* Consider a way to insert these other than '<pre' sequence

Bug: T159900
Change-Id: I5bc4ea6e5d893736f65ef0dd43b08c18cb1a1e85
2017-03-14 14:08:50 -07:00
Bartosz Dziewoński 461f99e9da Document usages of ve.dm.Node.static.suggestedParentNodeTypes
Ed told me this.

Change-Id: I5e3160d3e5c38f9babc133db8977a6e6b8bbd610
2017-03-02 00:11:54 +01:00
Ed Sanders 9337e6ecbd Tables: Add support for editing mw-collapsible/mw-collapsed
We don't support editing <div>s right now (as they're BranchNodes) nor
<span>s (as they're annotations), but most of those are inside templates
and so not editable in VE anyway.

Bug: T157989
Change-Id: I647b2a544fd16952696d0de8d07cb72189b27ecb
2017-02-16 17:21:44 +01:00
Ed Sanders f2cf73eaaf Define default HTML types for extension nodes
Use span/div for inline/block nodes respectively.

Bug: T157389
Change-Id: I4c501a6af88a490eec83af26adaa515a2b1d18d1
2017-02-07 20:12:39 +00:00
James D. Forrester 122f49b2dd build: Bump file copyright notices for 2017
Change-Id: I3c20809e71cc0da58123e1b5f29c4f3aac945496
2017-01-03 08:58:33 -08:00
Ed Sanders dc0c751100 Ensure max size in not enforced for vectors
Otherwise they can't be scaled up. Also move svgMaxSize code
to comment as it isn't used yet.

Change-Id: I7af2bc91524e832555b66f090a671672cd14f294
2016-11-02 18:12:02 +00:00
Ed Sanders e655880d14 eslint: Remove unused exception and fix documentation errors
Don't enable valid-jsdoc yet though, due to @chainable bug.

Change-Id: I4d2a6de19c72c6e4c20733446616d8046419d431
2016-10-28 12:02:36 -07:00
Kunal Mehta 090b8ad5c7 Don't hardcode magic link URLs
These are actually configurable via MediaWiki messages, so use those
instead of hardcoding the default URLs.

Change-Id: Ie66a1b53f9c011947fe9e8db198a5904373f3192
2016-10-15 16:02:35 -07:00
jenkins-bot b656f3d5f1 Merge "Use super property to call parent methods" 2016-09-01 17:04:39 +00:00
Ed Sanders 5788340b49 Update VE core submodule to master (632f0a9)
New changes:
14b5fbc [BREAKING CHANGE] Move originalDomElements to the IV store and use MD5
c5d21f0 Provide methods to (de)serialize transactions

Local changes to move originalDomElements to IV store

Depends-On: I8a71c1a40ec35108d0a9a388da6f75632f8dc53c
Depends-On: I32c9b5f984fcf96e3354841ecfcd444149e8f159
Change-Id: I0fbb6324eede94558426178cbdad6b5daf0f8318
2016-08-24 18:14:14 +00:00
Ed Sanders 62bdaac13b Use super property to call parent methods
Change-Id: I76982b844cf2871d7583463def4393e5bdc33aa2
2016-08-23 11:56:47 -07:00
Ed Sanders bb7b38575f Rewrite TOCWidget based on Linker::generateTOC
Use the new node cache to find headings.

Change-Id: I5eb75c5db5ca466fd6f16a57c693c2a4458cff7c
2016-08-05 14:11:15 -07:00
jenkins-bot 913d3c0cf4 Merge "New decodeURIComponentIntoArticleTitle method" 2016-06-29 16:15:41 +00:00
Ed Sanders aeca19c9ea Ensure text version of counter is written to external links when copying
Bug: T137503
Change-Id: Iae791253ea272847984fee5d0586dc302027f1bd
2016-06-27 22:17:58 +01:00