Commit graph

210 commits

Author SHA1 Message Date
Ed Sanders 9041562ed3 Add AnnotationAction.test.js
Depends on I1868130 in core.

Change-Id: I13372efabe91212c10a75df20125365a422919d3
2014-04-24 00:54:02 +00:00
James D. Forrester 11dfcd269c Enable the language tool as a Beta Feature
Change-Id: I14560b758c664081110c76a709a7279c9840cc11
2014-04-23 17:46:27 -07:00
Ed Sanders 3da70b40b9 Update jquery.uls from 601a5256b8 To 1932de9e347d
f404bc9 Update to use jQuery 1.10.1
3571e77 Update jQuery version in examples to 1.10.1
5c6c24d RegionSelector: Scroll to appropriate area instead of rebuilding the list
6d92fa3 Update README.md
ab9b014 Update to latest grunt
078448a Update code formatting
adcc1ad Fix spelling mistakes
33ec928 Use events instead of callbacks for success or no results
e54d85a Use Autonym font for autonyms
d8fdcd4 Corrected the Unicode character in the Arab Kazakh autonym
7b8e43e Add lrc and ses
b1d01d9 Updated Autonym font
0e0cb89 Updated uls.data.js
658914a Update code formatting
9dddc41 Updated Autonym font
e83494c Formatting fixes
a48123e Update Autonym font
61f7bce Update Autonym font
ac8aa27 Remove non-existing "-ms-linear-gradient"
522b14f Use text() instead of html() to set language names
9ae403b Remove unnecessary object instance
a985d33 Use attr and prop consistently
5444e17 Avoid 'recalculate style' by conditionally change classes while scrolling
67cc85f Reduce data size a bit by using unescaped unicode
2247581 Move the autonym font to example instead of making part of jquery.uls
49497d7 Avoid overriding grid css for language list
a4276bb Optimize png images with optipng -o7
72c0bd2 Optimize language icon SVG
e43994d Optimize the search and worldmap svgs
623cdb6 Validate whether the language from API is known while trying to display
9d77cfb Fix typo
cfba32a Remove developer console logs when unknown language found
9b3d64e Remove stray character in example file
84d7636 Use a single var statement
520e1b1 Suppress JSHint double quote warnings in jquery.uls.data.js
09aeb8e Update the Autonym for 'cu'
902afa5 Add the missing closing paranthesis for Chinese Simplified Han
69f3256 Avoid title case
78e9b83 Make ULS language selector appear faster after clicking trigger
a93ad4b Remove comments from json
a1b5db4 Update README.md
50477e2 Update documentation about options
2d93a37 When clicking a region, scroll only the list and not the whole page
d8fc3d4 Remove double scrollTop call
02ebadf Apply /* @embed */ pragma to every image, not just the topmost in each block
d4ea222 Drop -moz-linear-gradient for images
99f1f86 Add rwr and ota to the languages supported by ULS
40e3a94 Updated jquery.uls.data.js file
83bd524 Add EU too for ota.
f00cf29 Optimize all SVGs
38b3780 added dxʷəlušucid [ISO:639-3:lut] to langdb.yaml and updated jquery.uls.data.js wuth ulsdata2json.php
6676222 Lojban to lower case
859bccd Test: Add lut to the list of languages in AM region
5b68627 Add rmf to langdb
61d0086 fixed autonym for Lushootseed
91f3906 updated jason file after modifications to langdb.yaml
0c11d38 Space before comment #
42733b5 Remove prefixed border-radius rules

Repo is https://github.com/wikimedia/jquery.uls.

Change-Id: Ibef36df5fa476725f3f3307888ed368381a70ea5
2014-04-23 18:32:39 +00:00
jenkins-bot a1fd95e522 Merge "Don't change tabs on Education Program pages" 2014-04-17 03:38:50 +00:00
Krenair e3be4a6588 Don't change tabs on Education Program pages
Unfortunately the best way I've come up with to do this so far is
checking the namespace.

Bug: 53477
Change-Id: Ib2dbe91aff516f2d2408e07ff3f73ea861bfcbe2
2014-04-16 20:33:24 -07:00
Krenair 99640bf1a7 Use updated tab labels on description pages for files in foreign repos
See I4a43b759

