Commit graph

1107 commits

Author SHA1 Message Date
Ed Sanders f9d7129465 Prevent link-annotating MWReferences
As it isn't sensible wikitext.

Bug: 56250
Change-Id: I7ec03f87ad69645c2877ee7a399950f3967a1362
2013-11-19 10:58:20 +00:00
Timo Tijhof 8f9d184758 doc: Fix existing violations detected by JSDuck 5
* Fix invalid @param name (mixup of type and param name).
* Fix incorrect reliance on inferred name for ve.Range.
  @class uses the below function to guess its name, however
  if @property is encountered, the @class block ends. Thus
  it was indexed as a nameless class.
* Separate @property definitions because combining them like
  that doesn't work (it silently ignored everything after the
  first "from" property).

Also:
* Add some missing @static to static methods in ve.Range.
* Remove a few redundant @method while at it.

Change-Id: I8357c30711a4830af0b68b18350352c457a607f3
2013-11-19 16:10:25 +05:30
jenkins-bot f0982adf3b Merge "doc: Get rid of 'static' property container in jsduck index" 2013-11-19 10:28:23 +00:00
Timo Tijhof 4854d644ee doc: Get rid of 'static' property container in jsduck index
Us grouping the inheritable static properties that way is an
implementation detail that is polluting the index and makes
it harder to refer to individual identifiers.

It also causes problems under JSDuck 5 because that version is
more strict about defining properties (Foo.static.bar) of which
the parent is not defined in the index (Foo.static), we'd have
to add a sea of `@static @property {Object} this.static` all
over the place. Might as well hide this implementation detail
and just consider them static properties (just like we already
do for "private" properties).

Change-Id: Ibf2ebf7752aabc2b75b6ac6fa00e2284a181a600
2013-11-19 10:21:39 +00:00
Jeff Hall 583936f82f [Browser test] Add Review Changes workflow per reviewer comment
Change-Id: I50d0defb3c4f51f317a497d0f805859e961b8f7f
2013-11-19 10:28:26 +01:00
Roan Kattouw ef5f3ec054 Combine all the saveError.* track events
Instead just use saveError, and indicate the type of error in the data.

Change-Id: Ibc33b108c1f8f3aa0841ab7f0886a35d99525195
2013-11-19 11:02:52 +05:30
James D. Forrester 74332f7a21 Only replace meta-data from dialog if it has changed
Previously we had a defaultSortKeyChanged value that lied - it was
possible for the value to be changed A -> B -> A by the user mid-
edit. However, the meta dialog assumed that defaultSortKeyChanged
wasn't lying, so blindly changed the meta item to the new value,
causing an unnecessary meta change if the user had done a no-op.

Now the value is renamed to defaultSortKeyTouched, and we actually
detect for content changes, and only change the meta item if a
change is actually needed (be that a removal, a replacement, or an
insertion).

Change-Id: I13022090bd7561a460a1151013e2b7d2a029f4dd
2013-11-18 14:13:15 +05:30
jenkins-bot 3b0c87f5e3 Merge "Make generic localization utility for lang code keyed objects" 2013-11-13 22:37:02 +00:00
Trevor Parscal 2d7f93bdb6 Make generic localization utility for lang code keyed objects
Utilize in OO.ui.IconedElement and ve.dm.TemplateSpecModel

Change-Id: I0883a73cb478d4f7509f61aebed2b2957ddb9ce8
2013-11-13 14:26:51 -08:00
cmcmahon 2d6864e19f [browser test] Additional UTF-8 editing test string
Change-Id: Iaf894043462e114e0845fc3016396ab4f51fa21b
2013-11-13 18:46:44 +00:00
cmcmahon d2165ad8fb [browser test] identifier for Link close element changed
Change-Id: Ia923c775315af9f0cd7017e0b02e621b3d9112b4
2013-11-13 00:23:50 +00:00
Timo Tijhof 98bc6adf1f Use mw.util.getUrl instead of mw.util.wikiGetlink (deprecated)
Change-Id: I72afbbd909ce2394d54f78d465bd8ad245c1694f
2013-11-12 18:34:05 +01:00
Timo Tijhof 6feef815e2 ce.MWTransclusionNode: Don't pass token to parsefragment API
As of 46f40dc, we've split the VisualEditor API backend and the
part containing the parsefragment method no longer needs
an edit token.

This gets rid of the warning that started appearing after 46f40dc:

{
 "warnings":{"main":{"*":"Unrecognized parameter: 'token'"}},
 "visualeditor":{"result":"success","content":"<p>foo\n</p>"}
}

Change-Id: I36f79fa8ae48cdbec1b3506953418561ef2ff828
2013-11-11 20:33:26 +01:00
Ed Sanders 26726ee31d Fix edit source switch in Firefox
Previously was failing for two reasons:
1. FF requires the form to be attached before submitting
2. options.watch failed because of FF's annoying Object.prototype.watch

Bug: 56767
Change-Id: I7b3d349f057f5b87f823ce788b4143f817af5303
2013-11-09 17:39:53 -08:00
Trevor Parscal 4192cbc4d5 Window refactor
Changes:

* Cleanup the window API to use more consistent and intuitive methods - we
  now use initialize/setup/teardown instead of
  initialize/onSetup/onOpen/onClose as methods which are overridden, and
  use open/close methods to control the window
* Change events around to have opening/open and closing/close events which
  act as before/after points during the opening/closing process
* Make WindowSet and Context respond to windows being opened, rather than
  opening them directly
* Fix a LinkInspector creation mode bug where the initial text doesn't get
  reset
* Move inspector, a VisualEditor concept, back to VE
* Cleanup naming of SurfaceDialog, SurfaceToolbar, etc. to use shorter
  names, they were given Surface* names when the generic ones were also in
  VE, but now the generic ones are in OO, so they can return to their
  original names

Change-Id: I82c4fed8bcb3fb5630938c8bc4dd9b2d5f1a8c1d
2013-11-08 12:33:25 -08:00
jenkins-bot d64801c86a Merge "MWExtensionInspector input direction based on content" 2013-11-08 19:29:58 +00:00
Moriel Schottlender 53f4b2f1ea MWExtensionInspector input direction based on content
In general, the direction of the MWExtensionInspector textarea
should be dependent on the directionality of the node it is editing.

The only exceptions are <hiero> and <math> that need to have their
textarea LTR always; these two inspectors' directionality definition
is overridden in their onOpen() method.

Bug: 56779
Change-Id: Iac5c1c3bf2c61b9fa36c9588c1734c91ca4305c4
2013-11-08 11:27:02 -08:00
jenkins-bot c0ee282b16 Merge "Add shortcut commands for underline & sub/superscript." 2013-11-08 19:02:50 +00:00
jenkins-bot efac869499 Merge "Add <ref> tags to wikitext detection regex" 2013-11-08 18:56:24 +00:00
cmcmahon f8d0cbded5 [browser test] one more variable string no longer hard coded
Change-Id: Ifa4917442707d0c83799ea7e018ae1c4aa7bb4c6
2013-11-08 09:19:30 -07:00
cmcmahon 53cb5a3ffd [browser test] edit string no longer hard coded
Change-Id: I8d9e9ae2cafa18a9a680abdca8c4224ef10a08b6
2013-11-08 07:35:38 -07:00
Ed Sanders 20063995b2 Add shortcut commands for underline & sub/superscript.
Underline is particularly important as CE will apply underline
formatting automatically when you press Ctrl+U but the
SurfaceObserver will not notice it, leading to inconsistency
between the view and the model.

For sub/superscript I've used the Google Docs key mappings as these
appear to have the fewest conflicts with existing browser shortcuts
and there isn't much consistency between desktop clients anyway
(Word and Open/LibreOffice use completely different shortcuts).

Bonus: reordered command lists to be consistent with UI layout.
Change-Id: I92998e42f9bcfb932d44e8f483811efd538e5981
2013-11-08 13:55:08 +00:00
Roan Kattouw 6f650d9a61 Add <ref> tags to wikitext detection regex
Bug: 56755
Change-Id: Ib7279401601147420441e77e4796b94fe91ac956
2013-11-07 17:47:33 -08:00
jenkins-bot d2da45ec36 Merge "Add a whole bunch of new ve.track() events for instrumenting loading and saving" 2013-11-07 23:57:57 +00:00
Roan Kattouw d6a00d689e Add a whole bunch of new ve.track() events for instrumenting loading and saving
Renamed events:
* performance.domLoad --> performance.system.domLoad
* performance.domSave --> performance.system.domSave

New events:
* performance.system.activation: total load time
* performance.system.domDiff: timing of paction=diff; like .domSave
* performance.system.domSerialize: timing of paction=serialize; like .domSave
* behavior.lastTransactionTillSaveDialogOpen: time from last transaction
  until user opened save dialog
* behavior.saveDialogOpenTillSave: time from save dialog opening to user
  clicking save
* behavior.saveDialogOpenTillReview: time from save dialog opening to user
  clicking review (skipped when a cached diff is shown)
* behavior.saveDialogClose: when user closes save dialog; duration is time
* performance.user.saveComplete: time from user clicking save to successful
  save completion; 'retries' indicates # of badtoken retries
* performance.user.saveError.*: time from user clicking save to failure;
  'retries' indicates # of badtoken retries
** performance.user.saveError.abusefilter
** performance.user.saveError.badtoken: token was bad and we prompted the user
** performance.user.saveError.captcha
** performance.user.saveError.editconflict
** performance.user.saveError.empty
** performance.user.saveError.spamblacklist
** performance.user.saveError.unknown
* performance.user.reviewComplete: time from user clicking review to diff showing
* performance.user.reviewError: time from user clicking review to diff failure
  since dialog was opened

Change-Id: I9815fa637d34c766c163e181d2f9527d3f32a7c3
2013-11-07 15:42:52 -08:00
cmcmahon ca2a7ce38f [browser test] input string no longer hard coded
Change-Id: I361b3ea025e405d1fc5a2e12c3c85d177147b90d
2013-11-06 17:08:42 -07:00
jenkins-bot edb769814c Merge "[browser test] add a test to edit with utf8 strings" 2013-11-06 17:21:05 +00:00
Ed Sanders 2e0d642a11 Make sure all links have target=_blank in the save dialog
Anything that uses getParsedMessage could contain a link.

Change-Id: I523edd935c4989e5929fca8891651c2287af973a
2013-11-05 21:23:02 +00:00
cmcmahon 3754bc77e4 [browser test] add a test to edit with utf8 strings
Change-Id: I88e475ee98bc8f696c1a1d0ad108c12a48fe7eee
2013-11-05 07:45:06 -07:00
Roan Kattouw 3ed7bb16a6 Send the old category and language types to Parsoid for back compat
Change-Id: If67d822e1a22bc24aa0c816952081dc614f6e686
2013-11-04 19:41:19 -08:00
jenkins-bot e309271289 Merge "Fix appearance and messages on demo page" 2013-11-04 15:19:21 +00:00
Ed Sanders 3a98e84932 Fix appearance and messages on demo page
Some 've-ui-toolbar-bar' classes hadn't been converted to OO.ui so the
toolbar had no border. Also removed a useless rule in mw.ViewPageTarget.css.

SA platform didn't override OO.ui.msg to use the ve.msg so no messages
were getting through.

Change-Id: Ieb5bc3c98d1c435ec194b201b517a688cd9b02b9
2013-11-04 15:11:04 +00:00
jenkins-bot 154726deea Merge "Fix metadata issues in newFromDocumentReplace" 2013-11-04 14:55:37 +00:00
Roan Kattouw 64e5016423 Fix metadata issues in newFromDocumentReplace
* Our metadata insertions now need to be the same length as the data
  insertion, not one more, so:
** Remove the +1 in the listMetadata splice
** Shorten the metadata variable by dropping the merging of the
   metadata right before and right after the internal list; it was
   also including the metadata right after the internal list twice
*** We still need to deal with this in some way though, left a TODO
** Fix the metadata insertion test for these changes
* Fix null reference keys in the test data; we made all references
  keyed a while ago, but this test data was never updated for that
** The remapping of reference data doesn't remap auto/N keys yet,
   left a FIXME for that

Change-Id: I8ef4e6ee7c1808574d81d0b83294848afd400cd7
2013-11-04 14:37:26 +00:00
Zeljko Filipin efa741baea [browser test] Updated Ruby gems
Change-Id: I8c298efe8dd1abbb42b5c42ee0b8075a0aad9acf
2013-11-04 15:36:03 +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
jenkins-bot ac1a386c95 Merge "dm.MWTemplateSpecModel: Resolve translations through the TemplateData API" 2013-10-31 21:42:43 +00:00
jenkins-bot 1cb87f73d4 Merge "Button tool to switch to edit source with changes" 2013-10-31 17:49:45 +00:00
Ed Sanders 7b2cacbe57 Button tool to switch to edit source with changes
By serialising the current DOM, and injecting it into a form we can
end up in the source editor with our VE changes converted.

Bug: 50687
Change-Id: Iafcc02a737d9c6c3a59dce1caff130d47ca25650
2013-10-31 10:46:51 -07:00
jenkins-bot 519a35dfe4 Merge "mw.Platform: Only add split lang codes with a dash" 2013-10-31 17:24:34 +00:00
Zeljko Filipin abc5b9920d [browser test] Removed visual_editor from file names
No longer needed, since the files are now in VisualEditor repository.

Change-Id: Id677c2630ff5a1ae2d49f62058d0d4fdebeaf381
2013-10-31 16:22:08 +00:00
Ed Sanders 3838498e8b Store inner whitespace of the body and compare it on conversion
Calculate and store the two inner whitespace values of the body in the
dm.Document. When converting back, make sure the first/last nodes
pre/post outer whitespace matches the inner left/right whitespace
of the body.

Bug: 54964
Change-Id: I45f1ffd63669f25a6cae878400bfe21719ed58ee
2013-10-31 17:09:06 +01:00
Timo Tijhof 44ada9ac71 dm.MWTemplateSpecModel: Resolve translations through the TemplateData API
Also removed comment in ui.MWTransclusionDialog that was
copied from dm.MWTemplateSpecModel.

Bug: 50888
Change-Id: I9dcfef3ae65fe716bae91f703f9169171448797a
2013-10-31 00:54:59 +00:00
Timo Tijhof 9261f300a6 mw.Platform: Only add split lang codes with a dash
It was returning ['en', 'en'] instead of ['en'].

Change-Id: I3fcf44b39b09b99997e558c1fa636e5fcbff15ad
2013-10-31 01:37:24 +01:00
jenkins-bot 5d55d3a5b9 Merge "[browser test] changes make it convenient to click Refs icon" 2013-10-30 17:32:34 +00:00
cmcmahon 86745454a6 [browser test] changes make it convenient to click Refs icon
Change-Id: I9a9ca50357601e9d254a8c86e172a497ca839387
2013-10-30 10:35:57 -06:00
cmcmahon 937f68aaa8 [browser test] changes make it more convenient to click Transclusion icon
Change-Id: I21e5a0f11f58c7f199d9c36c2ac65705c295b397
2013-10-30 16:27:15 +00:00
cmcmahon e4549a14b3 [browser test] disabled indent/outdent are now spans not links
Change-Id: I8b8788f4c92219480936360efe7153ab093c274e
2013-10-30 09:49:39 -06:00
jenkins-bot 564605711c Merge "Convert the mass Beta Feature into feature-level ones, enabling formulæ" 2013-10-30 00:08:31 +00:00
cmcmahon 2fd5507f99 [browser test] remove OS-specific part of elements using :title
Change-Id: I1d6db5b6bf9bec44f5646ed8f7096ce462a5707c
2013-10-29 09:47:44 -06:00
jenkins-bot 9ae15a77b7 Merge "[browser test] fixed Cucumber tags" 2013-10-29 06:20:59 +00:00
Roan Kattouw c9b959e878 [Browser tests] Fix a couple of stray ve-ui classes that moved to oo-ui
Change-Id: Ie89c0b1312b3150e7a3d9144d771a8996f0f606d
2013-10-28 23:10:42 -07:00
Trevor Parscal a3295f0939 Allow direct opening of pages in the meta dialog
Objectives:

