Commit graph

81 commits

Author SHA1 Message Date
Ed Sanders 0e51180709 Update VE core submodule to master (55a5cdc): use new ve.ui.Dialogs and ve.ui.Inspectors
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
2014-04-09 20:28:30 -07:00
Trevor Parscal 70655da2b9 Limit the number of initially visible parameters in the parameter search widget
* 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
2014-04-09 12:56:02 -07:00
Trevor Parscal 84ed719cd0 Additional initializeSelection methodicde
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
2014-04-07 12:15:40 -07:00
James D. Forrester f1471a59f3 MWMediaSearchWidget: Bump media search result size to 20
At 15 the new, taller dialog means we never get to search for more…

Change-Id: I255d93b8230f962579e1a07840b7cc209577876b
2014-03-29 00:08:59 +00:00
James D. Forrester 95dee3ceee Fix copyright year range for fourteen files not updated to 2011-2014
Change-Id: Ibef2bf965dbd970b235a57058bcb3922a8777aa2
2014-03-24 18:36:51 -07:00
Trevor Parscal be199c0bf2 Ultra-mega-hyper-citation editing on crack
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
2014-03-24 19:24:38 +00:00
jenkins-bot 8ae779ec1f Merge "Don't use search widget emptiness as a proxy for "no reusable references"" 2014-03-20 05:50:40 +00:00
Roan Kattouw 45b17da937 Don't use search widget emptiness as a proxy for "no reusable references"
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
2014-03-19 22:46:04 -07:00
jenkins-bot e6280f34b2 Merge "Add lookupTitle attribute" 2014-03-20 02:44:10 +00:00
Roan Kattouw 0304b89db9 Add lookupTitle attribute
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
2014-03-19 19:34:19 -07:00
Rob Moen e02460131f Properly teardown TOC widget
Change-Id: Ib115024b4e50ac379e5b8689ae796fce3586d386
2014-03-19 15:51:23 -07:00
Rob Moen eba7d58dd1 Table of contents widget
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
2014-03-14 15:20:19 -07:00
Trevor Parscal 066a471346 Make parameter search widget case insensitive
Also ignore pipe and bracket characters, since they are not allowed in parameter names.

Change-Id: If7378826f103d0b7f8d24edcdc83419879a0c1fe
2014-03-06 12:10:42 -08:00
Krenair a4112ce30d Make new category suggestion section for hidden categories
Change-Id: If60437ce886c03ca1fb75ba23590e9cdb6c2d78b
2014-03-05 17:30:13 -08:00
jenkins-bot 43abad6193 Merge "Mark hidden categories as different in the meta-data dialog" 2014-02-27 02:12:58 +00:00
Krenair 5fc0faa7e8 Mark hidden categories as different in the meta-data dialog
This gives users a clue to understand why they won't display in the
category box at the foot of the page.

Bug: 50763
Change-Id: I1cf3a76bbf6370e7f67ec16f0a931f6ea4ba9d28
2014-02-27 02:08:48 +00:00
Ed Sanders ed0637a016 Update MWLanguageInputWidget to new API
As per changes in core:
* Use new #this.setAnnotationFromValues method.
* Inline 'initialize' in constructor.
* Bring over 'Change language' button.
* Rename 'Change language' button to 'Find language' and
  move to top of form so that it's obvious it's not just a submit
  button for the form.
* Properties -> local vairables.

Depends on If121603b5637 in core.

Change-Id: I059acea7258fc5097b747595e09fae394ab066ec
2014-02-20 15:30:09 -08:00
Roan Kattouw 575afb99c8 Fix occurrences of @mixin to be @mixins
Change-Id: I1e727d359bdc9a04cb8a4ef11080743d596ddca9
2014-02-18 21:12:46 +00:00
jenkins-bot bbba650002 Merge "Only display image info if that exists" 2014-02-15 02:14:54 +00:00
Trevor Parscal 7a3267467a Update VE core submodule to master (64650c6)
Switch to using FieldLayout for laying out forms.

New changes:
64650c6 Update OOjs UI to v0.1.0-pre (424b40373e)

