Commit graph

365 commits

Author SHA1 Message Date
Ed Sanders 9fb6977e52 Update VE core submodule to master (363adf2)
New changes:
63c5f67 [BREAKING CHANGE] GeneratedContentNode: Introduce new hash for rendering
6dd1cb2 Add ve.dm.Surface#selectLastContentOffset

Local changes:
* Use new getHashForRendering in GeneratedContentNode users

  As we no longer have a model hash, remove the originalIndex check
  and just rely on the deep comparison of mwData (trading a deep copy
  for a hash computation should result in similar performance).

Bug: T114689
Change-Id: Ida0ee0234418408b735232c633d41908a424a9ff
2015-10-07 15:00:32 +00:00
Ed Sanders c5c88482b9 MWExtenionNode: Ensure objects are deep copied when used in the hash
We don't expect users not to alter the hash (subclasses may delete items)
so make a copy of any objects we put in it.

Change-Id: I6274f47e02b9f2d53864d4a2ae80df42e6c89867
2015-10-01 15:57:49 +01:00
Alex Monk 736561f3af Actually get uploader details when querying media info
Used in MWMediaDialog's buildMediaInfoPanel function

Bug: T109563
Change-Id: I398957eb0a4610379b29aac1df4234a58e845f28
2015-09-17 00:31:23 +00:00
Ed Sanders 8e63c9e991 MWInternalLinkAnnotation: Make protocol matching case-insensitive
This was causing a regression in the behaviour that takes you
to the external link tab automatically when 'http://' is typed,
as internally it is normalised to 'Http://'.

Bug: T112158
Change-Id: Id7cff07e89caafe5b350f4fb27b99c6c89498990
2015-09-16 23:49:55 +00:00
Ed Sanders 0fdf3cbb93 Update VE core submodule to master (9dcfbdb)
New changes:
184f952 [BREAKING CHANGE] ve.dm.Converter: Put static things in .static
a4c1e1e Localisation updates from https://translatewiki.net.

Local changes:
* Switch to using Converter's newly-static methods

Change-Id: If30f7b2a0de92c4c7f4d5ca57663251c132eeed2
2015-09-15 17:36:27 -07:00
Ed Sanders 830718ce22 Use ve.resolveAttributes instead of resolveUrl in clipboard conversion
This method does the tree traversal for us, and resolves src as well
as href.

Change-Id: Ic3ea47fb9acde9a1dad5caac3ee9c9b63c86d900
2015-09-15 13:44:52 +01:00
Ed Sanders 036b6c9edf Resolve image paths when writing to clipboard
Bug: T111927
Change-Id: Idf3b761481454197eecbc0f6cd5cf6199419ca6c
2015-09-09 16:19:18 +00:00
Ed Sanders d67d110d26 Use rendered contents when copying to clipboard
Bug: T111923
Bug: T111924
Change-Id: I04b98e317d0c883fc257c46552476041c7f53679
2015-09-09 08:56:22 -07:00
jenkins-bot 8502d3ea05 Merge "Specialized inspector for ISBN magic links" 2015-09-01 18:34:23 +00:00
C. Scott Ananian 7cc23367f6 Specialized inspector for ISBN magic links
Implement a special node type, context item, and inspector for
ISBN/PMID/RFC magic links.  Add buttons to the link inspectors
to convert back and forth between "simple" links, and magic links.

Depends on I5d000d8b63dafdfe0a2753069d3f0ac5b03b8829 in Parsoid
for clean round-tripping of localized ISBN magic links.

Bug: T63558
Change-Id: Id5b7a2ae3c80b0e5eed598f0bd024d3e94f7e9aa
2015-09-01 14:25:59 -04:00
Ed Sanders c6236b7b77 MWReferenceNode: Don't allow cross-VE paste of template-defined ref
The reference body is not available, so it would be useless.

Bug: T110479
Change-Id: I2a40178bc629ca65d7507feb1c5ff062fd591eda
2015-08-31 14:50:19 -07:00
jenkins-bot 64c73a4ac6 Merge "ve.dm.MWReferenceModel: Require parent document" 2015-08-27 15:38:01 +00:00
Roan Kattouw e4d2d4785e ve.dm.MWImageModel: Require parent document
Add a parentDoc parameter to the MWImageModel constructor and use
it to inherit language, direction and HTML document. Remove
getLang(), setLang(), getDir() and setDir() whose only purpose
was to propagate the language and direction from the parent document
in a hacky way.