* Hamburger menu in actions area of toolbar
* Add tools that open specific pages in the meta dialog
* Fix support for using setPage in ve.ui.PagedOutlineLayout
* Allow passing setup config objects through window open calls
* Add dialog action, similar to inspector action
* Fix incorrect or missing documentation

Change-Id: I2d2c9b87554fb2a0c90ed6944a58b38a37efa712
2013-10-29 05:58:06 +00:00
Trevor Parscal e83dc3f8fc Use a toolbar for the actions buttons in ve.init.mw.ViewPageTarget
Change-Id: I260059802379d8cab8ca175b7d7d32813e3ff10a
2013-10-29 05:57:52 +00:00
Trevor Parscal 230d88d182 Isolate links within OO.ui.Tool
This allows other content to be added without it being nested inside an
<a> which results undesired visual and functional effects.

Change-Id: I667878fe4ae682712094a61bb4b411ac5fb999c7
2013-10-28 22:55:32 -07:00
Zeljko Filipin 781e788b9d [browser test] fixed Cucumber tags
There was no space between a couple of tags in a couple of files.

Change-Id: I1fadc61e41a4a0e210739106f5f8b28b2a460f01
2013-10-29 06:55:24 +01:00
Trevor Parscal 6774cd74f3 Detangle triggers from OOUI
Changes:

* Pass toolGroup into tools instead of toolbar
* Split tool labels into title and accel
* Make toolbars provide accelerator labels
* Remove getLabelText method since it's not being used and is likely not useful
* Make tools update their own labels
* Only show accelerator information for triggers that are active in the surface
* Make surface toolbars listen to commands being added and update tools accordingly
* Introduce command object to encapsulate command info

Change-Id: Ieac4bfa63b63ac0a9dee154af3007a33b4d447ff
2013-10-29 05:50:30 +00:00
jenkins-bot 40da34aa36 Merge "Split oojs-ui from ve.ui" 2013-10-29 05:45:02 +00: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
Roan Kattouw 829967951e Convert the mass Beta Feature into feature-level ones, enabling formulæ
Make every module that was formerly part of the experimental module its own
Beta Feature. For now, all of them are commented out except for formulæ editing
(mwmath). The "experimental" Beta Feature bucket is no more, but the preference
remains so that it can be set to both true and hidden on MediaWiki.org to let
all the different experimental flags.

The feature icons, previous mis-named "logo" and mis-identified as "screenshots"
are now renamed. One for the mwmath Beta Feature has been added (the rest need
creating before those can be enabled). The i18n descriptions now each identify
that the feature is an experimental one, and that caution is needed.

Change-Id: I28862f3e62f5c78aca33f11265aced1db67f4725
2013-10-29 01:20:48 +00:00
cmcmahon 192b9d3c1e [browser test] workaround for VE bug probably caused by https://bugzilla.wikimedia.org/show_bug.cgi?id=56274
Change-Id: I2b872966399ecb6eb60da619eb9af52ae33f3aca
2013-10-28 20:42:46 +00:00
jenkins-bot cc8010e556 Merge changes Ia6ca85bc,I919135eb,Ia18bd8fc,I49dfc81f,Ia234f174,I06425e2c,Ia192331b,I5624ae07
* changes:
  Get rid of dmRendering hack in ve.ce.MWInternalLinkAnnotation
  Render resolved URLs for href and src attributes in CE
  Give ce.Annotations a reference to their ce.ContentBranchNode
  Track the original HTMLDocument in ve.dm.Document
  Create CE nodes and annotations with the correct $$
  Add ve.resolveUrl for URL resolution
  Don't render href as src in MWBlockImageNode
  Rename 'html' to 'body' in converter tests
2013-10-28 18:55:11 +00:00
jenkins-bot 6bfa803fda Merge "Resolve rendered URLs according to the provided <base>" 2013-10-28 18:32:55 +00:00
jenkins-bot 18eb08dc6b Merge "Filter DOM load/save deferreds through ve.track callback" 2013-10-28 18:14:15 +00:00
jenkins-bot 4d688b6db5 Merge "Add a placeholder into an empty transclusion" 2013-10-28 17:42:16 +00:00
jenkins-bot 58d581669b Merge "[browser test] don't run cursor test pending Bug 56068 and review" 2013-10-28 16:58:08 +00:00
jenkins-bot c51d3f7b64 Merge "[browser test] organize tags for running in beta, test2" 2013-10-28 16:57:01 +00:00
cmcmahon f0444ca3c0 [browser test] don't run cursor test pending Bug 56068 and review
Change-Id: If7f7b063398adef822f1a4d1bfa385f1517b8533
2013-10-28 10:44:54 -06:00
cmcmahon 4029605979 [browser test] organize tags for running in beta, test2
Change-Id: I706cd995c9e8c5529782621288e24952cd6b3b63
2013-10-28 09:58:05 -06:00
Roan Kattouw 5c04118c07 Get rid of dmRendering hack in ve.ce.MWInternalLinkAnnotation
Centralize href computation in getHref(). Because getHref() is provided
by the generic LinkAnnotation class, the subclass implementation is
now simpler.

Bug: 51487
Change-Id: Ia6ca85bc84b4f4453b572285836adb631e8d0683
2013-10-28 15:49:08 +00:00
Roan Kattouw 36061c7f5d Render resolved URLs for href and src attributes in CE
URLs are resolved according to the <base> URL from the Parsoid DOM.
For instance, a link can have its href set to '../Foo' in the DM, and
the target will show up as '../Foo' in the link inspector, but the CE
rendering will be <a href="http://localhost/Foo"> (assuming Parsoid sent
<base href="http://localhost/wiki/Bar">).

Bug: 48915
Change-Id: I919135eb758c82361525078f276ca193dc4c4820
2013-10-28 15:49:04 +00:00
Roan Kattouw 8e6bde2f56 Give ce.Annotations a reference to their ce.ContentBranchNode
This gives them a way to reach the dm.Document, which is needed
for ce.Annotations to do URL resolution.

Change-Id: Ia18bd8fc3510ad1b627644cd2c6ebcf148254e05
2013-10-28 15:48:59 +00:00
Roan Kattouw a05703114a Track the original HTMLDocument in ve.dm.Document
Add it as an optional parameter to the constructor, and create a new
one if omitted.

This is going to be used to resolve URLs according to the right <base>,
but really that's a hack and we should come up with a better way to
track metadata from the <head>.

Change-Id: I49dfc81ff793d73e08a20e502d681a15613d23f7
2013-10-28 15:48:55 +00:00
Roan Kattouw 904abe74c8 Create CE nodes and annotations with the correct $$
Most of CE wasn't passing through $$ at all. Also fix CE tests that
weren't passing the required surface parameter to the ce.Document
constructor.

Change-Id: Ia234f174050f4b2666ec20e8acc24c6aa4305202
2013-10-28 15:48:51 +00:00
Roan Kattouw ec008a6464 Don't render href as src in MWBlockImageNode
<a src="..."> isn't a thing

Change-Id: Ia192331b88f17480f4285697e024bda25078968b
2013-10-28 15:48:39 +00:00
Roan Kattouw 608b8d378d Rename 'html' to 'body' in converter tests
Because that's what it is now since 'head' was added. Also removed
the wrapping <body> tag (now added by the test runner) and renamed
normalizedHtml to normalizedBody.

Change-Id: I5624ae076c5e661d2789e499cd28e8282c885409
2013-10-28 15:46:55 +00:00
cmcmahon 5b7bd6d56b [browser tests] add the double-logout fix to the other Before clause
Change-Id: I23e73d0c91b9d7f77fb8390fcae22ac00ce086e1
2013-10-28 15:40:53 +00:00
Roan Kattouw 74b8807df5 Resolve rendered URLs according to the provided <base>
This is done by using the computed property value rather than the
literal attribute value when rendering href and src attributes.
Helpfully, this provides perfect URL resolution natively in the browser,
which means the document's <base> is respected and all that good stuff.

For GeneratedContentNodes, we also need to find all DOM elements inside
the rendered DOM that have href or src attributes and resolve those.
This is done in the new getRenderedDomElements() function, which the
existing cleanup steps (remove <link>/<meta>/<style>, clone for
correct document) were moved into.

In order to make sure that the computed values are always computed
correctly, we need to make sure that in cases where HTML strings
in data-mw are parsed, they're parsed in the context of the correct
document so the correct <base> is applied.

We still need to solve this problem for models that actually store and
edit an href or src as an attribute. I'll post more about that on
bug 48915.

Bug: 48915
Change-Id: Iaccb9e3fc05cd151a0f5e632c8d3bd3568735309
2013-10-28 15:16:05 +00:00
jenkins-bot a07f270fc5 Merge "Don't corrupt categories/langlinks with new types" 2013-10-28 12:34:00 +00:00
jenkins-bot 291e1f3449 Merge changes Iaba76ac1,Ib15c39f3,If5a3b4d4,I44425d26,I8f162894
* changes:
  .change( null, foo ) -> .setSelection( foo )
  Remove SurfaceObserver locking (unused)
  Implement ve.dm.Surface.prototype.undo() and redo() in terms of change()
  Enslave dm.Surface to dm.Document
  Remove dm.Surface's 'change' event
2013-10-25 21:05:32 +00:00
jenkins-bot e180b8c1ca Merge changes Ifeb1a1fc,I521eff00
* changes:
  Migrate away from using the 'change' event in dm.Surface
  Make dm.Surface's 'select' event more useful
2013-10-25 17:59:00 +00:00
Roan Kattouw 534f0bdde7 .change( null, foo ) -> .setSelection( foo )
Change-Id: Iaba76ac17888a7825f5a9cd1c383d4f429454278
2013-10-25 18:29:49 +01:00
Roan Kattouw b7ee30d4e4 Enslave dm.Surface to dm.Document
* Replace surface 'transact' event with 'documentUpdate' event
* Have surface listen for all document transactions and update selection
  as appropriate (as well as emitting 'documentUpdate')
* Implement change() in terms of setSelection()
** Queue 'contextChange' events so contextChange is only emitted once
** Use this.transacting flag to prevent setSelection() (which is called
   because the model emits transact events) from doing too much
** Behavioral change: lock/unlock now emitted separately for
   transaction and selection changes

Change-Id: I44425d260ec70758f99d13f99e41f5c993d260c2
2013-10-25 18:29:48 +01:00
Zeljko Filipin aa3c569e28 [browser test] Workaround for the problem when Cucumber hook executes twice
Bug: 56116
Change-Id: I99bf48b1452647b42edd97dc47e8664b08b7667a
2013-10-25 17:26:05 +02:00
Zeljko Filipin e6cd405abf [browser test] Use the latest version of mediawiki-selenium gem
Change-Id: I14baca7b9cfb6a76a4e026ea5c6673b87ced3c0f
2013-10-25 15:10:56 +00:00
jenkins-bot 044e2e289c Merge "Split ext.visualEditor.experimental into specific modules" 2013-10-24 14:05:33 +00:00
Ori Livneh 56a9484149 Filter DOM load/save deferreds through ve.track callback
Binding ve.init.mw.Target#onLoad and the anonymous function which calls ve#track
with timing data to the resolution of the same deferred makes the timing
measurement sensitive to how long it takes ve.init.mw.Target#onLoad to yield,
which in turns depends on whether the requisite ResourceLoader modules for
setting up the editing surface are ready. This muddles the definition of what
we're actually measuring, making it dependent on a race condition.

This patch moves the tracking call to a filter function through which the jqXHR
deferred is threaded. This ensures that the 'duration' datapoint on the domSave
and domLoad events captures just the time spent talking with the API.

Change-Id: I6e162014a4043d4ff9422131ae87fb25d0ab4c29
2013-10-23 22:44:27 -07:00
Roan Kattouw 412eb34de8 Split ext.visualEditor.experimental into specific modules
Math, hiero, language and alienextension are now each in their own
module. Kept the experimental module for backwards compatibility,
it just has all of its constituent modules as dependencies.

MWExperimentalTool.js was split up, and ExperimentalTool.js was
renamed to LanguageInspectorTool.js.

Change-Id: I63b49dfbdb59dc9a494049553cc0c01e89e48826
2013-10-23 16:20:30 -07:00
jenkins-bot 2f2a2207aa Merge "Make category suggestions dropdown appear below the input box" 2013-10-23 19:38:10 +00:00
Roan Kattouw 53e4c370ea Migrate away from using the 'change' event in dm.Surface
Instead, listen to 'select', or to 'transact' on the dm.Document.

This commit only fixes uses outside of the dm/ce.Surface ecosystem.
ce.Surface still listens to 'change'.

ve.init.mw.ViewPageTarget.js:
* Rename onSurfaceModelTransact to clearSaveDialogDiff and bind it to
  the document's transact event instead
* Rename onSurfaceModelChange to checkForWikitextWarning and bind it
  to the surface's transact event. This is needed because the function
  inspects the surface's selection, which isn't yet in a consistent
  state when the document's transact event fires

ve.ui.MWReferenceDialog.js:
* Rename onSurfaceChange to onDocumentTransact and rebind accordingly

ve.ce.ProtectedNode.js:
* Get rid of onSurfaceModelChange
* Instead, bind positionPhantoms to the document's transact event
  directly, and only bind it while phantoms are visible

ve.ui.Context.js:
* Rename onChange to onModelSelect and rebind accordingly
* Rename afterChange to afterModelSelect
* Drop check for undefined selection, no longer needed now that we're
  listening to a finer-grained event

ve.ce.Surface.test.js:
* Listen to 'select' instead of 'change'

Change-Id: Ifeb1a1fc5427696f2aae5441d4b54dde366793e0
2013-10-23 11:54:35 -07:00
Zeljko Filipin 904c5a48ad [browser test] Moving shared code to mediawiki-selenium Ruby gem
Bug: 53579
Change-Id: I4ef8b63f485b0274f252cf95e566f0484615e8cf
2013-10-23 16:43:51 +00:00
Timo Tijhof 6560cfda2b Remove simpleArray utilities from ve.js and use oojs instead
Change-Id: I23710ff50378f4069b8a0dea89f0491884acd377
2013-10-23 03:26:53 +02:00
Trevor Parscal b635541de2 Remove ve.getHash and use getHash from oojs instead
Change-Id: Ib688a3ba0ab07e0d0dc328a3878440756d1103fe
2013-10-22 19:14:23 +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
jenkins-bot b017dcef30 Merge "Fix save dialog crash on load error" 2013-10-22 17:26:21 +00:00
Trevor Parscal 6018e77d70 Use OO.EventEmitter instead of ve.EventEmitter
Change-Id: Ie35e5f51a8d3c0d7f4fa46230b7b37112df610b9
2013-10-22 16:57:33 +00:00
Roan Kattouw 9d915aca2d Fix save dialog crash on load error
If there was an error loading the HTML from Parsoid, ViewPageTarget
would try to tear down the save dialog, which caused a crash because
the save dialog doesn't exist yet at that point.

Change-Id: Ia50756a19cb775be96b90e87b642eb2a38f254ce
2013-10-22 01:15:35 +02:00
jenkins-bot 324b04137b Merge "Add requirements to BetaFeatures hook" 2013-10-21 15:18:24 +00:00
Zeljko Filipin 421924bd69 [browser test] cursor feature was not tagged @login
Change-Id: I587ad033c93078d8e626840de3b3eedc73b83516
2013-10-21 13:04:43 +00:00
Roan Kattouw d3c706ff93 Add a node type for numbered external links
Since I0f0a826c in Parsoid, numbered external links are now empty
<a rel="mw:ExtLink"></a> tags. This means we have to put in a node type
for them to prevent them from being considered empty annotations and
getting converted to alienMeta.

