Commit graph

1107 commits

Author SHA1 Message Date
jenkins-bot 09dee21de7 Merge "Split ext.visualEditor.mwcore out of ext.visualEditor.core" 2013-12-17 21:34:45 +00:00
jenkins-bot 0a5687e296 Merge "Allow ve.init.Platforms to asynchronously initialize themselves" 2013-12-17 21:15:29 +00:00
Roan Kattouw b61813b935 Move visualeditor-languages-tool message from ve to ve-mw
I intially thought it was associated with the language inspector, but
it's not, it's the label for the languages pane in the meta dialog.

Change-Id: I478e3951862a25eee056e3df6cc3c9f9f7d9d935
2013-12-17 20:56:13 +00:00
Roan Kattouw fb3a75b85d Split ext.visualEditor.mwcore out of ext.visualEditor.core
* Split files according to ve / ve-mw paths
* Split messages according to msgs-ve / msgs-ve-mw
* Update dependencies accordingly
* Remove ve-mw/ hack in makeStaticLoader.php, no longer needed

Bug: 45342
Change-Id: I6cb89606c307e27e237a1e9b56b94dfdcd310f41
2013-12-17 20:56:03 +00:00
Translation updater bot e7ea330f96 Localisation updates from https://translatewiki.net.
Change-Id: Ifd7b23212032c27448a6204b7d77acef8524c961
2013-12-17 19:25:54 +00:00
jhall 5e6154ebc4 [Browser test] New transclusion template search
Per Bug: 58406, updating search criteria for
tranclusion templates to work with existing
content in beta labs.

  Please enter the commit message for your changes. Lines starting

Change-Id: Iac6919d234bd298034cc3c3d90ec62239a3fd0df
2013-12-17 08:30:07 -05:00
Roan Kattouw fc119e3d60 Allow ve.init.Platforms to asynchronously initialize themselves
We'll need this for the standalone platform to load jquery.i18n messages

Change-Id: Iacb9fcb2d5750711187f7d72d53d8c7d54c6f30b
2013-12-16 22:46:19 +01:00
Translation updater bot 11ff000c97 Localisation updates from https://translatewiki.net.
Change-Id: If5925a9a9e9ecd1fc44921d1f91f3cc31c23cae7
2013-12-16 19:50:58 +00:00
Jeff Hall f83c8d7519 [Browser test] Additional waits for SauceLabs timeouts
Applying same fix that was applied earlier to "bullets_steps.rb"
since that relieved frequent timeout behavior seen with tests
run via SauceLabs.

Change-Id: I0c924a315cd2bf4821a9155a1d1dcd052910e50e
2013-12-16 10:29:20 -08:00
jenkins-bot 93a75dcc04 Merge "Add useful HTML in toDomElements for refs and templates." 2013-12-16 14:57:08 +00:00
Ed Sanders f5cbcc4f56 Add useful HTML in toDomElements for refs and templates.
For the benefit of pasting out of VE.
Use data-ve-ignore where necessary to avoid the HTML being
used on the way back in to VE.

Change-Id: Iabe678c4246c1d1f51abb058b6e750811fdf9bea
2013-12-16 14:33:40 +00:00
jenkins-bot 46f5f29839 Merge "Move index label generation to the model" 2013-12-16 13:17:26 +00:00
Translation updater bot e2f816a4bb Localisation updates from https://translatewiki.net.
Change-Id: I6930c50f3e0a6410e70f9817e953d490895dfe86
2013-12-15 20:59:48 +00:00
Translation updater bot 35f1d5ad77 Localisation updates from https://translatewiki.net.
Change-Id: Ic4dd2f71419cd76a4deb220c1947e4eb4040ff16
2013-12-14 20:55:06 +00:00
Ed Sanders 8e3f77a9e7 JSCS fixes
Change-Id: I11032f05eaee1e8c895e06ebbc9c329cbc70c8c0
2013-12-14 00:04:12 +00:00
Ed Sanders 8ce7182045 Move index label generation to the model
Also make available as a static method so it can be used by the
converter. We will need this for generated HTML for the external
clipboard.

Change-Id: Ief843ac10cd6c6e4b25e09a007625d363792adff
2013-12-14 00:02:50 +00:00
jenkins-bot 717f8acf47 Merge "Move language inspector messages to VE core" 2013-12-13 21:32:56 +00:00
jenkins-bot 628eb96c24 Merge "Reformat English JSON files" 2013-12-13 21:32:22 +00:00
Roan Kattouw c3ea309a78 Move language inspector messages to VE core
They conceptually belong in VE-MW, but right now the language
inspector is used in the VE standalone, and not having the
messages breaks it.

Change-Id: I0f84c6ee6c6142581c895515a2bd2a6caf4e511d
2013-12-13 13:23:58 -08:00
Roan Kattouw e0f011be54 Reformat English JSON files
They were never reformatted by the TWN export

Change-Id: I24b455d7897a4dba89993a8eeaad2fa68933ae1e
2013-12-13 13:01:37 -08:00
jenkins-bot 386f27bffc Merge "Fix the standalone toolbar to not demote heading1" 2013-12-13 20:47:17 +00:00
Roan Kattouw af4b7bd067 Fix the standalone toolbar to not demote heading1
The duplication of the toolbar definition is ugly but we don't
have a better system to say "give me the same except demote this
one thing" right now.

Change-Id: Id74ed1a18aee4a947992bdd626702f578bbace14
2013-12-13 12:24:54 -08:00
jenkins-bot 0fcc524bd3 Merge "Add a getDirectionFromRange Method to ve.ce.Document" 2013-12-13 20:24:23 +00:00
Translation updater bot 69957698c7 Localisation updates from https://translatewiki.net.
Change-Id: Ied0dc7cfda9706146529f47f10c089963f80e0d7
2013-12-13 20:09:48 +00:00
Moriel Schottlender 95d99192b4 Add a getDirectionFromRange Method to ve.ce.Document
getDirectionFromRange returns the direction property of the ce nodes under
that range. That method is mostly useful to recognize the overall block
direction of a selection or fragment.

