Commit graph

4221 commits

Author SHA1 Message Date
jenkins-bot cd898d07b6 Merge "Rename index to offset in AnnotationSet" 2013-07-27 01:06:01 +00:00
Timo Tijhof b0e8900a02 mw.ViewPageTarget: Clean up nested binds and triple model/connect
Change-Id: I67cabfdf0247dd0951b7d4f26c99d621aa2f7b0d
2013-07-26 23:54:04 +00:00
Roan Kattouw 4041d3f342 Fix the newline bunny-hop bug
We would dirty-diff "</span>\n<!-- comment -->\n<span>" to
"</span>\n\n<!-- comment --><span>", i.e. the second newline made
a bunny-hop to the left over the comment.

The actual bug turned out to involve a double bunny-hop, with
"</span> <!-- comment -->\n<span>" turning into
"</span>\n <!--comment --><span>", i.e. the newline bunny-hops
both the comment and the space.

This happened because outputWrappedMetaItems() didn't take
wrappedWhitespace into account when restoring meta items and
associated whitespace. I hacked a check for wrappedWhitespace into it,
but we should really just rewrite this pile of hacks into a unified
system for queuing and processing both whitespace and metadata.

Change-Id: I4375f4c07983ffec6877d0371aeaa9bf6e65fd6e
2013-07-26 16:24:27 -07:00
jenkins-bot fe40b86e74 Merge "Quick optimisation to avoid containsComparableForSerialization" 2013-07-26 23:14:01 +00:00
Ed Sanders f11db48234 Rename index to offset in AnnotationSet
To avoid confusion between IV store indexes and the index
within the set, rename them to storeIndex and offset.

Change-Id: Ic7d741bd5d39240d63fdc04a2df45658a64441de
2013-07-26 23:04:01 +00:00
Ed Sanders 017b947464 Quick optimisation to avoid containsComparableForSerialization
As that method makes expensive ve.compare calls, we can quickly
avoid most cases by testing AnnotationSet#contains first.

On page load this reduces the number of ve.compare calls on
[[:en:Argentina]] from ~6,000,000 to about ~2,000.

Also reduces ve.compare calls per backspace keystroke from
~300 to 2.

We can optimise this further, but this is a good simple start.

Bug: 52013
Change-Id: Ie3b4517fd13383c48acb64b3c4e82051c34e7484
2013-07-27 00:03:11 +01:00
Roan Kattouw be9495d31e Properly clone the document for the sanity check
Previously, we'd clone the data but convert it in the context of
the existing dm.Document, whose nodes had pointers to elements in the
old data array, not to the cloned ones. Because dm.MWReferenceNode
has logic like if ( something === dataElement ), this caused the sanity
check conversion to behave slightly differently compared to the real
conversion that happens on save, and so a references corruption
bug went unnoticed.

Change-Id: I79a42ae21f91cb8eb410ae26ea638036db19e217
2013-07-26 15:33:58 -07:00
Trevor Parscal f822e2b7c6 Cleanup code icon
Sharper!

Change-Id: I68a8895ca1bb652e09d66db4ce7abd68cf0a3e99
2013-07-26 13:07:40 -07:00
jenkins-bot 57be610976 Merge "Consistency in MW*ButtonTool comments and naming" 2013-07-26 19:42:14 +00:00
jenkins-bot b8ea6a22ac Merge "Code annotation button" 2013-07-26 19:41:34 +00:00
Ed Sanders fadd7c46a2 Code annotation button
Pretty straightforward, although we should start thinking about
grouping/hiding 'advanced' formatting options in the toolbar.

Making this button experimental for now until we've come up with
a way to deal with this problem.

Bug: 51590
Change-Id: Ieb1935b742aced4b883d8a194e6cb69be68473d0
2013-07-26 12:36:34 -07:00
jenkins-bot d477bfeb6c Merge "Infrastructure for loading plugins in the MW integration" 2013-07-26 19:35:08 +00:00
jenkins-bot 8768d59e13 Merge "Code annotation icon" 2013-07-26 19:33:42 +00:00
jenkins-bot 04c95eb8c6 Merge "Alphabetise icon styles in ve-mw" 2013-07-26 19:33:40 +00:00
Roan Kattouw e49df7f9d9 Infrastructure for loading plugins in the MW integration
Server-side, plugins can register themselves by adding to
$wgVisualEditorPluginModules. This is the recommended way for
MW extensions to extend VE. Client-side, plugins can register
themselves through mw.libs.ve.addPlugin(), which takes a string
(RL module name) or a callback.

When VisualEditor loads, we load the registered plugin modules in
parallel with ext.visualEditor.core. Note that they're loaded in
parallel, not after, and so the plugins should explicitly depend
on ext.visualEditor.core if they use or extend classes in VE core.
Once the modules finish loading and user and site scripts have run,
we execute the registered plugin callbacks. These callbacks can
optionally return a promise. We gather these promises and wait for
all of them to be resolved, then initialize the editor.

This allows Gadgets to extend VE by top-loading a small module that
depends on ext.visualEditor.viewPageTarget.init and calls
mw.libs.ve.addPlugin( 'ext.gadget.bottomHalfGadget' ); , the bottom
half being a hidden Gadget that depends on ext.visualEditor.core and
contains the actual code. The addPlugin() call needs to be in a
top-loading module because otherwise there's no guarantee that the
plugin will be registered before the user clicks edit and VE loads.

