Commit graph

149 commits

Author SHA1 Message Date
jenkins-bot 21b4249360 Merge "Switch action=opensearch call to list=prefixsearch where appropriate" 2014-05-29 00:38:20 +00:00
Krenair d12a0d73d7 Switch action=opensearch call to list=prefixsearch where appropriate
Bug: 63555
Change-Id: If39e6f9c3a8445d506f14797bcec46714fb3e0f9
2014-05-29 01:15:03 +01:00
jenkins-bot 9da25b36fd Merge "Suggest categories that exist but don't necessarily have pages" 2014-05-29 00:06:27 +00:00
Krenair 20a1860f49 Suggest categories that exist but don't necessarily have pages
Instead of suggesting categories that have pages but don't necessarily exist.

Replaces part of If39e6f9c

Bug: 49044
Change-Id: I5c53669776c4c5bbbfe7b753747f3f677a752d91
2014-05-28 17:37:01 +01:00
Krenair 060fcabe3b Detect that a category is hidden when following a redirect
At the moment, if you have a category on a page, and the category redirects
to another category which is hidden, VE does not mark it as hidden when
loading the page.

Change-Id: I9303838d36fbc1e2c0ed16b8bb0020bf52a6c211
2014-05-22 17:44:05 +01:00
Moriel Schottlender 3a9faa44fc Hide 'no results found' once there's at least one result
Naturally, the 'no results found' should only appear as long as there
are actually no results found.

Bug: 52463
Change-Id: I0116b769b9e4995678975d43a74c54c4d426f672
2014-05-16 18:35:41 -04:00
Timo Tijhof 25d00cc777 build: Update jscs and jshint
jshint:
* Update to grunt-contrib-jshint v0.10.0 (jshint v2.5.0).
* Remove coding style options covered by jscs.
* Enable new option "freeze" (prohibits changing native prototypes).
  http://www.jshint.com/blog/new-in-jshint-oct-2013/#option-freeze
* Re-order to match http://www.jshint.com/docs/options/