The method is currently used in the following locations:
* ve.ui.Toolbar onContextChange - as a means to recognize the current context's
  block direction for the icon directionality.
* ve.ui.MWExtensionInspector - if the selection is text and not an existing node
  the input directionality adjusts to the context direction.

Bug: 57421
Change-Id: Ifc01b8e5dc0a2fe39d221e59e452c5cfad709a2d
2013-12-13 12:07:19 -08:00
jenkins-bot 252f25c9cd Merge "Fix hashes in MW toDomElement functions" 2013-12-13 19:36:01 +00:00
jhall c6a002110e [Browser test] Add waits for SauceLabs happiness
1) when_present waits to deal with SauceLabs sluggishness
2) Restore a "sleep" method for running test locally

Change-Id: I692befa5da607cf2468e3a56eb9b634a17f8deb2
2013-12-13 18:56:53 +00:00
Ed Sanders 2843714834 Fix hashes in MW toDomElement functions
Hashes weren't using the new [ object, config ] set up so were
never matching the store. Also added a check to see if the
originalDomElements actually exists before trying to use them
(they may have been removed by a clone operation).

Change-Id: I886e369ced9a9d2e0e457ced9c21b2a7a8e55d58
2013-12-13 17:48:03 +00:00
James D. Forrester de4b7e4f0e Move "visualeditor-toolbar-insert" to ve, not ve-mw
Fix mis-placed message breaking stand-alone.

Change-Id: Ibffff67105e6877a61ba68eafc6395e598a36f82
2013-12-12 17:11:46 -08:00
Ed Sanders 5f78aa22f1 Check InternalList node exists when rendering MWReferenceList
If you've just pasted in a reference and a list the internal list
nodes may not have been rebuilt yet.

Bug: 58242
Change-Id: Ib10b81f4023194791f789f3e7dda393f2e355ea3
2013-12-12 23:02:10 +00:00
jenkins-bot 630249b1cc Merge "[Browser test] Update Firefox + Selenium versions." 2013-12-12 21:40:42 +00:00
jhall b552171189 [Browser test] Update Firefox + Selenium versions.
Change-Id: Iea8b5dea546140da58759da2db3150f85e1a553f
2013-12-12 21:33:27 +00:00
jhall b9cd28589b [Browser test] Updates to use new Insert menu
"Insert" menu replaces "More" menu for
accessing some advanced markup features.

Change-Id: I57635b54f3a5b2b72f754747bdb836fe1bfda5ec
2013-12-12 21:32:42 +00:00
Translation updater bot ae5b16e981 Localisation updates from https://translatewiki.net.
Change-Id: If498cb7858a02cdc647d26251f35625c93e158e0
2013-12-12 21:17:06 +00:00
jenkins-bot da14b51b7e Merge "Use the same new toolbar for media and reference dialogs" 2013-12-12 19:32:22 +00:00
James D. Forrester 00088bbf05 Use the same new toolbar for media and reference dialogs
With blocks comment out where they're not wanted.

Bonus: Actually make the pasteSpecial command available in these
contexts.

Bug: 58404
Change-Id: Ic77c252ddc9ae54019b2d86ee5f8a6f4febf4292
2013-12-12 19:22:50 +00:00
Moriel Schottlender e3308b0bd9 Direction adjustment to <figure> styling
Adding @noflip to align-left and align-right in the <figure> css styling
rules and removing the need to resize the Branch Node div element on center.

Change-Id: Iec6e589ba9ecdf32c1a0934b9eb05ee3fd42af66
2013-12-12 19:15:53 +00:00
jenkins-bot 46c708df2f Merge "Make commands aware of their symbolic names" 2013-12-12 18:48:07 +00:00
jenkins-bot cf03ad7616 Merge "Render CE MWBlockImageNodes as styled <figure>s" 2013-12-12 18:47:12 +00:00
jhall d35cc1e573 [Browser test] Update to use new text styling menu
Also removed some duplicated code and
added test cases for bold and italic styling.

Change-Id: I181c208dd1165ea52bd4c49eb00c2eaae41ef05f
2013-12-12 10:37:48 -05:00
jenkins-bot 29f047ea89 Merge "Fix issues with copy-pasting MWTransclusionNodes" 2013-12-12 00:45:28 +00:00
Ed Sanders f0e9ec7922 Fix issues with copy-pasting MWTransclusionNodes
ve.dm.MWTransclusionNode
* Implement getClonedElement to remove originalDomElements
  and originalMw. We don't want to put these in the clipboard
  as there is no guarantee they are the rendering of the current
  set of parameters (a refresh may be in progress) and they may
  confuse the converter on the way back in.
  Remove about attribute to prevent about grouping of duplicated
  nodes.
* Set an extra attribute to flag that the outputted DOM doesn't
  have any generated content attached to it that can be stored
  on load.
* Check for said attribute in toDataElement and skip the
  storeGeneratedContents step. This will trigger an async update
  of the generated contents on paste.

ve.ce.Surface
* Call cloneElements before writing to pasteTarget so data in external
  clipboard is stripped of generated contents.

ve.dm.Node
* Only strip data-parsoid as other attributes may be meaningful.

ve.dm.mwExample, ve.dm.Node.test
* Update tests

Bug: 58241
Change-Id: I3e15cc97e94747647078204a0b398e6ac3ec6382
2013-12-12 00:02:11 +00:00
Moriel Schottlender f1123f87f5 Render CE MWBlockImageNodes as styled <figure>s
This change is meant to transform the current block image node rendering
in ContentEditable from the nested <div> structure to a <figure> tag more
closely matching Parsoid's output, with CSS to style it the same. This is
mostly so we can work with and display attribute changes, like 'type' and
'alignment', without constantly destroying and rebuilding nested <div>
structures.

This change also includes all the attribute changes that will be called
when the media edit dialog changes image type, alignment, size, etc.

Node: The mw-classes 'thumb', 'thumbinner' and 'thumbcaption' are
preserved in the structure of the <figure> but CSS designers should note
these styles are no longer necessarily attached to <div> elements.