User and site scripts can extend VE by simply calling addPlugin()
directly, as mw.libs.ve is already present when user scripts run (since
it's top-loaded) and VE waits for 'user' and 'site' to run before
executing plugins.

If user/site scripts need to load additional JS files, they can load
these with $.getScript() and return the corresponding promise:
mw.libs.ve.addPlugin( function() { return $.getScript( 'URL' ); } );

For a diagram of all this, see
https://www.mediawiki.org/wiki/File:VE-plugin-infrastructure.jpg :)

VisualEditor.php:
* Add $wgVisualEditorPluginModules

VisualEditor.hooks.php:
* Expose $wgVisualEditorPluginModules in JS

ve.init.mw.ViewPageTarget.init.js:
* Add mw.libs.ve.addPlugin function that just stores the registered
  values in an array and passes them into the mw.Target when it's
  being initialized

ve.init.mw.Target.js:
* Add $wgVisualEditorPluginModules to the set of modules to load when
  initializing VE
* Add a Deferred (this.modulesReady) to track module loading
* Add addPlugin() and addPlugins() methods that add to either
  this.modules or this.pluginCallbacks
* In load(), instead of mw.loader.load()ing this.modules, use using()
  to load this.modules plus user and site, and fire onModulesReady()
  when they're loaded
* In onModulesReady(), execute the registered callbacks, gather the
  returned promises, wait for all of them to be resolved, then resolve
  this.modulesReady
* Fire onReady based on this.modulesReady being resolved, rather than
  using a second using() call

Bug: 50514
Change-Id: Ib7d87a17eaac6ecdb8b0803b13840d7ee58902df
2013-07-26 19:31:56 +00:00
jenkins-bot afcd539eb1 Merge "'CodeScript' => 'Code'" 2013-07-26 19:31:18 +00:00
Ed Sanders f689c8735b Code annotation icon
Change-Id: I16330c11a2f67a8b5fb09be70a809460b3731484
2013-07-26 11:21:36 +00:00
Ed Sanders cc92b1e629 Alphabetise icon styles in ve-mw
Change-Id: I6d0e5aa7e17abbe88c6bd06e7e9c605cdb5ad9a1
2013-07-26 11:19:36 +00:00
Ed Sanders 07821f5f55 Consistency in MW*ButtonTool comments and naming
Change-Id: Id71c7f862e43125599ecfc6eeb27719e1891489d
2013-07-26 12:04:19 +01:00
Ed Sanders 7c452a234f 'CodeScript' => 'Code'
I assume this was a copy-paste error from subscript above.

Bug: 51590
Change-Id: I8351fd7e272812017e0e9cfdd76e3da4745119d3
2013-07-26 11:26:51 +01:00
jenkins-bot e055bf82c6 Merge "Fix MWBlockImageNodes' default horizontal location code" 2013-07-25 22:50:02 +00:00
Inez Korczyński c24820140b Fix MWBlockImageNodes' default horizontal location code
Introduce method ve.ce.MWBlockImageNode.getCssClass and use it instead of
accessing ve.ce.MWBlockImageNode.static.cssClasses - it gives a better
way of handling special cases.

Bug: 51995
Change-Id: I236b08c8345a10d144f392ec37fd130cf5f7737d
2013-07-25 15:48:08 -07:00
jenkins-bot 0fbff1e580 Merge "Fix font size for overlays in Monobook" 2013-07-25 22:38:44 +00:00
jenkins-bot 33f6588216 Merge "Regress RTL fix transclusion icon" 2013-07-25 22:38:05 +00:00
jenkins-bot 5fdc9abdc8 Merge "doc: Clean up spacing that caused <pre> or broken <ul>/<ol>" 2013-07-25 22:36:41 +00:00
jenkins-bot 4166cfd8a2 Merge "oojs: Update to upstream v1.0.2" 2013-07-25 22:35:06 +00:00
jenkins-bot 7b84716b55 Merge "Optimise history stack truncation" 2013-07-25 22:11:30 +00:00
jenkins-bot ad63335bd1 Merge changes If571bb99,I2e3637af
* changes:
  Parse category names correctly
  Rename 'CategoryList' to 'Category' for consistency
2013-07-25 18:16:49 +00:00
Timo Tijhof 01f9c702b4 oojs: Update to upstream v1.0.2
* http://trevorparscal.github.io/oojs/releases/oo-1.0.2.js
* https://github.com/trevorparscal/oojs/blob/v1.0.2/History.md
* https://github.com/trevorparscal/oojs/compare/v1.0.1...v1.0.2

Change-Id: I7378b7cbef55243845d3f4cbc96406b3267c8c01
2013-07-25 17:57:41 +00:00
jenkins-bot 280e05afb1 Merge "Fix CSS lint error" 2013-07-25 17:21:55 +00:00
Ed Sanders 7874b39291 Fix CSS lint error
"Background image 'images/icons/italic-k.png' was
used multiple times"

Change-Id: Ib6a497021fe871c4597a80be91a259689b5d537b
2013-07-25 18:19:40 +01:00
jenkins-bot 0830d24a04 Merge "Add bold/italic icons for be-tarask" 2013-07-25 16:48:08 +00:00
Ed Sanders 7e9b4fafd3 Optimise history stack truncation
If undoIndex is 0 then we don't need to do anything, or even
emit the history event which is quite expensive as it triggers
various node redraws.

Bug: 52012
Change-Id: I09ca2d6cd0f4cbaf8316819dab0bd6edfc5de62c
2013-07-25 14:33:51 +01:00
Ed Sanders d7bbb1d206 Parse category names correctly
Category names containing colons now parse correctly.

Bug: 51902
Change-Id: If571bb9922399c5a5f77f0b304bec3f2b6f5f7dd
2013-07-25 13:50:49 +01: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 c81228f8ea Regress RTL fix transclusion icon
The fix to the transclusion icon messed up the way inspectors appear in RTL
wikis. The rtl check/correction (inside 'this.embedded') seems to be the only
rtl fix necessary. Something completely different will have to be done to the
transclusion icon.

Change-Id: I2417e125c99de9b0c5fd922a47de43ed9952d6fd
2013-07-24 20:28:32 -04:00
Ed Sanders 326347b5a9 Fix font size for overlays in Monobook
Bug: 50058
Change-Id: I751682c4bc51299c15e7efef487ae32e70049b16
2013-07-25 00:12:01 +01:00
jenkins-bot faeb27c477 Merge "ve.ce.MWBlockImageNode: Use this.constructor to refer to class" 2013-07-24 21:22:34 +00:00
Timo Tijhof 586696fc4d ve.ce.MWBlockImageNode: Use this.constructor to refer to class
Minor clean up for maintainability.

Change-Id: I14729cba683964177ef807dca1139e3887a767ad
2013-07-24 23:20:40 +02:00
Roan Kattouw acb30c3f51 Fix the save button disappearing on certain pages in Firefox
If the first thing on the page is an image, then we'll try to select
it in Firefox, and get a JS error because .data( 'view' ) is undefined.

It turned out that MWBlockImageNode's onSetup() didn't call the parent
implementation, and all the way up in ve.ce.View.onSetup is where
we set .data( 'view' )

Bug: 51986
Change-Id: I0de3692566b0aa02a229054e07767e45fd5d4a49
2013-07-24 14:02:08 -07:00
Roan Kattouw 81d3bde440 Fix copyright warning, which wasn't populated due to a missing .end()
Change-Id: I1a04a40415f3fcf8d11b49e5c90672ee625a85f7
2013-07-24 11:51:35 -07:00
Ed Sanders 541bd0b063 Add bold/italic icons for be-tarask
Also move 'en' into alphabetical order, because we're not special.

Change-Id: I4a34a570444655460d470deb1d624877a38d3adb
2013-07-24 16:35:23 +01:00
jenkins-bot 8e8aec5f3a Merge "Split continued link annotations on wordbreaks" 2013-07-24 14:43:45 +00:00
jenkins-bot 7b5af5bc79 Merge "Make ButtonWidgets more accessible" 2013-07-24 14:40:36 +00:00
jenkins-bot 9e8ce997db Merge "Show error when trying to save in read-only mode" 2013-07-24 14:35:52 +00:00
Ed Sanders 049bbf7b73 Make ButtonWidgets more accessible
* Give them a role=button, and a default tabIndex of 0
* Listen for a keypress of 'space' and emit a click event
  (you'd have thought role=button would do this, but oh well)

Bug: 50047
Change-Id: I429ad165c95f34d26975daf81db18cc966802cde
2013-07-24 14:34:06 +00:00
Ed Sanders 7557dd39ed Show error when trying to save in read-only mode
We already correctly show the read only error if the user tries
to load VE which the database is locked, but if the database gets
locked after they've loaded VE, we also need to show the error
when they try to save.

Bug: 51636
Change-Id: I7a56f1b4387e7ea594a2a7f939c81626c9eee834
2013-07-24 14:33:10 +00:00
jenkins-bot 12b250a929 Merge "Handle meta-only transclusions as meta items" 2013-07-24 14:29:21 +00:00
Ed Sanders cdfed7039f Handle meta-only transclusions as meta items
To achieve this we need to evaluate the DOM contents of
transclusion nodes to see if it consists solely of meta items
and whitespace.

To check for meta items we do a model registry match, but with an
additional parameter to exclude mwTransclusion types as a possible
result (as the first item may be a meta tag, but with a mw:Transclusion
typeof attribute).

Bug: 51322
Change-Id: I89a220350fb7e10e15f3682d21438539196a5846
2013-07-24 14:27:24 +00:00
Ed Sanders 3f3e0c0721 Split continued link annotations on wordbreaks
For now this approach is bit of a hack and will hopefully
be replaced with an ability to cursor either side of an
annotation.

Bug: 51463
Change-Id: I701e3d26e06a28fed2d4950b1d418eda80a1fac5
2013-07-24 11:50:26 +01:00
Roan Kattouw 393807462e Render check boxes from EditPage
EditPage has a lovely getCheckboxes() function which includes the
minor and watch checkboxes as rendered by MW core, as well as any
checkboxes extensions like FlaggedRevs might have added. Output
these in the API, render them, and send their values back.

ApiVisualEditor.php:
* Build a fake EditPage, get its checkboxes, and return them

ApiVisualEditorEdit.php:
* Pass through posted request data to ApiEdit, which passes it
  through to EditPage thanks to Idab5b524b0e3 in core

ve.init.mw.ViewPageTarget.js:
* Remove minor and watch checkboxes from the save dialog template
  and replace them with a generic checkbox container
* Have getSaveOptions() pull the state of all checkboxes in
** Special-case minor and watch, and pass the rest straight through
** Move normalization from true/false to presence/absence here, from
   ve.init.mw.Target.prototype.save(), because here we know which ones
   are checkboxes and we don't know that in save() without
   special-casing
* Remove getSaveDialogHtml(), we don't need to hide checkboxes based on
  rights anymore because in that case the API just won't send them to us.
** Moved logic for checking the watch checkbox down to where the same
   logic for the minor checkbox already is
* Unwrap getSaveDialogHtml() in setupSaveDialog()
* Access minor and watch by their new IDs throughout

ve.init.mw.Target.js:
* Get and store checkboxes from the API
* Pass all keys straight through to the API

Bug: 49699
Change-Id: I09d02a42b05146bc9b7080ab38338ae869bf15e3
2013-07-24 00:02:14 -07:00
jenkins-bot fd2fa931cb Merge "Hide contentSub completely" 2013-07-24 05:03:36 +00:00
Roan Kattouw 74e6b716a5 Hide contentSub completely
Previously it was faded out to 60%. contentSub contains FlaggedRevs
stuff we don't want around in the editor, and contains the revision
navigation when editing an oldid, which James decided also shouldn't
be visible when editing.

Change-Id: Icdef98f756ce92a32d276d6eeb22c9de04640d8b
2013-07-23 22:00:48 -07:00
jenkins-bot 71953d7ca6 Merge "Set target=_blank for links in the edit notices" 2013-07-24 04:49:55 +00:00
jenkins-bot 8b201c7dc4 Merge "Quickfix for Transclusion icon in RTL wikis" 2013-07-24 03:45:01 +00:00
Moriel Schottlender 5bb15c4332 Quickfix for Transclusion icon in RTL wikis
Added GUI-level and Page-level "getDir()" methods to get the direction
of the GUI and Page respectively in the ve.ui.Surface and ve.ce.Surface
respectively.

The correction to the direction-test condition in ve.ui.Context reflects
the new method of getting these directions, and fixes the problem with
the transclusion icon. The icon position depends on the wiki/page-level
directionality, regardless of the GUI-level direction.

Bug: 51819
Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
2013-07-23 20:31:08 -07:00
jenkins-bot 292981746c Merge "Add bold/italic for cyrillic/georgian languages" 2013-07-24 02:24:56 +00:00
jenkins-bot 8b493a7e02 Merge "Add bold/italic for more latin langages" 2013-07-24 02:23:38 +00:00
James D. Forrester 0536d22370 Create temporary preference to disable VisualEditor during beta
This preference will allow users to opt-out of VisualEditor during the beta
if they so choose. We do not re-use the alpha enablement flag because (a) this
would lead to a confusing preference description, and (b) because opting in
and then out of the alpha is not the same user choice as opting out of the
beta period.

Change-Id: I0f0a1b5eb21703ad422d007cab65c75ac1aa6fd8
2013-07-24 01:59:47 +00:00
Roan Kattouw 64442148bf Set target=_blank for links in the edit notices
Change-Id: I63bbf557fa94cda7435614ba7d743e22a148fdce
2013-07-23 18:19:45 -07:00
jenkins-bot 890c14009e Merge "Image insertion alignment fix" 2013-07-24 00:27:20 +00:00
Moriel Schottlender 96fa010f58 Image insertion alignment fix
This removes the initial alignment (either left or right) from new
inserted images, letting the wiki decide the default positioning.
Also, it makes sure that VisualEditor positions the image properly
(according to wiki defaults tright/tleft for ltr/rtl) when editing.

Bug: 51851
Change-Id: I25b966cf6f2736437509ea7e70bfda1bdbc79021
2013-07-23 20:22:43 -04:00
jenkins-bot 6ca420ab60 Merge "Prepend section title to edit summary" 2013-07-23 23:02:15 +00:00
jenkins-bot 598b975171 Merge "RTL Fix for Category & Suggestion Popups" 2013-07-23 22:44:56 +00: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
Ed Sanders 4e17496fa6 Prepend section title to edit summary
When section edit links are used.

Bug: 50872
Change-Id: I44cef7a892b4f2f22f60f8f7f531f4e9dcfe8363
2013-07-23 22:27:33 +00:00
jenkins-bot 6728b24f1c Merge "Add ve#graphemeSafeSubstring method" 2013-07-23 21:08:38 +00:00
jenkins-bot c6331c84d3 Merge "mw.ViewPageTarget.init: Move conditionals client-side" 2013-07-23 19:49:15 +00:00
jenkins-bot 2ceead1258 Merge "Ensure ve-ui-panelLayout-scrollable is actually scrollable" 2013-07-23 18:57:41 +00:00
Timo Tijhof a81beef27a mw.ViewPageTarget.init: Move conditionals client-side
Load the module always and have the conditionals on the
client-side so that we can change these without running into
problems with the new conditions not being rolled-out quickly
for anonymous users because the load queue is in the HTML
and cached for 30+ days.

This also allows us to fix above problem retroactively in wmf
production by just adding a mw.loader.load for this module
in something like MediaWiki:Common.js or something else that is
already in the cached load queue (temporarily, until the cache
has rolled over).

Removed unreachable code for loading ext.visualEditor.splitTest.

Change-Id: I21114960a88d224747447f2dc83d17d160f5f066
2013-07-23 20:25:37 +02:00
Ed Sanders c6c6a431d1 Add ve#graphemeSafeSubstring method
Allows us to take a substring without splitting a multibyte grapheme.

Change-Id: I811bdc7f010d10bf3c9509a73677939486751fec
2013-07-23 10:45:23 +01:00
MatmaRex e6fd823d6f ve.ce.Surface: Prevent focus loss on the document node in Opera
Opera triggers 'blur' on the document node when clicking on any <a>
link and never trigger 'focus' until after the user blurs the document
node *again* (by clicking outside of it or pressing 'Esc').

This causes the change polling to stop (SurfaceObserver#stop is called
without a subsequent call to SurfaceObserver#start).

To avoid this let's bind a delegated 'focus' event on all <a> links
inside the document and refocus it whenever that happens.

Bug: 47793
Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
2013-07-22 21:09:52 +02:00
jenkins-bot e57d8709cf Merge "Array.prototype.splice polyfill for Opera" 2013-07-22 18:40:01 +00:00
Ed Sanders e7d423dd53 Add bold/italic for cyrillic/georgian languages
ru, ky, os, ka now covered

Bug: 51711
Bug: 51712
Bug: 51713
Change-Id: I07987361f18719e96f5cb1b5a2b5eb8987fbf207
2013-07-21 18:32:47 +01:00
Ed Sanders 1b5d950904 Add bold/italic for more latin langages
es, eu, fr, gl, hu, it, nl, pt(-br) all covered now.

Bug: 51702
Bug: 51703
Bug: 51704
Bug: 51705
Bug: 51706
Bug: 51707
Bug: 51709
Bug: 51710
Change-Id: Ie75cc0941245dffabf64f09d649982ba48fae340
2013-07-21 14:09:19 +01:00
MatmaRex 47edc8d7d0 Ensure ve-ui-panelLayout-scrollable is actually scrollable
Due to CSS specificity rules the styles defined for
.ve-ui-panelLayout-scrollable and .ve-ui-panelLayout-padded in
ve.ui.Layout.css were being overriden by more general rules for
.ve-ui-pagedDialog-pagesPanel .ve-ui-panelLayout in ve.ui.Dialog.css.

Bug: 51739
Change-Id: If2d5ec3168a874eb4f856450583d6c89967513df
2013-07-20 13:21:05 +02:00
jenkins-bot 47fec91adb Merge "Set Malayam to use B/I rather than A/A for toolbar icons" 2013-07-19 20:27:28 +00:00
James D. Forrester 7c477d3021 Set Malayam to use B/I rather than A/A for toolbar icons
This is how it is configured in WikiEditor; presuming that this is not
incorrect. :-)

Bug: 51314
Change-Id: If285c14d8a798c57924af04c1dabfe6cf53e018b
2013-07-19 13:19:07 -07:00
jenkins-bot 21e47c5a33 Merge changes I2edc46b6,Iea905f2b,Ia572fd06,Id81da87b,I98a7d3eb
* changes:
  Add a node class for mw:Nowiki
  Move getHashObject() from dm.Node up into dm.Model
  Allow annotations to render nothing
  Pass child DOM elements to annotations' toDomElements()
  Process annotations bottom-up rather than top-down in data->DOM
2013-07-19 19:11:38 +00:00
jenkins-bot 97bb435a1c Merge "mw.ViewPageTarget.init: Expose support.visualEditor" 2013-07-19 18:52:12 +00:00
jenkins-bot 41ff03c98a Merge "Math Node UI (Bug Fix)" 2013-07-19 17:14:58 +00:00
jiabao 8eadcb0a26 Math Node UI (Bug Fix)
Fixed two bugs found after merging:

1. Opened the Math node inspector without editing
anything, then clicked somewhere else on the page,
it crashed.

2. Similarly, opened the Math node inspector
without editing anything, then clicked the
"Cancel" button to cancel the edit, it crashed.

Both of these problems are fixed by this patch.
The issue was with using the getFocusedNode() in
the inspector onClose function to save changes.

Also, I included some minor changes relating to
the last code review. =D

Change-Id: I6e200f2a228b71dc5af5aa9843c461f43b926f8d
2013-07-20 01:42:08 +10:00
Timo Tijhof 61a1e8c738 mw.ViewPageTarget.init: Expose support.visualEditor
Refactor a few things to make it easier for scripts to see
not just whether mw.libs.ve is present but also whether it
allows the user to activate VisualEditor.

Change-Id: I50da8d9a260207d4ec1c43254dfe738f91386a9e
2013-07-19 03:56:25 +02:00
jenkins-bot 0edd857dfd Merge "De-alienate <code>foo</code> blocks (code element)" 2013-07-19 00:51:19 +00:00
James D. Forrester 79aff53400 De-alienate <code>foo</code> blocks (code element)
Adding the <code> element as a matched text style annotation, plus some
tests (for all the other un-tested text styles as well, whilst I'm at
it).

We'll need an icon, a button and a way of the buttons not forever
extending the length of the toolbar to properly edit <code> spans, but
this is a start.

Bonus: unit test coverage for all TextStyleAnnotations

Bug: 51590
Change-Id: I5438bcf2ec6eeb2e50400f8013964f91c33ce455
2013-07-19 00:48:46 +00:00
James D. Forrester 8c88e84be3 Maths icon for inspector menu as well as inspector itself
As not done by 992cb43de5 (whoops).

Change-Id: I29e9452e8bc85ec256f46ddfa4f5000f5fcd2ba4
2013-07-18 17:28:39 -07:00
jenkins-bot 13f2450e18 Merge "Now we have a maths icon, let's use it" 2013-07-18 23:21:35 +00:00
James D. Forrester 992cb43de5 Now we have a maths icon, let's use it
Change-Id: I057f74975c0cb61bee54733fd4153ab0f75416d5
2013-07-18 15:48:21 -07:00
jenkins-bot a2ea33fb95 Merge "Handle backspace correctly when in a slugs" 2013-07-18 22:20:05 +00:00
jenkins-bot f37e0c7359 Merge "Use ve.ui.SurfaceWidget for image captions" 2013-07-18 21:41:18 +00:00
jenkins-bot 9feb71ff4b Merge "Reference dialog commingling" 2013-07-18 21:39:20 +00:00
Trevor Parscal dc606823e2 Use ve.ui.SurfaceWidget for image captions
Objectives:

* Make use of the new ve.ui.SurfaceWidget.js for image caption editing

Changes:

ve.ui.MWDialog.css
* Remove styles that are no longer needed
** -body class isn't needed if you contain the content in a layout and
   configure it to be padded
** Toolbar styles are now part of surface widget

ve.ui.MWMediaEditDialog.js
* Wrap caption fieldset in an editPanel (also nice because we may merge
  this dialog with MediaInsert and use a stack panel layout in the future
* Replace surface and toolbar with surface widget which manages both

Change-Id: I1b7e0e2ec1cfa30879360a7ebde2b0f35d26aca5
2013-07-18 21:35:22 +00: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
jenkins-bot af16cbab52 Merge "Math(s) icon" 2013-07-18 19:01:00 +00:00
Ed Sanders 9c8409a987 Math(s) icon
Change-Id: Iaf5766d2d7751fdaf34161276b7ecf4f73456d91
2013-07-18 11:58:58 -07:00
jenkins-bot 565cb99e23 Merge "Update static loaders" 2013-07-18 16:40:10 +00:00
jenkins-bot 458c8757db Merge "Fix ordering of store items in converter tests" 2013-07-18 16:38:55 +00:00
Ed Sanders c414147b5a Handle backspace correctly when in a slugs
We need to detect if the endNode we are trying to move is
inside our original delete selection, and not perform the
move if it is.

Bug: 50076
Change-Id: Ib89706c8717d13829bf89e44c4fb39e16a00821e
2013-07-18 12:33:42 +01:00
Timo Tijhof 1c97668377 Update static loaders
Ran makeStaticLoader.php:
- Synced mis-match of css in demos.
- Added missing experimental.
  We originally had experimental in static. They were removed
  because the section became empty (not because we no longer
  wanted them in static loader). If we don't want them here, we
  should remove the entry from makeStaticLoader.php.

Change-Id: I275133d1cfebf174e54bf1b8f44465495949991a
2013-07-18 04:19:42 +02:00
Trevor Parscal 51ecf6d096 Fix for scrollable panels
Fixes mistake made in I50e996b9d2fde361238cde75e09baa5872e12223 which made scrollable panels not be, well scrollable.

Change-Id: I0ec59a1b76acf047b1a4d6de426a0ddb554a3e42
2013-07-17 17:17:01 -07:00
Trevor Parscal ef262dc241 Add padded option to layouts
Objectives:

* Add option to layouts to control whether it's padded or not
* Rename "scroll" option to "scrollable" to better fit with it's boolean value

Changes:

ve.ui.Layout.css
* Add styles for scrollable and padded options

ve.ui.StackPanelLayout.js, ve.ui.PagedDialog.js, ve.ui.ReferenceListDialog.js
* Update use of scroll option

ve.ui.PanelLayout.js
* Add padded option
* Rename scroll option to scrollable
* Switch to using a class for scrollable option, rather than hardcoding CSS properties

Change-Id: I50e996b9d2fde361238cde75e09baa5872e12223
2013-07-17 19:10:44 +00:00
Trevor Parscal 3da34d7107 Fix getAnnotationIndexesFromOffset for last offset in doc
If the element is undefined, it would stand to reason that there are no annotations there.

Just sayin'.

Change-Id: I2b66e7adc2b3af19df1a3f490ab479627807636e
2013-07-17 19:10:38 +00:00
Timo Tijhof 553102644f mw.ViewPageTarget: Show AbuseFilter warning in save dialog
Misc:
* Updated signature of #showMessage to include allowing
  an array of nodes to be passed. We pass this to jQuery#append
  so we're just extending the explicitly documented subset of
  things it could already do due to passing to jQuery#append.

Bug: 50472
Change-Id: I3f56820a4f14b0684bfa265e3eb5e3820f2a3513
2013-07-17 17:20:29 +00:00
Roan Kattouw 7294c65a2e Add a node class for mw:Nowiki
These represent <nowiki> tags. If the user doesn't edit the text inside
the nowiki, we round-trip the <span typeof="mw:Nowiki"> wrapper cleanly,
but if they do edit it, we unwrap it. This then triggers re-escaping
in Parsoid, and prevents cases where the user edits the text to no
longer need escaping but Parsoid still wraps it in <nowiki> because
of the <span typeof="mw:Nowiki"> wrapper.

In order to detect whether the contents have changed, the nowiki
annotation stores a copy of its contents. To avoid infinite recursion,
we have to exclude this attribute for hash generation.

Bug: 47678
Change-Id: I2edc46b6d87d2f91e952efcb09c0edae5166958f
2013-07-16 19:35:24 -07:00
Roan Kattouw 779099e660 Fix ordering of store items in converter tests
In the DomFromData tests, we put the provided storeItems in the store
first, then run preprocessAnnotations (which puts annotations in the
store). However, in DataFromDom we ran preprocessAnnotations first
(which puts annotations in the store), then ran getDataFromDom (which
is expected to put the asserted store items in the store). Because the
order was reversed between these two tests, it was impossible to write
a test for an annotation whose toDataElement function adds to the store.

Fix this by reordering the operations in the DataFromDom test, doing the
conversion first and only then running preprocessAnnotations on the
expected data. This preprocessAnnotations call will not write to the store
if the test passes, because all annotations in the expected data should
already have been put in the store by the conversion.

Change-Id: I8f741d96fe12590fd711542794570fb95b1132d0
2013-07-16 19:06:48 -07:00
Roan Kattouw 4098e47b8b Move getHashObject() from dm.Node up into dm.Model
This way annotations inherit it too.

Also add htmlAttributes to the hash, and implement getComparableObject()
in terms of getHashObject().

Change-Id: Iea905f2b430f8e51c6026065be17b89b9a03cfab
2013-07-16 19:04:53 -07:00
Eloquence c5de7696a7 Make beta notice more informative and increase CSS width.
Point out that the software may have issues, and point users to the "Edit source"
link explicitly.

Change-Id: Id84d76887038a3a6a9e11a203f19dc3db7703e6a
2013-07-16 18:49:39 -07:00
jenkins-bot ee5c90f8b0 Merge changes Icdc2730e,I9e4264a7
* changes:
  mw.ViewPageTarget: Add support for spam blacklist
  mw.ViewPageTarget: Swap captcha and badtoken logic in onSaveError
2013-07-16 22:52:06 +00:00
jenkins-bot 3675ca4cc8 Merge "Create MWResizeableNode mixin to control defaultSize flag" 2013-07-16 22:51:24 +00:00
Timo Tijhof fd0f4ff5cf Run UnicodeJS tests from Special:JavaScriptTest/qunit
Previously they were only run from the dedicated standalone test
which meant they weren't being run from Jenkins.

Change-Id: If22456f0031c68b0c1e7621b35b1e79c0664da15
2013-07-17 00:45:11 +02:00
Ed Sanders 56ef8cb5b5 Create MWResizeableNode mixin to control defaultSize flag
Previously wasn't being updated to 'false' after a width/height
attribute change.

Bug: 50645
Change-Id: Id5dcd6998e0125757238426f8052505d131d712d
2013-07-16 23:13:40 +01:00
Roan Kattouw 46c5192477 Allow annotations to render nothing
This effectively unwraps the annotation. Annotations can do this by
returning an empty array from their toDomElements() function.

Right now this is only supported for annotations, but once the converter
is rewritten to be entirely bottom-up, this is trivial to support for
other model types, and could even be used to implement unwrapping of
wrapper paragraph.

Change-Id: Ia572fd0610afccccfe795c257c0de9d003330f13
2013-07-16 15:09:08 -07:00
Roan Kattouw 2942fa8fa0 Pass child DOM elements to annotations' toDomElements()
This is special-cased for annotations but should be supported for
all model types once the converter is rewritten to be bottom-up
entirely.

Add a toDomElements() stub to ve.dm.Annotation overriding the stub
in ve.dm.Model so there's a place for the new parameter to be documented.

Change-Id: Id81da87b8b83d556a3618cc6187b22443a1e37e6
2013-07-16 15:09:08 -07:00
Roan Kattouw 15a7822df1 Process annotations bottom-up rather than top-down in data->DOM
This means that instead of creating a DOM element for an annotation,
then appending stuff to that DOM element, we queue up the things to
append and only create the DOM element after we've built everything
that's going to be in it.

Most significantly, this moves the toDomElements() call to the close
function, which paves the way for passing in the annotation's contents.

Change-Id: I98a7d3ebb0f3eb8627c22348b48596906db2646e
2013-07-16 15:09:05 -07:00
Timo Tijhof 16831b16d1 mw.ViewPageTarget: Add support for spam blacklist
Bug: 50826
Change-Id: Icdc2730e5fc644c9030a6648702e071934f5ad62
2013-07-16 23:39:27 +02:00
Ed Sanders bdbae42b3e Fake superscript style for references generated as spans
This is a hack because Parsoid should just generate <sup>s.

Bug: 50978
Change-Id: I0c418b4f70640b8212d4a58a6f33a0821f7338c4
2013-07-16 16:41:16 +00:00
Timo Tijhof bc7836d1ab mw.ViewPageTarget: Swap captcha and badtoken logic in onSaveError
This way if both are the case, the user (or VE, if possible)
will deal with badtoken first instead of potentially having to
solve the captcha twice (as each handling of the error does - and
should - end with an early return).

Change-Id: I9e4264a7001ffa9654bfab02cc955aa36ff5b6aa
2013-07-16 16:02:27 +02:00
Roan Kattouw ce3014c768 Remove superfluous clear() when pawning
We already call clear() 4 other times in this code path, including
one right at the end of change(), which is called right before this
clear() call.

Change-Id: I6d5ba5075e1b24a981546243977c6a8501748c5f
2013-07-16 00:37:51 +00:00
jenkins-bot a4558108b8 Merge "Adjust padding for surfaces inside dialogs" 2013-07-16 00:37:22 +00:00
jenkins-bot c4b05b893d Merge "Use template icon on template placeholder pages" 2013-07-16 00:35:08 +00:00
jenkins-bot 55493f7f9e Merge "Reset context menu on selection change while inspector is open" 2013-07-16 00:34:16 +00:00
Roan Kattouw f9864e9288 Continue links
This isn't as simple as just dropping applyToAppendedContent = false
on LinkAnnotation, because browsers differ in their continuation
behavior. Firefox continues links, but Chrome doesn't.

To work around this, add a property indicating that the annotation
needs its continuation behavior to be forced.

Rename areAnnotationsCorrect() to needsPawn() accordingly.

Bug: 49931
Change-Id: Id6424af89c92bba2be87736e8a937e0f2067c007
2013-07-16 00:29:55 +00:00
jenkins-bot 0ffc4d15ca Merge "Remove field set label on reference edit dialog" 2013-07-15 23:56:16 +00:00
jenkins-bot 78d58e637c Merge "Make the clear button clear insertion annotations too" 2013-07-15 23:54:45 +00:00
Trevor Parscal 0ba331afdc Reset context menu on selection change while inspector is open
Objective:

* Make the inspector close and context menu reset when the selection is
  changed while an inspector is open

Changes:

ve.ui.PopupWidget.js
* Add isVisible method

ve.ui.Context.js
* Check if popup is visible when the selection changes and close the
  inspector and reset the context if it is

ve.ui.AnnotationInspector.js
* Don't update the selection when closing if the selection has changed
  since opening

Bug: 50895
Change-Id: Ie7f0b7ac76b0460b39ec002705172376e4e602dc
2013-07-15 23:51:40 +00:00
Roan Kattouw fd6238d62f Make the clear button clear insertion annotations too
There previously was no way to clear them other than to manually
unset each one.

Change-Id: I553d224595e424cb8a743ea70031503d1fe00b6a
2013-07-15 16:48:08 -07:00
Trevor Parscal 09f920fcac Remove field set label on reference edit dialog
Objective:

* Allow fieldsets to not have labels
* Remove label from reference edit dialog field set

Changes:

ve.ui.Layout.css
* Only apply negative top margin if fieldset label is being used

ve.ui.FieldsetLayout.js
* Only add label element to DOM if icon or label are used

ve.ui.MWReferenceEditDialog.js
* Remove label from reference edit dialog's first fieldset

*.php
* Remove unused message

Change-Id: I4a36e819ec6ef73aad80d3fb2f06000cb35ec109
2013-07-15 23:44:07 +00: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
Ed Sanders 267ccf9040 Compare annotations by name only when clearing/toggling
Otherwise links don't get removed as an empty link is not
comparable to a real link with an href.

Bug: 50461
Change-Id: Id8b421bd44cd5c427d0e5cd738c380bc2b1ea719
2013-07-16 00:05:11 +01:00
Trevor Parscal 64548428ca Adjust padding for surfaces inside dialogs
Objective:

* Make horizontal and vertical padding of surfaces inside dialogs equal

Change-Id: I8672a4506cdbda59795b12236526b048aaadfa58
2013-07-15 15:44:46 -07:00
Trevor Parscal c7a5546bb2 Use template icon on template placeholder pages
As opposed to using a parameter icon - which just doesn't make sense.

Change-Id: Idbe42a1b91a0691d1cf83dde4221ce3aac09d0fa
2013-07-15 15:43:39 -07:00
Timo Tijhof 43bce96fae mw.ViewPageTarget: Surface error messages from core edit api
Previously we only looked at error info/code from the root of
the API response, not the ones from the root of the response
that action=visualeditoredit forwards from action=edit.

This changes the message for e.g. AbuseFilter from:

 > Error: Invalid error code

to:

 > Error: Hit AbuseFilter: [name of triggered filter]

Also changed default error for other reasons (e.g. hooks of other
extensions that we don't yet have specific support for) to "Unknown error"
instead of "Invalid error code".

Bug: 50472
Change-Id: I3b32eddafd8fff83f323606f9922ac60b5d3b58e
2013-07-15 22:22:55 +00:00
jenkins-bot 4854b00770 Merge "Replace text strings with grapheme arrays in onContentChange" 2013-07-15 22:10:20 +00:00
Ed Sanders 4af4f7928d Replace text strings with grapheme arrays in onContentChange
Was previously generating incorrect transactions when document
contained multibyte characters.

Bug: 51140
Change-Id: Ie5f749768f970b2aef09e667f844d2ef5961207b
2013-07-15 22:57:40 +01:00
jenkins-bot fde142ae86 Merge "Set bold/italics icons for cs/he/pl; da/no/nn/sv" 2013-07-15 19:58:46 +00:00
Timo Tijhof 45c79f8c23 mw.ViewPageTarget: Refetch token if session expired
* Rephrased visualeditor-savedialog-error-badtoken to emphasise
  that it is the old session that become invalid, not the one
  the user started browsing with since in a different window.
* If the session changed, the user will be asked whether they
  agree to save with this new session instead.
* We explictly update mw.config so that future save attempts
  in the same window compare against the correct environment.
  Without this there are two problems when saving and then
  making a second edit in the same window and saving that:
  - It will bring up the same question again (user A -> user B),
    which is annoying.
  - If the user logged back in again (new session, but for
    user A again) it would silently try with that new token
    without asking, thus saving as user A when the user still
    thinks it switched to user B. It switching back automatically
    is not obvious since we asked them from A->B, so we should
    also ask the other way around.
  This can be reproduced by opending ve-edit logged-in, then
  logging out in a new window, save, confirm anon, save,
  open edit again, log back in in a new window, save open edit
  in the old window, confirm new logged-in, save.

Bug: 50424
Change-Id: Id055eca1886f85aeaf615f645de29898afc0373c
2013-07-15 21:40:18 +02:00
James D. Forrester 9b1bc14779 Set bold/italics icons for cs/he/pl; da/no/nn/sv
Per bug 51330, cs (Czech), he (Hebrew) and pl (Polish) should use the same icons
as English (B for bold, I for italics), rather than the generic As; da (Danish),
no (Norwegian Bokmål), nn (Norwegian Nynorsk) and sv (Swedish) should use those
that German (F for bold, K for italics).

Bug: 51330
Change-Id: I1d5937bed658d45ba6a18d8eb77e9e20d55a16cc
2013-07-15 12:29:04 -07:00
jenkins-bot 5a5fb6030d Merge "Extend empty document check to check for meta-only data" 2013-07-15 16:18:50 +00:00
jenkins-bot bc1f499e72 Merge "Move common linear data methods into LinearData.static" 2013-07-15 16:10:28 +00:00
jenkins-bot cc391e1643 Merge "Actually use op.retainMetadata in structural replace mode" 2013-07-15 11:45:13 +00:00
Ed Sanders aaf4f5b134 Extend empty document check to check for meta-only data
An empty document is one which contains no 'real' data, so
we should check for meta-only documents when deciding whether
to add in a wrapper paragraph.

Bug: 50289
Change-Id: Ib3ebf0717aa0c6c51fd1d0b14e95de50b2842647
2013-07-15 12:12:00 +01:00
Ed Sanders 784ebc16e3 Move common linear data methods into LinearData.static
Some methods apply to all types of LinearData. Also moved to
static so they can be used by the converter on raw data.

Change-Id: I79066d6d3ccde48aea7c0848d56ef86bc70f6656
2013-07-15 11:29:54 +01:00
jenkins-bot 9379483a5f Merge "Warn users when they are typing wikitext" 2013-07-15 02:30:44 +00:00
Ed Sanders abf3671723 Warn users when they are typing wikitext
Without making the code much more complex (and possibly create
performance issues) the warning will fire on pages which already
contain escaped wikitext (when that text is edited). I think this
should be a small enough minority that it won't be an major annoyance.

Bug: 49820
Change-Id: I0f67ec04b890f4add9247be6126bdc086b6ae72f
2013-07-14 19:27:32 -07:00
Ed Sanders f2b4998faf HACK: Don't merge adjacent annotations from Parsoid
Adjacent annotations should not be merged if they both
originate from Parsoid. This is a hack because this logic
should be in Parsoid, not VE.

Bug: 49873
Change-Id: If1e23e3039178300d72b1c0c585931417bb603b5
2013-07-14 18:36:33 -07:00
Roan Kattouw bab7689feb Actually use op.retainMetadata in structural replace mode
It was being used correctly in the textual replace case, but it was
omitted in the structural replace case. This caused rare, insidious
metadata placement bugs that I haven't been able to reproduce outside
of newFromDocumentInsertion testing, but this might explain some of
the odd category bugs that have been reported.

Change-Id: I1424e482303853f285e4516a93c9609076648eff
2013-07-12 15:57:26 -07:00
jenkins-bot 4c85442047 Merge "Fix uses of addPart to make them async friendly" 2013-07-12 21:19:55 +00:00
jenkins-bot e65baa886f Merge "Make link inspector re-usable by splitting it up" 2013-07-12 21:17:49 +00:00
jenkins-bot 587079401e Merge "Fix annotated element alien metadata inside wrapped paragraph" 2013-07-12 20:48:58 +00:00
Ed Sanders d2778b1df4 Fix annotated element alien metadata inside wrapped paragraph
Add check that we can close the wrapper to meta items, also
annotate them correctly.

Bug: 51235
Change-Id: Idd4a2304f588ea74b9a9814ce86c1fd0c026e441
2013-07-12 20:13:15 +01:00
Trevor Parscal a4491c12f8 Make link inspector re-usable by splitting it up
Objective:

* Make the majority of link inspector, which is generic to any annotation,
  usable for other annotation inspectors

This was merged earlier (f7107fa20d) but broke master, so it was
reverted (092fa74dee). This commit also incorporates 5dcf5d1c49.

Change-Id: Ib9190dee66ce064d69962f9c4c5b3a710be8ad07
2013-07-12 17:58:04 +00:00
jenkins-bot 0926fd0656 Merge "Optimise png images with optipng" 2013-07-12 17:34:39 +00:00
Trevor Parscal d3df2a5a91 Fix uses of addPart to make them async friendly
Problem:

Adding or moving templates or content resulted in the incorrect item
being selected.

Diagnosis:

Although recently we solved a few issues by making addPart async, it
caused some other issues where callers of addPart were assuming
otherwise

Solution:

Return a promise from addPart which is resolved after the part is
actually added and setup callers to use the promise when needed

Changes:

ve.ui.MWTransclusionDialog.js
* Use promises to auto-select new or moved parts

ve.dm.MWTranclusionModel.js
* Make addPart return a promise
* Resolve promise when queue is processed
* Automatically remove existing items before adding them in different
  locations at the time of processing the queue we don't yield between
  removing and adding

Change-Id: Ie43c5b89ca4ed34d5f797714e19c9a7e1824cdec
2013-07-12 01:30:04 +00:00
Trevor Parscal b3b2d3fb91 Preserve unused Parsoid template properties
Problem:

Parsoid has a property called "i" which we don't use, but they need for
round-tripping purposes. Since we were generating a structure from
Parsoid data and then generating data from the structure without
preserving properties we didn't use, it was getting lost.

Solution:

Abstract creating a template from data vs. creating it from name. Make
only templates have an origin argument in their constructors, so and
set it within a set of static constructors that create a template for
either data or a template name. Store the original data in the former
case, and use it as a base when serializing.

Changes:

ve.ui.MWTranslcusionDialog.js
* Remove no-longer-needed mw global declaration
* Move most of the addTemplate function to a static constructor in the
  template model class

ve.dm.MWTransclusionPartModel.js,
ve.dm.MWTransclusionContentModel.js,
ve.dm.MWTemplatePlaceholder
* Remove unused origin argument/property/getter
* Add serialize method (if needed)

ve.dm.MWTranclusionModel.js
* Move template/parameter generation from data into static constructor
  of template model
* Move serialization to part classes

ve.dm.MWTemplateModel.js
* Add mw global declaration
* Stop passing origin to parent constructor, store it locally instead
* Add original data property/setter for preserving unused properties
  when round tripping
* Add static constructors for generating a template from data or by name
* Add serialize method

Bug: 51150
Change-Id: Ide596a0ca0ae8f93ffce6e79b7234a1db7e0586c
2013-07-12 00:47:01 +00:00
Timo Tijhof c292e326e8 mw.ViewPageTarget: Improve error message for badtoken error
Previously all it did was surface api response error.info,
which surfaced underneath the edit summary form as mere:
"Error: Invalid token".

Bug: 50424
Change-Id: I60169b42701ae3b88e54626c4ff7050549e6ef55
2013-07-11 16:20:26 -07:00
jenkins-bot 87f48b1d44 Merge "api: Split save action into separate API module" 2013-07-11 23:11:22 +00:00
jenkins-bot 91be52402c Merge "Adjust toolbar group margins for equal vertical alignment" 2013-07-11 22:46:04 +00:00
jenkins-bot 33e653aa7e Merge "Don't change edited transclusion nodes to <span>s" 2013-07-11 22:44:14 +00:00
Timo Tijhof 46f40dc696 api: Split save action into separate API module
This allows us to make the token no longer a requirement
for non-save actions while still using the built-in system
for token verification.

Update documentation for "oldid" since it is not required even
outside (paction=save). In fact, if we require it VE loading
fails because it doesn't pass oldid unless it has to when
restoring a specific version.

Bug: 50424
Change-Id: I7b1b50a43648b1cc40a984340846efdb0ba2ecc9
2013-07-11 15:37:23 -07:00
Matthew Flaschen 8f63a5e38e Bump gender survey width to 475.
Change-Id: I37336f1d8f962e31d6a241106384c542879f6e67
2013-07-11 18:06:04 -04:00
jenkins-bot 8ad91a7255 Merge "Normalize image titles in cache to prevent duplicates." 2013-07-11 21:37:36 +00:00
Rob Moen 25b937c496 Adjust toolbar group margins for equal vertical alignment
Change-Id: I4596e50c941b1cb628f2ccba983d4b60b7939174
2013-07-11 11:22:45 -07: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
jenkins-bot 20da0c23a8 Merge "Auto-add required params for user added templates" 2013-07-11 16:33:52 +00:00
jenkins-bot e317792028 Merge "Tighten up outlines and fieldsets" 2013-07-11 16:32:27 +00: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
Trevor Parscal 1c637008e5 Tighten up outlines and fieldsets
Objective:

* Make outline widgets and fieldset layouts take up a little less space

Bonus:

* Fix option icons always showing up on the first item because the option
  wasn't position relative

Changes:

ve.ui.Widget.css
* Add position: relative to option widgets
* Cleanup unused background properties for outline items
* Reduce padding for outline items
* Move icons to match padding changes

ve.ui.Layout.css
* Reduce margins for fieldset layouts, including using a negative top
  margin to compensate for the overly tall legend

Change-Id: Ida6147b8171dcb4152ca9be0e099a5f9b81ac1c0
2013-07-11 16:22:38 +00:00
Ed Sanders 176025e5fd Prevent escaping of piped links in wikitext parameters
Also in this commit is a fix to the regex for brackets in general
as previously it was grouping multiple pairs together which was
making the stack count incorrect.

Bug: 50801
Change-Id: I2cd825eaa7242e37a6317286cb8f9a4a78e693e2
2013-07-11 16:20:39 +01:00
Roan Kattouw 8a8c2ae6bd Actually run all the tests
Some of the ones that were moved to ve-mw disappeared from index.php
(the MW-only test runner) and/or VisualEditor.hooks.php (the runner for
Special:JavaScriptTest that's also used by Jenkins).

Add the missing tests, and rename the SurfaceFragment test. We can't
add the ViewPageTarget test to the index.php file in ve-mw because
it only works when running inside an actual MediaWiki instance.

Change-Id: Iec34f2029f5f9c34855b4d79ef70db5751461a96
2013-07-10 19:36:55 -07:00
Roan Kattouw a16e3fd244 Don't change edited transclusion nodes to <span>s
This is harmful because we don't know whether <span> is acceptable
in context. They're not allowed in <tbody> for instance, and so if
we replace a <tr> with a <span> that breaks things.

Instead, use the nodeName of the first original DOM element.

Change-Id: I95ea9f13985767123f692706c6cc71fefd74d517
2013-07-10 19:11:07 -07:00
jenkins-bot ca15571b2f Merge "Reuse the rules variable" 2013-07-11 00:23:00 +00:00
Roan Kattouw 7345e63961 Reuse the rules variable
Change-Id: I8ce666dad712a99e471930132e3d123dfcf5466d
2013-07-10 17:21:07 -07:00
jenkins-bot bc6a4ee8e1 Merge "Work around Firefox's excessive style security paranoia" 2013-07-11 00:20:21 +00:00
Roan Kattouw 9938186cab Work around Firefox's excessive style security paranoia
Apparently it's possible for a stylesheet's .cssRules to be accessible,
but for the individual items' .cssText not to be, in which case Firefox
throws a nice security exception that kills the entire editor.

Wrap all inspector of cssRules in a try-catch, and fall back to cloning
the ownerNode if anything weird happens.

Change-Id: I0187ad308e395e92aea587c00fd8d8eb0280822e
2013-07-10 17:16:00 -07:00
jenkins-bot 6b61c53909 Merge "jquery.client: Update to upstream from 92f06b4a in mediawiki/core.git" 2013-07-10 23:07:36 +00:00
jenkins-bot fa37670c0b Merge "Hide ref errors inside MW transclusions" 2013-07-10 23:05:10 +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
Ed Sanders 796ee5258a Hide ref errors inside MW transclusions
Bug: 50423
Change-Id: I661493ab2ff2d1ddb5d1a8266ceeb4f155075150
2013-07-10 23:32:30 +02:00
Timo Tijhof 3c2d151d76 jquery.client: Update to upstream from 92f06b4a in mediawiki/core.git
Change-Id: Ica5079f45a4dd1bd24847829a338e54ffc731bda
2013-07-10 23:23:11 +02:00
jenkins-bot ac6c10dad7 Merge "Bind listener to keyup to capture arrows & better math for scrolling." 2013-07-10 21:22:58 +00:00
Rob Moen 31104d5788 Bind listener to keyup to capture arrows & better math for scrolling.
Listen to keyup to properly capture and respond to up and down arrows.
Rewrite calculation for scroll to better follow toolbar obscured cursor.

Bug: 48787
Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa
2013-07-10 14:21:03 -07:00
jenkins-bot 877463e712 Merge "Add hooks and classes, initially to support GuidedTour" 2013-07-10 19:32:32 +00:00
jenkins-bot 691d9fe462 Merge "Language Inspector: CE / DM" 2013-07-10 19:13:40 +00:00
Moriel Schottlender fdcec169d1 Language Inspector: CE / DM
This is the infrastructure for the Language Inspector prototype, defining
the dm and ce pieces of the <span lang='xx' dir='yy'> annotations. It also
sets up a visual indicator for language blocks (with informational tooltip
for the user while editing. The UI is built on top of this.

Bug: 47759
Change-Id: I239eef5124e29369ea9c5d8c0f49b2f6a61bc053
2013-07-10 12:11:27 -07:00
jenkins-bot c404079f61 Merge "Focus link inspector input prior to lookup." 2013-07-10 19:03:38 +00:00
Rob Moen ef36b753da Focus link inspector input prior to lookup.
Since the menu only shows while it's input is focused, input must be focused
prior to suggestions being popuplated.  Fixes race condition where
look up request is near instantaneous.

Change-Id: Icf645d051415ac3ee9e15bc85f22f29dc9b64666
2013-07-10 10:22:20 -07:00
Timo Tijhof a7e8c9d660 mw.ViewPageTarget.init: Document use of mw.libs.ve to test presence
The presence check used to be against the VE global, but we
recently made that impossible without providing an alternative.

Though by accident, mw.libs.ve has become the new way to check
for presence.

Change-Id: If85695525777a71dde467675052d2ede4e52c9b7
2013-07-10 15:55:17 +02:00
Matthew Flaschen 7f094ee607 Add hooks and classes, initially to support GuidedTour
* Hooks for activation, deactivation, save dialog state change,
  and tab setup.
* Class for save button (needed to point to it in a clean way).
  Also done for cancel button to be consistent, though GuidedTour
  doesn't currently use this.

Change-Id: I4a0e0631d513fb09c3408f2f36a0de0bd51e1a37
2013-07-10 00:05:05 -04:00
jenkins-bot f8184ebeb9 Merge "Lock surface while inspectors are animating open" 2013-07-10 01:54:05 +00:00
jenkins-bot 5f24fe3d40 Merge "jquery.client: Update to upstream from ce3e67e1 in mediawiki/core.git" 2013-07-10 01:44:13 +00:00
jenkins-bot 06faf92a12 Merge "Make parameter search widget have a horizontal limit" 2013-07-10 01:42:44 +00:00
jenkins-bot 15f2ff6f20 Merge "Tool and context menu size and alignment fixes" 2013-07-10 01:37:34 +00:00
Timo Tijhof c903a087bd jquery.client: Update to upstream from ce3e67e1 in mediawiki/core.git
Change-Id: I5b21a2a48ba3fde53370758bac7f1b8a65c4c04f
2013-07-10 01:36:54 +00:00
Trevor Parscal 703328d770 Make parameter search widget have a horizontal limit
Objective:

* Cut off really long parameter names with ellipsis

Changes:

ve.ui.Widget.css
* Use ellipsis when option labels get too long

ve-mw/ve.ui.Widget.css
* Limit the size of a parameter result widget label - this is a hack, but
  since there are strange bugs with using ellipsis together with % based
  width, it's the best we can do for now

Bug: 50800
Change-Id: Idbfa336d2bba376b0d078fdd0ece65926d610d81
2013-07-10 01:35:38 +00:00
jenkins-bot 9d5ba2bf78 Merge "Remove dead CSS code" 2013-07-10 01:35:30 +00:00
jenkins-bot 164094ee6c Merge "RTL Improvements" 2013-07-10 01:34:06 +00:00
Trevor Parscal 9297f33989 Tool and context menu size and alignment fixes
Objectives:

* Make context menu toolbar consistently sized and aligned, especially
  in monobook

Changes:

ve.ui.Toolbar.css
* Remove vertical line between groups, just use whitespace
* Switch from padding to margins to avoid size calculation issues

ve.ui.Tool.css
* Remove tiny margin on button tools, tightening them up a bit
* Replace 50% 50% with center center

ve.ui.Context.css
* Switch from padding to margins to avoid size calculation issues
* Use different margins depending on text direction
* Reverse the 0.8em rule used in the dialog - this is a hack, it should
  be cleanup up later with a better strategy for normalizing the size
  of text within VE elements

Change-Id: If65f12382625efa33777e284bd23a94dc509436a
2013-07-10 01:33:37 +00:00