Bug: 63666
Change-Id: Ie4aeddde4909f455472dc5239156c23200033ee8
2014-04-09 00:26:29 +01:00
Siebrand Mazeland f8d56e6804 Move VisualEditor disabling from now-scrapped preferences section
'editing/beta' section stopped being used by anything other than
VisualEditor in 3c0aa26a0da68a9 in June 2013, and the section was
removed from MediaWiki core in ief2c7d1df876fb04.

This is a follow-up to 799e11ca7e which omitted one occurrence.

Change-Id: I05a6cce89d71808d82c12f54beb6b7a6730b265f
2014-04-07 11:42:41 +02:00
James D. Forrester 799e11ca7e Move VisualEditor disabling from now-scrapped preferences section
'editing/beta' section stopped being used by anything other than VisualEditor
in Id8b9a47a in June 2013, and the section was removed from MediaWiki core in
I76667a15cc today.

Change-Id: Ida16f714c28c46d552b92c05b07b63f5d6dd361e
2014-04-06 16:53:25 -07:00
Krenair e3b7827c44 Give the edit tab <li> closest to the collapsed tabs menu class=collapsible
Bug: 50225
Change-Id: Ib2e6237483338c8072d5f7919c6459bf7418946a
2014-04-03 02:16:13 +01:00
James D. Forrester da381da76d Switch Beta Features hook to use new ltr/rtl screenshot style
Change-Id: I48f5ca54130e4d9c9e3745c89e561b06ccd94a83
2014-03-22 20:54:04 +00:00
James D. Forrester aea64bf2df Remove the math inspector code
Moved to the Math extension in I8e582ee6deadc2750

Change-Id: Iab0c56246626de1e0f6ab770e777c0a28756fa75
2014-03-19 19:27:25 -07:00
jenkins-bot fbdc55dc78 Merge "Table of contents widget" 2014-03-14 22:31:10 +00:00
Rob Moen eba7d58dd1 Table of contents widget
TOC Widget is created in the mw target view class.
Adding and removing a heading rebuilds the TOC Widget based
on the the order of the page heading nodes.

TOC Widget considers TOC page settings and displays in the default manor
unless forced or disabled.

TOC Widget still needs to be finalized by being placed in the surface.
This could be a problem until we have a CE node for it to live in or
have some DM work added.  Roan and I have discussed how to go forward.

To enable the widget you must add the following to LocalSettings.php:
$wgVisualEditorEnableTocWidget = true;

Change-Id: I488cfbbdb060e50d81f51e0f757e67d0114b8936
2014-03-14 15:20:19 -07:00
Krenair 6b2d30c259 Rename 'wasve' parameter to 'veswitched'
Per Krinkle's comment on I1426d300

Change-Id: Ic99efe9488c98a7f6703142d6061bd2cdbac833b
2014-03-12 18:10:17 +00:00
Krenair f8685d94a7 Fix fatal when user switches from VE to the old editor and makes a null edit
$revision can be null if the user makes a null edit, I have changed the doc
page to reflect that.

Change-Id: I40c1412dbd3f8e023bd4fa65d86d3d5092870ad4
2014-03-12 00:01:54 +00:00
James D. Forrester a78a8b458e Update VE core submodule to master (48dd09a)
New changes:
48dd09a Update OOjs UI to v0.1.0-pre (8ac38a5c31)

Add OOjs UI's new Apex theme to the module definition (for users on
older versions of MediaWiki that do not have it available).

Change-Id: Ia79c2380aa2368d58e5980131cf70c91576dfd49
2014-03-04 11:45:12 -08:00
Ed Sanders b14326624b Consistency in DM MW test naming and comments
Move MWConverter to Converter and fix some comments.

Change-Id: I8b73d064c890e9cdae61f8118b092e5041febaa5
2014-03-03 14:34:08 +00:00
Trevor Parscal cbd3419dfb Update VE core submodule to master (ac4b49a)
Also update template/transclusion code for OOJS UI
OutlineControlWidget changes, and uses some of the new
functionality.