Bug: 53436
Change-Id: I40065acd9fd59d30f94b5336736d4986e8de15aa
2013-12-11 15:54:55 -08:00
James D. Forrester bd94ff92bb Initial re-styling of the toolbar
Move all text styles, and the remove styles button, into a new 'list' toolbar
group, using the text-styles icon. Less-used text styles (strikethrough, code
and underline) are demoted, with remove styles at the end, and bold and italic
promoted.

Now re-label the "More" catch-all to now be "Insert", which is what's left.

Change-Id: I66a1bba347ea64e540106b1090995b3117a8b1b2
2013-12-11 23:41:12 +00:00
Kyle Florence 638e4f65b6 Make commands aware of their symbolic names
This introduces a small reorginization of how commands are registered so
that they are associated with their corresponding symbolic names.
This change is mainly to aid with event tracking, but it might be
generally useful for other things as well.

Change-Id: I2ccf4522f786a54c1f5395008b7b0333a1fa6072
2013-12-11 15:34:20 -08:00
jenkins-bot 1fb7446738 Merge "Re-label the formula inspector to not be LaTeX" 2013-12-11 23:12:01 +00:00
jenkins-bot 67dad75ddd Merge "Format MW example HTML" 2013-12-11 22:28:31 +00:00
Ed Sanders 0da40d1c09 Format MW example HTML
For readability

Change-Id: I7e58fd71a0a34e2e11bf93b1f088e4c87795b748
2013-12-11 22:03:15 +00:00
James D. Forrester 68d077fa70 Re-label the formula inspector to not be LaTeX
Because users like to understand labels.

Bug: 53251
Change-Id: Iab24371161f278f07e516478a864d957859c32ae
2013-12-11 13:05:27 -08:00
Translation updater bot 942946cec1 Merge "Localisation updates from https://translatewiki.net." 2013-12-11 20:31:05 +00:00
Translation updater bot f6c5722b1f Localisation updates from https://translatewiki.net.
Change-Id: Ia3cd64ae99a564324c09a134eb32aacbbf269e75
2013-12-11 20:29:53 +00:00
jenkins-bot 04c9f79834 Merge "Don't select nodes inserted by a dialog, but drop cursor after" 2013-12-11 20:25:50 +00:00
Roan Kattouw 536df35ed1 Add language code to language dialog
Bonus: give both the language name and page name
lang and dir attributes.

Further bonus: reintroduce message that was deleted
earlier with all of its original translations.

Change-Id: Id137ff9a069799b6c09574b72f450eac6665d144
2013-12-11 02:42:20 +00:00
Translation updater bot c6cf993c2d Localisation updates from https://translatewiki.net.
Change-Id: Ic5d1dee35d8347ea461681eacc51f1e2e0789e81
2013-12-10 20:44:55 +00:00
Roan Kattouw b6a35aa96d Sync JSON i18n for 1a5bdd5
Change-Id: Ib9c7219e4f9ae5893439eec7059519d2f24cd5f2
2013-12-10 09:09:45 -08:00
jenkins-bot 9bf0f5b93e Merge "Show full language names in the MW language dialog" 2013-12-10 17:00:53 +00:00
Roan Kattouw 96000558a2 Don't select nodes inserted by a dialog, but drop cursor after
It used to be that when you closed a dialog, the thing that the dialog
inspected or inserted would be selected. For insertions, the selection
will now be collapsed immediately after the inserted node.
For modifications, the original behavior was kept, as it makes sense to
keep selecting the node that the user had to select in order to access
the dialog. For removals (only possible in the transclusion dialog),
the selection ends up as a collapsed selection at the location where
the removed node used to be; this was already behaving correctly,
as we get this behavior for free with offset translation.

Bug: 54957
Change-Id: Ibd14e8084d67a9ee85e3bac075c3fb50f27b05b2
2013-12-09 18:02:18 -08:00
Translation updater bot 711d578486 Localisation updates from https://translatewiki.net.
This is a full export of the recently converteted i18n of
VisualEditor. The conversion script should generate output in
this format, so that future diffs for localisation updates
remain as small as possible.

Change-Id: I03c3223f51027b97d7962553e80afd741991c9af
2013-12-09 22:30:48 +00:00
Roan Kattouw f462ea5bb0 Convert all i18n to JSON blobs
Split the i18n messages into four groups:
* oojs-ui (moved to the oojs-ui repo in a separate commit)
* VE core
* VE-MW (MediaWiki-specific things)
* VE-WMF (Wikimedia-specific things)

The VE-WMF group is new, and we'll split WMF-specific code out into
it later, for now it's just messages associated with that code.

Each language has its own JSON file at modules/MODULE/i18n/LANG.json

Kept messages in VisualEditor.i18n.php as the master copy, because
TranslateWiki can't deal with the JSON files just yet. Added a script
to rebuild the JSON files from the PHP file.

Change-Id: I94e084b2f10994f41324fd08a05ff7f8391ea2eb
2013-12-09 10:52:01 -08:00
cmcmahon d627b4da8f [Browser tests] maintenance for remove parameter/template buttons
Change-Id: Ia04ddc5aa18f412bb2e02ee45dcfdc421b3ec64a
2013-12-09 17:39:09 +00:00
jenkins-bot ed43cab350 Merge "mw.Target: Fix document focus scroll bug" 2013-12-06 21:40:50 +00:00
jenkins-bot 0d1e458ea1 Merge "Spell removable and movable using modern English" 2013-12-06 21:36:30 +00:00
Timo Tijhof c6b997d0ba mw.Target: Fix document focus scroll bug
Follows-up I55ef2622c9eacc which activated code introduced in
mw.Target in commits before that one that caused a change in the
execution order.

Hiding of page content (regular wiki page content provided by
original view request) must happen before the surface document is
focussed.

We used to hide the content from mw.ViewPageTarget#setUpSurface,
which is called from #onReady, which focusses the document after
setUpSurface is done.

Most of this code was moved to mw.ViewPageTarget#onSurfaceReady
which is the listener for the surfaceReady event emitted from

If our surface document gets focus while the original wikipage
content container is still there, the view port is forced to
scroll down because our surface is the next element sibling after
the wikipage container in the DOM.

And browsers (apparently Chrome is not affected) naturally retain
scroll position even if the elements above the one you "scrolled to"
disappear.