Also add a parentDoc parameter to newFromImageAttributes(), replacing
the lang and dir parameters. Remove the unused and ill-conceived
caption parameter.

This causes caption documents to always have an HTML document
for URL resolution. Previously, this worked when editing existing
images because a document generated by cloneFromRange() (which
propagates the HTML document) was passed into setCaptionDocument(),
but it didn't work when creating new images.

Bug: T109599
Change-Id: Ida36862092cd779ffc2f04c0ecbc1164f8d71453
2015-08-27 00:09:21 -07:00
Roan Kattouw f11fbee278 ve.dm.MWReferenceModel: Require parent document
Add a parentDoc parameter to the MWReferenceModel constructor and use
it to inherit language, direction and HTML document. Remove
getLang(), setLang(), getDir() and setDir() whose only purpose
was to propagate the language and direction from the parent document
in a hacky way.

This causes ReferenceModel documents to always have an HTML document
for URL resolution. Previously, this worked when editing existing
references because the newFromReferenceNode() code path calls
cloneFromRange() which propagates the HTML document, but it didn't work
when creating new references.

Bug: T109599
Change-Id: I5d9d34d4343be8428318fa0b795fa54c110e34f4
2015-08-26 23:48:45 -07:00
Ed Sanders a67965a888 MWInternalLinkAnnotation: Override new getDisplayTitle method
This allows the URL paste handler to use the normalized title
as the text content. Add a test to cover this behaviour.

Depends on Ica48fea69cc in core.

Bug: T109980
Change-Id: I2784adaf2949a73256049921227dde0917ef9aef
2015-08-24 14:29:49 -07:00
C. Scott Ananian 2852f6368f Builder for ve.dm.MWInternalLinkAnnotation
Add ve.dm.MWInternalLinkAnnotation.static.newFromTitle to build an
appropriate internal link annotation from a mw.Title.  Tweaked some
method signatures to avoid repeated reparsing of the title text.

Also refactor ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref
to explicitly return a boolean indicating whether the result was determined
to be an internal link.

Bug: T64816
Change-Id: I74385d7b3ede1794398dabb749185f4080509b99
2015-08-19 16:57:06 -04:00
James D. Forrester 282ddfa1b6 build: Enable jscs jsDoc rule 'checkTypes' and make pass
Change-Id: Idbf6e698ba7015ee5e4f1cf78234ad3f187f1c06
2015-08-19 11:37:13 -07:00
James D. Forrester 9e7041f925 build: Enable jscs jsDoc rules 'checkRedundant*' and make pass
Change-Id: I36262ee1fe6116749586014fd30df3e00733fa6c
2015-08-19 11:35:43 -07:00
James D. Forrester 00d3226be1 build: Enable jscs jsDoc rule 'checkParamNames' and make pass
Change-Id: Ifcd3f67524c32148ff3591263d6374b31ee57d3b
2015-08-19 11:33:59 -07:00
James D. Forrester 85f91f394e build: Enable jscs jsDoc rule 'requireNewlineAfterDescription' and make pass
Change-Id: I7c0fabc93834d19198caea8f5dd1834e9e473d0a
2015-08-19 11:21:01 -07:00
James D. Forrester 945242a55a build: Enable jscs jsDoc rule 'checkAnnotations' and make pass
Change-Id: I76abb1eb1f3e1a2e8a4c03f577a080f4889b3a6d
2015-08-19 11:09:34 -07:00
James D. Forrester 19df1d4c8a build: Enable jscs rule 'requireVarDeclFirst' and make pass
Change-Id: Ia2f765d12bde001c329c2ff4c080a36b71de9803
2015-08-19 11:05:01 -07:00
James D. Forrester f5c6f61163 build: Enable jscs rule 'requireSpacesInsideBrackets' and make pass
Change-Id: I846d36c15e1b1f810d2ef7fd422f8412790bcb0f
2015-08-19 10:33:02 -07:00
James D. Forrester 06cdfe7acb build: Enable jscs rule 'requireDotNotation' and make pass
Change-Id: I2586e6959c3bbc7e4204242fc65551747c0e25a9
2015-08-19 10:26:19 -07:00
jenkins-bot a150550bea Merge "MWNumberedExternalLinkNode: Provide a context item" 2015-08-17 20:16:27 +00:00
James D. Forrester 31b4466d5f MWNumberedExternalLinkNode: Provide a context item
Bug: T98211
Change-Id: I0ca7811f5be5ce058f2ec22b2ce80e3228af5886
2015-08-17 13:10:58 -07:00
Alex Monk f6195426f0 Fix foreign file repositories (e.g. InstantCommons or equivalent) support
We were checking 'local' in config to determine whether a repo was local or not,
but config.local *will be set* to undefined in cases where it isn't.