New changes:
ac4b49a Update OOjs UI to v0.1.0-pre (51f922ba17)

Change-Id: Id7a1f60cd6ce3bdaba7ccb8774563b9e81c75cad
2014-02-28 16:41:42 -08:00
jenkins-bot 66df1ec1b5 Merge "Track edits where user switched into wikitext editor from VE" 2014-02-27 01:35:56 +00:00
Krenair 952a239866 Track edits where user switched into wikitext editor from VE
By adding a tag called 'visualeditor-switched'.

Bug: 56465
Change-Id: I1426d300499b59ca55c9b97fc1560f4adbfa9295
2014-02-27 01:33:40 +00:00
James D. Forrester 0f45399082 Split up ext.visualEditor.mwcore into smaller parts
Core retains core functionality, including text styling and architectural
items like dialogs.

The new modules are:
* mwformatting
* mwimage
* mwlink
* mwmeta
* mwreference
* mwtransclusion

The new modules are loaded in ViewPageTarget (for desktop), except for
mwlinks which is included from MWTarget (for desktop and mobile), per the
needs of the Mobile team.

Also, mwgallery was moved to desktop-only loading status.

Some styles which were loaded in mwcore but only used in modules is now
loaded in said modules.

This does not split up ext.visualEditor.core yet, which is left as an
exercise for the fool-hardy.

Bug: 61075
Change-Id: I6374854eaa13af824c11078d2f7004dc8a211a30
2014-02-26 16:31:15 -08:00
Moriel Schottlender b54575a797 Set up wiki-default image size
This commit makes several adjustments to make sure default size is being
handled correctly:

* Add wiki's default size configuration parameter to the
  VisualEditor.hooks.php file so it can be called from VE.
* Make sure new images are inserted with default size and are
  marked 'defaultSize = true' for the DM to handle.
* Force default size if 'defaultSize=true' in the DM
* Add a 'default|custom' switch to the media edit dialog for size
  inputs. When 'default' is chosen, the media size widget will be
  emptied, displaying its placeholders (default size)
* When the size widget's values are 0 it will automatically turn to
  default size values. If the value started default and the user
  typed in a size, it will automatically override default and use
  custom size.

Bug: 47804
Change-Id: Ib973ea2afa96090a4ba61b2b55ee63457f1329c1
2014-02-25 16:26:15 -05:00
James D. Forrester 0390da9dbc Remove SyntaxHighlight code
Unused. Will move instead to the SyntaxHighlight extension.

Change-Id: If4d786b55aca45a517c098f3282ba553da0ceb9c
2014-02-20 11:59:37 -08:00
Roan Kattouw 038fe128fe Clean up onResourceLoaderRegisterModules() to make it more data-driven
Bonus: it's now half the size.

Change-Id: I0946eaa8794b49e44a2791befe024e1bc475c0b8
2014-02-14 15:19:21 -08:00
Ed Sanders d169108eeb Implement SVGMaxSize
wgSVGMaxSize sets the maximum size for the shortest edge of a
vector image. Pass this through to MWImageNodes.

Change-Id: I6410e7cda137cf4828d12280cb1e5cfc27805859
2014-02-06 00:59:25 +00:00
James D. Forrester 9a2fb3cfe1 Set wfUseMW down to MW 1.22
Our only dependency on MW was backported from MW 1.23wmf2 to 1.22 before
it was released, so this has been unnecessary.

Change-Id: I6652e6a0a783d33fc8a10eff62128e87923c2510
2014-02-05 08:46:11 -08:00
Trevor Parscal 7994eae8c2 MediaWiki language inspector updates
* Add ULS, which was removed from VE core
* Add experimental mwlanguage module which adds ULS integration
* Hook in ULS to the existing language widget

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

Bug: 47759
Change-Id: I325a4dcc316d0334fadfcaa46ad3acd45c6bf84b
2014-01-18 01:02:23 +00:00
Trevor Parscal 0916b68ed5 Remove unused OOUI messages
Change-Id: I0ce895cb7982fa2e320885b22808b857dc59ca47
2014-01-17 12:49:27 -08:00
Roan Kattouw dc882baab6 Refactor extraModules to $wgVisualEditorPreferenceModules
Instead of having a hard-coded array of preference-triggered modules
that we need to maintain in multiple places, manage this data in one
place in a configuration variable, and explicitly declare the preference
and module names rather than interpolating both of them from a name.