We can't (and shouldn't) move the hidePageContent call because
that's the responsibility of the Target subclass, so instead
moved the document focus to below the hidePageContent which is
now also part of the responsibility of the Target subclass.

Also:
* Removed target.surfaceOptions reference because that property
  does not exist. We never passed a second argument here, and
  whatever this was intended for, doesn't exist.

Bug: 58089
Change-Id: I230fbd5401cbd6e3b9450c7f156650409be8ef16
2013-12-06 22:32:51 +01:00
jenkins-bot 47fcb0fad1 Merge "Revert "Revert "Remove dual-type support for Languages and Categories""" 2013-12-06 21:15:40 +00:00
Catrope c3c0a5e166 Revert "Revert "Remove dual-type support for Languages and Categories""
The Parsoid team says the cache is clean of old language /
category types, and would like us to use the new types
for newly generates languages/categories.

This reverts commit d8dcafe25b.

Change-Id: I0cffd5d299624230f3805f9468b2497f392c12c0
2013-12-06 21:12:44 +00:00
jhall ba90be7d7a [browser test] Headings now include a buffer space
Confirmed with James F that this was an intentional Parsoid
change (and not a bug).

Change-Id: I21d7eba4675eaf7250267003516585e96069b4e6
2013-12-06 20:55:58 +00:00
Trevor Parscal b3281bd87a Spell removable and movable using modern English
Also...

* Update OOjs UI to v0.1.0-pre (5ffe63d088)
* Make template parameter text boxes shorter (3em down from 10em)
* Reorder extendObject calls to not modify incoming config objects
* Allow level option to default to 0, rather than specifically defining it
* Use icon button widgets with remove icons for parameter, placeholder,
  template and content removal buttons

Change-Id: I29db9d814fab5cf4debd0fc7bab6f51475cb0f94
2013-12-06 12:24:36 -08:00
Timo Tijhof cf7f2b141d Set up node-jscs, pass it, and configure in local Gruntfile
Let's experiment with this via our local Gruntfile. If it works
fine we can install it in Jenkins (similar to node-csslint).

Verify through $ npm install && npm test;

Fixed all outstanding violations.

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

Bug: 54218
Change-Id: Ib2630806f3946874c8b01e58cf171df83a28da29
2013-12-06 10:37:27 -08:00
Zeljko Filipin e195aa7bb5 Updated Ruby gems
Checking if selenium-webdriver 2.38.0 fixes cursor problem in Chrome.

Change-Id: I4467ed4ec1b3d7007f4293e3791f41502ce05959
2013-12-06 16:11:36 +00:00
cmcmahon e54170929d [browser test] Chrome seems to not honor when_present() correctly
1) Added another sleep statement which seems to fix the issue locally.
2) Modified a link page element identifier.

Change-Id: Ic0006f18752d3625bc244d924a7a8a9fac2d5221
2013-12-06 15:02:53 +00:00
Ed Sanders 1a5bdd5bd2 Show full language names in the MW language dialog
Bug: 54086
Change-Id: I099ac552638d666a447eb3aeaef68329ffacdfce
2013-12-06 13:10:33 +00:00
jenkins-bot d17e031d46 Merge "Revert "Remove dual-type support for Languages and Categories"" 2013-12-06 04:03:10 +00:00
Jforrester d8dcafe25b Revert "Remove dual-type support for Languages and Categories"
'Cos Parsoid caches things for ages.

This reverts commit 114a24f1d3.

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

Change-Id: Idb6a84dc32706d90dea70dceb0b9b3a26ed70110
2013-12-06 01:42:49 +00:00
jenkins-bot 674236cab4 Merge changes I51e74b32,Ibaa14d20
* changes:
  Refactor Transclusion and Meta dialogs to use BookletLayout
  Update OOJS UI to v0.1.0-pre (592e1d6401)
2013-12-06 00:48:41 +00:00
Trevor Parscal 51e096d6f2 Refactor Transclusion and Meta dialogs to use BookletLayout
Use OOJS-UI's newly-extended paged dialogs (in e08eb2a03b) to refactor
how the Transclusion and Meta dialogs work, splitting out the code for
each of the panels into its own file and simplifying extensibility.

The Meta dialog (ve.ui.MWMetaDialog) now has two self-managing panels:
* ve.ui.MWCategoriesPage for categories and the default sort key
* ve.ui.MWLanguagesPage for language links

The Transclusion dialog (ve.ui.MWTransclusionDialog) now has four:
* ve.ui.MWTemplatePage for a template's primary panel
* ve.ui.MWTemplateParameterPage for each parameter of a template
* ve.ui.MWTemplatePlaceholderPage for a placeholder to insert a template
* ve.ui.MWTransclusionContentPage for non-template transclusion

Additionally, the Transclusion dialog has been slightly cleaned up:
* Replace add/remove events with replace events in transclusion model
* Actually return and resolve a promise (as documented)
* Get rid of "origin" info in template models
* Add method for adding required parts

TODO:

* Decide how and when we will choose between advanced transclusion and
  template dialogs
* Work out design issues with how template descriptions will be visible
  and how adding parameters will work if only showing parameters in
  outline
* Add preview to template dialog
* Consider ways to further improve pages for use in continuous mode

WARNING:

* Right now the template dialog gets overridden by the advanced
  transclusion dialog because they have the same symbolic name and the
  latter is registered later than the former. To test the template
  dialog, just change the symbolic name of the advanced transclusion
  dialog.

Change-Id: I51e74b322aec9a4c3918e6f792bdb3d318060979
2013-12-05 16:26:26 -08:00
jenkins-bot 68ad762613 Merge "Remove dual-type support for Languages and Categories" 2013-12-05 23:01:32 +00:00
jenkins-bot 9205d81c56 Merge "Merge getDataFromDom and getModelFromDom" 2013-12-05 22:58:37 +00:00
Ed Sanders 3c66a297c9 Merge getDataFromDom and getModelFromDom
Now getDataFromDom is no longer called externally, we can merge these two
methods to provide one API endpoint. Also now we have deleted getDataFromDom
we can remove the 'Recursion' disambiguator from the internal function.