Change-Id: I757aecf3485673f54aa9e7f38e88c079dda4451d
2014-02-15 01:55:55 +00:00
Roan Kattouw cebb0ad9da Bring down arrows in CategoryItemWidget back
This escaped the icon -> indicator migration because it was rolling
its own class (!).

Now using IndicatedElement to render the indicator.

Also, cleaned up some incorrectly named CSS classes.

Change-Id: I7f3369f2ffd3c34f0d29c0a235d1a15ddd68d1e3
2014-02-14 16:12:12 -08:00
Moriel Schottlender 21ccb20d3a Only display image info if that exists
When a new search is performed in the MWMediaSearchWidget,
image thumbnail details are extracted from the API's imageinfo.
In some cases, this parameter does not exist. MWMediaResultWidget
relies on that parameter to get image details like 'src' and
width/height. Without it the search fails.

This fix makes sure that the thumbnail result is only displayed
if there are 'imageinfo' details at all. Otherwise, the image
result is ignored.

Bug: 61392
Change-Id: I5261059bb42d3a57441514eafaa0bffa3a3c3ba4
2014-02-14 18:12:26 -05:00
jenkins-bot 813cbd087a Merge "Fix more code that misreads API data with $wgDebugToolbar enabled" 2014-02-12 23:32:36 +00:00
Krenair 0fea59f171 Fix more code that misreads API data with $wgDebugToolbar enabled
See also I907ef6fc.

Change-Id: Ie44faa15629ebba834cb08ba6247ff3beaabd0ae
2014-02-11 10:28:55 +00:00
Moriel Schottlender bee4e5323f Make MWMediaSearchDialog not ignore empty scriptDirUrl
For wikis that are installed in root directory, the API parameter
'scriptDirUrl' is an empty string. This change makes sure it is not
ignored.

Change-Id: Ib58adf76c184c32c0cdbb9dba31db1e4028fa383
2014-02-10 13:42:05 -05:00
Krenair a7f6b37096 Pluralise visualeditor-linkinspector-suggest-(matching|redirect|disambig)-page
Bug: 61071
Change-Id: Ia9893b8bfb80aa5d8a2bab9ecfe9ca1b6c85afbe
2014-02-08 00:35:30 +00:00
jenkins-bot 50b6de4866 Merge "Mark disambiguation and redirect pages in the link inspector" 2014-02-08 00:09:26 +00:00
Krenair 60d8021765 Mark disambiguation and redirect pages in the link inspector
Bug: 50240
Change-Id: If975398e4d6b13eea6207ee80b33067e65acd724
2014-02-07 23:48:41 +00:00
Ed Sanders 5aafc1256f Hide automatic reference names
Anything which matches :[0-9]+ is not particularly helpful
to display.

Bug: 57875
Change-Id: I63e7c6fffe275f7869adeafb35390de4b85d0c1b
2014-02-06 00:57:41 +00:00
Ed Sanders 047d6bf6cc Fix usage of '$' in MWReferenceSearchWidget
Easier to just use native getAttribute.

Change-Id: Ibd72eb457bb82b3b134d1eb29c4c33b3b9a7242f
2014-02-04 16:09:38 +00:00
Ed Sanders c528a0ffea Fix 'use existing reference' list rendering
Got broken by mass $ -> $element conversion in If3d870124ab8d1

Bug: 57209
Change-Id: Iada098d0fa361f4a825a4c87aa8a7493386855e4
2014-02-04 15:55:04 +00:00
Krenair fc56562364 Fix search results when $wgDebugToolbar is enabled
When $wgDebugToolbar is enabled, a debuginfo key is always returned from the
API.
Unfortunately that broke the ve.isArray check on the result, breaking the
opensearch calls by the linker.

Change-Id: I907ef6fc2589581cf7333af3968b63b483af65a9
2014-01-31 02:34:39 +00:00
Ed Sanders 5dff7fc7d0 Fix typo in ui.MWCategoryItemWidget
Change-Id: I6270753598bed3179451d17919b445f15db42233
2014-01-24 19:00:11 +00:00
Trevor Parscal 7994eae8c2 MediaWiki language inspector updates
* Add ULS, which was removed from VE core
* Add experimental mwlanguage module which adds ULS integration
* Hook in ULS to the existing language widget