This allows extensions to add preference-triggered modules, and it
allows them to have preference names and module names that aren't
prefixed with 'visualeditor-enable-' and 'ext.visualEditor.' respectively.

Change-Id: I9eb14349cd39125d5c11ffb44c962cc5febb6ba0
2014-01-06 16:57:45 +08:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Roan Kattouw ee743f869d Use submodule for VisualEditor core
* Add lib/ve.
* Remove modules provided by VisualEditor core.
* Update paths.
* Remove VisualEditor core specific things from Gruntfile.
* Remove entries from external.js already in lib/ve/.docs/external.js.
* Implement build script to compose a jsduck index that includes
  all of VisualEditor core. Right now it includes VisualEditor's
  index as-is, and because those patterns (e.g. ve.dm.*Node) will
  also MW subclasses this means our category page will include
  MW classes under "VisualEditor (core)" (before the repo split,
  this was intentional).
  This is inevitable unless we list every class individually, or
  (the plan) until we move the MW subclasses out of the ve.*
  namespace and into mw.* somewhere.

Bug: 45342
Change-Id: Iff45cd555430634c9fc341fd3b177c1e0625300b
2013-12-20 09:18:41 +00:00
Roan Kattouw c41b60021d Move libraries to the lib/ directory
Didn't move unicodejs because it doesn't have its own repo
and is currently mastered in this repo

Change-Id: I14ab4bd641077d993ac235d8bcdcf8e50a1a72a7
2013-12-19 23:02:52 +01:00
Roan Kattouw 21dd4e411a Update jquery.i18n to f6102aa4feddf3623c9fba3a3d31592c58204b58
From f6102aa4fe

Also rename jquery.i18n.messages.js to jquery.i18n.messagestore.js ,
somehow these files are named differently between the version in ULS
and the version in github and I didn't pick up that change when
switching between them.

Change-Id: Icd78c1374969f1ea539938237d405a8aeecd1dd7
2013-12-13 12:16:53 -08:00
Roan Kattouw 3955ceeafa Combine ResourceLoader::register() calls
Build an array of modules to register, then call register() once.

Change-Id: I2040ff12e2660260698bca783a7be50308687011
2013-12-12 00:59:38 +00:00
Ed Sanders 6c231be8ab Organise Flat/ElementLinearData methods and tests
Move containsElementData to FlatLinearData next to isElementData. Move
tests for both methods to FlatLinearData.test.js.

Change-Id: I07a192f5925da7cc763efe5e41427f1f47d85850
2013-12-10 17:51:36 +00:00
Roan Kattouw e1a404e68f Add jquery.i18n files and RL module
Imported 09f7c9e40fc3bd502 from
 https://github.com/wikimedia/jquery.i18n/tree/09f7c9e40fc3bd502

Change-Id: I9bc4759202a0475bcf52230e0c57a877cc848773
2013-12-06 22:50:43 +00:00
Roan Kattouw 3b82dc5cf3 Use proper conditional registration for jquery.uls
Previously worked by checking for the UniversalLanguageSelector
extension, now actually checks for the modules themselves.

Change-Id: I99b1bfabb1953579d3aaa661ab0a4d824a7fe656
2013-12-05 22:02:40 -08:00
Roan Kattouw 0f01f951bb Conditionally register oojs and oojs-ui
Only register them if they aren't already registered, so we're compatible
with versions of MW core with and without oojs.

Change-Id: I5dbb480e8330ceaf0531c194b8ef6cc6c65f537e
2013-12-04 18:28:59 -08:00
David Chan b4f4eeb4b6 Event Logger: collect IME functionality info
ve/ce/SurfaceObserver.js
* Do not setTimeout if frequency === null

demos/ve/eventLogger.html
* Standalone event logging script