Also now that the whitespace info doesn't need to be passed around, implement
it as a simple return value get function.

Change-Id: I9c667e9b90443d12660b731347d7535ccb1a17cd
2013-12-05 21:54:08 +00:00
jenkins-bot 2554487f41 Merge "Prevent content selections ending up inside handlesOwnChildren nodes" 2013-12-05 18:02:43 +00:00
mayankmadan 306665fa72 [browser test] Changed readme file so that it points to mediawiki-selenium
Bug: 56089
Change-Id: Ia0f5d0a36337d883c4066a866aada98d849b8315
2013-12-05 17:52:58 +00:00
jhall 02ae003f2b [Browser test] Removing hard-coded MEDIAWIKI_USER value
Per this QA mail list discussion:
http://lists.wikimedia.org/pipermail/qa/2013-December/000799.html

Change-Id: Ide3bafe9b69eb5769eb99d0a3989d0e909f512ea
2013-12-05 16:56:29 +00:00
Ed Sanders 62e9b6a939 Prevent content selections ending up inside handlesOwnChildren nodes
The delete logic sees the caption inside the image as a valid place to
put a cursor and therefore a valid range to delete up to. This means
paragraphs can be merged into image captions by backspacing them in.

Add in a flag that keeps track of whether we are in a handlesOwnChildren
node so we can skip over them.

Bug: 57927
Change-Id: I19e91d2d3a871806d207cbd419f4a45e41d69dc0
2013-12-05 16:45:28 +00:00
James D. Forrester 114a24f1d3 Remove dual-type support for Languages and Categories
The new form was implemented in Parsoid and deployed in October, so enough time
has passed that there is no longer any need for VisualEditor to support the old
type.

Bug: 56009
Change-Id: Ief2e584345ccdb0e7eb44ab16c4bc14f7c14f5ec
2013-12-04 18:49:48 -08:00
jenkins-bot d2c74b18a7 Merge "Revert "Update OOJS UI to v0.1.0-pre (d047752ccc)"" 2013-12-05 02:04:59 +00:00
Catrope 2a4ba14862 Revert "Update OOJS UI to v0.1.0-pre (d047752ccc)"
Still broken, this time because PagedOutlineLayout / BookletLayout
usage wasn't updated.

This reverts commit c6cfe763bb.

Change-Id: If0d37d396ecf3bb09f026d4432c5d7e30f040085
2013-12-05 02:03:00 +00:00
Ed Sanders e01e2e045b Always use #getDocumentNode.
Because if you only sometimes use a getter you're just wasting your time!

Change-Id: Idd38976f77b58e322d527cecca9f9c36e3ad9318
2013-12-04 22:55:26 +00:00
Ed Sanders 6d34e344ee getDataFromDom -> getModelFromDom
Following on from getDomFromModel, this returns a document model
instead of element linear data. The only instance that hasn't been
replaced is in rich paste, where we need to sanitize the converted
data before constructing the document model.

This should be cleaned up in a later commit.

Change-Id: I37a2b641632af2cb515e3409deed5cd1fa358af5
2013-12-04 14:46:34 -08:00
Roan Kattouw c8608fd7bc Remove duplicate method setUpSurface from ViewPageTarget
Was already implemented in the parent class. Moved setPasteRules() so it
would still get run, everything else had already been moved.

Change-Id: I55ef2622c9eacc8b46bd3487919165bccfc347d5
2013-12-04 22:43:47 +00:00
jenkins-bot 4fe0bc5b80 Merge "Change signature of getDomFromData and rename" 2013-12-04 22:03:43 +00:00
Timo Tijhof 68cf65844e jscs: "var\t" -> "var "
Only 2 hits.

Change-Id: Ie8c5c39a49f620891bae8582dcc0d2f151e50e21
2013-12-04 21:06:19 +01:00
jenkins-bot aff527a20b Merge "Update OOJS UI to v0.1.0-pre (d047752ccc)" 2013-12-04 19:28:24 +00:00
Timo Tijhof c6cfe763bb Update OOJS UI to v0.1.0-pre (d047752ccc)
Also, as OOjs UI's StackPanelLayout was renamed to StackLayout, and the
showItem() function to setItem(), fix uses in VisualEditor.

Change-Id: If153e5e7c3a7c60e3d62e20aac8fabd4eaaa73c2
2013-12-04 08:53:53 -08:00
Ed Sanders 86922f8ca8 Change signature of getDomFromData and rename
Currently it takes 4 arguments which are all properties
of the document model, so just pass the model instead and
access the properties later. Rename to getDomFromModel.

Change-Id: I0c378a04dc08b9b90bdc3984f8fa8c4acfe0b667
2013-12-04 16:30:40 +00:00
jhall 1b847c44dd [Browser test] Restoring a missing page element
Earlier check-in for a VE media interface test
inadvertently re-named a page element that
should not have changed.

Change-Id: Iac1ef365e9cb3912977c8a89f3158ad9d122c93d
2013-12-04 16:03:15 +00:00
jenkins-bot 12d2210cb3 Merge "[Browser tests] Prefer double-quoted strings in Ruby code" 2013-12-04 12:17:01 +00:00
jhall 73198b52d0 [Browser test] New test for VE media interface
Updated to capture changed iframe positioning of some page controls.

Change-Id: I3864e04935eca1ae7c9d70df42fd34ce58e90d66
2013-12-03 23:12:57 +00:00
James D. Forrester a0065cbe0b Fix naked request for save dialog's summary in save
Sometimes a save is not a save, but a switch to the wikitext editor; in this
case, the save dialog doesn't exist, so don't assume that it does.

Bug: 57947
Change-Id: Ic2df7d2066ba03564ed531e1d31351cd27441abe
2013-12-03 14:35:55 -08:00
Timo Tijhof 31e6950af0 Fix csslint warnings
Also:
* Added modules/syntaxhighlight to csslintignore because
  it is broken right now, so it's hard to fix those warnings
  without being able to verify it.
* Fixed a typo in the grunt-watch config that accessed an
  inexistent property.