MWNumberedExternalLinkNode is protected and focusable to avoid making
the link text (which isn't editable) clickable. It isn't inspectable
yet, we need to work on that.

Bug: 53505
Change-Id: I83f69695f3974089e51a84e799f31ab6ed879e05
2013-10-18 22:31:45 +02:00
Trevor Parscal efafed3231 Remove ve.{inheritClass,mixinClass} and use OO instead
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
2013-10-18 18:58:08 +02:00
jenkins-bot 40a8e9ef12 Merge "Document constructor params for dm.MWMathNode and dm.MWExtensionNode" 2013-10-18 12:52:19 +00:00
Timo Tijhof 832f8e1e11 Document constructor params for dm.MWMathNode and dm.MWExtensionNode
Follows-up Ib909c5fb02.

Change-Id: Ia3dfbabc8dde9f1e65e8fbb0e4d67f868031247a
2013-10-18 12:44:50 +00:00
cmcmahon 828747f0f0 [Browser tests] identifier for anonymous warning changed for test2
Change-Id: Idfdd6db441205280373f8d24bf0a693b46eed1af
2013-10-18 01:31:47 +00:00
jenkins-bot 5dd44dab93 Merge "Rename performance.parsoid.domLoad to performance.domLoad" 2013-10-17 19:30:58 +00:00
jenkins-bot 8b3de827cb Merge "Use .done()/.fail() instead of 'success'/'error'" 2013-10-17 17:21:47 +00:00
jenkins-bot 107689087a Merge "Followup 8a4058584: use a single media source for rerendering images" 2013-10-17 17:20:13 +00:00
Zeljko Filipin a3ae0478ed [browser test] Updated Ruby gems
Change-Id: I78cbac61ca534957a39474a82306aaa954ab9de1
2013-10-17 16:19:03 +00: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
Roan Kattouw 660e7c664a Don't corrupt categories/langlinks with new types
Parsoid changed these types from mw:WikiLink/{Category,Language}
to mw:PageProp/{Category,Language} in I0f0a826c. We had previously
added support for them in 4d91e4ed but code overwrote the new types
with the old ones on the way out, triggering the DOM corruption warning.

Change-Id: I768ec2ffd623e5a01f18959277786697603a97f0
2013-10-17 15:48:37 +02:00
Roan Kattouw f81de3e1e9 Initialize the save dialog correctly even if the sanity check failed
A very weird if statement caused pretty much all logic for displaying
the 'save' panel to be skipped if the sanity check had failed. The
result was that all buttons were displayed at the bottom of the
save dialog, even those that don't make sense in that context.

Change-Id: I628ebc05830fb25d67ff181852a1e56f0e25dee9
2013-10-17 15:29:03 +02:00
Roan Kattouw d3cd404877 Use .done()/.fail() instead of 'success'/'error'
'success' and 'error' are deprecated.

Also make all generateContents() promises abortable.

Change-Id: I8f95e9386f7749e635ce3715389896a0ccdb7523
2013-10-17 14:03:37 +02:00
Roan Kattouw 7035c8de01 Followup 8a4058584: use a single media source for rerendering images
The code asked all media sources for a rerender and used whichever one
came in first, which meant that it might potentially render the wrong
image, or reject the promise if one source served an error response
before a good response from another source arrived.

Also reject the promise if we can't find an image source in the response.

Change-Id: I6b516ad41b8a9e2abd440625bb76f3e1abb54520
2013-10-17 14:02:51 +02:00
Moriel Schottlender 81ca18ecc8 Add a placeholder into an empty transclusion
If a template was setup without a default output and returns an empty result
to the transclusion, the user could not access the template dialog because
there was nowhere to hover over to get it visible. This commit checks the
output from the template after it was rendered with the given parameters
and if it returns empty, it adds a placeholder to the output so to give
the users way to access that template's transclusion dialog and edit
or remove it.

Bug: 55810
Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c
2013-10-16 16:33:08 -07:00
jenkins-bot 47cccb4feb Merge "Cleanup on save dialog cruft & fix updateWatchLink" 2013-10-16 23:17:22 +00:00
Rob Moen 351bf3195f Cleanup on save dialog cruft & fix updateWatchLink
Change-Id: I730003726db0164e1bef8bddcd45e31df1373618
2013-10-16 15:32:39 -07:00
Gabriel Wicke 266603c3a1 Rename performance.parsoid.domLoad to performance.domLoad
See
https://gerrit.wikimedia.org/r/#/c/89347/2/modules/ve-mw/init/ve.init.mw.Target.js
for the reasoning. Ori offered to adjust the consumers for this.

Change-Id: I835f0752ab3a4c8ad56eec437668423ba8b81c24
2013-10-16 15:02:26 -07:00
Ed Sanders 8a40585847 Re-render images after resize
Using the MW APIs get a resized version of the image and use
GeneratedContentNode to cache the url.

Bug: 55697
Change-Id: I418f7e1464663f447d46de7ffc29aa5f52d23b12
2013-10-16 16:38:31 +01:00
Ed Sanders 3077be6d9c Remove -ms-transition
Because it never existed.

Change-Id: Iaae7e8f11efb0a9853130bcdad8b643c06a1eed8
2013-10-16 15:32:04 +00:00
jenkins-bot 1f8d2fd9a7 Merge "Log DOM save timing; update existing ve.track calls" 2013-10-16 14:50:16 +00:00
jenkins-bot 5d772e1dae Merge "Misc UI fixes" 2013-10-16 12:42:19 +00:00
jenkins-bot 9500801848 Merge "Rename storeDomElements to storeGeneratedContents" 2013-10-16 12:36:27 +00:00
jenkins-bot e4c73c64e8 Merge "Resizable node live preview" 2013-10-16 12:35:37 +00:00
Ed Sanders 79f4755850 Resizable node live preview
Resizes the $resizable element as you drag.
Can be disabled by setting the 'outline' config option.

FocusableNode
* Redraw on resize

ProtectedNode
* Destroy and prevent creation of phantoms on resize

MWInlineImageNode
* Correctly pass this.$image to ResizableNode

Bug: 54298
Change-Id: I7d6d345af8bb4712bbf154072b4704943a5a620d
2013-10-16 14:25:00 +02:00
Trevor Parscal bb03e8f17e Misc UI fixes
* Followup 75270e24: use this.surface directly in MWMetaDialog
* Document that MWDialogTools need a SurfaceToolbar
* Namespace CE events and CSS classes with ve-ce- rather than ve-ui-
* Namespace SurfaceToolbar CSS classes correctly and put them in their
  own CSS file

Change-Id: I9e70917d9c220b39e68833f67ed49fae7f7cbe6a
2013-10-16 12:40:40 +02:00
Ed Sanders a1a448b6de Rename storeDomElements to storeGeneratedContents
The default is to store the entire generated DOM node, but in
general classes can store anything that can be held by the store.

Change-Id: Ia761079fadfb5a6cfa2f00e5b5e23d6c6d3468ac
2013-10-16 11:17:01 +01:00
jenkins-bot fdf40f1655 Merge "Convert MWBlockImage dimensions to numbers and update tests" 2013-10-16 09:56:43 +00:00
Rob Moen 87629a99e1 Use existing ve config for pluginModules
Change-Id: I16a50f342e0794a98e648afc7251e8341270e9c9
2013-10-15 11:36:06 -07:00
Ed Sanders c7b3d34017 Convert MWBlockImage dimensions to numbers and update tests
MWInlineImage already does this but it wasn't copied over to
MWBlockImage.

Change-Id: I9f34182b30ae72beb7b5c3d5fde2f08185cba663
2013-10-15 17:59:39 +01:00
jenkins-bot dd567f8b27 Merge "'clearMessage' is a method of MWSaveDialog, not ViewPageTarget" 2013-10-15 10:55:41 +00:00
Ori Livneh b001b2b976 'clearMessage' is a method of MWSaveDialog, not ViewPageTarget
Fixes a small casualty left behind by 972c9a46b7.

Bug: 55726
Change-Id: I8cf8418dede002068fb1090d940b09c3bb91c196
2013-10-15 10:53:44 +00:00
jenkins-bot 577e3b3924 Merge "Enable VisualEditor using Beta Features" 2013-10-14 18:16:22 +00:00
Ori Livneh c27661507b Log DOM save timing; update existing ve.track calls
* For consistency with target.loading, target.saving should be either a boolean
  false or a jqXHR, with the latter type indicating a pending save attempt.
* Rename 'DOM Retrieved' topic to 'performance.parsoid.domLoad' (and thus
  inaugurate a convention of hierarchical, dot-separated topic names).
* Add a 'performance.parsoid.domSave', which is a near-mirror of domLoad, but
  measures the time it takes to save a DOM.
* Remove three old ve.track events, because they are not used and because their
  name and signature are not consistent with current usage.
  - page-save-attempt
  - page-save-success
  - page-edit-impression

Change-Id: I54602394eee5d6d9229c01d868cb366c9f56b2c3
2013-10-11 15:16:05 -07:00
jenkins-bot d826bc702e Merge changes I160e55ad,Idd0592d6,I4d403f1b
* changes:
  Remove ve.ce.Node.prototype.onAttributeChange
  Remove ve.ce.ImageNode.prototype.onUpdate
  Remove .tagName from ce.MWInlineImageNode
2013-10-11 17:30:18 +00:00
jenkins-bot 391057bcec Merge "[browser test] icons appear hovering when cursor is on object" 2013-10-11 15:21:55 +00:00
cmcmahon 22f409070b [browser test] icons appear hovering when cursor is on object
Change-Id: I296445d0ec11f375ddb30f293ec3542ccc6332d6
2013-10-11 17:19:01 +02:00
Roan Kattouw 1d7d19ff33 Remove ve.ce.Node.prototype.onAttributeChange
There was code in there once, but it's now empty. Removed it in favor
of adding explicit listeners in the handful of subclasses that
override it.

Change-Id: I160e55ad3c7d85c9f830a4bd7d42ec5dc18ad04f
2013-10-11 15:02:19 +00:00
jenkins-bot 7e399a6202 Merge "Fix empty document length check in MWReferenceDialog" 2013-10-11 14:35:38 +00:00
Ed Sanders e8082ba968 Add requirements to BetaFeatures hook
Change-Id: Ifc809f49e1cf03015dbb295b6b092b4181edc38b
2013-10-11 14:50:41 +01:00
Ed Sanders 9cba9910c6 Enable VisualEditor using Beta Features
Change-Id: I76ba788751dacc24cdbc667b4d24f1656f0ade44
2013-10-11 14:50:24 +01:00
jenkins-bot 4c9d22c7ca Merge "Generalise the way extra modules are loaded" 2013-10-11 13:33:30 +00:00
Roan Kattouw 0c6dadb605 Remove .tagName from ce.MWInlineImageNode
Was unused, because this.$ is always overwritten in the constructor

Change-Id: I4d403f1b89351fb7d23131f944406d5a088fdeef
2013-10-11 15:09:21 +02:00
Roan Kattouw 0901c0328a Generalise the way extra modules are loaded
Change-Id: Icd453421b022a6450d1358edbe2132e49ca0b3bf
2013-10-11 14:07:00 +01:00
jenkins-bot 8c44a53d3a Merge "Make MWInlineImages resizable" 2013-10-11 09:26:55 +00:00
cmcmahon 50ffa7c40c [browser tests] remove cruft and order page.rb file
Change-Id: I7d7cba0256e1d2631cdc4b73026c89cb5c85e0f5
2013-10-10 07:35:50 -06:00
Ed Sanders a2b667c8f7 Make MWInlineImages resizable
Because they are.

Change-Id: Ib2ff3ac6e9c5ed896486c93c48697d232b892493
2013-10-10 13:35:59 +01: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
jenkins-bot 3d55c6a081 Merge "Fixes for Trevor's crazy half-baked commit" 2013-10-09 20:16:51 +00:00
Roan Kattouw 75270e24d5 Fixes for Trevor's crazy half-baked commit
Fix things that 4aa86d0f8 broke:
* Update surface parameter to windowSet in all ve.ui.SurfaceDialog subclasses
* Do the same for ve.ui.SurfaceInspector subclasses
* Fix @extends documentation for SurfaceDialog
* Fix documentation for ve.ui.SurfaceInspector, copypasta from SurfaceDialog

Bonus:
* Add .getMetaList() getter to dm.Surface

Change-Id: I843e99e45e9b013cb9cb559f050384d39bbbddf2
2013-10-09 22:08:13 +02:00
cmcmahon bd2b828555 [browser test] update references for proper iframes, new workflow
Change-Id: Icafbbcac9a70401bd87ea87e6dbb94ea9a6c3726
2013-10-09 13:29:58 -06:00
cmcmahon 46aed9debd [browser test] up arrow no longer exists, use X instead
Change-Id: I79684633b69ad48b4ce291e2bd6e12d14564cca6
2013-10-09 12:51:03 -06:00
cmcmahon 6c299ff2b3 [Browser tests] Sort all the elements for Links tests to proper iframes
Change-Id: I873cfaccf7211f379eadc6574edbe8de8c2e15f1
2013-10-09 18:26:48 +00:00
cmcmahon d3a75d0501 [browser tests] editing controls to proper iframe
Change-Id: Ifc24e4fcc0fe4688ee8e8b277f54fe2582dcadaf
2013-10-09 17:24:19 +00:00
jenkins-bot 39d5a1a9c4 Merge "Prevent deletion of FocusableNodes from a collapsed selection" 2013-10-09 17:22:45 +00:00
cmcmahon f8d4f10de7 [Browser tests] transclusion elements to new 3rd iframe
Change-Id: Ia1a02ece54c44d3bfb0dd985fec97e9c8d5b9d59
2013-10-09 16:55:03 +00:00
Ed Sanders bffa0df53f Prevent deletion of FocusableNodes from a collapsed selection
Instead select the node and require the user to press delete
again if they really meant to delete the node.

Also test cases!

Bug: 55336
Change-Id: I66520e18740e78ce6313f9b31bb575d06b91bea8
2013-10-09 17:41:31 +02:00
cmcmahon 46d14ca163 iframe
Change-Id: Id771991a89e1cf836c7f19083df22edb38ffc6c8
2013-10-08 16:38:44 -06:00
Roan Kattouw 74f9fe13ea Fix empty document length check in MWReferenceDialog
We now initialize the surface in the dialog with a 4-element linmod
(paragraph, /paragraph, internalList, /internalList) rather than a
2-element linmod. This broke the code that disables the Insert button
in the reference dialog when the surface is empty.

Change-Id: Id733e654a628b1294e697ad4ef3f2f6fe1a9c869
2013-10-08 21:39:25 +02:00
cmcmahon ad1a579197 dismiss latest warning iframe
Change-Id: Ic1c5099f1531174140c2033212da35632a6188cc
2013-10-08 11:17:14 -06:00
cmcmahon 971b026786 id for ip warning changed
Change-Id: I6623751228be1aa550ec8c7e1e3071a38563ada0
2013-10-08 06:00:43 -07:00
Ed Sanders 972c9a46b7 Make the save dialog an actual dialog
Major changes:
* Create a MW specific save dialog class
* Widgetize save dialog elements
* Simplification of viewPageTarget

Minor changes:
* Added getWindow method to windowSet and setTitle methods to window class
* Add transition css properties to dialog styles

Bug: 48566
Bug: 50722
Bug: 51918
Bug: 52175
Bug: 53313
Change-Id: I8c0db01fb8477a9b3d3dfe2a6073ac67869ce40e
2013-10-07 15:59:00 -07:00
jenkins-bot bcbefc63cc Merge "Track DOM retrieved events" 2013-10-07 22:15:07 +00:00
jenkins-bot 1e0c24da49 Merge "Make dialogs, inspectors windows and window sets generic" 2013-10-07 18:55:07 +00:00
Trevor Parscal 4aa86d0f87 Make dialogs, inspectors windows and window sets generic
Objective:
* Remove surface dependencies in dialogs, inspectors, windows and window sets
* Introduce surface-specific versions of dialogs, inspectors and window sets

Change-Id: I2db59127d2085b02e173a3605e174317e419e213
2013-10-07 10:37:47 -07:00
jenkins-bot 00b6de429b Merge "Use FlatLinearData for storing converter results" 2013-10-07 14:47:21 +00:00
jenkins-bot fb18831143 Merge "mw.ViewPageTarget: Fix broken firstHeading transition" 2013-10-07 10:30:17 +00:00
jenkins-bot 0b09b597a1 Merge "mw.ViewPageTarget: Fix incomplete teardown sequence in #deactivate" 2013-10-07 10:28:46 +00:00
Timo Tijhof b169a01907 Follow-up 6ec34a3de: Fix bug and exception in edit notice button
After 6ec34a3de the edit notice button was no longer hidden by
default if there were no notices. The alert icon was always
visible (when clicked it would show "0 notices").

In addition, on any page (except pages with edit notices) it
would throw a fatal exception at load time because method .hide()
doesn't exist.

As a result, current master shows an incomplete toolbar (e.g. not even
a Save button!)

Change-Id: Ib6e91c4756664c25fbb7403ef54b4fffcc0f9938
2013-10-07 00:28:23 +00:00
Timo Tijhof 66ff702561 mw.ViewPageTarget: Fix broken firstHeading transition
Class ve-init-mw-viewPageTarget-pageTitle added various
transition settings that were never used. Meanwhile, we're doing
fadeTo which sets inline opacity css every X ms until the
animation is finished.

* Changed the inline jQuery animation  to use css transitions
  instead.
* Removed the inexistent and obsolete ms-transition declaration.
* Removed ":visible" from selector query. This makes the selector
  more performant (since :visible is a proprietary Sizzle keyword)
  and it was obsolete anyway. The classes don't affect display none/hide,
  this is handled naturally by the browser now.

Change-Id: Ibdfb442ff6c743ef16b514a7696796ee27821887
2013-10-06 22:59:13 +02:00
Timo Tijhof 7f01c9fadc mw.ViewPageTarget: Fix incomplete teardown sequence in #deactivate
When deactivating before the surface became active (e.g.
this.active is still false, as case is the case when Parsoid
isn't running), the teardown sequence was incomplete.

Most notable, the page title (h1.firstHeading) was still dimmed
after cancelling the alert for Parsoid error, eventhough
everything else was shown and restored.

* Moved call to #showTableOfContents in #deactivate up for
  consistency with #activate.
* Added call to #restorePageTitle in #deactivate so that the
  title is restored even if the surface didn't activate yet.
* Removed calls to various methods in #tearDownSurface that
  were already called by #deactivate.

Now activate/deactivate and setUpSurface/tearDownSurface are
in balance.

Change-Id: Ibb2fbf0e5ab9b6a028d4e139c13aa7ff8c82be82
2013-10-06 21:50:06 +02:00
Ed Sanders 44b1fdebe4 Use FlatLinearData for storing converter results
Previously we returned ElementLinearData from the converter, then
stripped out the MetaLinearData. This meant that before processing
the ElementLinearData from the converter actually contained metadata
which is confusing.

The new document constructor stores the converter results in a
FlatLinearData object and simultaneously populates element and meta
data stores.

Also in this commit I have moved various methods from ElementLinearData
to FlatLinearData, from which ElementLinearData inherits.

Change-Id: I64561bde2c31d8f703c13ac7b0a0c5f7ade9f3d4
2013-10-06 20:27:32 +01:00
Ori Livneh e8aad4d4a7 Track DOM retrieved events
When the editor finishes retrieving the target DOM, fire a 'DOM retrieved'
analytic event with the following properties:

* Response time in millisecond.
* Response size in bytes.
* Whether request was a cache hit.
* Value of X-Parsoid-Performance header (or null if unset).

jQuery.byteLength is now a dependency for ext.visualEditor.mediawiki.

Change-Id: I74d3964238927645e847b6e215991bd6b1ebad59
2013-10-05 23:24:06 -07: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 e1c49ace99 Merge "Refactor ve.ui.PagedDialog" 2013-10-04 20:25:43 +00:00
Kyle Florence 4efc6cadb7 Refactor ve.ui.PagedDialog
This commit extracts the page and outline handling logic from
ve.ui.PagedDialog (RIP) and moves it into two layouts: ve.ui.PagedLayout
and ve.ui.PagedOutlineLayout, respectively. These layouts are now implemented
inside the dialogs that used to mixin the ve.ui.PagedDialog class. This
brings a much cleaner separation of concerns between Dialogs and Layouts
and allows the use of page handling logic without the accompanying
outline logic.

Change-Id: I5efa2f893f4b7e962438b3aff34b737573bbd5ca
2013-10-04 12:09:15 -07:00
Zeljko Filipin 45a222a863 The element has different title on a Mac
It is "Edit this page with VisualEditor [ctrl-option-v]".

Change-Id: I54d72c63f07826106e8fbb0de0828dd82b67c766
2013-10-04 17:14:03 +02:00
jenkins-bot 1a9f6489d7 Merge "Rename getDocumentSlice to cloneFromRange" 2013-10-03 18:19:13 +00:00
Ed Sanders 1957eb3e28 Rename getDocumentSlice to cloneFromRange
We already getSlice which returns a ve.dm.DocumentSlice, so using
the word slice in this method is very confusing. What we are actually
doing is creating a ve.dm.Document from a range. Also remove argument
overloading as it's not particularly helpful and would make the new
name a lie.

Change-Id: I93da3419510410b170396e6765fbe2a87f9795be
2013-10-03 12:48:01 +01:00
jenkins-bot 0c3014c968 Merge "Add specific message for empty ref group list" 2013-10-02 21:05:07 +00:00
Ed Sanders 912e0b1aef Add specific message for empty ref group list
Currently we just say 'group ""' which is a bit weird, so
instead have a specific message which talks about the
'default group'.

Bug: 51873
Change-Id: I4a17f15ee18175fac11b36b102a06cc9714426ee
2013-10-02 14:01:37 -07:00
Moriel Schottlender fb4aae8ea8 Add optional i18n parameters to MWDialog titles
This change allows for the Username to be sent in MWBetaWelcomeDialog
title so the i18n message can support {{GENDER:}} parameters.

This change arose from the need to provide GENDER support when translating
the welcome message from Change-Id: I6a3da40b286bb1abd2aff360dab3b386deb13420

Change-Id: Iae70fbaa5be822d571a0d75704cfeca4eabd2fe8
2013-10-02 17:32:49 +00:00
cmcmahon d8bdbd0570 reset @make_selectable_line properly again
Change-Id: I1efa45f639bc4a7cdd764be3f5c23ba2ef2605e9
2013-10-02 08:44:18 -07:00
cmcmahon eb0919981f reset @make_selectable_line properly
Change-Id: I8bd55b2ddc55b8368826af58903e7f988058b325
2013-10-02 15:03:32 +00:00
cmcmahon f5e18e45a2 refactor to use Scenario Outline and REUSE_BROWSER env var
Change-Id: I65970c0df35bcac48f16899090cadc8df8c560c6
2013-09-27 11:36:53 -07:00
cmcmahon 7849be8ec0 indent/outdent is conceptually different than bullets strings
Change-Id: I8fec64d6d01148f18588a8af7336e9791f88640b
2013-09-27 09:08:37 -07:00
jenkins-bot 8fc5fd5822 Merge "Implement live preview in MWMathInspector" 2013-09-27 08:12:35 +00:00
cmcmahon 2fb1313f7e VE link not immmediately present since opt-in change, especially in Chrome
Change-Id: Ia0baff017b3b887f06182b1c8630b2270bc8823b
2013-09-26 23:11:02 +00:00
Roan Kattouw b8a0512237 Implement live preview in MWMathInspector
250ms after the user stops typing, we rerender the node with what they've
typed so far.

Bonus:
* When using MathJax, tell it which node to rerender
* Avoid crash when trying to unwrap wrapper paragraph

Change-Id: I623eef48e40d480cc98766cf7daf75dacd0bde19
2013-09-26 14:59:16 -07:00
jenkins-bot 164d16eb86 Merge "Fix timing of rerender event in GC nodes" 2013-09-26 21:46:09 +00:00
jenkins-bot bea113fee2 Merge "Introduce newFromDocumentReplace() transaction builder" 2013-09-26 20:45:54 +00:00
Ed Sanders 515ad01713 Fix timing of rerender event in GC nodes
Move the triggering of the rerender event into an overridable method
'afterRender'. Some nodes don't have the correct dimensions
immediately after rendering their DOM elements as they may need
to wait for images to load, or for a script to run (e.g. MathJax)

Change-Id: If204f665dcb2fd69d00a183279056d11188ddd74
2013-09-26 21:39:39 +01:00
jenkins-bot 52a26ebd8e Merge "make test DRY, use Before hook" 2013-09-26 19:32:00 +00:00
jenkins-bot 23dd5f9fb9 Merge "'Config' -> 'Configuration' in all comments" 2013-09-26 19:02:30 +00:00
cmcmahon 5d84372f36 make test DRY, use Before hook
Change-Id: I6f127e675a3c9e7b6126c0f052dce781d1103b52
2013-09-26 18:01:37 +00:00
jenkins-bot d01cd4cb0e Merge "Allow MWExtensionNode to render with arbitrary text/attributes" 2013-09-26 13:12:19 +00:00
jenkins-bot 9fbdd32986 Merge "Make undo work for changes to MWExtensionNodes" 2013-09-26 12:40:39 +00:00
Roan Kattouw cf17789985 Introduce newFromDocumentReplace() transaction builder
Replaces newFromNodeReplacement(). newFromNodeReplacement was very
simplistic and didn't support metadata or internal list items, so
if you had comments or references inside of the data you were editing
(reference contents or an image caption), they'd get mangled.

With this, you can do:
newDoc = doc.getDocumentSlice( node );
// Edit newDoc
tx = ve.dm.Transaction.newFromDocumentReplace( doc, node, newDoc );
surface.change( newDoc );

and that takes care of metadata, internal list items, and things like
references that reference internal list items.

ve.dm.Document.js:
* In getDocumentSlice(), store a reference to the original document
  and the number of items in its InternalList at the time of slicing
  in the created slice. This is used for reconciliation when the
  modified slice is injected back into the parent document with
  newFromDocumentReplace().

ve.dm.InternalList.js:
* Add a method for merging in another InternalList. This provides a
  mapping from old to new InternalList indexes so the linear model data
  being injected by newFromDocumentReplace() can have its InternalList
  indexes remapped.

ve.dm.Transaction.js:
* Replace newFromNodeReplacement() with newFromDocumentReplace()

ve.ui.MWMediaEditDialog.js, ve.ui.MWReferenceDialog.js:
* Use getDocumentSlice/newFromDocumentReplace for editing captions/refs
* Change insertion code path to insert an empty internalItem/caption, then
  newFromDocumentReplace into that
* Add empty internalList to new mini-documents

ve/test/dm/ve.dm.Transaction.test.js:
* Replace newFromNodeReplacement tests with newFromDocumentReplace tests

ve-mw/test/dm/ve.dm.Transaction.test.js (new):
* Add tests for newFromDocumentReplace with mwReference nodes

ve.dm.mwExample.js:
* Add data for newFromDocumentReplace with mwReference tests

VisualEditor.hooks.php:
* Add new test file

Bug: 52102
Change-Id: I4aa980780114b391924f04df588e81c990c32983
2013-09-25 21:46:38 +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
Roan Kattouw c5ccc9fcbc Allow MWExtensionNode to render with arbitrary text/attributes
The config object in GeneratedContentNode exists for this purpose,
so let's use it :)

Change-Id: I567c3eee5fc26979aa0dff93071a9c461d27058b
2013-09-24 16:57:51 -07:00
Roan Kattouw 885c0a5495 Make undo work for changes to MWExtensionNodes
If you changed the contents of an alien tag extension, then tried to
use undo, the change wouldn't be undone, but the undo state would
toggle.

This was because we only kept one copy of the data-mw object for these
nodes and modified that one copy. Instead, create a new copy every time
we modify it, so we can actually go back to previous states.

Change-Id: Ib4d5d460a6fdda9c3b0968f269585d620b47fdd8
2013-09-24 16:57:51 -07:00
jenkins-bot 1546485fed Merge "No more configuration overrides" 2013-09-24 22:11:06 +00:00
cmcmahon a855dd067a don't run VE test on beta for anon, since VE is now opt-in
Change-Id: If6690ff82c23fe69544d087efb51ae4c6b1891fb
2013-09-24 10:18:19 -07:00
jenkins-bot 9740d1683e Merge changes I9e065aa4,Iac7649f4
* changes:
  MW*ImageNode's can't take link annotations
  Node annotation blacklists
2013-09-24 00:09:22 +00: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 48c60153a6 Merge "Extend SurfaceToolbar into TargetToolbar" 2013-09-23 23:48:41 +00:00
Ed Sanders 3541502b97 Make more types of node relocatable
In this instance, MW(Extension|Reference|Transclusion)Nodes.
In general anything that is focusable should probably be relocatable
by default. We should considered this when we sorting out the
focusable/protected/relocatable mess in the near future.

Change-Id: Ifc55e251cba3e875798d5103540d02ad651399ad
2013-09-23 23:38:16 +00:00
jenkins-bot 2df047308a Merge "Use a frame wrapper for all highlights on MWBlockImageNode" 2013-09-20 23:56:05 +00:00
Roan Kattouw eb64743436 Prevent naming collisions when generating unique reference names
Simply generating ':3' as the "unique" name for the 4th reference
doesn't work. Even if getUniqueListKey() had been used, that only
checks for conflicts with names that have already been encountered
(i.e. occur in <ref> tags that precede the current one), not for
conflicts with names that first occur further down in the document.

The solution is to generate names at serialization time, when we
have full knowledge of which names are in use. Internally, we use
'literal/<name>' for names that literally appeared in the source,
and 'auto/<number>' for unnamed references. Then at serialization
time, we translate 'auto/<number>' to 'literal/:<number>' if needed
(i.e. if the reference was reused).

ve.dm.MWReferenceNode.js:
* toDataElement()
** Prefix listKey with literal/ or auto/ as appropriate
* toDomElements()
** Map auto/ listKeys to unique names
** Don't try to unset the name if not present (was unsetting a property
   that didn't exist anyway)

ve.dm.InternalList.js:
* Remove now-unused isUniqueListKey()
* Rewrite getUniqueListKey()
** Make prefix configurable
** Take previously generated unique keys into account
** Map the same old key (auto/N) to the same generated key (literal/:M)
* Add getNextUniqueNumber() as a source for auto/N numbers: previously
  used the length of the itemHtmlQueue, but that only works during
  conversion, not from the UI dialog

ve.ui.MWReferenceDialog.js:
* For new references or conflicting names, generate an auto/N key and
  let toDomElements() deal with actually mapping that to name

ve.dm.InternalList.test.js:
* Rename listKeys to new style
* Split the test case into two groups so we can test multi-group cases
* Add tests for getUniqueListKey()

ve.dm.mwExample.js:
* Rename things to new style
* Modify the test case so it attempts to trigger bug 54341

Bug: 54341
Change-Id: I726fb83e6fb66ffec643d996768a854ec9474b3d
2013-09-19 21:03:15 -07:00
Ed Sanders 2d0bf61c78 MW*ImageNode's can't take link annotations
Because there's no sane wikitext to handle that case, and Parsoid
will just output garbage.

Bug: 53151
Change-Id: I9e065aa46d88f6bed9c47127b3e002ec2e1fec5a
2013-09-19 19:09:28 +01:00
rachel99 1157b50fe8 VE bullets, numbering, indents, outdents
Change-Id: I0394c9d6f89e9a723d070b517560685d003f7bef
2013-09-18 11:53:30 -07:00
jenkins-bot 3d01a5bc85 Merge "Hide version info if not available" 2013-09-18 01:10:52 +00:00
jenkins-bot 51a1d4da39 Merge "Always use multi-part format for transclusions" 2013-09-18 00:39:54 +00:00
cmcmahon ab26c1fb2f update class for suggestion list element
Change-Id: Id4e653ec0400609d1aa19de55a7080ec122216d7
2013-09-17 17:19:41 -07:00
Roan Kattouw 9fed6b17b1 Always use multi-part format for transclusions
The Parsoid team has changed their spec to always use multi-part
format even for one-part transclusions. This commit changes VE's
output format to always be multi-part, but still accepts single-part
format on the way in.

Change-Id: I6b3156b0b599ad042bb52d7f53dcdeb1c4a0954a
2013-09-17 17:05:01 -07:00
Zeljko Filipin f4de574350 Updated Ruby gems
Cucumber 1.3.6 seems to be problematic:

gems/cucumber-1.3.6/lib/cucumber/rb_support/rb_language.rb:122: warning: redundant nested repeat operator: /^** This is a new line/

Updating the rest of the gems too.

Change-Id: Ia173312baa178a45d648fc537c8abf914144bbd5
2013-09-17 20:46:14 +00:00
Ed Sanders 4d1d632ebd Extend SurfaceToolbar into TargetToolbar
Toolbars may want to control the target as well as the surface (spoiler alert!).
The new TargetToolbar has a pointer to its target as well as its surface.

Change-Id: I928316d9e23ac3f3de3e76c34ef0ac3d27855ab3
2013-09-17 17:05:01 +01:00
Trevor Parscal 143b086c74 Scroll into view support
Objectives:

* Scroll when needed to show highlighted (with keyboard) or selected (by
  any means) options in select widgets
* Allow clipping and automatic scrolling for certain elements when they
  are otherwise going to be rendered partially out of view

Changes:

*.php
* Add links to new file

ve.ui.Widget.css, ve.ui.Dialog.css
* Removed unneeded x-axis overflow rules

ve.ui.ClippableElement.js, ve.ui.Element.css
* New mixin, adds visible area clipping support to an element

ve.ui.PopupToolGroup.js, ve.ui.MenuWidget.js
* Mixin clippable element

ve.ui.OptionWidget.js, ve.ui.OutlineItemWidget.js
* Add scroll-into-view configuration for option widgets

ve.ui.SearchWidget.js
* Scroll items into view when highlighting with keyboard

ve.Element.js
* Add getBorders, getDimensions, getClosestScrollableContainer and
  scrollIntoView static methods
* Add getClosestScrollableElementContainer and scrollElementIntoView
  methods

Bug: 53610
Change-Id: Ie21faa973a68f517c7cfce8bd879b5317f536365
2013-09-16 16:46:58 -07:00
cmcmahon daa0b10b16 VE support on beta is now reliable, run tests there
Change-Id: I82e42f24a6950680770bf6fc2b11e554d95224b6
2013-09-16 18:50:26 +00:00
Ed Sanders eeb3ac3b19 Hide version info if not available
Sometimes GitInfo returns a version ID of false if it can't
find the right files. In this case we should hide the whole
message as it is meaningless.

Bug: 53050
Change-Id: I71161df7588aa9311bc1fdf6b064cc6d8c155f61
2013-09-16 16:53:20 +01:00
Ed Sanders 4f768f3734 Integrate with BetaPreferences
Look at logo Michael.

Bug: 52686
Change-Id: I3cfada2ea264184698de5f322c1fe5041b37b8c8
2013-09-10 10:20:14 -07:00
Inez Korczyński 988f518ced Define RDFa types in ve.dm.MWInlineImageNode once and reuse whenever possible
Change-Id: I62ec12a6b71b60b15a4200722b8963d4cfd1b582
2013-09-09 13:04:08 -07:00
Roan Kattouw c183d09bcf Delete ve-mw/test/index.php, it's broken and unmaintained
Change-Id: I5153fde7897b5d6c3d6f1222c3c56593d256dac7
2013-09-09 11:32:36 -07:00
cmcmahon 6a91695c59 update tests for latest release- no issues found
Change-Id: I84830927a72a908fa4b676ccdbbd33afd8835638
2013-09-06 11:23:45 -07:00
David Chan 8a2b55321c docs: Minor improvements
CODING.md
* Document the procedure for adding a new javascript class

ve.dm.MWExternalLinkAnnotation.js
ve.dm.MWInternalLinkAnnotation.js
ve.dm.ElementLinearData.js
ve.dm.LinearData.js
* Add whitespace line before preformatted code to fix a
  rendering bug

Change-Id: I54443ea3d4799328655d279f379d4ddc176c50a0
2013-09-05 23:56:59 +00:00
jenkins-bot c0fe8b877c Merge "Apply DOM changes in onProtectedSetup and onProtectedTeardown instead of constructor" 2013-09-05 22:57:53 +00:00
Inez Korczyński 7f9fa4f0e5 Define RDFa types in ve.dm.MWBlockImageNode once and reuse whenever possible
Change-Id: Iebb2081dee4555f459adaa4cb9b802c283cf4827
2013-09-05 15:52:07 -07:00
Inez Korczyński 301b287515 Apply DOM changes in onProtectedSetup and onProtectedTeardown instead of constructor
It's important in case of replacing root element ($) of a node, so new element
does have CSS class and contenteditable property set.




Change-Id: Icf14e2164e89114e6b7c10672b782d02f4c5daac
2013-09-05 22:05:23 +00:00
jenkins-bot 0333d87fd3 Merge "Exclude tools from catch-all menu in media and reference edit dialogs" 2013-09-05 04:59:38 +00:00
jenkins-bot a55b374475 Merge "Reference core bug 53774 in bug 49000 comment" 2013-09-05 04:55:48 +00:00
Trevor Parscal d5e7a7ef95 Exclude tools from catch-all menu in media and reference edit dialogs
Change-Id: Ic3c94099fa1db5b1a40ac2a2dbf17562cb36c73b
2013-09-04 17:32:50 -07:00
jenkins-bot feff1fbc24 Merge "Improve welcome dialog support for large fonts" 2013-09-04 23:02:05 +00:00
jenkins-bot 9d67f41ca7 Merge "Insert images after selection, not in place of it" 2013-09-04 23:00:03 +00:00
Trevor Parscal 0c42e51c8f Improve welcome dialog support for large fonts
Objective:

* Make the welcome dialog work with smaller fonts by increasing its
  size a bit, and also making its contents scroll vertically if needed

Changes:

ve.ui.MWBetaWelcomeDialog.js
* Move content into a scrollable and padded panel layout element

ve.ui.MWDialog.css
* Remove padding, now provided by panel layout

ve.ui.Dialog.css
* Remove min-height override, inherited value is fine
* Use max width and height instead of setting them directly

Bug: 52667
Change-Id: Ie35b041e13ef18ffcacef6d9e70439e4e1351e0a
2013-09-04 22:58:52 +00:00
jenkins-bot 8dfa827a97 Merge "ve.EventSequencer: Post-event listening" 2013-09-04 20:08:42 +00:00
James D. Forrester 4da68b71d1 Reference core bug 53774 in bug 49000 comment
Bug: 49000
Bug: 53774
Change-Id: I1f26c7ac770daca06ae3c87742c1b3e3d2b17e41
2013-09-04 13:07:27 -07:00
David Chan 793172e41e ve.EventSequencer: Post-event listening
modules/ve/ve.EventSequencer.js
* Class to sequence pre-event and post-event listening correctly

demos/ve/eventSequencer.html
* Plain HTML example page for testing EventSequencer and event sequences

Change-Id: I4ddb10a30c2f44015136a7978a185d0b13f0690b
2013-09-04 11:20:46 -07:00
Timo Tijhof 298afbf337 mw.ViewPageTarget.init: Don't add class ve-available when unavailable
In commit e1f8ee7 the return statement was moved into the
userPrefEnabled check, however addClass( 've-available' ) was
still unconditional. This has now been restored.

Change-Id: Ia59bfed93a8849a529cc3b9d1d2e0619d65240d4
2013-09-04 17:58:13 +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 c457d8afcc Add keyboard shortcuts for formatting tools
Objective:
* Add keyboard shortcuts for paragraph, heading 1-6 and pre-formatted

Testing:
* Using [control+num] triggers appears to work well on Chrome, Safari, Firefox and Opera on Mac

Changes:
ve.init.Target.js, ve.init.mw.ViewPageTarget.js
* Add formatting commands to targets
ve.ui.MWFormatTool.js
* Add mediawiki specific format tools and commands
ve.ui.CommandRegistry.js
* Add commands for all formatting tools
ve.ui.TriggerRegistry.js
* Add triggers for formatting tools

Bug: 33512
Change-Id: I5d6176eff50aa3cea72aed226ca06512629412d4
2013-09-03 17:17:03 -07:00
Trevor Parscal d377f3e495 Insert images after selection, not in place of it
Bug: 52460
Change-Id: I69ce4c2473d57fd585df0c602359c1d0f60a58f7
2013-09-03 13:37:43 -07:00
Trevor Parscal 8dfbc5baa5 Make tools generic and add fancy tool groups
Objectives:

* Got rid of mw prefixing in tools, inspectors and dialogs
* Simplify tool classes so they can be generically used as items in bars, lists and menus
* Add support for a catch-all toolbar group
* Simplify tool registration, leaning on tool classes' static name property
* Move default commands to command registry
* Move default triggers to trigger registry
* Get language tool working in standalone

Change-Id: Ic97a636f9a193374728629931b6702bee1b3416a
2013-09-03 11:27:39 -07:00
jenkins-bot a8879e1c47 Merge "Include param label in search index" 2013-08-31 00:48:35 +00:00
Ed Sanders 9ab79330c7 Round trip alien extensions correctly when edited
ce.MWExtensionNode
* Build up the wikitext for round-tripping using jQuery, and pass
  through the attributes from data-mw

dm.MWExtensionNode
* Use a static getExtensionName to correctly get the extension
  name from the dataElement (as the getMatchRdfaTypes hack won't
  work for MWAlienExtensionNode's)

dm.MWAlienExtensionNode
* Implement new static getExtensionName function

Bug: 53543
Change-Id: Id4e83c14ec68c3b3970d05317477f19aaf31abe4
2013-08-30 16:43:50 -07:00
Ed Sanders c139b3c2cb Use a frame wrapper for all highlights on MWBlockImageNode
This prevents the highlight for a centred image being full width.

Change-Id: I4d5a46766276e36f5720f330a5a856fe2906cd72
2013-08-30 16:32:24 -07: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
jenkins-bot 3d2a33855c Merge "Re-build reference search index so they can be used mid-edit" 2013-08-30 19:12:23 +00:00
Trevor Parscal ac77d33c9e Re-build reference search index so they can be used mid-edit
The search index was only being built on initialization, rather than at
the time the list was being shown. By moving it to be built on open
the list will always be fresh. Also, just after building the index, we can
enable/disable the select existing button based on the number of
results.

Bug: 51689
Bug: 51848
Bug: 52000
Change-Id: Ib38b1b227edc3d61dc49fa58999358e7adf11b08
2013-08-30 19:09:47 +00:00
jenkins-bot 651ce4a55b Merge "Expose version information in the client" 2013-08-30 18:53:19 +00:00
jenkins-bot bc9205e0cc Merge "VisualEditor: RTL entries don't receive dir="rtl" in Page settings / Languages" 2013-08-30 18:26:55 +00:00
cmcmahon 88504aa3d9 use regexp anchors to prevent false matches
Change-Id: Ib13b85986e3df431b0f900fea38165197411370e
2013-08-30 17:28:40 +00:00
Pavel Selitskas 1084cdb350 VisualEditor: RTL entries don't receive dir="rtl" in Page settings / Languages
We call isRedirect to get the real language code instead of the site code.
Post-factum, lang attribute is added as well for each entry.

Bug: 53503
Change-Id: Ia6bf63a7cbe3c7b99ed05d0bd0fdd33190550c98
2013-08-30 14:39:45 +03:00
Ed Sanders a72099af66 Expose version information in the client
By passing in the information via a ResourceLoaderModule this
gets around any concerns with performance (version information
is read from the file system).

The version information is appended to the beta toolbar dialog.

Bug: 53050
Change-Id: I7836e1d4003416cbb7e18e3435aa87d82fd5c2e2
2013-08-29 18:19:40 -07:00
Timo Tijhof bdd1a73eaa data: Rename MessagesModule to DataModule
Also..
* removed an incorrrect comment referring to the old module
  name (standalone didn't use the VisualEditorMessagesModule).
* made it use debug mode to determine whether to minify or
  prettify the js code.

Change-Id: I493007649fba27e7faab0cf743eded5f68714c50
2013-08-29 18:07:35 -07:00
jenkins-bot 0cdcf2d155 Merge "Always give references names. Ignore if used once." 2013-08-29 18:26:04 +00:00
jenkins-bot 0ae19ffa40 Merge "Set contentEditable using jQuery#prop" 2013-08-29 17:54:56 +00:00
Ed Sanders 98cad0f410 Set contentEditable using jQuery#prop
Also always use strings 'true'/'false' for the value, because
it is a string property (spellcheck, however, is a boolean)
and always use a capital second 'E' in the name.

Change-Id: Ia4e1f9edfd8f236fe81df190e6a68729d7b52243
2013-08-29 09:59:55 -07:00
jenkins-bot 53eda266d9 Merge "Add dual detection for types that Parsoid is about to rename" 2013-08-29 00:55:50 +00:00
jenkins-bot 1375c48488 Merge "Move contentEditable=false to protected node" 2013-08-28 23:33:09 +00:00
jenkins-bot 4493ca1f48 Merge "Rename 'DOM Changes' => 'DOM changes'" 2013-08-28 23:32:25 +00:00
Roan Kattouw 4d91e4edbf Add dual detection for types that Parsoid is about to rename
Bug: 53432
Change-Id: If404585f9a118b4155ceb46fbe8e467b41ec6b29
2013-08-28 16:30:20 -07:00
Ed Sanders 458f8d1a82 Move contentEditable=false to protected node
Because that's where it should be.

Bug: 53507
Change-Id: I9afffea238a774b884d4d2434d3523e4c4e445b2
2013-08-28 16:18:55 -07:00
Ed Sanders e0018e8e94 Rename 'DOM Changes' => 'DOM changes'
Because we don't use title case in comments

Change-Id: I5cdd3241aba0727a3cd5d0ded972ae54abf1efd0
2013-08-28 15:55:35 -07:00
Zeljko Filipin 8f7e9c27a7 Moved VisualEditor Selenium tests from browsertests repository
Requested by James Forrester at QA mailing list:

http://lists.wikimedia.org/pipermail/qa/2013-August/000339.html

Bug: 53467
Change-Id: I915b4e41d32c9190ccea73f2b3bce9a53918fe80
2013-08-28 20:14:21 +00: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
Ed Sanders f50102f521 Disable inserting/changing references when surface widget is empty
This listens to change events on the surface and checks to see if
there is more than just an empty paragraph node.

Bug: 53345
Change-Id: Ic8fa84d7cdcbffd154178939d0ec8c2c4f86c415
2013-08-27 17:18:52 -07:00
Timo Tijhof d0d0e156b8 doc: Restore and clean up documentation for Platform subclasses
- Added missing @inheritdoc so that generated documentation is
  not empty.
- Fixed type of mw.Platform#getMessage from (implied) @property
  back to @method.
- Removed notes from mw methods. They are prepended instead of
  appended, thus overriding the useful single-line summary
  of the method with this random note. Description should either
  be replaced entirely (e.g. no @inheritdoc) or inherited.
- Rephrased a few description to be consistent with the others
  (e.g. "Get .." and "Add .." instead of "Gets .." or "Adds..").

Follows-up cbe35632f1.

Change-Id: Ie55bb9e18f1524b706f0e195300170e4d552bf73
2013-08-26 12:47:28 -07:00
jenkins-bot 3f7761d242 Merge "Modify regex to allow section links as valid titles" 2013-08-22 21:21:55 +00:00
Amir E. Aharoni b10b5143ff Reverse the progress image for RTL
The reversed image was created by Ebraminio using
convert loading.gif -flop loading2.gif

Bug: 51401
Change-Id: I264d9368cf8fd030ff34540e50e0038aa42ece16
2013-08-22 23:46:59 +03:00
Ed Sanders 227f214610 Modify regex to allow section links as valid titles
Bug: 53219
Change-Id: I552d0128de2c1ca683e30ae6d4b9fb137b827c7d
2013-08-22 19:24:16 +01:00
Trevor Parscal 3886821b9b Use mw specific names for commands
Objective:

* Use the MW link specifically, since the target/command system doesn't
  understand the group/id/extension concept yet

Change-Id: I8b756fa0bb55468312bb30d45ac5b943ff7362b5
2013-08-21 23:53:53 +00:00
jenkins-bot ffdbc92a41 Merge "Toolbar API" 2013-08-20 23:17:42 +00:00
Trevor Parscal 332e31fb00 Toolbar API
Objectives:

* Make it possible to add items to toolbars without having to have all
  toolbars know about the items in advance
* Make it possible to specialize an existing tool and have it be used
  instead of the base implementation

Approach:

* Tools are named using a path-style category/id/ext system, making them
  selectable, the latter component being used to differentiate extended
  tools from their base classes, but is ignored during selection
* Toolbars have ToolGroups, which include or exclude tools by category or
  category/id, and order them by promoting and demoting selections of
  tools by category or category/id

Future:

* Add a way to place available but not yet placed tools in an "overflow"
  group
* Add a mode to ToolGroup to make the tools a multi-column drop-down style
  list with labels so tools with less obvious icons are easier to identify
  - and probably use this as the overflow group

Change-Id: I7625f861435a99ce3d7a2b1ece9731aaab1776f8
2013-08-20 16:08:26 -07:00
jenkins-bot 841a414c31 Merge changes Id2328d6e,I840b689d
* changes:
  Remove language variants from bold/italic now we have fallbacks
  Implement fallback langauges
2013-08-20 21:38:33 +00:00
jenkins-bot cd5ee730ab Merge "Remove duplicate comments from platform code" 2013-08-20 21:25:48 +00:00
Ed Sanders 069b757afc Implement fallback langauges
Return an array of languages instead of a single language. Languages
containing hyphens return themselves along with the root code e.g.
'en-GB' => ['en-GB', 'en']

Change-Id: I840b689d0021d865f93d16d075473a2ed0a9f0d8
2013-08-20 20:12:46 +00:00
Ed Sanders cbe35632f1 Remove duplicate comments from platform code
Inherited methods don't need to repeat documentation.

Change-Id: I05c4efe8e4a394411922add5f11259d47d44e3bb
2013-08-20 21:12:33 +01:00
jenkins-bot 515283d142 Merge "Correct unicode range in legal title regular expression" 2013-08-20 18:28:36 +00:00
David Chan f9c41c754b Correct unicode range in legal title regular expression
The old regex was lifted from PHP, which matches on UTF-8 byte sequences.
In PHP, [...\x80-\xFF]+ matches any bytes with the high bit set, which
by the particular properties of UTF-8 will match any sequence which
represents a Unicode character above U+007F.

In Javascript, regex matching is on UTF-16 Unicode code units, so we
don't have to do byte sequence matching (and cannot do so). So the
equivalent Javascript regex should use [...\u0080-\uFFFF]+, to match any
code unit above U+007F directly. (It also matches surrogate pairs, by
the particular properties of UTF-16, so any Unicode codepoint above
U+007F is matched).

Change-Id: I674b89f757b60331dd1cb23fd7ff8b18775012e9
2013-08-20 18:03:38 +00:00
jenkins-bot 34b143eb36 Merge "Increase line height in beta warning" 2013-08-20 17:30:42 +00:00
Ed Sanders b6443b262c Preserve selection when inserting references
Some browsers (e.g. Firefox) change the CE range when the dialog
is opened, so after the first surfaceModel change (to modify the
internal item) the surface's selection is modified, and the reference
is inserted in the wrong place.

Bug: 52159
Change-Id: Ia5da33b95a599ba78f308cf0554279ad44616f50
2013-08-20 18:18:37 +01:00
Ed Sanders f25d34d0a6 Minor syntax error
End of line comma instead of semi-colon.

Change-Id: I6e8d56e378b2a0f8846d18c413b0cccfb9b780d0
2013-08-20 18:06:28 +01:00
Ed Sanders 4a3cc06ac5 Increase line height in beta warning
See bug for screenshots.

Bug: 53045
Change-Id: Ia4e97f42786cb8ced9ab1c94b1cce9f4abd17750
2013-08-19 20:22:18 +01:00
Ed Sanders 708d8b5e67 Build link-less images with <span> not <a>
toDataElement part fixed in  I6d496f7. This fixes the
toDomElement part so we don't trigger a round trip warning.

Bug: 51963
Change-Id: I27a7579890d669a8b980710db1bafe066b744236
2013-08-16 20:03:46 +01:00
jenkins-bot 916d1c2b69 Merge "Create a subscript tool" 2013-08-16 02:16:25 +00:00
jenkins-bot c01499fb66 Merge "Create a superscript tool" 2013-08-16 02:15:42 +00:00
jenkins-bot ffc513fcf3 Merge "Create an underline tool" 2013-08-16 02:13:02 +00:00
jenkins-bot db16e7ce72 Merge "Fix traversal for images with link=''" 2013-08-16 01:24:51 +00:00
Ori Livneh 825322d4ac Use internal ve.track to log events
This patch rounds off change I29740fa7a by replacing calls to EventLogging's
eventLog.logEvent with calls to VisualEditor's ve.track. ve.track publishes
events by providing an interface, ve.trackRegisterHandler, which event handlers
use to subscribe to VisualEditor events. By making it the responsibility of the
web analytics framework to register itself as a handler, VisualEditor can
remain decoupled from (and indeed ignorant of) any particular event logging
implementation. This allows VisualEditor to be integrated with many different
web analytics platforms with nothing more than a bit of glue code for mapping
ve's event semantics to those of the target platform.

The practical difference that this makes is that it frees VisualEditor from
having to know about EventLogging or from having to load EventLogging
components, which means we can remove quite a lot of gnarly code. My current
plan is to migrate the code for registering and loading the 'Edit'
schema module to Extension:CoreEvents, which is also where I'll commit the
handler for VE events. (CoreEvents exists precisely to provide an organized
place for persistent but WMF-particular instrumentation.)

Once this patch is merged and deployed, the following two configuration
variables may be removed from mediawiki-config:

- $wgVisualEditorEnableSplitTest
- $wgVisualEditorEnableEventLogging

Change-Id: Idfdf692668d2adfbe029e8f0c4ff9e96c60ff741
2013-08-15 19:43:36 +00:00
James D. Forrester 23af88edc3 Create a subscript tool
Bug: 51612
Change-Id: Ia05e09a411213cbc035ad9dd3d3156d57f8e102c
2013-08-15 19:40:15 +00:00
Ed Sanders 67f09a0318 Fix traversal for images with link=''
We were assuming images were wrapped in <a> tags. Images with
link='' are only <span> wrapped.

Bug: 51963
Change-Id: I6d496f719cfbbc7556c55f0a660cb192040f29de
2013-08-15 20:36:49 +01:00
James D. Forrester 34a37471c6 Create a superscript tool
Bug: 51611
Change-Id: I74b6418542927eeeb7e80d664a30fcaf07b93a13
2013-08-15 12:36:35 -07:00
Steven Zhang 3c65d830f2 Create an underline tool
Bug: 51609
Change-Id: I65246d7eeb154950c35a1cb70909a113080c2323
2013-08-15 12:16:01 -07:00
Ed Sanders 37b461fe56 Reposition context menu after rerender
Add rerender event to all image loads in MWExtensioNode.
MWHieroNode's implementation of onParseSuccess is now the same as
its parent so can be deleted.

Change-Id: Iaa4999372f1ba88a7bdf1490fc3f8640af77ceae
2013-08-15 10:43:31 +01:00
Ed Sanders 6fb65ec3a1 Fix MWAlienExtensionNode's extensionName in ce update
Create getter for extensionsName which is overriden by
MWAlienExtensionNode.

Also removed angle brackets around Alien title as the inspector
already has an angle bracket icon, and a '<' close button.

Change-Id: Ice8c5d73ed621f8e585b5f372788666f8c5aeb50
2013-08-15 10:40:58 +01:00
Ed Sanders 9582432c4c Fix logical conflict from I8feefd9e8
onUpdate was renamed to update. Also neither event was
actually implemented so have just removed them.

Change-Id: Iaae1661a99f97272fa42c71223fc2cb832d50c66
2013-08-15 10:18:22 +01:00
jenkins-bot 71f4472d34 Merge "mw.Target: Removed unreachable badtoken recovery code" 2013-08-15 08:40:08 +00:00
jenkins-bot 2c4e9d8323 Merge "Support previews and concurrent updates in ce.GeneratedContentNode" 2013-08-14 22:00:12 +00:00
jenkins-bot c84c47aeba Merge "Prevent the creation of invalid MWInternalLinks" 2013-08-14 21:58:27 +00:00
Ed Sanders 599ad772ed Allow inspectors to not show the delete button
This functionality makes sense for annotations, but not for extensions.

Change-Id: I64fea941f8e01d0464eb9a045257f4810d789d60
2013-08-14 18:50:39 +00:00
jenkins-bot ddf748e53b Merge "Generic support for multiple tags in TextStyleAnnotation" 2013-08-09 04:42:32 +00:00
Ed Sanders 00c681f0d9 Generic support for multiple tags in TextStyleAnnotation
Bug: 52477
Change-Id: If8e2f541adb045f9b84a913829a5b7430ca83299
2013-08-09 04:15:45 +00:00
Ed Sanders ad3a7c95c8 Alien extensions
VisualEditor.i18n.php, VisualEditor.php
* Button title
* New experimental files

ve.*.MWAlienExtensionNode.js
* Very basic extension of ve.*.MWExtensionNode

ve.ui.MWAlienExtensionInspector.js
* Default to inline-block for wrapper. Should probably
  get rid of styled wrappers for GeneratedContent eventually.

ve.ui.MWAlienExtensionInspector.js
* Basic extension of MWExtensionInspector. Override title to
  use tag name e.g. '<easytimeline>'. Could be changed in future
  to 'Extension: easytimeline' or similar.

*.png, *.svg, *Icons*.css, ve.ui.MWAlienExtensionButtonTool.js
* Angle bracket icon for button (open to suggestions)

ve.ui.MWInspector.css
* Make extension inspector text input tall by default.

Change-Id: I07f0686839192cad3cd8dfd3233ae907fe5cdf6a
2013-08-08 14:27:49 +08:00
Roan Kattouw 7673a39878 Support previews and concurrent updates in ce.GeneratedContentNode
GeneratedContentNode didn't track concurrent updates at all, so a
race condition was possible: if the node was updated a second time
before the first update had been rendered, the second update might
render first and then be overwritten by the other one.

To prevent this, we track the promise associated with the current
render. If a new update is launched while a previous one is still
pending we attempt to abort the old one by calling .abort() on it,
and ignore any future resolution or rejection from it.

Also allow rerenders based on non-model data by calling
.update( { config object } );

Change-Id: I8feefd9e8fb6c41d06b8b20131e3be5e37954e83
2013-08-08 11:34:50 +08:00
jenkins-bot 32734767fc Merge "clean up: Consistently use MW instead of Mw in constructor names" 2013-08-07 10:29:03 +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
Ed Sanders 0d1617a627 Hieroglyphics support
Mostly as a demonstration of how easy this is with MWExtensionNode.

The icon was chosen with the following criteria:
1. Recognisable (the ankh is quite common in popular culture, right?)
2. Doesn't look idiotic to academics (I've consulted an Egyptology
   PhD and they can confirm it's not the glyph for penis)
3. Renders well at <16x16

That said it does look a little like a stick man...

Bug: 43118

Change-Id: I9f9e8af501401866bfeecf0eec3690a705fbd4db
2013-08-07 09:43:04 +00:00
Ed Sanders 671c7d3b25 Create base MWExtensionNode for simple extension support
MWMath and other simple extensions all behave in a similar way, e.g.
<tagname>Foreign syntax</tagname>.

This creates a base class that should make supporting such extensions,
and editing their contents in a plain text box, very simple.

Change-Id: Icc0acb33fe32704f71dacb552d9dfa3142eaef2b
2013-08-07 17:39:31 +08:00
peter-coti 5014e122e3 Create strikethrough text style button
Experimental to avoid making toolbar too long

Bug: 51610
Change-Id: I1eb5b1361d6058a6e1533ab62c0aa7e21c9fc090
2013-08-07 16:14:19 +08:00
Trevor Parscal 2717ea1645 Add ve.ui.ToolGroup and use within toolbar setup
Objectives:

* Use a class for toolbar groups to add more functionality later
* Rename addTools method to setup

Changes:

*.php
* Add link to new file
* Move ui element classes up for more general use

ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js, ve.ui.Context.js,
ve.ui.SurfaceWidget.js
* Update use of addTools method

ve.ui.Tool.css, ve.ui.Toolbar.css
* Move styles between sheets

ve.ui.Toolbar.js
* Rename addTools to setup
* Use ve.ui.ToolGroup objects when building tools

ve.ui.ToolGroup.js
* New class, encapsulates tools

Change-Id: Ic3a643634a80a8ac7d6f6f47f031d001c7efaee7
2013-08-07 05:08:20 +00:00
jenkins-bot ed5917faae Merge "Update reference to renamed init.setupSectionEditLinks method" 2013-08-05 09:20:14 +00:00
Matthew Flaschen ccd9889cd7 Tweak comment to explain isAvailable and what mw.libs.ve means
Change-Id: Ie5df644b0e70871345950afa188545279c3ee91c
2013-08-04 14:11:25 +00:00
Timo Tijhof 293b707acd Update reference to renamed init.setupSectionEditLinks method
Follows-up e1f8ee7890

Change-Id: Ib9e6c8cf472f656052adca4fbd87630ec1aaf697
2013-08-04 16:09:04 +02:00
Ed Sanders 8c77b802b3 MWMath: Fix broken usage of old ve.copyArray method
Was missed or conflicted during the migration to ve.copy.

Change-Id: I2bb528212043a1be65ca9ae5b514981e18749fa2
2013-08-03 13:13:47 +00:00
Timo Tijhof 9e687efdf9 ve.ce.MWTransclusionNode: Check for API errors
See ApiVisualEditor.php#parsefragment.

Error code is also incorrectly about Parsoid, method
parseWikitextFragment does a FauxRequest to MediaWiki. Fixed
error.info. Keeping the same error.code for now for consistency.

Bug: 52483
Change-Id: Ic473ae4a5c1e9706140f6ec4cc8157fadd02c318
2013-08-03 00:35:42 +02:00
jenkins-bot 686e134b41 Merge "Split ve.ui.Toolbar and ve.ui.SurfaceToolbar" 2013-08-02 21:37:07 +00:00
Trevor Parscal a226716d70 Split ve.ui.Toolbar and ve.ui.SurfaceToolbar
Objective:

* Make it possible to make a toolbar without a surface

Changes:

*.php
* Links to new file

ve.ui.Toolbar.js, ve.ui.SurfaceToolbar.js
* Split toolbar into generic and surface specific classes

*.js
* Update symbol names

Change-Id: Ice063a2fb67b5ce5155cdc96a0d47af49eee48cb
2013-08-02 14:33:25 -07:00
jenkins-bot dbfe499d25 Merge "mw.ViewPageTarget.init: Setup "source" links even if VE is not available" 2013-08-02 21:02:40 +00:00
Timo Tijhof e1f8ee7890 mw.ViewPageTarget.init: Setup "source" links even if VE is not available
Follows-up ced2a8a which moved the tab layout to the server-side
and changed it to set up "source" tab and section links always
everywhere (even if VE would not be availabe in the namespace
or browser).

The JS logic (which continues to exist to take care of pages
cached before we moved it to PHP and/or to fix up pages cached
with a different configuration in the future) didn't do this yet
causing the "Edit source" tab to inconsistently appear on pages
for anonymous users viewing pages where VE is not available.

Change-Id: Ic575b3fcef17e636adaa338abc7748a4388ed9a9
2013-08-02 22:25:44 +02:00
jenkins-bot 31e3fe5ab6 Merge "Make the link to the user guide open in a new window" 2013-08-02 20:04:55 +00:00
James D. Forrester ceb62980ed Make the link to the user guide open in a new window
Bug: 52475
Change-Id: Ia83ec459edb730bbc2adf5712586fdac269b7e00
2013-08-02 12:53:09 -07:00
jenkins-bot cd9c38aa9a Merge "Remove inserted leading whitespace" 2013-08-02 19:03:52 +00:00
Ed Sanders f153f932a2 Remove inserted leading whitespace
This is bit of a hack, as leading whitespace could be
significant if styled with white-space:pre.

Long term VE shouldn't be editing the user's HTML, and
should just highlight potential formatting issues.

We avoid the stripping in preformatted elements as we
expect they will have that styling.

Bug: 51462
Change-Id: I654d98e17dd604cb2a192831ff3f3597f95b9962
2013-08-02 19:01:22 +00:00
Ed Sanders 0fdd124a17 Allow more things to be inserted into captions
Specifically: transclusions, formulae & references.

Captions also allowed to contain other images and reference lists
but we should probably not encourage that.

Change-Id: Ia1c99e51640a3f9ee53281a1e3ebd67dc13c8990
2013-08-02 18:55:53 +00:00
Ed Sanders 926db97d64 Only skip past empty keyedNodes sets if key exists
Otherwise unkeyed references won't be listed!

Bug: 52427
Change-Id: I8bbce955f584cca046e23d07aab8440f1e733657
2013-08-02 17:32:42 +01:00
jenkins-bot 390ce7db3f Merge "Beta welcome dialog" 2013-08-02 04:12:06 +00:00
jenkins-bot 07a513ac9d Merge "Move edit tab generation into PHP and make it more configurable" 2013-08-02 04:10:46 +00:00
Rob Moen 5231d05bbe Beta welcome dialog
For configured wikis, show a dialog that welcomes the user to the
amazing and fantabulous world of VisualEditing, which is not only full of
wonderment and joy but also may lead to increased popularity and love.

The dialog only shows up once (uses a cookie).

Change-Id: I8e7c4dc2c63b36594378a543b9d66291395eebcf
2013-08-01 21:08:15 -07:00
Roan Kattouw ced2a8aa59 Move edit tab generation into PHP and make it more configurable
* Generate the edit tabs and the section edit links in PHP, with a
  fallback in JS for cases where we don't have them yet due to
  caching. But only change things if VE is enabled, and have the JS
  correct the state if the wrong cached HTML comes through.
* Make the order of the tabs/links and the messages to use as captions
  configurable
* Make the edit tabs and section edit links always be present in the
  page (regardless of namespace, user prefs, etc.) but be hidden and
  have JS unhide them (using html.ve-available) if appropriate
* Add appendix messages so we can do a superscript "beta" even in places
  where we can't use HTML in the message

VisualEditor.php:
* Add new hook registrations
* Remove edit link caption messages from the init init module because
  they're now added dynamically in VisualEditor.hooks.php
* Add a noscript CSS module so we can hide some things in JS-less
  environments
* Remove $wgVisualEditorTabLayout and replace it with
  $wgVisualEditorPosition
* Add config vars for link captions, with null causing us to use
  the default caption
* Add config vars for link caption appendices. Too many config vars
  but we'll clean that up later

VisualEditor.hooks.php:
* Dynamically add tab messages to the init init module
* Remove unused globals in onBeforePageDisplay()
* Add noscript CSS module
* Add a SkinTemplateNavigation hook that changes and reorders the edit
  tabs as appropriate
* Add a DoEditSectionLink hook that overwrites the edit section links
* Export the new config variables to JS

VisualEditor.i18n.php:
* Add beta appendix message
* Add a message for the default VE edit section link

ve.init.mw.ViewPageTarget.init.css:
* Remove the animation on the edit section links
* Darken the color of the brackets and the pipe from #ccc to #555
* Style the beta message to be superscript-like (but not real <sup> to
  avoid moving the baseline)

ve.init.mw.ViewPageTarget.noscript.css:
* Hide the VE edit tab, the pipe and the VE edit section link initally
  unless and until JS unhides

ve.init.mw.ViewPageTarget.init.js:
* Toggle .ve-not-available / .ve-available
* Edit tabs
** Only generate the the edit tabs if they're not already there from PHP
** Rewrite the edit tab generation to mirror what's being done in PHP
* Section edit links
** Same as for edit tabs
** Also add mw-visualeditor-expanded to pad the brackets

ve.init.mw.ViewPageTarget.js:
* #ca-ve-edit is now always the VE tab (and #ca-edit always the
  edit source tab) so update the .selected behavior accordingly

Change-Id: Idcb15faea7fabe5fe7578b1508079969b27d2469
2013-08-01 21:08:13 -07: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 87bfe3ee09 mw.ViewPageTarget.init: Fix pageExists/isViewPage behaviour
"Let me clarify this for you" - Timo

Follows-up 1984c3ca46.

Bug: 49000
Change-Id: Ia094aa9aae1da1ba11dbaef827e305cbcf08f9b4
2013-08-01 23:58:10 +00:00
Ed Sanders 1984c3ca46 Fix edit links on special pages
Added wgIsArticle to isViewPage checks, otherwise we were attempting
to load VE dynamically on Special:Move/Delete, which resulted in a
broken h1 title and odd behavior off the 'Read' tab.

Also added !wgIsArticle to pageExists. This is a bit of a hack because
we don't have any info on page existence in the JS on these pages
(I think?). But it's better to display 'Edit' for a page that doesn't
exist, than 'Create' for a page that does.

Bug: 49000
Change-Id: Ib47e5524d41e6066b362e0f5645750c769de5193
2013-08-01 23:14:51 +01: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
jenkins-bot ee858eddb3 Merge "Use new class to detect Cite errors inside templates" 2013-08-01 03:10:43 +00:00
Ed Sanders 2ba8f8c8b5 Use new class to detect Cite errors inside templates
Bug: 51337
Change-Id: I1cd9e2beaa64a84ddc6d690fbc483f16d9350b68
2013-08-01 03:09:06 +00:00
Timo Tijhof 9e89c019f1 mw.ViewPageTarget.init: Don't depend on mediawiki.user
Follows-up 5036099. We don't have that dependency.

Change-Id: I2bdf397a0e575f3f0fb82b905c92c34278b39037
2013-08-01 03:46:49 +02:00
Timo Tijhof ac6c4da3a7 doc: @return -> @returns
Follows-up 8f05cdbf70.

Change-Id: Id2b68e521ab68862f0f635925708a35d10795342
2013-08-01 02:10:23 +02: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
jenkins-bot 21f443321c Merge "doc: @inheritDoc -> @inheritdoc" 2013-07-31 22:07:38 +00:00
jenkins-bot dd3d41841d Merge changes I9ca43005,I68f9258f
* changes:
  ve.init.mw.ViewPageTarget.init: Pass default values
  VisualEditor.hooks: Sort keys
2013-07-31 22:06:38 +00:00
jenkins-bot cbf46c0f5c Merge "ve.ui.Toolbar: Emit position event on toolbar instead of surface" 2013-07-31 22:04:01 +00:00
Timo Tijhof c9cd496fdc ve.ui.Toolbar: Emit position event on toolbar instead of surface
mw.ViewPageTarget is currently getting events from both the
platform target toolbar and context menu toolbar because the
event is emitted from within the toolbar to the surface.

Instead we're now emitting it on the toolbar itself and it is up
to the binder to access the correct one and listen to its events.

Bug: 52317
Change-Id: Ibd8053768e82b1df91081bd77a172628ea855db7
2013-07-31 21:59:30 +00:00
jenkins-bot f50086b2da Merge "mw.ViewPageTarget: Emit position event after toolbar is animated" 2013-07-31 21:58:46 +00:00
jenkins-bot bc78624cfe Merge "Add ve.now utility function" 2013-07-31 21:56:56 +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
jenkins-bot ed8133e317 Merge "Link inspector bug fixes" 2013-07-31 20:54:46 +00:00
Timo Tijhof 5036099906 ve.init.mw.ViewPageTarget.init: Pass default values
Though this is already handled by Ie50b63ba5064e85d26 for the
server-side, and that should automatically reflect to the
client-side. Since we're dealing with cache conditions in
wmf-production where the user.options manifest does not yet
contain an entry for these relatively new preferences, lets
transfer the default value here as well. This does not affect
logged-in users (since their user options are always up-to-date
and embedded in the page).

Also made ve.support.es5 be casted to boolean. Previously it
would be a reference to JSON.stringify (if supported), or the
bottom value of whichever feature the browser didn't support.
Doesn't change any behaviour but should make things slightly
more performant when this value is evaluated.

Change-Id: I9ca430051ae6f4e603c2d89982e540e455055255
2013-07-31 20:46:45 +00:00
Ori Livneh ca98a473c2 Add ve.now utility function
On browsers that implement the Navigation Timing API, performance.now()
provides values with microsecond precision that are guaranteed to be monotonic
(i.e., they are not subject to skew due to changes to the system clock).
This patch adds a `ve.now` utility function that will use this API when it is
available and fall back gracefully to `Date.now` when it is not.

Change-Id: I377025fcb23cb26399b9e437e33c8afa138916af
2013-07-31 13:42:08 -07:00
Timo Tijhof 301eaa4088 mw.ViewPageTarget: Emit position event after toolbar is animated
In target#setUpSurface, both target#setUpToolbar and
target.surface#initialize are called. #setUpToolbar does an
asynchronous animation.

After that animation is completed we call target.toolbar.initialize
and target.surface.context.update.

Right now ce.ProtectedNode needs to update the position of its
shields when the CE Surface changes position (which it does when
the UI Surface changes position because of the UI Toolbar changing
position), and does so by listening to toolbarPosition.

Adding this event to allow it to listen to that instead.

Change-Id: I826986794630c04c34cef6da36ccb15ff7dde49a
2013-07-31 22:15:33 +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
Ori Livneh e98d54078b Remove gender micro-survey from VisualEditor
The 'ext.visualEditor.genderSurvey' module was introduced in I2b4aba6a9
for the purpose of instrumenting a short-lived microsurvey that would be
concomitant with the deployment of VisualEditor. The survey has now run
its course; this patch removes its code.

Change-Id: I8be6198a66957d792757a5312e9e71b3c8cdd1e3
2013-07-31 00:22:09 -07:00
jenkins-bot 6828804d27 Merge "Language Inspector UI" 2013-07-31 07:14:56 +00:00
Roan Kattouw ceb81353fc mw.Target: Removed unreachable badtoken recovery code
This code caught badtoken errors on load, but we can't get those
any more since the API module was split and we no longer send a token
on load. badtoken handling on save is done in mw.ViewPageTarget.

Bug: 51253
Change-Id: Idb172ee46b7142681d41e593eacd9600b8f11a9a
2013-07-31 00:45:28 +00:00
jenkins-bot b3fef14dad Merge "Fix badtoken handling broken by 7557dd39ed3" 2013-07-30 23:51:32 +00:00
Roan Kattouw e23df9f5a7 Fix badtoken handling broken by 7557dd39ed
7557dd39ed make the badtoken handling code unreachable. Revert that
change, and fix the rest of the function to deal with the possibility
that editApi is undefined. Let handling of the read-only mode error
and any other errors fall through to the bottom of the function.

Change-Id: I0673f2bb629e5cc9449675c1074d283e3926e1d5
2013-07-30 16:46:31 -07:00
Ed Sanders 0d30e1e77d MWMath cleanup
VisualEditor.php
* Add CSS file

ve.ce.MWMathNode.js
* Wrap the image in a span, so GenerateContentNode doesn't
  try to nest an image inside an image
* Remove unnecessary attribute setting
* Only pass unwrapped image to deferred.resolve
* Retrigger MathJax rendering

ve.ce.Node.css
* Use inline-block for image wrapper

ve.dm.MWMathNode.js
* Mixin GeneratedContentNode and implement getHash
* Copy over functionality of MWTransclusionNode:
  + Just store data-mw for attributes
  + Store orignal(DomElement|MW|Index) for selser

ve.init.mw.ViewPageTarget.js
* Add mwMath to the toolbar

ve.ui.MWMathInspector.js
* Remove static.InputWidget, not required in this architecture
* Use multiline TextInputWidget
* Only update mw attribute
* Allow creation of new math nodes

ve.ui.MWInspector.css
* Set height of TextInputWidget

Change-Id: I520f8ccc9f89a2ce70aa1d9e02ed0c6cacbecc2f
2013-07-30 23:47:37 +01:00
jenkins-bot e8d9f09ecf Merge "ve.ui.Toolbar: Refactor floating logic for performance" 2013-07-30 22:31:47 +00:00
Roan Kattouw ed4b9c3cf0 Remove the DM 'about' attribute from references and reference lists
It's totally unnecessary, and actually caused a bug where new references
got about="undefined", which caused Parsoid to about-group adjacent
new references together.

Bug: 52228
Change-Id: Id40d53c72a35412d612ae9441ae3d561622c1bec
2013-07-30 15:08:19 -07:00
jenkins-bot 19c9be5d4f Merge "Ref in references support" 2013-07-30 21:53:00 +00:00
Timo Tijhof bdd7aa5e3c mw.ViewPageTarget: Fire 'wikipage.content' hook after saving
Bug: 51565
Change-Id: I5b6dcd3cb425d2763cc3069e3cbc04be7a57af4c
2013-07-30 19:35:31 +02:00
Ed Sanders 6d921067d7 Ref in references support
When we encounter a ref tag inside the mw-data of a references
tag, we pass it off to the converter and store it as nested data.

In toDomElements we convert any nested children and write them
back to mw-data if changed.

As refs in references are invisible we exclude them when generating
the references list in ve.ce.MWReferenceListNode.

Bug: 51741
Change-Id: I31d06616849a00449df0fc77f3b33e46207cdc7f
2013-07-30 15:41:48 +01:00
Ed Sanders f5c8af541a Set links in wikitext warning to load in new window
Bug: 52093
Bug: 49820
Change-Id: I20ef246b6382ce801ce7a2cb0c82bc698471b88e
2013-07-30 13:11:53 +00:00
jenkins-bot 40e712985c Merge "Add keyboard shortcut for 'clear' button" 2013-07-30 00:51:19 +00:00
James D. Forrester bc3cc9bbdc Add keyboard shortcut for 'clear' button
Now Ctrl+\ (Cmd+\ on Mac) will trigger the 'clear annotations' button
on the current context. Ideally we'd also bond to the 'clear' keyboard
button (ASCII 12) but it does not seem possible to do that yet.

Bug: 51507
Change-Id: I300ec1ffa237e51418ec429be39001f820f053ae
2013-07-30 00:14:17 +00:00
Timo Tijhof 14343c7bf7 ve.ui.Toolbar: Refactor floating logic for performance
== Renamed methods ==

* enableFloating  -> enableFloatable
* disableFloating -> disableFloatable
* setPosition     -> float
* resetPosition   -> unfloat

== Scroll and resize event ==

Timeline for scroll event reduced from about half a dozen
"Recalculate style" and various forced "Paint" down to 0.

New timeline for scroll is clean (for me: from ~35 to ~59 fps):
* 1 Event (scroll)
* 1 Composite Layer

The composite layer action is the browser changing the viewport
to a different portion of the document drawing. Exactly the one
thing a simple scroll should do.

Timeline for resize event is still pretty crowded and low fps,
but it has improved. Further improvement would likely be around
using requestAnimation and going outside ve.ui.Toolbar.

== Changes ==

* New: ve.ui.Toolbar#initialize.
  Similar to what surface has. Users of Toolbar should decide
  whether to call enableFloatable, append it to the DOM at some
  point and then call initialize() once.

* Don't compute offset() every time.
  Eliminated by doing it once in #initialize. These 'top' and
  'left' offsets do not change.

* Don't compute outerWidth() and $window.width() every time.
  Reduced by doing it once in #initialize to compute the 'right'
  offset. Updating it only on resize.

* Don't set 'top' every time.
  This is already in the stylesheet. It was never set to anything
  else so the abstraction for it in #float has been removed.
  This also made it obvious that code for "ve-ui-toolbar-bottom"
  was unused and left behind. Tha class was only ever being
  removed from something (never added).
  The one addClass call for it was in a condition that is always
  false ("if top > 0").

* Don't set 'left' every time.
  Eliminated by doing it once in #float.

* Don't set 'right' every time.
  Reduced by no longer doing it on scroll. Done once in #float,
  and on resize after computing the new value for it.

* Remove no-op style operations.
  Wrapped methods in if-floatable, if-floated etc. to reduce a
  fair amount of easily avoided re-paint overhead.

* Avoid double re-paint in mw.ViewPageTarget.
  Though we prevent a lot of redundant re-paints now, whenever
  we do repaint we want to do it in 1 repaint instead of 2.

  ve.ui.Toolbar emits #toolbarPosition, which tells
  mw.ViewPageTarget to update toolbarTracker which would read
  the new $bar style properties and copy them over to the
  $toolbarTracker. However, this read operation forces the browser
  to do an immediate re-paint half-way just for $bar.

  Browsers only repaint when style properties are changed and
  JS has yielded. The exception to this is JS reading style
  properties: in that case the browser is forced to do those
  deferred repaints directly and reflect the new values.

  We can avoid this double repaint by passing the updated values
  as data instead of requiring the receiver to read the DOM (and
  thus a keep the deferred repaint). Now toolbarTracker can use
  them directly whilst the browser hasn't even repainted $bar yet.

== Clean up ==

* Redundant "border-radius: 0". This would reset something, but
  it never does. None of the things it inherits from set a
  border-radius. There is one subclass where toolbar is used
  with a border-radius (".ve-ui-surfaceWidget .ve-ui-toolbar-bar"
  sets a border-radius) which overrides this on purpose, so the
  default of 0 is redundant.

* Pattern "if ( .. ) addClass() else removeClass()" changed to:
  "toggleClass( , .. )"

Bug: 52014
Change-Id: I9be855148962eee068a77fe83e98eb20bbdcfeec
2013-07-30 01:47:54 +02: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 529199802c Merge "mw.ViewPageTarget: Clean up nested binds and triple model/connect" 2013-07-29 23:25:02 +00:00
jenkins-bot d0a6e70b1e Merge "Use postEdit mw.hook for save notifications" 2013-07-29 23:23:11 +00:00
Ed Sanders 138270e8ef Use postEdit mw.hook for save notifications
The core changes to postedit in I778b18b that this depends on were
deployed to the cluster as part of 1.22wmf11.

Bug: 39632
Change-Id: Id4a8bc22c09a552ef79670b0d4fc4a70df07ec33
2013-07-29 21:49:46 +00:00
jenkins-bot 9c77d14c29 Merge "Properly clone the document for the sanity check" 2013-07-29 19:45:02 +00:00
MatmaRex 54c5230b01 Unblacklist Opera >= 12
Opera 12 seems to work well enough, but I'm not confident enough to
whitelist it just yet.

Opera 15 is basically Chrome with a different interface, so it should
work perfectly, but it's barely out of beta and untested right now.

Bug: 36000
Change-Id: Ia80a6f53f8c128ef52d0bfde1828fdc132046afb
2013-07-29 12:30:06 -07:00
Moriel Schottlender 59079978ff Language Inspector UI
This is the language inspector UI engine with ULS core.
The Language Inspector works alongside ULS to choose and change language
blocks in text. The inspector was based on ve.ui.TextInputWidget and
now changed to inherit ve.ui.Widget and display details in a table
instead of an input textbox.

Added jQuery.ULS module:
* Repository: https://github.com/wikimedia/jquery.uls
* Latest Commit 728f112ffc90b03b50c0109487886a2647f12020
* Taken 'src' / 'images' and 'css' folders into modules/jquery.uls

Bug: 47759
Change-Id: I3c9fd6c135c05a54f6c7fc28c5962fc0a6677806
2013-07-29 00:38:59 -04: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 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
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 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
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
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 5fdc9abdc8 Merge "doc: Clean up spacing that caused <pre> or broken <ul>/<ol>" 2013-07-25 22:36:41 +00: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
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
jenkins-bot 9e8ce997db Merge "Show error when trying to save in read-only mode" 2013-07-24 14:35:52 +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
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
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
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
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
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
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 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
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
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
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
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
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
jenkins-bot c4b05b893d Merge "Use template icon on template placeholder pages" 2013-07-16 00:35:08 +00: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
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
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
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
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
jenkins-bot 4c85442047 Merge "Fix uses of addPart to make them async friendly" 2013-07-12 21:19:55 +00: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 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 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
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
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 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
jenkins-bot 877463e712 Merge "Add hooks and classes, initially to support GuidedTour" 2013-07-10 19:32:32 +00: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 06faf92a12 Merge "Make parameter search widget have a horizontal limit" 2013-07-10 01:42:44 +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 164094ee6c Merge "RTL Improvements" 2013-07-10 01:34:06 +00:00
Timo Tijhof 50b7a9fc93 mw.ViewPageTarget: Explicitly release our copy of linmod data
Follows-up Ic0c6d190c9b78 which introduced a full linmod copy in a
scope that is also accessible by other closures (namely the
callbacks to jQuery.Deferred #done and #always, and setTimeout).

Though in theory engines may be able to garbage collect it,
I doubt it. Though browsers probably destruct the setTimeout
callback I know  at least the closures pass to jQuery.Deferred
are not released by jQuery, so an engine would have to
understand these other functions well enough to know it doesn't
access the `data` variable.

Let's release explicitly to be safe.

Change-Id: I11000edcad4690dcce53b6e9d1a45bf2ab82fbcb
2013-07-10 01:02:10 +00:00
Trevor Parscal 33e2c8f280 Lock surface while inspectors are animating open
Objective:

* Prevent input while the inspector is animating open

Changes:

ve.ui.LinkInspector.js
* Disable and then re-enable the surface while the inspector is opening

ve.ce.DocumentNode.js
* Remove opacity changes on disable/enable

ve.init.mw.ViewPageTarget.js
* Change the opacity of the document when save dialog is open

Bug: 51075
Change-Id: Ic7910a666b33b41b57b035a15cf1f8c9264e7111
2013-07-09 17:16:25 -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
jenkins-bot bf930c88c6 Merge "Defer conversion in the sanity check" 2013-07-09 23:33:31 +00:00
Roan Kattouw e9ca44c86c Transplant CSS from the main document to each iframe
We previously manually loaded CSS into these frames, which is flawed
because it completely bypasses ResourceLoader (so CSSJanus didn't flip
them, necessitating a bunch of hacks for RTL), and doesn't pull in
MediaWiki styles (so templates inside references don't render correctly).
Instead, this commit copies all styles from the main document into each
frame's document, inlining what it can.

Loading all styles in dialogs and inspectors caused some problems,
initially. We didn't namespace our styles for dialogs vs. inspectors
at all; the only reason inspector styles weren't being applied to dialogs
and vice versa was because we controlled which files were being loaded
in which context. This commit namespaces the inspector and dialog styles
where needed so they don't conflict and try to override each other.

Tested in Vector and Monobook, but not in Apex and not in RTL.

ve.init.mw.ViewPageTarget*.css:
* Namespace styles that are only intended for the main document
* Undo Monobook's font-size: x-small; in frames

*Dialog.js:
* Remove addLocalStylesheet() calls, we don't need those any more
** ve.ui.MWDialog seems to be unneeded now, we may want to remove it

*.css:
* Remove @noflip-ped RTL rules where they were just flipped versions of
  their LTR counterparts

ve.ui.Dialog.css, ve.ui.Inspector.css:
* Namespace styles with .ve-ui-dialog-content / .ve-ui-inspector-content

ve.ui.Frame.css:
* Move the margin:0 and padding:0 here (were in the frame <body>'s style
  attribute) and add background:none to prevent frames from getting
  the skin's background (grey in Vector, a book in Monobook)

ve.ui.Dialog.js, ve.ui.Inspector.js:
* Add ve-ui-dialog-content / ve-ui-inspector-content class to the
  frame's content <div> so we can restrict styles to only apply in
  dialogs / inspectors

ve.ui.Frame.js:
* Replace infrastructure for @import-ing stylesheets with transplantation
* Remove code polling to see when the stylesheets were loaded
** We can't do this in the new approach AFAIK, since all styles in the
   frame are either inlined or inaccessible due to the same-origin policy
** We also shouldn't need it because the browser should have cached the
   styles when it loaded the main document
* Apply ve-ui-frame-body class to the frame's <body> so we can style it
** Move inline padding:0;margin:0; into ve.ui.Frame.css
** Move the ve-ltr/ve-rtl class up to the <body>

ve.ui.Window.js:
* Remove infrastructure registering stylesheet URLs to load

Change-Id: I4a37115301811ad860f4578344a04873ea8c2b69
2013-07-09 16:13:28 -07:00
Catrope 30ebc9a656 Revert "Add support for <blockquote> elements"
Whoops, merged too soon. The dropdown part of it doesn't
actually work right.

This reverts commit 3c51ebad93.

Change-Id: Ieafbf18ca8a43b07e33a787772abbc77aef63e4c
2013-07-09 21:35:47 +00:00
Roan Kattouw b77a1b2250 Defer conversion in the sanity check
Conversion is apparently pretty slow on large articles, so put it inside
the setTimeout(). We still need to copy the data array synchronously
though.

Change-Id: Ic0c6d190c9b782f8c643d00d335f0e004d860bcf
2013-07-09 13:21:48 -07:00
James D. Forrester 3c51ebad93 Add support for <blockquote> elements
Bug: 51009
Change-Id: I7ba1635e4f856a021e1a7a2d26a8714230c9364a
2013-07-09 13:15:06 -07:00
Timo Tijhof fdedbb36e2 mw.ViewPageTarget.init: Clarify reason for FF12 / FF14 blacklist
Follows-up I7a9dddb693091f.

Change-Id: I49a952f6b1714808cd4f063c48cf3102997f8746
2013-07-09 13:11:15 +02:00
James D. Forrester d59a3f1202 Blacklist Firefox 13 and 14 too
Firefox 13 and 14 were the cause of links magically turning into [[./Foo]].
Once the immediate rush of deployment is over, we'll want to investigate as
to why and hopefully find a way to unblacklist FF.

Bug: 50720
Change-Id: I7a9dddb693091fa1e44b4325e77b9e4f55e5c193
2013-07-08 18:20:42 -07:00
jenkins-bot 11d5218444 Merge "mw.ViewPageTarget.init: Only bind edit section links on view page" 2013-07-08 23:16:54 +00:00
jenkins-bot 98c92d49c7 Merge "mw.ViewPageTarget: Fix incorrect retention of the wrong oldid" 2013-07-08 23:16:15 +00:00
Timo Tijhof 106f357852 mw.ViewPageTarget.init: Only bind edit section links on view page
The handler for the Edit tab already is in this conditional,
for edit section we were making the assumption that they only
ever appear on a view page, but that's wrong. They're also shown
on a diff against the latest revision of the page.

Bug: 50925
Change-Id: I802e548cbcdc03cfca66129466668854604bc3e7
2013-07-08 16:12:47 -07:00
Timo Tijhof d16fef546a mw.ViewPageTarget: Fix incorrect retention of the wrong oldid
* Only pass the oldid to the API from #load if we restoring from
  oldid in the url. Otherwise load the latest version.
* Setting 'restoring' from mw.Target instead of mw.ViewPageTarget
  so that we don't rely on mw.ViewPageTarget in mw.Target#load.
* Fix the API to not require 'oldid' to be passed.
* Fix the API to actually return the 'newrevid' property. It
  was doing a no-op on a $result that is never used due to the
  same variable being overwritten with the result of parseWikitext.
* Moved updating of wgCurRevisionId to mw.ViewPageTarget as it
  belongs there (possible future inline editors probably act
  on a different page than the main one). Also made it only
  update if it isn't undefined, so that a null edit doesn't
  result in wgCurRevisionId being unset.

Bug: 49943
Bug: 50441
Change-Id: I221e5038f95eadf6d87013e80f12394f0376a293
2013-07-08 16:11:23 -07:00
jenkins-bot de61c74ff2 Merge "Drop mw:ExtLink/URL support" 2013-07-08 19:13:29 +00:00
jenkins-bot 67d1629754 Merge changes I4d7533af,Ib909c5fb
* changes:
  Math Node UI
  Math Node Matcher
2013-07-07 07:36:00 +00:00
Trevor Parscal 37240aca59 Math Node UI
Show an inspector with inputwidget when the user clicks a math
node. The data of the math equation is shown in the
edit box, it can re-render the math tag image when
the inspector is closed, and save the change when
saving the page.

TODO:
* Change the icon from link to math
* Translate title by translatewiki in i18n
* Other further UI improvements

Change-Id: I4d7533af25186cc39cc4bc6a4326d222ffd6db19
2013-07-07 07:32:11 +00:00
jiabao 7eb6efa3b7 Math Node Matcher
This patch creates two files handling math node matching,
which are:
ve.dm.MWMathNode.js - a basic version of toDataElement
and toDomElement functions work
ve.ce.MWMathNode.js - math formulas in VisualEditor are
clickable and render as img tags

Change-Id: Ib909c5fb02e385c88050f42d02d207ab6a97d0dd
2013-07-07 07:32:02 +00:00
jenkins-bot 614a1a3d9c Merge "mw.ViewPageTarget.init: Move edit section to top init" 2013-07-05 18:40:12 +00:00
Timo Tijhof eddd0b384a mw.ViewPageTarget.init: Move edit section to top init
Since we're now only loading the light-weight init on page load,
the section editing wasn't just deferred to after page load (like
it was before), but wasn't happening at all until you clicked
"Edit" (at which point the library loads). It only worked when
going back to "View" after "Edit".

Contrary to tab layout, edit section handling needs to be
accessible both in the top init and in the main target class
because we need to run it both at run time and after the user
has saved a page when we show them the updated page without
refresh. This is why we need to transfer the method at run time
and give the main class access to it as well.
Can't wait for bug 50707 to get rid of this mess...

Bug: 50731
Bug: 49993
Change-Id: Iab9c81222df7f1084179c3643d158374a89ca14b
2013-07-05 18:29:12 +00:00
jenkins-bot 00f5e6474f Merge "Blacklist Firefox 11 and 12 Bug: 50780" 2013-07-05 18:25:44 +00:00
James D. Forrester 92991ef20f Blacklist Firefox 11 and 12
Bug: 50780

Change-Id: I6461f066443223dfd5f6d73aeea0c87cbbdb81d0
2013-07-05 11:24:06 -07:00
Moriel Schottlender 1dc21c01e3 Page settings fix-fix
This re-fixes the fix to the frame fix. fix fix.
Two things changed: Background position flipped to the right properly
(was somewhat off before) and text-alignment flipped as well.

Bug: 49613
Change-Id: I0aa317ef674537d20d7ed64e74eaa3cfe8030c8c
2013-07-05 13:44:13 -04:00
Niklas Laxström 5957065043 Optimise png images with optipng
Change-Id: Id014ad0a0aa99c9440360e32d2e10bc99fa64738
2013-07-05 09:47:12 +00:00
Ed Sanders 5df020a5f0 Drop mw:ExtLink/URL support
Because Parsoid has.

Bug: 50734
Change-Id: Id2c893467c5063cc29cd9a91203406b86a3abfbe
2013-07-04 13:18:18 +02:00
jenkins-bot 817d24dd50 Merge "Revert "Make link inspector re-usable by splitting it up"" 2013-07-04 01:42:13 +00:00
Catrope 092fa74dee Revert "Make link inspector re-usable by splitting it up"
Breaks MWLinkInspector initialization behavior

This reverts commit f7107fa20d.

Change-Id: If93d1092eeb14f6ba23e6368834a6f80df765d21
2013-07-03 18:39:31 -07:00
Timo Tijhof 1875851f7e mw.ViewPageTarget.init: Remove harmless debugging code for ES5
Was accidentally kept in Ic8b0004ab5288fa9.

Change-Id: I1c95189437e3e74c5e2884d14c1ccf000ef0c178
2013-07-04 02:08:41 +02:00
jenkins-bot 7c58fc9394 Merge "Split off setup from the rest of mw.ViewPageTarget" 2013-07-03 23:26:53 +00:00
Timo Tijhof b21fe5fbc1 Split off setup from the rest of mw.ViewPageTarget
Initialisation initialisation? It's time to rename ve.init
to ve.platform and ve.init.Platform to ve.platform.Environment,
but that'll come later.

* Moved support detection and skin set up to separate class-less
  file.
* Swapped usage of ve.msg for mw.msg.
* Callback of edit tab now does an mw.loader call to fetch
  the actual VisualEditor libraries.
  Though mw.loader won't load the same thing twice, we would
  bind a callback each time. To avoid instantiating ViewPageTarget
  more than once we use a Deferred.

Bug: 50542
Bug: 50608
Bug: 50612
Change-Id: Ic8b0004ab5288fa91bb29d496485b93ffd8d977e
2013-07-04 01:18:28 +02:00
Trevor Parscal f7107fa20d 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

Change-Id: I1f7e9c13537105da7aa0351c9c92e8af5eb5a3f4
2013-07-03 15:13:47 -07: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