Also update VE core submodule with changes:
* 1e92abe Generic language inspector

Bug: 47759
Change-Id: I325a4dcc316d0334fadfcaa46ad3acd45c6bf84b
2014-01-18 01:02:23 +00:00
Trevor Parscal f4156bd09f Update VE core submodule to master (e7e2833)
New changes:
* e7e2833 - Update uses of Push/IconButtonWidget to ButtonWidget
* d9d9eb5 - Update OOjs UI to v0.1.0-pre (d9bab13)
  * d9bab13 - The Great Button Refactor of 2014
* 22b93ef - Update OOjs UI build (88b2871)
  * 88b2871 - Fix png transparency on required.png
  * 670c468 - Add i18n

Also:
* Update uses of Push/IconButtonWidget to ButtonWidget as there
  is a breaking change in new OOjs UI version.
  This was separated from commit I325a4dcc316d0.

Change-Id: I82220d15221c52be03feafcfc85c2bd6c12ba462
2014-01-17 16:29:36 +01:00
jenkins-bot 2284cb9aae Merge "Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()" 2014-01-15 10:37:43 +00:00
Roan Kattouw 97c4c6c71b Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()
Change-Id: I90b0858ccd657b7183ae5327903449d17d9f0bef
2014-01-13 11:45:30 -08:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Moriel Schottlender 580a3f3d8d Use image sources from the fileRepo API
This commit switches from using hard-coded media source urls to utilizing
MediaWiki's API call for meta=filerepoinfo. The API call is done only if
needed when the media insertion dialog is loading, and is done only once
per session.


Bug: 50673
Change-Id: Ia5ad9a8c00cca6cbbbc890359dc529e29e1a6be7
2014-01-04 01:21:24 +00:00
Timo Tijhof cf7f2b141d Set up node-jscs, pass it, and configure in local Gruntfile
Let's experiment with this via our local Gruntfile. If it works
fine we can install it in Jenkins (similar to node-csslint).

Verify through $ npm install && npm test;

Fixed all outstanding violations.

Also:
* Added syntaxhighight to ignore.
* Added imetests (which contain unformatted JSON) to ignore.
* In ve.dm.ModelRegistry#matchTypeRegExps, removed redundant
  !! cast from the [+!!withFunc] statement which was hitting
  a bug in node-jscs. All callers to this local private function
  pass a literal boolean true/false so no need to cast it.
* Removed "/* key .. , value */" from ve.setProp, though this
  wasn't caught by node-jscs, found it when searching for " , ".
* Made npm.devDependencies fixed instead of using tilde-ranges.
  This too often leads to strange bugs or sudden changes. Fixed
  them at the version they were currently ranging to.

Bug: 54218
Change-Id: Ib2630806f3946874c8b01e58cf171df83a28da29
2013-12-06 10:37:27 -08:00
James D. Forrester d0ba27fd1f Only remove and insert a Category if it's changed
The CategoryPopupWidget's popupClose() method was checking for the
category having changed by comparing its sort key value to the existing
one, but it failed to account that null !== ''.

Change-Id: Idb6a84dc32706d90dea70dceb0b9b3a26ed70110
2013-12-06 01:42:49 +00:00
Timo Tijhof 68cf65844e jscs: "var\t" -> "var "
Only 2 hits.

Change-Id: Ie8c5c39a49f620891bae8582dcc0d2f151e50e21
2013-12-04 21:06:19 +01:00
Trevor Parscal db9f941fa6 Rename this.$ to this.$element, and this.$$ to this.$
Objectives:
* Rename this.$ to this.$element
* Rename this.$$ to this.$
* Get rid of the need to use this.frame.$$
* Rename OO.ui.Element.get$$ to OO.ui.Element.getJQuery