Change-Id: Ic203b6e8204b95a644672790a2836d6e4709d218
2015-08-14 20:19:01 +01:00
jenkins-bot f4192a7847 Merge "Make transclusions which are td/th elements behave as table cells" 2015-08-04 20:37:41 +00:00
Ed Sanders de98382a55 Make transclusions which are td/th elements behave as table cells
Depends on Ic94242c0 in core.

Bug: T85648
Change-Id: I0f65fca37fe94486d0a736d763270b3dc5503649
2015-08-04 17:52:13 +00:00
Jforrester dbe11c3b14 Revert "Revert "For empty / whitespace-only headings, output <p> instead of <h#>""
It's seemingly still needed.

This reverts commit 924c58a893.

Change-Id: Ib9428865fbab2669153bd23cf239717080eb8291
2015-08-03 22:49:16 +00:00
Ed Sanders a4b250c790 MWImageModel#insertImageNode: Separate out linmod generation
Change-Id: Idee01e2e59f2a68481476f3d784502d3ebdf015b
2015-08-03 01:11:50 +00:00
Ed Sanders 97e0cd28a5 Make missingref references uneditable, not uninspectable
Depends on I1ba8978dd in core.

Bonus: remove not-allowed-cursor & highlight title (which was
broken) now that we can display this information properly.

Bug: T106810
Change-Id: I1800490ba1b8e10ff54b26372a8a78661c1c7d68
2015-07-24 12:03:05 -07:00
jenkins-bot 31e45cf530 Merge "build: Drop last jscs over-ride and make pass" 2015-07-23 18:48:48 +00:00
James D. Forrester 57f8fc5368 build: Drop last jscs over-ride and make pass
Change-Id: I4ff60af79cfc6e09e284d51f9b7ac2afa900f0f5
2015-07-22 15:13:09 -07:00
jenkins-bot 8d467915f7 Merge "Revert "For empty / whitespace-only headings, output <p> instead of <h#>"" 2015-07-22 22:05:34 +00:00
Ed Sanders aeedd808cd Never use original data optimisation when in clipboard mode
In clipboard mode we need the full body regardless of if the reference
has changed since load or not.

Bug: T104230
Change-Id: Ie59e04d381f2fd2680e8af0cf05a80df71052822
2015-07-10 19:45:56 +00:00
Ed Sanders 924c58a893 Revert "For empty / whitespace-only headings, output <p> instead of <h#>"
Functionality is now provided by Parsoid's scrubWikitext.

This reverts commit 884f301aa0.

Change-Id: I19f340a1c2d9718bfa05c6667042488f3a589719
2015-07-09 11:46:50 +01:00
Marc Ordinas i Llopis 7a33613d23 Use Parsoid's new Cite HTML and CSS
Starting with I21fbbd3247bf7801e5ef9bd5312f95777f4dd6ef, Parsoid
will emit a new HTML for its Cite extension, which enables CSS
styling. In I487095df8a7c4241a14f7b4480360f6774130bec the new
module 'ext.cite.style' is added to the Cite extension to style
this new HTML format.

This patch
* Loads the ext.cite.style module if the Cite extension is
  present.
* Uses the new HTML format for the internal structure of
  reference and reference list nodes, so they are correctly
  styled.

Backwards compatibility: Only new HTML is used internally in VE,
so as long as ext.cite.style can be loaded the new styles will be
used. It does not depend on which format Parsoid returns, so this
patch only depends on the Cite extension patch, not on the Parsoid
one.

