By default, MWTitleInputWidgets are now 30em wide, but this doesn't
work in the transclusion dialog where we want to put the "Add template"
button after an MWTitleInputWidget and have it not wrap to the next line.
So make the MWTitleInputWidget on the add template page 20em wide instead
(this is what they all were before the default was changed to 30em).
Change-Id: I2f33a87427657f4e27939c401436c4ce6441208c
Use new dm.Surface method for checking undo history state
(hasPastState -> hasBeenModified).
New changes:
38776df [BREAKING CHANGE] Refactor history state methods to better suit uses
3412b41 Localisation updates from https://translatewiki.net.
0c5238c Add system to dm.Surface for staging changes
8f0077c Only hide popups on selection change
4575f82 Fix initial selection when focusing in Firefox
debfd4e Document focus/blur cleanup
Change-Id: Ic66c96a4f64ad82a01a84535ca8cd19332065b37
16ec8ffdcf did this for the reference dialog, but the media edit
dialog needs it too. Additionally, we need to focus it when the
user switches to a different page then comes back.
Bug: 63909
Change-Id: If1b9587f4d10dbe6374e987b35c781954bcc566d
Due to a lack of clarity in the wikitext documentation the border
checkbox wasn't set up right. This is the proper behavior: border is
allowed for all unframed images (frameless and basic) while the
framed images (frame and thumb) have it anyways. Wikitext
documentation was also clarified for prosperity.
Change-Id: I4dd4775da473d669781553796be99646240c13fe
Otherwise the surface ends up in a weird half-focused state which
causes it to behave strangely.
Bug: 63909
Change-Id: I3ebc30fde0202116b383a5b497aca65b66732922
The logic was checking that there were at least three items to show, then triggering
the MWMoreParametersResultWidget widget with the number of items left in the overflow
if the limit was two. Whoops. :-)
Change-Id: Icec16a2d26bef8bf8d74ed619341afd494ca0479
Previous hack caused unwanted blur events and subsequent range changes.
Depends on I8388318311 in core.
Change-Id: I9163f4d9928887a5eec09f0651ec0a66cc221cd4
There are two ways dialogs determine if they are inserting or updating.
1. They evaluate whether the dialog is inserting or not and set a boolean
flag, used later to steer the saving code
2. They evaluate whether the dialog is inserting or not and, if not,
store the node to be updated in a property, used later to steer the
saving code
In the reference list dialog, setup used strategy 1, and teardown used
strategy 2. We've now normalized to use strategy 2 in both methods, which
fixes this bug.
Bug: 61885
Change-Id: I1b077b2aef4121328bce2b373874dd7373e405a1
These were being used indirectly in the MW*Model's. Use surface
fragments instead.
Fixes I0fae3e5ff2bd.
Change-Id: I1d6aa5e00a9315cf7088f87f9e9d828833feec64
Move various bits of code from initialize to setup as required.
MWDialog is now useless so use ve.ui.Dialog directly.
New changes:
0b2d03f [BREAKING CHANGE] Pass fragments, not surfaces, to windows (reprise)
0101ac4 Update OOjs UI to v0.1.0-pre (ac6848398c)
Change-Id: I0fae3e5ff2bd0da5b74c244af226b07b1f5883bd
ve.dm.Scalable is now a computational model for image scaling and
size manipulation. This commit adjusts the nodes and the edit and
insertion dialog to handle the new scalable model, and by that
use a centralized computational engine for all scaling and size
changes.
New changes:
3ec19fb8 Refactor Scalable functionality
Change-Id: I017a017924f544cc8bc9b7d8245335759ae0e890
* Truncate beyond 3 parameters
* Add a special option class that, when clicked, shows the remaining parameters
* Use a special option class for the no parameters item instead of hacking the normal one
* Simplify the design of the no parameters item: no icon, centered text
Change-Id: Ia8259e91b42a59c2b08019df36217d485208ad99
Changes:
* Change uses of initializeSelection to selectItem
* Use "choose" event to respond to deliberate item selection by the user
Depends on changes in OOJS-UI (Ib3826ed)
Change-Id: Ia167a70ca5f40b1f15adad30620fdb13ef0d02d7
This test never worked. Last week this feature broke but the
test continued to pass. Let's not do that again.
Change-Id: I9819a3304191959b9b194b3e675dfdd273618881
These were backwards which was triggering edit conflict detection for all users.
Fortunately for logged in users, if Revision::userWasLastToEdit was given a bad
timestamp (e.g. when we submitted here), it would just return true, suppressing
the conflict. It always showed a conflict for anonymous users however.
Bug: 56835
Change-Id: Ib07f965238ca96e17bf59b34da8a8e789954da61
When using a tool that opens a citation or citation transclusion dialog,
the dialog shouldn't use edit mode unless the template in the node and the
template the tool would insert match.
Bug: 63452
Change-Id: I34a5a2da576247f4046da45f742bccc3cec22c5a
Also update tools for changes in VE core.
New changes:
e4de14b Make tools use commands
e029817 Make getToolsForNode place primary commands first
Change-Id: I66575ee6d49e6b2f5a5f789978da98bb55e6dc5e
Protocol-relative <base> tags are fine when the iframe trick is used
because the iframe inherits a default base URL from the parent document,
so if the <base> is relative it can be resolved against that. However,
a document created with DOMParser (or document.implementation, oops!)
won't inherit anything, so anything other than a fully absolute <base>
will just break.
To make Parsoid's relative <base> work anyway, resolve it in the
context of the main document, then write the resolved version
back into the <base> tag.
Change-Id: I7261bd5dbe9ec1f4077a4e5a00bd2a03ac237ca0
New changes:
0318f64 Fix copyright year range for one file not updated to 2011-2014
4dbd57e Add <base> for relative URLs in tests
554cde9 Localisation updates from https://translatewiki.net.
c32448a Update OOjs UI to v0.1.0-pre (1c7875205a)
8f675c8 Localisation updates from https://translatewiki.net.
4fb929c Add a <base> to every test document by default
09c404c Protect against invalid/absent <base> in ve.resolveUrl()
05924db Use DOMParser in ve.createDocumentFromHtml() if available
9c19df0 Update OOjs UI to v0.1.0-pre (e697490c9b)
Local changes:
Use ve.dm.example.base for link tests in mwExample
Change-Id: I384e2a2edeebe9379de4910889a61670d9f734f5
The transclusion tools shown in the toolbar in the reference dialog
passed a template to open with to the transclusion dialog, but it
didn't take that config parameter.
Moved this parameter up from CitationDialog to TransclusionDialog,
and moved its logic into the setup function.
Bug: 63037
Change-Id: I9249c845a5ae7cca2ec4d75d69e1236f7755d246
this.refGroup is only ever read and never written, so obviously it's
always undefined. And it turns out that creating references with
listGroup='mwReference/undefined' crashes when you try to remove
them again.
Bug: 63085
Change-Id: Id326208bd6b3fe3b602ed6e3b57b7ea06d8ceb2c
* Create a method to produce the correct label
* Override that method in the citation dialog subclass
Change-Id: Ic74a23dcf30aae201f3d6c312b760cf058aadf11
This fails before the reference has been inserted, because
it's not yet in keyedNodes at that point.
Bug: 63031
Change-Id: I34ea1a88c0f332c23e43597d1c42158bfb0f1e98
Objectives:
* Allow users on-wiki to create tools and dialogs for citation templates
of their choosing
* Allow editing of citation templates directly, without having to go
through the reference dialog
* Provide citation template tools within reference editing that use the
same titles and icons as the citation tools do, but don't wrap the
inserted content in a ref tag
Changes:
* Reference list was cloning the DOM element it was inserting into its
view before the generated content node could finish rendering, so it
never ended up showing the finished rendering in the reference list
* Documenting hack about use of reference list node's destroy method,
and how we are depending on destroy not canceling generated content
rendering
* Introduced reference model
* Added saving/updating method to transclusion model
* Added getPartsList method to dm transclusion node, which caches the
result and invalidates the cache on update
* Added citation dialog, which extends transclusion dialog
* Added cite group to toolbars, cite-template in reference dialog toolbar
* Factored out getting the node to edit and saving changes procedures in
transclusion dialog so they could be extended in citation dialog
* Updated uses of autoAdd as per changes in oojs-ui (Ic353f91)
* Renamed MWDialogTool file since there was only one tool in it
* Expanded TransclusionDialogTool file out since there is now more logic
to it
* Switched to using ve.dm.MWReferenceModel instead of plain objects in
reference search widget
Configuration:
If you add to MediaWiki:Visualeditor-cite-tool-definition.json the
following code you will magically be presented with a delightful array
of citation options:
[
{ "name": "web", "icon": "ref-cite-web", "template": "Cite web" },
{ "name": "book", "icon": "ref-cite-book", "template": "Cite book" },
{ "name": "news", "icon": "ref-cite-news", "template": "Cite news" },
{ "name": "journal", "icon": "ref-cite-journal", "template": "Cite journal" }
]
...or...
[
{
"name": "any-name",
"icon": "any-ooui-icon",
"template": "Any template",
"title": "Any title text"
}
]
The title text is derived either from the title property or from the name
property by pre-pending the string 'visualeditor-cite-tool-name-' to
generate a message key. Titles for 'web', 'book', 'news' and 'journal' are
provided. The icon is a normal oo-ui-icon name, and more icons can be
added, as usual, by adding a class called .oo-ui-icon-{icon name} to
MediaWiki:Common.css. 'ref-cite-web', 'ref-cite-book', 'ref-cite-news'
and 'ref-cite-journal' are provided. The template name is simply the name
of the template without its namespace prefix.
Depends on Ic353f91 in oojs-ui
Bug: 50110
Bug: 50768
Change-Id: Id401d973b8d5fe2faec481cc777c17a24fd19dd4
If we render new links with a plain target, then if you're on a
subpage like Foo/Bar, [[Baz]] will point to Foo/Baz. In order to
avoid this, we fake the link target to be ../Baz and resolve that,
which produces the correct result.
This hack is only needed until Parsoid stops producing ../-prefixed
links. This hack is only applied in view mode, because applying
it to our DOM output back to Parsoid would confuse Parsoid and
cause bugs.
Bug: 58314
Change-Id: Ifb4b63a26235a04e6362fc3e3e57d8773831eb38
The request for originalDimensions is taken from the API, which can be
rather slow. There is a future (soon) fix that refactors the entire way
we read the originalDimensions asynchronously and load it into the dialog
but until that is available, this fix introduces a couple of basic
fallbacks in case originalDimensions are not yet available in the size
widget.
Bug: 62024
Change-Id: I8d00cea6f1d667359a44a6c185c16340bc6e81c9
New changes:
7b68782 Update OOjs UI to v0.1.0-pre (3b434d5388)
ecb194d Remove border-radius prefixes
993220a Fix invalid use of border shorthand syntax
580473e build: Clean up repo split left overs in Gruntfile
Incidental change:
* The OOjs UI-provided 'autoAdd' configuration option for tools has been
replaced with 'autoAddToCatchall' and 'autoAddToGroup'.
Change-Id: Ie7646ae867e5c6ca616c3f9045c79b886e78475c
It was excluded, but also promoted, and the toolbar resolves this ambiguity
in favor of promotion.
Bug: 62575
Change-Id: I2f1eadb27cbd16e3258aee0311c7b35f6311ea5a
This works the first time the dialog is opened, but if the user types
a value into the search widget that yields 0 results, then closes
and reopens the dialog, that value will persist and the search widget
will still be empty, so we'll wrongly disable the "Use existing reference"
button.
Instead, check what we're actually interested in directly: whether
the index of reusable references is empty.
Bug: 61960
Change-Id: If4bf6ced7dc3af643f602c07f3142a0e637a3247
Apparently adding a parameter whose name is an empty string causes Parsoid
to output |undefined= . And I can't say I blame them.
Bug: 62621
Change-Id: I01bc401ae60935dcce309b743057641e2e503528
* Add ve.init.mw.LinkCache to track page existence and
transparently query it
* Populate it with initial data from the parser cache
if available, obtained in the VE API module
* Use linkCache data in link annotation rendering
This doesn't yet integrate the LinkCache with other
components like the link inspector. That should be
done so we can deduplicate the existence checks.
Additionally, we should generalize LinkCache and use
it for the category existence/status checks as well.
Bug: 37901
Change-Id: I9fd43e8c3864dd375cf6dadfdeedd05e4fe9cf3b
This is the normalized title without the fragment, which is what
should be used for existence check purposes. Also add a test for
an internal link to a page's section.
Change-Id: I0e04f64c1bebeff84a0c17ef9b6c8dc06876f769
Also, we warn the user that Here Be Dragons™ when they're editing a Page
Translation /source/ page.
Bug: 50284
Change-Id: I841ccb8461d31358640a16301a6a78750a660d36
This patch increases the width of the defaultsort field, a problem
identified in bug 51012. It does this by adding a custom class in
/modules/ve-mw/ui/pages/ve.ui.MWCategoriesPage.js called
.ve-ui-mwCategoriesPage-defaultsort and then applying the style in
modules/ve-mw/ui/styles/ve.ui.Page.css.
The patch also increases the width of a field that was not addressed
in the bug report, the page redirect field in the page settings
page in the options dialog. This was done because, like the
defaultsort field, this field takes as input page titles, which
can sometimes be long. This was done by adding a style to
modules/ve-mw/ui/styles/ve.ui.MWWidget using the
.ve-ui-mwTitleInputWidget class, a class which had been added
to the input field but didn't have any styles associated with it
until this commit.
In both fields, the width has been set to 30em.
Bug: 51012
Change-Id: Ic24f0d20256a5d64075f9d2850215a03b8c8ae66
Update MWMediaDialog for .static.config -> .static.dialogData
rename in VE core.
New changes:
61e34f3 Only insert slugs where paragraphs are allowed
f65983d Don't try to return the document in getCoveredNodes
b9313ba Remove incorrect documentation for the .static containers
16874e2 ve.ui.Trigger: Clean up indentation and documentation
0eeba06 Cleanup docs and method of tools
Change-Id: I7bfb500ace1acc360cc24de2763e3f52fbb82a0e
Also update ContentBranchNode test for changes in VE core
New changes:
bdf9a9f Merge two Properties blocks in DesktopContext
d3c22bb Make ContentBranchNode echo suppression work in CBNs that contain inline nodes
aaad03a Localisation updates from https://translatewiki.net.
Change-Id: I3e1757b42307c3bd52ba0571068eb1c6bfb5ab89
TOC Widget is created in the mw target view class.
Adding and removing a heading rebuilds the TOC Widget based
on the the order of the page heading nodes.
TOC Widget considers TOC page settings and displays in the default manor
unless forced or disabled.
TOC Widget still needs to be finalized by being placed in the surface.
This could be a problem until we have a CE node for it to live in or
have some DM work added. Roan and I have discussed how to go forward.
To enable the widget you must add the following to LocalSettings.php:
$wgVisualEditorEnableTocWidget = true;
Change-Id: I488cfbbdb060e50d81f51e0f757e67d0114b8936
New changes:
dd15f23 Split ve.ui.Surface into DesktopSurface and MobileSurface
16283f4 Add OOjs UI's sco.json i18n file
ef94038 Split ve.ui.Context into DesktopContext and MobileContext
Minor adjustments to point to desktop and mobile Surface or Context.
Change-Id: I7cf6f99a5a1216a28a7146afcd4deb68c7eac38e
* Corrected the condition that set default size only if the image
wasn't smaller than the default.
* Added a couple of sanity check conditions for the OO.Compare
condition
Bug: 62586
Bug: 62581
Change-Id: I4db996cec33ac9d53ef485b53568100e3912c4ae
Add meta items for the four remaining mwPageProp behavioural flags from Parsoid
that are added by MediaWiki core. These are each waiting for UX implementation,
based on the lack of context information in MWMetaDialog about the page, or
about the wiki:
* __NOGALLERY__
* __HIDDENCAT__
— These only make sense in a Category: page.
* __NOTITLECONVERT__ // __NOTC__
* __NOCONTENTCONVERT__ // __NOCC__
— These only make sense on wikis that have content or title conversion.
Change-Id: I752705f65cfbd79c7f3f71270659793996868aff
Shown when there's no template data.
Someday in the future, we will support adding a description inline. Not
yet. Calm down.
Change-Id: I18c0a591b60de53bc124d82c688d71d30ad1d5dd
Also update VE-MW for the comment changes in VE core
New changes:
4ad6a3d Add text direction to SA demo
89503e8 ve.ce.Node: Emphasise slug transition with increasing outline offset
864046e Update oojs to v1.0.8
65d1338 Localisation updates from https://translatewiki.net.
b66d482 Stop special-casing comments and recognize them as tagName='#comment' instead
09dda12 ve.ce.getDomText: Document node types and use .data instead of .nodeValue
b0a3b2a Make ve.dm.Converter assertions actually display message
ef791cc Make 'comment' its own metaitem type
d5ef0d7 ve.dm.Converter: Refer to nodes instead of elements where appropiate
c22c8af Fix JS error when pressing Enter with selection across multiple paragraphs
a26a708 Add ve.dm.Transaction.newFromReplacement
a9e136e Don't cause needless surface refreshes on overwriting.
6fd35ee Split part of getOpeningHtmlTag out to getHtmlAttributes
2c31f67 ve.ce.Surface: Document version number in focus workaround for Opera
e069e74 Add some more characters to the special character inserter
Change-Id: I859805fb261468e8fae9454c4992115369066b49
* Add class to items container right at creation time.
* Do handling for individual items when we have a reference to the
item. No need to query for children() afterwards.
Change-Id: I7f5eda3d514da6d7a931bc31090a08b1937ed3e7
Follows-up I260059802379 which removed got rid of
the "ve-init-mw-viewPageTarget-toolbar-editNotices-notice" class
from notices and didn't add something generic in its place.
(There is "ve-ui-mwNoticesPopupTool-item" but that's more an
internal class we don't want gadgets and wiki stylesheets to
rely on.)
Bug: 43013
Change-Id: I8e1e383c2cb3199fe78f45f4feaa24a44126cf0b
* Use "Insert template" when adding a single template
* Use "Insert transclusion" when adding a multi-part template
* Use "Apply changes" when working with an existing tranclusion
* Use "Loading..." and disable while waiting for template data
* Disable when the transclusion has only a template placeholder
Bug: 50998
Change-Id: Ib2fb3d8711ed6d3ef41cc0db55740c95394dd3f9
Store a bit of data with the states we push or replace in the
history so that when the user navigates back to them, we know
for sure this is a state we pushed in the history.
This allows us to filter out popstate events triggered by the
user browsing to states create by other software, as well as
states triggered by the browser that have no state data at all
(Chrome is known to, in contrast with other browsers, trigger a
blank popstate event on load, which we were mistaking for a user
event where the user navigates back to veaction=edit).
Bug: 57901
Change-Id: I142777d0d2ae96d3afee224782f0d2d1522da1eb
The switch to source mode code path was causing onSerializeComplete to
be called, which accesses this.saveDialog because it assumes it's being
called from onSaveDialogReview.
In fact, onSaveDialogReview was calling it twice, once as the callback
it passes to serialize() and once in response to the serializeComplete
event. Cleaned this up by renaming the function and removing the
event binding, so it's now only called once and only for reviewing
changes to new pages, not in the switch to source mode code path.
Bug: 62544
Change-Id: I86eea57806a20408c8dc89a234c39cae1d969bca
When an image is smaller than the default size, the placeholder 'default'
value will be the image's actual size. This means that if a user selects
default thumb size for the image, it won't be changed unless the original
size is bigger than the default. Also adjusted so that default size limits
width only, and doesn't act as a bounding box on size change.
Bug: 62293
Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
This can be overriden in subclasses (such as MobileViewTarget) so that
we can customize the way the surface is created.
Change-Id: Id17695c8c75c7ae6c549f915625667389aad5f2f
Make sure the magnify button in the caption is properly shown or
hidden when image type changes. The magnify icon will always be
built, but will be shown and hidden using CSS rules.
Bug: 62139
Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4