Changes: (using Sublime Text regex patterns)
* Replace "get$$" with "getJQuery"
* Replace "\.(\$)([^\$a-zA-Z])" with ".$element$2"
* Replace "\.(\$\$)" with ".$"
* Replace "'$$'" with "'$'"
* Set this.$ to null in constructor of OO.ui.Window
* Set this.$ to this.frame.$ in initialize method of OO.ui.Window
* Replace "\.(frame.\$)([^\$a-zA-Z])" with ".\$$2"

Bonus:
* Use this.$() in a bunch of places where $() was erroneously used

Change-Id: If3d870124ab8d10f8223532cda95c2b2b075db94
2013-11-03 23:03:49 -08:00
Trevor Parscal d2dfb9ac4f Split oojs-ui from ve.ui
* Move and rename generic parts of ve.ui to OO.ui
* We now have a UI test suite because ve.Element (outside ve.ui)
  is now part of oojs-ui, so it needs a test suite.
* Added to the MW test run (just like we do for unicodejs).
* Updated csslint config (also added ve-mw and syntaxhighlight
  which were missing).

oojs-ui still depends on the TriggerRegistry in VE, this is addressed
in a follow-up commit.

Change-Id: Iec147155c1ddf20b73a4d15d87b8742207032312
2013-10-28 22:40:08 -07:00
jenkins-bot 2f2a2207aa Merge "Make category suggestions dropdown appear below the input box" 2013-10-23 19:38:10 +00:00
Timo Tijhof 7db65f386c Rename @emits to @fires so we're forward compatible with JSDuck 5
Instead of using @emits in both, use our custom @fires in
production (JSDuck 4), and in the future it'll just naturally
use the native one.

This way we can also index oojs without issues, which seems to
have started using @fires already.

Change-Id: I7c3b56dd112626d57fa87ab995d205fb782a0149
2013-10-22 19:11:16 +00:00
Trevor Parscal efafed3231 Remove ve.{inheritClass,mixinClass} and use OO instead
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
2013-10-18 18:58:08 +02:00
Roan Kattouw 8fccb53afc Make category suggestions dropdown appear below the input box
Right now it's anchored to the bottom left of the category widget as a
whole, even if the text box is pushed farther to the right by existing
categories.

Change-Id: I7f2ca12b82d17c27fb3b87cb819a2a99a9fed108
2013-10-17 15:52:55 +02:00
Timo Tijhof d9153a2f1d ui.MWLinkTargetInputWidget: Fix crash on invalid input
Though the initialisation works since core has been fixed, there
are still plently of cases where we take real user input that can
genuinely be invalid.

Most notably, you couldn't make a link to [[.com]] because the
link input widget would crash on an exception from mw.Title.

Even after core was fixed (and ".com" is now valid), one still
couldn't make that link. This time because '.' is an invalid title,
and we create a Title object for that while typing ".com".

ve.ui.MWLinkTargetInputWidget#getLookupMenuItemsFromData:
* Guarded against mw.Title throwing by using newFromText
  and checking it first.

ve.ui.MWLinkInspector#static.legalTitle:
* Removed in favour of checking whether newFromText returns a
  truthy value.

Change-Id: I580bfccb83f86be3ad7e83d31f0834e1cde7df9c
2013-10-09 21:29:48 +00:00
Timo Tijhof eb515188ec Convert try/catch uses of mw.Title to newFromText
`new mw.Title` throws on invalid input. Converting uses to
mw.Title.newFromText instead and converting try/catch to if/else.

mw.Title in general (regardless of which constructor) has been
improved in core. It will no longer crash on pages where the page
title was a false hit for invalid (e.g. we couldn't load VE on
[[.com]] because the js parser thought it was invalid).

However, though the initialisation works since core has been
fixed, there are still plently of cases where we take real user
input that can genuinely be invalid.

In cases where the code did not catch exceptions and there was
no obvious way to handle it, I left it as is (let's revisit them
in a separate commit). It would be an exception either way, and
I'd rather see "mw.Title: Parser error" than
"TypeError: null does not have method getNamespaceId".

Change-Id: I5b1b23d56d39cdb7ecb0809e3d721992e0c30f54
2013-10-09 21:21:25 +00:00