Note: The only way I've found of adding a ext.cite.style dependency
only if Cite is present is to register the whole
ext.visualEditor.mwreference module in the
onResourceLoaderRegisterModules hook. Maybe someone can point to
a better way?

Bug: T86782
Change-Id: Ibf333a502d64d2ed6e029221458b7c606554e414
2015-07-06 14:23:18 -07:00
Ed Sanders 6822635158 Use new hasContent method on linear data
Change-Id: I430e628a9db30970ecdf6996bc51e7440a474077
2015-06-30 09:45:24 +01:00
jenkins-bot bbd91b0fb9 Merge "Remove redundant match function from block image" 2015-06-25 00:06:40 +00:00
jenkins-bot 2582f951af Merge "Give TranclusionNodes a matchFunction so they beat LanguageAnnotations" 2015-06-24 23:53:32 +00:00
Ed Sanders 6d8bd6f6e8 Remove redundant match function from block image
Functionality now provided by allowedRdfaTypes.

Bug: T98999
Change-Id: Icd933f4456fdc85fe08bdc9edc61040cb5bacd89
2015-06-24 23:45:14 +00:00
jenkins-bot bb9f9f9fb4 Merge "Converting an error image (red link) from block to inline does not lose its error state" 2015-06-17 17:28:03 +00:00
suchetag f7026d5e5b Converting an error image (red link) from block to inline does not lose its error state
Bug: T101085
Change-Id: I521be8fbcbab27d712ec408ea7048dca2eaab198
2015-06-17 22:41:41 +05:30
Ed Sanders 965a5dde89 Give TranclusionNodes a matchFunction so they beat LanguageAnnotations
This is a hacky fix, we should find a better way of telling the
model registry that language annotation loses to certain RDFa types.

Bug: T101977
Change-Id: I8be3aa55cbbc2832b8a02a15de27289b3041967e
2015-06-16 14:12:37 +01:00
Mark A. Hershberger 7d5e5ec9a9 MWMediaResourceProvider: Use exist instead of bool check on API values
In the MediaWiki API, booleans exist or don't exist (with an empty string),
you can't check "if (bool)..." since that will always be false.  The API has
a newer formatversion=2 that fixes this but we're not using that yet.

Also update the defaultSource placeholder to match the API response. If one
would only update defaultSource without the 'if'-fix, one can reproduce T66822
on a local wiki (JSON-P request instead of JSON).

Bug: T66822
Change-Id: I5a8ab1136325c33c62982c0869fa14ca2fb26034
2015-06-11 17:29:36 +01:00
Ed Sanders 425e581613 Unregister core image types
Once MW images are registered, we should remove core image support so
we don't accidentally match to them (e.g. an MW inline image with an
unsupported extra RDFa type).

Change-Id: I1c8567346c371fe338f95b232c9ac53e009c5a46
2015-06-02 14:36:14 +01:00
Timo Tijhof f2875141d8 ve.dm.MWTemplateSpecModel: Account for data.maps being undefined
This new property is optional and should not be assumed to be present.
Follows-up 2ac7959849.

The constructor defaults 'maps' to an empty object, so there's no need
to add a "|| {}" in extend() or getMaps(). We merely need to make sure
we don't accidentally dereference the default in exchange for undefined.

Change-Id: Id2cb93696d12a20ee14f9d59705877dc174e6564
2015-06-02 01:48:21 +00:00
suchetag dc2247460c Representation for the red-linked inline images in VE
The red-linked inline images in VE are now identifited as red links and image errors.
They can be changed and thereby be modified just as any other inline image on the editor.

Change-Id: Idb6f6f2da14379fd7db6ca19613dad32fe40023d
2015-05-25 15:18:15 +01:00
Ed Sanders 2f087d9ae7 Update VE core submodule to master (3c1f698)
New changes:
a6144f3 [BREAKING CHANGE] Allow models to specify which extra RDFa types they support

Local changes:
* Use new allowedTypes property in model registry
* For reference nodes, allow 'dc:references'.
* For transclusion nodes, allow any other types.
* For image nodes, allow 'mw:Error'.

Bug: T98999
Change-Id: I7eb2b61eb9336792535e9fd6d5a8dd2d57065f04
2015-05-18 19:42:43 +01:00