These are actually configurable via MediaWiki messages, so use those
instead of hardcoding the default URLs.
Change-Id: Ie66a1b53f9c011947fe9e8db198a5904373f3192
Logically depends on I575d92c4fa.
Should really use a registry, and also doesn't update when
format is changed by deleting text, but is an improvement
for now.
Bug: T147218
Change-Id: I0cb87dbad2ab4269c4f89bdff8a4ccd9b35c8635
Requires MediaWiki core change
Ic93d733cb9e1b1d7301f8975c68ab7ded778845a.
On wikis with CentralAuth installed, also requires
I24c2819ec2adcab468f961c5c46b31c331324567 and
I372e7bdff35400287b3d961da979d6f094d13bd9.
Bug: T143279
Change-Id: Id60bb3cde7e2032846da9606aefb00ea805f2ecd
The change was merged without the necessary dependencies.
This reverts commit 2b1c3914ec.
Bug: T143279
Bug: T146661
Change-Id: I5ce945f6167c9db5d5f03c824dee3d89cd0931a8
<a href="Foo%3F"> would dirty-diff to <a href="Foo?"> and also render
as such, pointing to the wrong page.
We also called decodeURIComponent() on the href twice, which can't
have been good.
Move URI decoding and underscore normalization into
getTargetDataFromHref(), and add rawTitle for callers that need it.
Put rawTitle in the origTitle attribute, so that equivalence
comparisons (decode(origTitle) === title) work as intended.
Bug: T145978
Change-Id: I29331a4ab0f8f7ef059c109f6813fa670a2c7390
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
Pretty much fix everything on the insert menu... RB doesn't like it when you
try to specify both title and revision ID, but don't provide an ETag.
Change-Id: Ib25d023309d984ed8848f67b349b23231f27a957
TODO: Do we need to do anything special here to handle multiple hash symbols in a URL?
Bug: T112898
Change-Id: I4773cb04ae2533e8125bc55d9ebb606d63b3bf48
This replaces ve.safeDecodeURIComponent(...).replace( /_/g, ' ' ) . This action
is really specific to the quirks of mediawiki title processing.
Change-Id: Ia9e525c9340e6de9e485355899996c97867ccb48
Percent-encoded characters are forbidden in titles. Copying URLs around will
tend to wind up when them percent-encoded when you paste. Therefore, when
trying to build a title from a pasted link, decode it first.
Change-Id: Ia0abcb2d903b04d99c7db16eb0a5962480b138d5
We may be trying to insert a block into a paragraph. fixUpInsertion
handles this, but not if use a replace transactions.
Bug: T136279
Change-Id: I1401da52676e79f38ef835a32d2c76004b75fb4e
Make some of the methods we currently use to render the node
static so we can re-use them before inserting. We do the evaluation
without inserting the node so as not to dirty the document and
transcation history.
In the unlikely case the request fails, just fallback to inline.
This only handles insertions for now as type changes on edit will be
very rare.
This changes the signature of insertTransclusionNode, which is used
in Cite and Citoid extensions.
Bug: T51784
Change-Id: Ibc2fc66e6866084b0a4deeb082c8a1ca412febb2
* Use TitleInputWidget for wiki-page-name and wiki-template-name parameters
* Use UserInputWidget for wiki-user-name parameters
* Use a custom hacky CheckboxInputWidget child class for boolean parameters
* Borrow some ve.ui.MWExternalLinkAnnotationWidget.prototype.createInputWidget code for url parameters
* Use a TextInputWidget with multiline disabled for line parameters
Not dealt with in this commit, so fallback to existing behaviour:
* string
* number
* unknown
* content
* unbalanced-wikitext
* date
* wiki-file-name
Bug: T55613
Bug: T124734
Bug: T124736
Change-Id: If04944d64303d959e8dd605e75a175895932b788
Depends-On: I87699a93ca1b34c6d248456fcc060f584623d158
Depends-On: I5e97604f0fc24176d5e89899bf0505dc442a1a7e
We now accept non-Parsoid generated external links from paste,
so make sure they have href attributes otherwise they aren't
really external links and will throw exceptions later on.
Bug: T131430
Change-Id: Ifb565b1ce30cfe80ae72b17f6a9551ea40b36453
ve.dm.MWExtensionNode#toDataElement calls storeGeneratedContents()
which prepopulates the cache, but because it was being called with
the wrong context, this.name was null and so the key we were storing
it under was different from the key we'd later be looking for.
Fixed by ensuring ve.dm.MWAlienExtensionNode#toDataElement preserves
context when calling its parent. Our static context hacks are tricky.
Change-Id: If859d861453067d7656a33a1767f6efc7bd9d323
Using the same logic we used for converting pasted URLs, detect
internal links by matching their base.
Currently link pasting is still disabled in the VE target, but
has been enabled elsewhere (Flow).
Change-Id: Iebd61abbe1fe82fd18d129e1dbc815ca75f44e87
Now that some targets support link pasting (Flow) we need to
make sure that pasted links match to an allowed type ('link/mwExternal')
instead of plain 'link' annotations which should never exist
in an MW document.
In a later commit we should auto-detect internal links.
Change-Id: I7faae834aa6e730c3cf93a691331a05fd0fe3d5c
* Override the static cloneElement. getClonedElement shouldn't
be overridden as doing so misses static invocations.
* Apply the same fix to extension nodes
* Fix DOM loop to reference clone.originalDomElements[ i ]
Logically depends on Id8024c171c to work.
Bug: T126169
Bug: T126114
Change-Id: Icf4d3115db5b12b97a6c805ff3d0b71d9e88b804
This prevents tables from getting sanitized even on
VE to VE copy. Also by calling ClassAttributeNode sanitize
extra CSS classes are removed.
Bug: T97462
Bug: T125220
Depends-On: Ia3ce386b2a03bc227818b10423bca72c736c0656
Change-Id: Ifd91e00b40665b446bbdcdf8859d2bb641bc0e67
Create a subclass for MediaSearch(Provider/Queue) and make the parent
class a more generic representation of API requests for media.
Change-Id: Iea8b90e829d532d210bfef3c96d6798c64e15eed
VisualEditor is usually not enabled in talk namespaces... but
sometimes it is. And when users see the button to edit with VE,
they're going to click it and expect to be able to sign their posts.
This tool is only loaded on talk pages and pages in additional
namespaces defined in $wgExtraSignatureNamespaces.
Code adapted with small tweaks from my own gadget
<https://meta.wikimedia.org/wiki/User:Matma_Rex/visualeditor-signature.js?oldid=13461327>,
which is already available under the MIT license.
Changes include:
* The tool is now always visible if the wiki allows signatures in any
VE namespaces, but disabled when not allowed in the current namespace.
* Register '~~~~' sequence to insert the signature.
* Code style tweaks for stricter lint checks in this repository.
* Documentation corrections.
Swedish translation provided by André Costa (already credited
as a translator as Lokal_Profil).
Depends on changes in VisualEditor core:
* I89fe53890ab59d12260ea6b41de802c38c24e8b9
* I14cd7efac521687ea38580341ae08ddc522edeeb
Bug: T53154
Change-Id: I6be5fb2118cf3eef5098d4c5320228aa81411ccb
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
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
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
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
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
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
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
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
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
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
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
In clipboard mode we need the full body regardless of if the reference
has changed since load or not.
Bug: T104230
Change-Id: Ie59e04d381f2fd2680e8af0cf05a80df71052822
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
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
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
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
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
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