Change-Id: Ib81572506786b6a1203c454d1b2b91bb6ae2a3de
2013-12-03 23:09:56 +01:00
jenkins-bot 9c3610afb3 Merge "Clear cache key when deactivating target" 2013-12-03 18:24:28 +00:00
jenkins-bot 5cc0706067 Merge "Move activating/deactivating to ViewPageTarget" 2013-12-03 18:21:55 +00:00
jenkins-bot ad2fac3f92 Merge "Genericise runSurfaceHandleDeleteTest to work with other 'handle' methods" 2013-12-03 02:59:09 +00:00
Roan Kattouw 75449ea597 Clear cache key when deactivating target
And other state too, while we're at it.

Bug: 57905
Change-Id: Ifd2744c841f302764cf57c13f4a760cbe80fa2e0
2013-12-02 18:52:47 -08:00
Roan Kattouw 9dc891f4cb Move activating/deactivating to ViewPageTarget
That's where they belong IMO, since ViewPageTarget is the one that
has .activate() and .deactivate(), and mw.Target doesn't retain any
state (apart from some caching things).

Change-Id: Ia6cf5bac9054163d54ab492d691d8ce9d6a3bb90
2013-12-02 18:21:31 -08:00
jenkins-bot 164a262aeb Merge changes I8c8b2d49,If2124c68,I786b63ab
* changes:
  Split apart onSaveError logic for other mw targets
  mw.ViewPageTarget: Remove unused onTokenError handler covered in onSaveError
  Create base MobileView config and target refactor
2013-12-03 02:11:57 +00:00
Rob Moen db970a61fc Split apart onSaveError logic for other mw targets
Change-Id: I8c8b2d4900b511a65cff4c554cf7ef89d6d39ea9
2013-12-02 18:04:29 -08:00
Rob Moen a701e87caa mw.ViewPageTarget: Remove unused onTokenError handler covered in onSaveError
Change-Id: If2124c68aab0d313f4ddd698014d2a4296bbabb8
2013-12-03 02:02:03 +00:00
Rob Moen f1fa56165d Create base MobileView config and target refactor
Changes include:
* Target mobile for ve dependencies
* Create mobile view constructor
** Some tools like dialogs are excluded for now
* Refactor mw.target to permit code reuse
** Split out pageTarget view functionality from core init methods

Change-Id: I786b63ab57518fc6af7761501259ed66592f70e3
2013-12-02 17:59:27 -08:00
jenkins-bot c06316eb64 Merge "Make veaction=edit work regardless of user preference" 2013-12-02 23:43:52 +00:00
Roan Kattouw f8ff2023c3 Fix JS errors when inserting references
ve.ui.MWReferenceDialog.prototype.teardown:
* Pass ranges rather than nodes to transaction builders
* Don't do a removal in insertion mode, we know the removal range
  will be empty

ve.dm.Transaction.newFromDocumentInsertion:
* Correctly splice the edited internalItem into listData in the case
  that newDoc isn't a document slice of doc
* Rename range to spliceItemRange for clarity
* Introduce spliceListNodeRange and set it to either newDoc's
  listNodeRange or doc's depending on whether newDoc is a slice of doc

Bug: 57683
Change-Id: Iae7de7701ae86bed89b707038407243d82249e1a
2013-12-02 11:35:00 -08:00
Ed Sanders 96e2313e6e Genericise runSurfaceHandleDeleteTest to work with other 'handle' methods
We will want to reuse this test runner for handleEnter and handleInsertion.

Change-Id: I7489bf2d20fa17b1c164ff20e0cfcd9b9d5102d2
2013-12-02 15:52:44 +00:00
jenkins-bot 97adcc2103 Merge "Tear down the save dialog and remove it from memory on surface teardown" 2013-12-01 22:23:06 +00:00
Ed Sanders 7982ecf2c3 Render MW extension node wikitext with XML
MW extensions are XML not HTML, so we shouldn't build them as XML
to prevent HTML specific rules being applied, such as <source>
always being self closing.

Bug: 54577
Change-Id: I84af4a29cd1c4ae4d1db4f70a4012a8ad0f98bf6
2013-12-01 17:13:39 +00:00
jenkins-bot 2cf336b958 Merge changes Icb404af8,Ib6efc2a5,I6d48f8ee
* changes:
  Make autonumbered external links inspectable
  Always remove the annotation when the remove button is clicked
  Add abstract getAnnotation() method to AnnotationInspector