jscs:
* Update to grunt-jscs-checker v0.4.4 (jscs v1.4.5).
* Format .jscsrc file in a more spacious way and order the
  properties less arbitrarily (using the jscs's readme order).
* Enforce more details of our coding style
* Get rid of the unsable "sticky" operator rules which have been
  deprecated in favour of using other rules instead that are able
  to enforce this more accurately.
  - disallowLeftStickedOperators: Remove deprecated rule.
    * Ternary covered by requireSpacesInConditionalExpression.
    * Rest covered by requireSpace{Before,After}BinaryOperators.

  - requireLeftStickedOperators: Remove deprecated rule.
     * Comma covered by disallowSpaceBeforeBinaryOperators.

  - requireRightStickedOperators: Remove deprecated rule.
    * Logical not (!) covered by disallowSpaceAfterPrefixUnaryOperators.

See also If46b94ce1, Ib731f11b1 and I0b0cadbc5 in oojs/core.

Also:
* Update grunt-contrib-watch to latest upstream version.
  Change log at https://github.com/gruntjs/grunt-contrib-watch/blob/v0.6.1/CHANGELOG#L1-L17

Change-Id: I6c5a34afea8b05a3dca617897c192594df06ca90
2014-05-15 16:52:34 +00:00
jenkins-bot 95828d4ff1 Merge "If no media is found display a message in media insert dialog" 2014-05-14 23:10:23 +00:00
Moriel Schottlender 8f68e9f497 If no media is found display a message in media insert dialog
Add a message indicating to the user that no image results were
found in the media insert dialog in case no results are found.

Bug: 52463
Change-Id: I93aea897d864298bf891a90c2fb147f7d34df06d
2014-05-14 16:08:11 -07:00
Ed Sanders af9cf9b2ff inheritdoc lowercase
Change-Id: Ie7a824a4f145d039b45fe60afbc7fe2a382c5e2d
2014-05-14 16:46:16 +01:00
James D. Forrester df280e27f9 ve.ui.MWTitleInputWidget: Fix documentation (@cfg not @param)
Change-Id: If76e22754b6e17b6ad98f72d5561929bb42bcab7
2014-05-10 12:02:25 +00:00
Timo Tijhof 9455e1f3ab ve.ui.MWMediaResultWidget: Use .on() instead of .error()
> JQMIGRATE: jQuery.fn.error() is deprecated.

While at it, also avoid using the overloaded .load(). It has
quite a few different signatures (one of them is to load $.ajax
by url and replace the contents of the element, completely
unrelated), and calling .on() directly is quicker as well.

Change-Id: I139b0c603577b5a0102d2ff679bd86b792830e3e
2014-05-07 20:35:19 +02:00
Ed Sanders 35c0694279 Use new mediawiki.language.names module
Depends on I63402b1e7 in core.

Change-Id: I803a966e380770609a32b6b64e0578e9be750f87
2014-05-02 14:04:14 +01:00
Ed Sanders be36dfca25 Use core language search dialog
Depends on I21a9d7e in core.

Change-Id: I12cacf775b490d7c676011a5a154deeefe5527c5
2014-04-23 18:43:03 -07:00
Ed Sanders 69ef943e46 Fix docs in ve.ui.MWParameterSearchWidget.js
Also re-use hasQuery variable.

Change-Id: I6166e45c6397723c6949f22f02af8b160e45ad4e
2014-04-23 18:14:42 -07:00
Ed Sanders b74aa4160b Hide ULS button
Currently it steals focus it doesn't use an iFrame, so we can't use
it in this way.

Change-Id: I4df95f3b60bc63b0ce296a06da648e96d94bf20f
2014-04-21 14:24:49 -07:00
Krenair 9c2e1d8048 Follow redirects in the category widgets
Display the redirects nicely in the UI, etc.

Bug: 52414
Change-Id: Ib62144cb90899d0c525d6f08f6b5f1159b7d2a86
2014-04-16 15:30:14 +00:00
James D. Forrester 37030882d1 Fix fencepost error with MWMoreParametersSearchWidget overflow
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
2014-04-15 12:30:40 -07:00
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
Trevor Parscal 6ec34a3dee Toolbar action widgetization and UI refactoring
Objectives:

* Use widgets to render toolbar actions
* Remove labels next to help notices and edit notices buttons
* Add a close button to the help notices and edit notices

Overview:

* ve.ui.ButtonWidget is now abstract, use ve.ui.PushButtonWidget instead
* ve.ui.IconButtonWidget now inherits from ve.ui.ButtonWidget
* ve.ui.PopupWidget's display method no longer takes x and y arguments
* Fixup naming issues in MWCategoryPopupWidget
* Fixup naming issues with some ve-init-mw CSS classes
* Rename ve-mw/ui/styles/ve.ui.Widget.css to ve.ui.MWWidget.css
* Change uses of "callout" to "tail"
* Add hyperlink functionality to buttons
* Make buttons accessible through focusing, but make unfocusable by
  clicking
* Add head option to popup for rendering a title and close button

Bug: 52386
Change-Id: Iea2c8df1be64d40f9c039873d89ee540cc56e687
2013-10-04 16:26:13 -07:00
jenkins-bot 23dd5f9fb9 Merge "'Config' -> 'Configuration' in all comments" 2013-09-26 19:02:30 +00:00
Ed Sanders e6f48c5c93 'Config' -> 'Configuration' in all comments
Because the former isn't a real word.

Change-Id: Ie6ed15f9e390b357bbaa768b57f3c3fd7cf21181
2013-09-25 11:23:16 +01:00
Roan Kattouw 336029d11f Fix use of removed function isUniqueListKey
Function was removed in eb64743436 but one caller was still left,
which caused VE to throw a JS error when opening the reference dialog
to insert a new reference.

Change-Id: I827381bfe3bdeecdbaa1fba55a09b3e8e03575a6
2013-09-24 19:18:36 -07:00
Erick Guan 30f1ed4c75 No more configuration overrides
In various places in the UI code, certain properties of config objects
were overridden and in some cases the configurations were documented as
private as a strange hack to prevent them from being advertised in the
docs.

I, Trevor, have been convinced of the error of my ways, and gladly
reverse this situation, allowing all configurations to always be
overridden when desired, while still allowing default values.

Change-Id: I242e3b1902dec8e09eeea38fa64381e69ee04215
2013-09-23 23:59:14 +00:00
jenkins-bot b777ff74e3 Merge "Offer the typed text as a link suggestion if the page is valid" 2013-09-04 00:32:30 +00:00
Trevor Parscal a365166948 Include param label in search index
Bug: 51670
Change-Id: I7f398bf26bf69d81b19fd258fddd490a6a81176c
2013-08-30 15:20:21 -07:00
Ed Sanders 176320a483 Offer the typed text as a link suggestion if the page is valid
Currently we only offer the normalised page title from the server
so 'iPhone' only suggests 'IPhone'. With this fix we offer the typed
text as the first suggestion if it matches via mw.Title, so 'iPhone'
suggests ['iPhone', 'IPhone', ...]

Bug: 50452
Change-Id: I05cc0cd19537cbfa682d7aac0f9640decea282b5
2013-08-30 15:08:37 -07:00
Ed Sanders 52de8b76ec Always give references names. Ignore if used once.
This avoids problems when unnamed references were copy-pasted.

Knowing that key is always non-null simplifies a lot of logic
elsewhere.

Bug: 53365
Change-Id: I3a23123ae732d9583814d38dd880a0cdf691fd5d
2013-08-28 12:47:33 -07:00
jenkins-bot c84c47aeba Merge "Prevent the creation of invalid MWInternalLinks" 2013-08-14 21:58:27 +00:00
Timo Tijhof eb0eeb240a clean up: Consistently use MW instead of Mw in constructor names
Most of 'em already do. Fixed the remaining ones.

Change-Id: I1a7ccb27dd66a33265dcaddaa7d34953d328ff87
2013-08-07 17:46:01 +08:00
Trevor Parscal 9f18fc0262 Don't override link target input value while typing
In some cases this would make VisualEditor be way too aggressive in
forcing you into the first matching page.

Bug: 52420
Change-Id: Ie0a793853d884ee0abf490a99c5214082e9dbf27
2013-08-02 00:49:53 +00:00
Ed Sanders 04c0a0d2ee Prevent the creation of invalid MWInternalLinks
By testing against a regex of legal title characters we can determine
if the entered text is a valid internal link. If it isn't we should
prevent the link inpsector from creating/changing the annotation.

Bug: 33094
Change-Id: Ia1df602601e4e82fc351279e432c28c425f5157a
2013-08-01 17:38:55 +01:00
Timo Tijhof 8f05cdbf70 doc: Add placeholders for unindexed methods
Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.

Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1

Added @return in a few places where it was easy to add.

Change-Id: I830c94cc7dbc261bd7a077391f930cbfff165f9d
2013-07-31 23:00:30 +00:00
Timo Tijhof cde62acf4b doc: @inheritDoc -> @inheritdoc
Follows-up db3da5d. Also scanned code base for more matches but
looks like those have been cleaned up already.

Change-Id: I62d1c4367e1ed7b7162d7b688227dfa5dca562aa
2013-07-31 23:06:29 +02:00
Trevor Parscal db3da5d16b Link inspector bug fixes
Formerly known as "The greatest commit in the history of the world*".

* Within a 3 block radius of Drayton Park and Auburt Park, starting
from July 30th at about 9pm or so.

Bugs:

* (bug 51404) Allow escaping out of the link inspector when in creation
  mode (no text is selected, text will be inserted based on link target)
  and the text input is empty
* (bug 51065 and bug 51415) Keep model and view in sync when changing the
  link inspector's text input value and showing options in a menu
* (bug 51523) Either restore selection at the time of close to what it was
  before opening the inspector (when using back) or to what it was before
  closing (might be changed by transactions processed during the close
  method) - this makes it simpler and more natural when clicking away from
  the link inspector, even when there are changes that must be saved by
  the link inspector on close

Bonus:

* Use only the light blue highlight color for menu widget items - the
  checkmark already displays the selected item, the dark blue is just
  masking the current highlight position and confusing the peoples
* Remove links when the user deletes everything from the link inspector's
  text input and then closes the link inspector
* Replace select menu's evil "silent" selectItem/highlightItem argument
  with a new method called initializeSelection which sets both selection
  and highlighting to an item without emitting events - this is needed
  when synchronizing the view with the model so the model isn't
  immediately told to change to a value it already has
* Make the MWTitle lookup menu not flash like crazy as you type (this was
  caused by a copy-paste oversight overriding
  initializeLookupMenuSelection unnecessarily)

Bug: 51404
Bug: 51065
Bug: 51415
Bug: 51523
Change-Id: I339d9253ad472c2f42c3179edc84a83d27561270
2013-07-31 17:42:14 +00:00
Timo Tijhof 44623c9b2a ve.copy: Remove obsolete copyArray and copyObject
These have been pointing to the same method for a while now,
we can safely remove these obsolete aliases and just use it
as generic copy.

* Each file touched by my editor had its new line at EOF fixed
  where absent
* Don't copy an otherwise unused empty object
  (ve.dm.Converter)
* Use common ve#copy syntax instead to create a link
  (ve.dm.Document, ve.dm.example)
* Remove redundant conditionals for isArray/copyArray/copyObject
  (ve.dm.example)

Change-Id: If560e658dc1fb59bf01f702c97e3e82a50a8a255
2013-07-30 01:44:22 +02:00
jenkins-bot 5fdc9abdc8 Merge "doc: Clean up spacing that caused <pre> or broken <ul>/<ol>" 2013-07-25 22:36:41 +00:00
Ed Sanders 8c87553761 Rename 'CategoryList' to 'Category' for consistency
Change-Id: I2e3637af38b789e588ce186497238f197e5fd5d3
2013-07-25 13:34:25 +01:00
Timo Tijhof 08610a4ecb doc: Clean up spacing that caused <pre> or broken <ul>/<ol>
Whenever there is more than 2 spaces (except the extra space
on a continued line of an @ tag, or the extra space on a
continued line of a list item) it causes a <pre> context.

Removed both spurious spaces that caused a <pre> and ones that
didn't but looked like it could.

When making an ordered or unordered list, the first item needs
to be on a new line and in block context (e.g. an empty line
before it). Otherwise it is rendered inline as 1. Foo 2. Bar
(such as in #rebuildNodes where both the ordered and unordered
lists were broken).

Change-Id: Id0f154854afbdc8e5a8387da92e6b2cdf0875f69
2013-07-25 04:02:50 +02:00
Moriel Schottlender 12372b41c9 RTL Fix for Category & Suggestion Popups
Flipped the generated positions of the MWCategoryPopupWidget and the
suggestion popup in the TextInputMenuWidget. The RTL position within
TextInputMenuWidget is only adjusted if the popup appears inside another
frame. This fix also corrects the suggestion popup positions in general
when inside another frame.

Bug: 51490
Bug: 51828

Change-Id: I83436d50a4a0596fdae9526c3fc2804cf880a530
2013-07-23 15:43:06 -07:00
Trevor Parscal 61ba07d409 Reference dialog commingling
Objectives:

* Merge reference insert and edit dialogs
* Change workflow to put editing/creating a new reference first
* Add secondary page in dialog for selecting an existing reference

Changes:

*.php
* Cleanup unused files/messages

ve.ui.Dialog.css
* In the footer; make primary, constructive and destructive buttons
  appear on the right; all others on the left

ve.ui.MWReferenceSearchWidget.js
* Fix documentation
* Remove create option and reuse section header items

ve.ui.MWReferenceInsertButtonTool.js,
ve.ui.MWReferenceEditButtonTool.js,
ve.ui.MWReferenceButtonTool.js
* Merge reference button tools

ve.ui.MWDialog.css
* Remove body styles, use padded option of layout instead
* Update selectors as per merging of dialogs

ve.ui.MWReferenceInsertDialog.js
ve.ui.MWReferenceEditDialog.js
ve.ui.MWReferenceDialog.js
* Merge reference dialogs
* Add buttons to switch between edit and select mode

ve.init.mw.ViewPageTarget.js
* Update reference button name as per merging of tools

ve.ui.SurfaceWidget.js
* New widget!
* Encapsulates a "sub-surface"

Bug: 51152
Bug: 50458
Change-Id: I8265febf4fd8f64d2ac40470ff033bac68b24d99
2013-07-18 14:14:14 -07:00
Trevor Parscal 130e446e52 Single-click insertion
Objectives:

* Reduce the number of clicks and mouse maneuvers required to insert
  media, references or template parameters
* Make use of highlighting with mouse movement or arrow key presses,
  similar to menus, to suggest action when clicked
* Improve the way media search results look and feel

Changes:

ve.ui.SelectWidget.js
* Add mouseleave handler to un-highlight when the mouse exits the widget
* Document highlight events (already being emitted)

ve.ui.SearchWidget.js
* Propagate both select and highlight events from results widget
* Make arrow keys change highlight instead of selection
* Get rid of enter event, make enter key select highlighted item instead
* Provide direct access to results widget through getResults method

ve.ui.MenuWidget.js
* Use the selected item as a starting point if nothing is currently
  highlighted when adjusting the highlight position

ve.ui.Dialog.js
* Add footless option to hide the foot element and make the body extend
  all the way down to the bottom
* Remove applyButton, which only some dialogs need, and should be creating
  themselves, along with other buttons as needed

ve.ui.Widget.css
* Change highlight and selected colors of option widgets to match other
  selection colors used elsewhere
* Leave selected and highlighted widget looking selected

ve.ui.Frame.css
* Add background color to combat any color that might have been applied to
  the frame body in the imported CSS from the parent frame

ve.ui.Dialog.css
* Add rules for footless mode

ve.ui.MWReferenceResultWidget.js,
ve.ui.MWParameterResultWidget.js,
ve.ui.MWMediaResultWidget.js
* Allow highlighting

ve.ui.MWParamterSearchWidget.js
* Switch from selecting the first item when filtering to highlighting

ve-mw/ve.ui.Widget.js
* Adjust media result widget styling to better match other elements

ve.ui.MWTransclusionDialog.js,
ve.ui.MWReferenceListDialog.js,
ve.ui.MWReferenceEditDialog.js,
ve.ui.MWMetaDialog.js
ve.ui.MWMediaEditDialog.js
* Add apply button, as per it being removed from parent class

ve.ui.MWTransclusionDialog.js,
ve.ui.MWReferenceInsertDialog.js,
ve.ui.MWMediaInsertDialog.js
* Insert parameter/reference/media on select, instead of clicking an
  insert button
* Use 'insert' instead of 'apply' as argument for close method

Bug: 50774
Bug: 51143
Change-Id: Ia18e79f1f8df2540f465468edb01f5ce989bf843
2013-07-15 23:42:56 +00:00
jenkins-bot 8ad91a7255 Merge "Normalize image titles in cache to prevent duplicates." 2013-07-11 21:37:36 +00:00
Rob Moen b61be39686 Normalize image titles in cache to prevent duplicates.
Bug: 50158
Change-Id: Ic86e063086917f739f53b4374b29f77bffd4ac1a
2013-07-11 10:11:24 -07:00
Trevor Parscal fc95029b34 Auto-add required params for user added templates
Objectives:

* Automatically add required parameters to templates that users create
  using the GUI, without touching existing templates loaded from data
* Cleanup some confusing terminology and APIs

Changes:

ve.ui.MWParameterSearchWidget.js
* Remove special logic for skipping aliases, which are no longer included
  in the list of names given by getParameterNames

ve.ui.MWTransclusionDialog.js
* Add origin arguments to constructors of transclusion parts
* Re-use onAddParameter method during initial construction of parameter
  pages
* Add required template parameters for user created template parts

ve.dm.MWTransclusionPartModel.js
* Add origin argument/property/getter for tracking where a part came from

ve.dm.MWTransclusionContentModel.js,
ve.dm.MWTransclusionPlaceholderModel.js,
ve.dm.MWTemplateModel.js
* Add origin argument pass through

ve.dm.MWTranclusionModel.js
* Add origin arguments to constructors of transclusion parts

ve.dm.MWTemplateSpecModel.js
* Rename origin to name - was a bad name to start with and will be even
  more confusing with the new part origin property
* Add isParameterAlias method
* Make getParameterNames only return primary names, excluding aliases

ve.dm.MWTemplateModel.js
* Update use of parameter origin, now called name

Bug: 50747
Change-Id: Ib444f0f5a8168cd59ea52a6000ba5e42ccdc2a24
2013-07-11 16:31:51 +00:00
jenkins-bot 49f909061b Merge "Retain original param names and ignore leading/trailing whitespace" 2013-07-10 22:57:52 +00:00
Rob Moen 6fba04f121 When normalizing category titles with mw.Title, use getMain method
This will get the name attribute plus this extension

Bug: 50702
Change-Id: I57298ef34b413002f1506b499903b73a18969e68
2013-07-10 15:52:58 -07:00
Trevor Parscal 0c3ca665d2 Retain original param names and ignore leading/trailing whitespace
Objectives:

* Trim leading or trailing whitespace that parsoid may have left on
  parameter names
* Preserve the original name for round-tripping cleanliness
* Ignore leading or trailing whitespace when entering new parameter names
  in the parameter search widget
* Consider aliases when listing suggested parameters

Changes:

ve.ui.MWParameterSearchWidget.js
* Use hasParameter method instead of using indexOf - uses map lookup
  internally, which is much faster, and also take aliases into account
* Trim query input value to prevent leading or trailing whitespace from
  being considered when filtering known or creating unknown parameters
* Take aliases into account when showing filtered results

ve.dm.MWTransclusionModel.js
* Use original name when round-tripping

ve.dm.MWTemplateParameterModel.js
* Store original name for round tripping, and trim the original name for
  other uses
* Add getOriginalName method

ve.dm.MWTemplateModel.js
* Add hasParameter method, which currently just does a map lookup, but can
  do other processing in the future

ve.dm.MWTemplateSpecModel.js
* Add isParameterKnown method

Bug: 50715
Bug: 50717
Change-Id: I36a5e93ca8938ac3401a6e274647597704700468
2013-07-10 15:34:36 -07:00
Trevor Parscal 3a6e91dfb7 RTL Improvements
Objectives:

* Make option widget icons correctly placed in RTL
* Make embedded context toolbar correctly placed in RTL

Approach:

Use separate elements for icons within option widgets which have more
flexibility when rendering in either LTR or RTL when compared to CSS
background position. The simpler approach, using CSS background
position offsets, isn't cross-browser compatible at this time.

Changes:

ve.ui.OutlineItemWidget.js
* Remove custom icon implementation, using parent class implementation
  instead

ve.ui.OptionWidget.js
* Add icon option, which adds an icon element only if an icon was
  specified

ve.ui.MenuItemWidget.js, ve-mw/ve.ui.MWParameterResultWidget.js
* Add override for icon config option
* Document icon config as private

ve.ui.Context.js
* Add detection and special handling for positioning embedded context
  toolbar when rendering in RTL

ve.ui.Widget.css
* Add styles for option widget's new icon option
* Add styles to make indentation still work for outline item widgets
* Adjust styles for menu item widget as per changes in option widget

ve-mw/ve.ui.Widget.css
* Adjust styles for parameter result widget as per changes in option
  widget

Change-Id: Ibfa4b613e0fd7902f8a2c78b5717de402c5f82b8
2013-07-10 00:09:22 +00:00
Roan Kattouw 92c38eab85 The great directory split of 2013
Move all MW-specific files into the ve-mw directory, in preparation
for moving them out into a separate repo.

All MW-specific files were moved into a parallel directory structure
in modules/ve-mw . Files with both generic and MW-specific things were
split up. Files in ve/init/mw/ were moved to ve-mw/init/ rather than
ve-mw/init/mw ; they're still named ve.init.mw.* but we should change
that. Some of the test files for core classes had MW-specific test cases,
so those were split up and the test runner was duplicated; we should
refactor our tests to use data providers so we can add cases more easily.

Split files:
* ve.ce.Node.css
* ve.ce.ContentBranchNode.test.js (MWEntityNode)
* ve.ce.Document.test.js (some core test cases genericized)
* ve.dm.InternalList.test.js (uses mwReference test document)
* ve.dm.SurfaceFragment.test.js, ve.ui.FormatAction.test.js
** Made core tests use heading instead of mwHeading
** Updated core tests because normal headings don't break out of lists
** Moved test runners into ve.test.utils.js
* ve.ui.Icons-*.css
* ve.ui.Dialog.css (MW parts into ve.ui.MWDialog.css)
* ve.ui.Tool.css
* ve.ui.Widget.css (move ve-ui-rtl and ve-ui-ltr to ve.ui.css)

ve.dm.Converter.test.js: Moved runner functions into ve.test.utils.js

ve.dm.example.js:
* Refactored createExampleDocument so mwExample can use it
* Removed wgExtensionAssetsPath detection, moved into mw-preload.js
* Genericized withMeta example document (original version copied to mwExample)
* Moved references example document to mwExample

ve.dm.mwExample.js:
* Move withMeta and references example documents from ve.dm.example.js
* Add createExampleDocument function

ve-mw/test/index.php: Runner for MW-specific tests only

ve-mw/test/mw-preload.js: Sets VE_TESTDIR for Special:JavaScriptTest only

ve.ui.Window.js:
* Remove magic path interpolation in addLocalStyleSheets()
* Pass full(er) paths to addLocalStyleSheets(), here and in subclasses

ve.ui.MWDialog.js: Subclass of Dialog that adds MW versions of stylesheets

ve.ui.MW*Dialog.js:
* Subclass MWDialog rather than Dialog
* Load both core and MW versions of stylesheets that have both

ve.ui.PagedDialog.js: Converted to a mixin rather than an abstract base class
* Don't inherit ve.ui.Dialog
* Rather than overriding initialize(), provide initializePages() which the
  host class is supposed to call from its initialize()
* Rename onOutlineSelect to onPageOutlineSelect

ve.ui.MWMetaDialog.js, ve.ui.MWTransclusionDialog.js:
* Use PagedDialog as a mixin rather than a base class, inherit MWDialog

bullet-icon.png: Unused, deleted

Stuff we should do later:
* Refactor tests to use data providers
* Write utility function for SVG compat check
* Separate omnibus CSS files such as ve.ui.Widget.css
* Separate omnibus RL modules
* Use icon classes in ViewPageTarget

Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
2013-07-02 20:51:38 -07:00