ve/test/ce/imetests/*.js
* JSON event logs for various tests/browsers/IMEs

ve/test/ce/ve.ce.test.js
* Add an IME test

VisualEditor.hooks.php
* Add test files

Change-Id: I50e89d5a289f3fcb4fe2a6835a2ec96fb497242c
2013-11-25 16:56:09 +00:00
Timo Tijhof 4cbf220bd8 Use __DIR__ instead of dirname( __FILE__ )
Change-Id: I7ea4cb82ec7b3c6077a7485b0fb618d4c1dd00f9
2013-11-20 09:39:02 +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
Timo Tijhof 98bc6adf1f Use mw.util.getUrl instead of mw.util.wikiGetlink (deprecated)
Change-Id: I72afbbd909ce2394d54f78d465bd8ad245c1694f
2013-11-12 18:34:05 +01:00
jenkins-bot 8de944d9f3 Merge "Adapt beta features icons for RTL" 2013-11-08 18:57:54 +00:00
Amir E. Aharoni e7b3ff3f32 Slight refactoring of global VE language variables
Grouping multiple $out->getTitle()->getPageLanguage() calls 
and updating its use instead of the global $wgContLang

Change-Id: I1bc0e83cbd31a95b1716665314e082d5ed9113ea
2013-11-08 17:30:33 +00:00
Amir E. Aharoni 1ba0fe0e83 Adapt beta features icons for RTL
Split the current icons to rtl and ltr versions.

Rename all the current mentions of beta icons to ltr and rtl,
even those that don't yet exist or are commented out.

Change-Id: I96be20515cc9d84d2d71ac7e65d97d72d96636b0
2013-11-08 18:33:53 +02:00
Mark Holmquist aec9f416dd Use new BetaFetaures message fields
Depends on Iccf52b789682d in the BetaFeatures repo.

Change-Id: I45ac87e9c715a3bcb1663c83329e1581bcef7907
2013-10-30 16:56:58 -05:00
Ed Sanders 9c8070aba2 Rename 'formulæ' to 'formulae'.
Everyone loves a ligature, but within our codebase we should
be consistent, and sadly that means using en-US, not en-GB-archaic.

Also having non-basic latin characters in filenames is a bit
of a pain for developers.

Similarly for the i18n message, the ligature should go in
MessagesEn_gb if anywhere.

Also in this commit, re-saved the BF thumbnails as plain SVG.

Change-Id: I21a2bf040bed132d3f1c73c916c731d36e0ad852
2013-10-30 17:01:12 +00:00
jenkins-bot 564605711c Merge "Convert the mass Beta Feature into feature-level ones, enabling formulæ" 2013-10-30 00:08:31 +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
Ed Sanders 58fba521e0 Use jsdifflib for QUnit diff
Because QUnit's inline diff is terrible for large diffs,
especially when there are block whitespaces changes.

Change-Id: I786fb981b02777ede38c4bee261f9e32f8f908ed
2013-10-23 20:31:17 +00:00
jenkins-bot 3191c47d10 Merge "Added SVG logos in new style, rm'd old pngs" 2013-10-23 19:20:40 +00:00
Trevor Parscal 26a1d8986b Remove ve.Factory and ve.Registry and use oojs instead
Change-Id: I2717300e6cc6102296a2b8d063d344fa5897c825
2013-10-22 19:15:18 +00:00
Ed Sanders 4194a5a380 Added SVG logos in new style, rm'd old pngs
Change-Id: I1f77c645a9fc92bc2a81391107ddb3a54ef37a50
2013-10-22 18:20:32 +01:00
jenkins-bot 324b04137b Merge "Add requirements to BetaFeatures hook" 2013-10-21 15:18:24 +00:00
jenkins-bot 577e3b3924 Merge "Enable VisualEditor using Beta Features" 2013-10-14 18:16:22 +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
Roan Kattouw 0901c0328a Generalise the way extra modules are loaded
Change-Id: Icd453421b022a6450d1358edbe2132e49ca0b3bf
2013-10-11 14:07:00 +01: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
James D. Forrester 0bff45959f Move skin support into $wgVisualEditorSupportedSkins
$supportedSkins is mostly an artefact of the currently-unrefactored init code that
will have a sub-class for each skin (so skin's maintainers can add VisualEditor
support without hacking around inside VisualEditor itself), but until then let's
split it out into a global configuration variable at least, so that they have a
hope.

Change-Id: I0742cea6469678c5599768340dfb1f6d2f4debf4
2013-10-07 15:55:22 -07:00
jenkins-bot bea113fee2 Merge "Introduce newFromDocumentReplace() transaction builder" 2013-09-26 20:45:54 +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 8547dbc032 Tests for handleDelete in ve.ce.Surface
Trigger fake delete/backspace events and assert changes to the DM.

Change-Id: I69659a3e49b6520376cac3c795e8a96e7fbda9ae
2013-09-24 15:32:37 +00:00
C. Scott Ananian 21cd7bad53 Don't break core's parserTests if VisualEditor is installed
VisualEditor's hook changes the edit section link, which changes the
output of certain parser tests so that they no longer match the
expected text.  Use the `ParserTestsGlobal` hook (which cleans up
after itself when the parserTests ends) to disable the
`onDoEditSectionLink` hook when we're running parserTests to avoid
the spurious failures.

Change-Id: Ic958d88f443ac37ba304d3256e2bb5ea2fde820d
2013-09-18 13:03:40 -04:00
Ed Sanders 4f768f3734 Integrate with BetaPreferences
Look at logo Michael.

Bug: 52686
Change-Id: I3cfada2ea264184698de5f322c1fe5041b37b8c8
2013-09-10 10:20:14 -07: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
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
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
Timo Tijhof 7ca95e3d32 VisualEditor.hooks: Sort keys
Change-Id: I68f9258f739532ca30d2fdc91e62d6a2f87a5180
2013-07-31 20:46:36 +00:00
jenkins-bot c9bcd42317 Merge "Remove gender micro-survey from VisualEditor" 2013-07-31 19:36:55 +00:00
jenkins-bot 2a272fa87c Merge "Add dependency check for MW1.22/wmf11" 2013-07-31 18:59:45 +00:00
James D. Forrester e763f9dd25 Add dependency check for MW1.22/wmf11
And perhaps-overly lengthy explanation as to why this is needed.

Bug: 51606
Change-Id: I225bfbe7923434f3c363562de6226ddf618b834b
2013-07-31 11:58:06 -07:00
Ori Livneh e98d54078b Remove gender micro-survey from VisualEditor
The 'ext.visualEditor.genderSurvey' module was introduced in I2b4aba6a9
for the purpose of instrumenting a short-lived microsurvey that would be
concomitant with the deployment of VisualEditor. The survey has now run
its course; this patch removes its code.

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

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

Bug: 47759
Change-Id: I3c9fd6c135c05a54f6c7fc28c5962fc0a6677806
2013-07-29 00:38:59 -04:00
Roan Kattouw e49df7f9d9 Infrastructure for loading plugins in the MW integration
Server-side, plugins can register themselves by adding to
$wgVisualEditorPluginModules. This is the recommended way for
MW extensions to extend VE. Client-side, plugins can register
themselves through mw.libs.ve.addPlugin(), which takes a string
(RL module name) or a callback.

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

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

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

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

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

VisualEditor.php:
* Add $wgVisualEditorPluginModules

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

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

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

Bug: 50514
Change-Id: Ib7d87a17eaac6ecdb8b0803b13840d7ee58902df
2013-07-26 19:31:56 +00:00
James D. Forrester 0536d22370 Create temporary preference to disable VisualEditor during beta
This preference will allow users to opt-out of VisualEditor during the beta
if they so choose. We do not re-use the alpha enablement flag because (a) this
would lead to a confusing preference description, and (b) because opting in
and then out of the alpha is not the same user choice as opting out of the
beta period.

Change-Id: I0f0a1b5eb21703ad422d007cab65c75ac1aa6fd8
2013-07-24 01:59:47 +00:00
Timo Tijhof a81beef27a mw.ViewPageTarget.init: Move conditionals client-side
Load the module always and have the conditionals on the
client-side so that we can change these without running into
problems with the new conditions not being rolled-out quickly
for anonymous users because the load queue is in the HTML
and cached for 30+ days.

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

Removed unreachable code for loading ext.visualEditor.splitTest.

Change-Id: I21114960a88d224747447f2dc83d17d160f5f066
2013-07-23 20:25:37 +02:00
Timo Tijhof 95f135b0c8 hooks: Only check relevant page title instead of both
The relevant page title is equal to the native page title
if we're on a regular page (e.g. both are Foo on Foo and on
Special:MovePage/Foo one is Special:MovePage and the other
Foo). In that case there is no point in checking both, especially
if it is with the OR condition.

Change-Id: I310e638a73312afea421a399ce4c6ea9b4254cbf
2013-07-22 19:50:25 +02:00
Timo Tijhof 712a7e9674 Don't set ignoreHidden=true when calling User::getOption
This parameter is confusingly named, but the purpose of it is
is to undo what wgHiddenPrefs does. So instead of returning the
default value and ignoring the value previously stored in the
user's preferences, setting ignoreHidden=true would instead give
us the stored value dispite it being no longer visible on
Special:Preferences.

We also don't need to do $defaulOverride since the default (null)
is falsy already.

Change-Id: I397ac16aae4a2ed02687dff8552548c662f5d9bb
2013-07-20 03:14:18 +02:00
Timo Tijhof fd0f4ff5cf Run UnicodeJS tests from Special:JavaScriptTest/qunit
Previously they were only run from the dedicated standalone test
which meant they weren't being run from Jenkins.

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

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

Change-Id: Iec34f2029f5f9c34855b4d79ef70db5751461a96
2013-07-10 19:36:55 -07:00
Timo Tijhof b21fe5fbc1 Split off setup from the rest of mw.ViewPageTarget
Initialisation initialisation? It's time to rename ve.init
to ve.platform and ve.init.Platform to ve.platform.Environment,
but that'll come later.

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

Bug: 50542
Bug: 50608
Bug: 50612
Change-Id: Ic8b0004ab5288fa91bb29d496485b93ffd8d977e
2013-07-04 01:18:28 +02:00
Roan Kattouw 92c38eab85 The great directory split of 2013
Move all MW-specific files into the ve-mw directory, in preparation
for moving them out into a separate repo.

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

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

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

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

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

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

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

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

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

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

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

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

bullet-icon.png: Unused, deleted

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

Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
2013-07-02 20:51:38 -07:00
Matthew Flaschen d86c425e10 Make GenderSurvey a number, not string.
Change-Id: I86f528070be66ae617337bb5df64951aad9b5f58
2013-07-01 16:01:38 -07:00
jenkins-bot 518dd6247c Merge "Add GuidedTour survey about user gender" 2013-07-01 22:46:52 +00:00
Matthew Flaschen 3b4b0c3c89 Add GuidedTour survey about user gender
Disabled by default, enabled with $wgVisualEditorEnableGenderSurvey.

Change-Id: I2b4aba6a95a33474c3e68423d478aa78e57d86ad
2013-07-02 00:13:38 +02:00
James D. Forrester 778b8d3f9e Add ability to disable for anonymous users
This adds a new config variable, $wgVisualEditorDisableForAnons,
defaulting to 'false', which disables VisualEditor for not-logged-in
users. This only makes sense where the visualeditor-enable setting is
set to 'on' for all users; it will be used but briefly.

Bug: 50000
Change-Id: I7418c7d96a79b17e717abfba1af8c5df3141e591
2013-06-29 20:55:47 -07:00
Roan Kattouw f538fcf6be mw.ViewPageTarget: Add sanity check for DOM roundtrip
The sanity check converts the linear model back to DOM, then
compares this DOM to the original DOM and rejects the deferred
if they are not equal.

The DOM creation has to be done synchronously (before we unlock
the surface), but the actual comparsion can be (and is) done
asynchronously.

To make the UI flow of the save dialog easier we just keep the
save button on the toolbar itself disabled until the sanity
check is done. Though this should finish before the user starts
editing the document (let alone start saving), we do add a class
to the button to indicate a progress cursor.

To simulate a slow sanity check, set the setTimeout in
startSanityCheck to 5000, load VE, make a change, hover the
button, and see it change from disabled + progress-cursor to
enabled after 5 seconds.

To simulate the sanity check failing, change !== to === in
the first "if" in startSanityCheck.

Bug: 47521
Bug: 50067
Change-Id: I04f71fe8e00c6257fbc953cc9de3323e24709b0f
2013-06-27 19:20:14 -07:00
Ed Sanders d1aca4503e Separate out MW specific converter tests
They are only run in the MW test runner, where the MW dependencies
are available. Create a ve.test namespace for storing shared
test runners.

Change-Id: I079cb18b1c73614d25a12c5d6afcf0700469e52e
2013-06-27 17:10:25 +01:00
jenkins-bot 3b0d5734fb Merge "Remove the preference to use the wikitext editor for editing sections" 2013-06-26 20:48:49 +00:00
MatmaRex 7a2811b6de Remove the preference to use the wikitext editor for editing sections
No longer useful now that I4b9c47fd exposes both ways of section
editing.

Change-Id: I93958413b4b6ad870306d9f06f540cdde47f7499
2013-06-26 19:25:29 +00:00
James D. Forrester a06a81370c (Re-)Add ability to work even if preference is hidden
We want to mark the preference as hidden as we then subsequently remove it.
However, if a preference is hidden and we don't set ignoreHidden=true, then
it will always fail to trigger VisualEditor, which is sad. Consequently, add
this awful hack until deployment of VisualEditor is true for all wikis.

(We may want to refactor this enablement code a bit - it's a tad ugly. I've
added some more spacing just so you can see what's what, but…)

Change-Id: Ia43c9241b53dddb3dcb8b3edfb3b5163e19e18b1
2013-06-26 10:23:56 -07:00
Mark Holmquist 9b320f73fa Fix fatal error on user registration due to hook fail
Hooks need to return true if they succeed. Fatal errors in production.

Change-Id: Ie5ec5881a8d158bd675dbb6db4540f02fd33290d
2013-06-17 20:14:46 -07:00
Ori Livneh ccfb14b99d Split test: instrument edit events for standard editor interface
This change adds 'page-edit-impression', 'page-save-(attempt/success)',
and '(section-)edit-link-click' events to the standard (non-VE) editor
interface, mirroring the events we added to VE. This makes the event data
usable for split-test analysis.

Change-Id: I51c441d61daa18d58ca7f62a9e5f07902a099050
2013-06-17 14:14:57 -07:00
Roan Kattouw df97f759b1 Refactor selectNodes tests
* Move them from ve.example.js to ve.dm.example.js
** Also move lookupNode() and createDomElement() there
** Delete ve.example.js because there's nothing left in it
* Make main example document implicit, but allow override
* Specify nodes as arrays and do the lookup later
* Specify range and mode separately rather than calling selectNodes()
  during construction
* Construct statically rather than in a function
* Use expect( cases.length );

Change-Id: I620e949c5e612b32eaa57c5d9b60cc91f9ddbf02
2013-06-17 20:08:08 +01:00
James D. Forrester 3818966063 Add ability to run a 50% split user test with VisualEditor as default
Will only run if $wgVisualEditorEnableSplitTest is set to true. To be removed
once VisualEditor is fully deployed.

Bug: 49604
Change-Id: I5c603ece309d61641d32ccc9eff5ea2890d5b816
2013-06-14 19:33:25 -07:00
Ori Livneh fe54db5141 Log user ID; 'pageViewSessionId' to alphanum string
By default, EventLogging uses INT columns for integers, which pageViewSessionId
overflows. I changed it to a STRING type in the schema and am now generating it
using 'mw.user.generateRandomSessionId()'. I also introduced a 'userId'
property, per bug 49585.

Bug: 49585
Bug: 49586
Change-Id: Iddb9eb9c64b55b25445ddf9e474d312b685978a6
2013-06-14 11:19:24 -07:00
Roan Kattouw 3674c8937b Send section edit links to VE by default
Add a preference to disable this behavior. Requires rewording by James.

Bug: 49260
Change-Id: I5ce7ea8c1e47e8243b619fc61aa957f767d22b48
2013-06-13 15:04:02 -07:00