2013-11-30 08:58:09 +00:00
Roan Kattouw 93b645a453 Make autonumbered external links inspectable
When the target of an autonumbered link is changed to a URL, it's kept
as an autonumbered link and its target is updated. When the target is
changed to a MediaWiki page, the autonumbered link is removed and
replaced with an internal link with the text set to the target.
So for instance, if you inspect [http://www.example.com] and change
its target to "Foo", the result will be [[Foo]].

The core of this commit adds support for inspecting nodes to
ve.ui.LinkInspector. This support should probably move into a
class in between AnnotationInspector and LinkInspector, perhaps
called HybridInspector or something, but I'm deferring that for now.

LinkInspector allows changes to inspected nodes to be reflected either
as attribute changes on the node, or by replacing the node with something
else. MWLinkInspector uses this feature to replace the autonumbered
external link node with an internal link annotation when the target is
set to an external link.

Bug: 53505
Change-Id: Icb404af84c24574438e4de3ef05bbd1993b593f7
2013-11-30 00:14:41 -08:00
cmcmahon c65a683ecf [browser test] more shuffling of elements among iframes
Change-Id: I1a60e2370fc436702d983705d7360563f5483242
2013-11-27 09:05:58 -07:00
Ed Sanders 5b9231d49d Tear down the save dialog and remove it from memory on surface teardown
Otherwise the old save dialog will still be around if the user sets up
another surface (e.g. a second edit), but won't be attached to the DOM.

Bug: 57654
Change-Id: I23c10849a212534bdd0600637d8ad4fa3ebc4fb7
2013-11-27 14:00:16 +00:00
mayankmadan 2af79b6108 [Browser tests] Prefer double-quoted strings in Ruby code
Bug: 57597
Change-Id: I4ddc3f20d03bf3e66b04234be529c3eaa29be9e0
2013-11-27 16:01:23 +05:30
cmcmahon 0a091193f9 [browser test] elements moved among iframes
Change-Id: Icc9f3f4422dfed063073724f8b610e75fd967b2d
2013-11-26 18:55:21 -07:00
jenkins-bot af9e6dd263 Merge "mw.ViewPageTarget: Use ve-activated class on the html element" 2013-11-26 22:52:14 +00:00
jenkins-bot c18534bcad Merge changes If814e178,Id133431e,I38d63e31,I16d575b6
* changes:
  Plain text paste with paste special
  Use rare unicode characters for paste placeholders
  Rich paste
  Add fixUpInsertion to newFromDocumentReplace
2013-11-26 21:07:46 +00:00
Rob Moen b37fbf9ba9 mw.ViewPageTarget: Use ve-activated class on the html element
This allows things outside of VisualEditor to style themselves
differently while the editor is active.

Bug: 57555
Change-Id: Ief6b5f53096dd5eeb43a72a7bb182a2c04ec97ca
2013-11-26 20:41:27 +00:00
jenkins-bot 3b63e332b5 Merge "Also apply autonumbering CSS to links in generated content" 2013-11-26 20:13:24 +00:00
Ed Sanders 7cec9ae04a Rich paste
Allow pasting of rich (HTML) content.

ve.ce.Surface
* Use a sliced document clone for converting to DM HTML (copy)
* Add full context to pasteTarget before copying
* Add ve-pasteProtect class to spans to prevent them being dropped
* Implement external paste by converting HTML to data and inserting
  with newFromDocumentInsertion
* Remove clipboard key placeholder after read so they aren't picked
  up by rich paste. Hash no longer includes the placeholder.
* Detect the corruption of important spans and fallback to clipboard
  data HTML if available.

ve.dm.LinearData
* Add clone method for copy

ve.dm.ElementLinearData
* Add compareUnannotated for use by context diffing.
* Add sanitize method for cleaning data according to a set of rules.

ve.dm.Transaction
* Add range parameter for inserting a range of a document only,
  e.g. stripping the paste context.

ve.dm.Document
* Implement sliced document clone creation so that DM HTML
  is generated correctly in onCopy

ve.dm.DocumentSlice
* Replaces LinearDataSlice. Now has two ranges for balanced data
  and data with a full context.

ve.init.Target.js
* Define default, loose, paste rules (just remove aliens).

ve.init.mw.ViewPageTarget
* Define strict MW paste rules:
  + no links, spans, underlines
  + no images, divs, aliens
  + strip extra HTML attribues

ve.init.sa.Target, ve.init.mw.ViewPageTarget, ve.ui.Surface
* Pass through and store paste rules.

Bug: 41193
Bug: 48170
Bug: 50128
Bug: 53828
Change-Id: I38d63e31ee3e3ee11707e3fffed5174e1d633b42
2013-11-26 18:23:12 +00:00
Roan Kattouw f4bb62b9d7 Also apply autonumbering CSS to links in generated content
We had CSS that applied to our rendering of autonumbered links,
but not for raw <a rel="mw:ExtLink"></a> tags appearing in
generated content like templates.

Bug: 57420
Change-Id: Ic1585ecb1a133d16b7393ce0ce38a11b76cc2239
2013-11-26 16:53:31 +00:00
Rob Moen 07464e20a5 Remove the toolbar tracker
We were using it for the pop-out save dialog, but now that the save
dialog is real dialog, we don't need it any more.

Change-Id: I72697b5502d5f3fd19f2369a754a62d614af715b
2013-11-26 13:37:50 +00:00
James D. Forrester 7ba9f24121 Make veaction=edit work regardless of user preference
Move the userPrefEnabled check out of isAvailable and instead check
it in-line with isAvailable for setting up the tabs with CSS, but
not for the veaction=edit function.

Bug: 55900
Change-Id: I23984e377ff3fc797e921546492b8c73a5101235
2013-11-26 09:46:42 +00:00
Roan Kattouw 620e0e21ef Use InputWidget facilities in byte limit counter
* Don't use setTimeout() within a change event, because change fires
  after the text has already changed
* Don't use .$input.val(), use .getValue() instead
* Don't use .placeholder()
** Reaching into .$input is bad
** Any use of .placeholder() is TextInputWidget's responsibility
** All browsers we support also support placeholder natively
* Remove .editSummaryByteLimit from ViewPageTarget, unused
* Remove ve.bind() wrapping, we already have var saveDialog = this;

Change-Id: I380575fec8d02d1191bfc1f3f235b94c64cd23b6
2013-11-25 17:23:35 +00:00
Roan Kattouw 080b4380fa Don't build out save dialog when initializing editor
The save dialog DOM is pretty big, so building it on demand
like every other dialog out there seems like a good idea.

Change-Id: I02077c3e45f01d3467d41616eb879bd1d608a82b
2013-11-25 17:23:29 +00:00
Roan Kattouw 35e20d954f Share code between conflict resolution and the edit source switch
Each used their own implementation of building a form and submitting it.
The edit source one wasn't passing in the oldid, which caused edit
conflicts.

Also introduced a separation between form fields (for the action=edit UI)
and API options, building one from the other.

Bug: 56835
Change-Id: I38547b4ba1827f4028a2255109cba2a57cd59e8a
2013-11-25 17:23:20 +00:00
Roan Kattouw 72b0d2a19c Move setting of minor/watch defaults from MWSaveDialog to Target
It looks like it also came from there originally, because it uses
this.pageExists which doesn't even exist in MWSaveDialog. This caused
all pages, even existing pages, to be watched when 'watchcreations'
was set.

This logic really belongs server-side, though.

Bug: 56206
Change-Id: Idf500383b27a93136dc0cfdd60a2e7b2607af95c
2013-11-25 17:20:29 +00:00
jenkins-bot 95358bb7a3 Merge "Consolidate edit section handling code in ViewPageTarget" 2013-11-25 13:47:20 +00:00
Roan Kattouw cf486e011a Consolidate edit section handling code in ViewPageTarget
Move generation of initial edit summary from setupSaveDialog() to
restoreEditSection().

This allows us to get rid of the properties tracking whether both
halves of the edit section handling had happened, because they're
now in the same method.

Moving setupSaveDialog() down so it runs after restoreEditSection();
this is needed for the communication via this.initialEditSummary
to work correctly.

Change-Id: I06a9c5cf5c752acea8a2ac25d0ffb6ac61cfe986
2013-11-25 13:40:05 +00:00
Roan Kattouw 9724bf939d Fix 1919fffc: forgot to add getInnerWhitespace() in one place
Change-Id: Ia90d671100ae445ef414c6aff7b27d078ba82ffc
2013-11-25 13:39:54 +00:00
Roan Kattouw 1919fffc74 Use serialization cache in MW integration
Add prepareCacheKey() which submits HTML for serialization and saves
the resulting cache key, and tryWithPreparedCacheKey() which uses that
cache key (if available; if pending, it waits for it) for API requests.
Implemented save(), serialize() and showChanges() in terms of
tryWithPreparedCacheKey().

When opening the save dialog, run the conversion, cache it, and fire
off a prepareCacheKey(). Then use the cached conversion for save/diff/
serialize. This means we don't convert multiple times, and it causes
the prepared wikitext to be used.

Bug: 55979
Bug: 56011
Change-Id: I1d56fe88d312e9810a57d56a285ccdf4f1facf42
2013-11-22 16:50:16 +00:00
jenkins-bot 10702d9fa0 Merge "Fix crash in MWExtensionNode creation mode" 2013-11-22 15:05:42 +00:00
jenkins-bot ecfa59ae4a Merge "Fix icon opacities" 2013-11-22 13:50:06 +00:00
Ed Sanders 6f984ea98a Fix icon opacities
* parameter.svg had no opacity set
* replace.svg had a document opacity of 80% in addition to the normal 75%
* re-rendered parameter.png (syntaxhighlight doesn't have png's yet)

Change-Id: I9c990fefaf4f5a7536b884b92523408146d7b2c7
2013-11-22 13:47:20 +00:00
Roan Kattouw 1b7fa1cf74 Make save dialog ready for async initialization
initialize() is currently called synchronously, but once the CSS
transplantation code is fixed and it goes back to being async, that'll
cause problems.

* Add this.setupDeferred and use it to defer setupCheckboxes() until
  after initialization
* Move code populating the edit summary from ViewPageTarget into
  MWSaveDialog and use .setValue() rather than manipulating the
  TextInputWidget's DOM. Defer this until after init as well
* Move clearing of the diff from ViewPageTarget into MWSaveDialog,
  and don't connect it to the transact event at startup, only when
  we've actually shown a diff
* Remove swapPanel( 'save' ) from ViewPageTarget, instead do this
  on setup in the dialog itself

Bonus:
* Document events
* Get rid of onFooButtonClick handlers in favor of array syntax

Change-Id: Idcdae5e013340f4519db4387bab507e714d47941
2013-11-22 13:17:53 +00:00
jenkins-bot edc1146eaa Merge "ce.MWTransclusionNode: Don't pass token to parsefragment API" 2013-11-22 13:14:42 +00:00
Roan Kattouw 1f8d01b72e Fix crash in MWExtensionNode creation mode
We can't get the directionality from the focused node if there isn't one.

This doesn't add any logic to determine the directionality in creation
mode, filed https://bugzilla.wikimedia.org/show_bug.cgi?id=57421 for that.

Change-Id: I3ff8d48f19c7beef5e24b55712a26d86efa5812a
2013-11-22 13:03:02 +00:00
jenkins-bot 4f573a3ea2 Merge "Recompute auto-numbered reference listKeys when merging internalLists" 2013-11-20 11:33:15 +00:00
Ed Sanders 24a95b102d Add fixUpInsertion to newFromDocumentReplace
In order to do this we have to separate out the removal
operation from NDFR, so it becomes newFromDocumentInsertion
(again, although actually, for the first time). As NFDI is
an insertion we can just run fixUpInsertion on the data
part of it.

In order for the removal operation to be a proper removal
we have to allow metadata removal (the default is to merge it).

Change-Id: I16d575b61b9796e7e889f2c27cfe02b4a40b7639
2013-11-20 11:24:06 +00:00
Roan Kattouw cde3304864 Recompute auto-numbered reference listKeys when merging internalLists
This fixes some of the problems with pasting references.

It's a bit overzealous in that references get renumbered even when
replacing, which is unnecessary but doesn't actually have any
noticeable effect.

Unfortunately, the internal list state depends so much on the converter
having run that we now need to add yet another hack, to set the counter
to the appropriate value.

Change-Id: I3c6514ce600af4f4c037f419554d34b5a5c86a63
2013-11-20 16:50:48 +05:30
Roan Kattouw fd4495e2df Pass the mw.user directly into {{GENDER:}}
Apparently we can do that ^^

Change-Id: I646bc7df29ad2ae605148089a53f1b5b238dca22
2013-11-20 10:51:32 +00:00
jenkins-bot 137ca9d2d6 Merge "Store inner whitespace of the body and compare it on conversion" 2013-11-20 10:45:04 +00:00
Roan Kattouw 59f5ec86ae Clean up uses of 'this' in mw.ViewPageTarget
* Use 'this' instead of 'viewPage' in setupSaveDialog()
* Unwrap unnecessary .each() in restoreEditSection()

Change-Id: I45d0c9714d59e195d0c4413ed3dbe9cbabe45e9d
2013-11-20 05:33:38 +00:00
Timo Tijhof de979ff293 Replace raw oojs-ui files with v0.1.0-pre (0267100ab3)
Change-Id: I792bc0335269976ff29433227b6fa562a1026aeb
2013-11-20 10:27:48 +05:30
Jeff Hall c027af9e12 [Browser test] Expanding test with additional text markup types
Change-Id: I3141993f1527dfdeea66ac2a52ee7c8be384f198
2013-11-19 13:42:07 -08:00
jenkins-bot 457cbfdbe8 Merge "Prevent link-annotating MWReferences" 2013-11-19 11:01:40 +00:00
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