Commit graph

83 commits

Author SHA1 Message Date
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
jenkins-bot dc4ceb9f56 Merge "Add ability to log analytic events using EventLogging" 2013-06-13 17:20:21 +00:00
Ori Livneh efba2cf8da Add ability to log analytic events using EventLogging
This change adds a '$wgVisualEditorEnableEventLogging' configuration
variable, accessible client-side as
'wgVisualEditorConfig.enableEventLogging'.

When true, the 'schema.Edit' ResourceLoader module will be loaded on the
page, and calls to ViewPageTarget.logEvent will forward to
mw.eventLog#logEvent.

When false, the module is not loaded, and ViewPageTarget.logEvent is a
no-op.

The change also adds a few calls to ViewPageTarget.logEvent to log certain
editor actions, documented in https://meta.wikimedia.org/wiki/Schema:Edit.

Change-Id: Iccd171d7cde15b0302d1b4c292bcbcc2a4b337ef
2013-06-13 10:14:53 -07:00
Trevor Parscal d3a2fab2c4 Transclusion editing
Objectives:

* Rename just about every use of "template" to "transclusion"
* Make a proper data structure for transclusions
* Abstract away template data
* Use more template data in the user interface
* Allow adding parameters
* Allow removing templates, parameters and content

Changes:

ve.ui.Dialog.css
* Add rule to place add param controls on a single line

ve.ui.MWTemplateDialogs.js
* Move template spec loading into transclusion class
* Add remove button for parts and parameters
* Add parameter adding form
* Use template data for labels and descriptions

ve.dm.*
* Add new transclusion data structures

*.php
* Add links to new files

*.*
* Rename all things "template" to "transclusion"

Bug: 39598
Bug: 49403
Change-Id: I3bcf924a3e179cb65f19e833277a39dfd3dad8bd
2013-06-12 16:39:13 -07:00
Timo Tijhof a0d764b8ee mw: Remove 'Report problem' feature
Removed the "report" slide from the mw.ViewPageTarget save
dialog and everything that becomes obsolete as a result of it:

* JS saveDialogReviewWrongButton, which pointed to the report
     slide (was already hidden as of I90de95f6337ee).
* JS ve.init.mw.Target#reportProblem.
* JS ve.init.mw.ViewPageTarget#diffHtml.
* JS ve.dm.ElementLinearData#getUsedStoreValues.
* PHP mw.config wgVisualEditorConfig.reportProblemURL.
* PHP $wgVisualEditorParsoidProblemReportURL.
* I18N visualeditor-savedialog-title-report.
* I18N visualeditor-savedialog-label-review-wrong

Change-Id: I8a5e0ab2060d7c14086bba413d4c7d73b29c9b97
2013-06-08 01:11:27 +02:00
Timo Tijhof 52025855ae mw.ViewPageTarget: Make tabLayout configurable server-side
Bug: 46871
Change-Id: I3fcb0c2903ae62d61ff789b5504e0ea23932121b
2013-06-05 15:58:27 -07:00
jenkins-bot 453c627922 Merge "Unit tests for browser compatibility list" 2013-06-05 12:33:42 +00:00
Ed Sanders 3b62ffe7c8 Unit tests for browser compatibility list
This test only runs in MW context.

Change-Id: I25315607d208a923aa28f8b34f099440ba311d9d
2013-06-05 14:30:13 +02:00
James D. Forrester 728d24423c Now we've got PHPCS switched on, kill long lines
Lest PHPCS throws wobblies over unrelated changes in PHP files with
underlying issues in their code style.

Change-Id: Ifc4aec328d726e9ca62db34af55ea9592c08d9f3
2013-05-30 11:56:01 +00:00
Ed Sanders c1136ca8e2 Add tests for ve.dm.InternalLists
Also fix clone method when no document supplied.

Change-Id: I7b24e8622049c6293fa0ef813696d5d91a901e75
2013-05-28 22:08:52 +01:00
Inez Korczyński 1d7cf569e6 Support for thumb and frame images with captions.
* VisualEditor.hooks.php
** export URL to magnify clip as a configuration variable so thumbnail image can render correctly

* ve.ce.Surface.css
** add CSS styling to make image captions look the same way in edit mode as they look in the view mode

* ve.ce.ParagraphNode.js
** add CSS class ve-ce-generated-wrapper if it is a generated wrapper

* ve.ce.MWImageCaptionNode.js
** make image caption rendering match the view mode

Change-Id: I0cd1b25e8f8355e0500aabc90e7c4cdf591545f3
2013-05-23 00:44:43 -07:00
Timo Tijhof d28e10d830 ve.Element: Add unit tests
Follows-up c2defc9.

Change-Id: I2045e40567de01f6b44beffe760b6a6287754f75
2013-05-21 19:18:46 +02:00
Ed Sanders a78042accd Disable VE on redirect pages
Will need to be undone once redirect editing support is added.

Bug: 47329
Change-Id: I68836156c35c796aa2156c382992b0c105ae34cf
2013-05-17 12:23:11 +01:00
jenkins-bot 30fb94e94f Merge "Implement ve.dm.MWTemplateNode.getWikitext()" 2013-05-15 22:18:01 +00:00
Catrope 54cd04c391 Implement ve.dm.MWTemplateNode.getWikitext()
Escapes }} and | by wrapping them in <nowiki> tags, and steps around
<nowiki> tags so as to not double-wrap things.

Change-Id: Ia50906524c1fcf55c9f390a114856bc7f20b2d3a
2013-05-15 15:16:34 -07:00
Trevor Parscal a56e795f58 ve.Editor
Objectives:

* Split ve.Surface into ve.Editor and ve.ui.Surface
* Move actions, triggers and commands to ve.ui
* Move toolbar wrapping, floating, shadow and actions functionality to configurable options of ve.ui.Toolbar
* Make ve.ce.Surface and ve.ui.Surface inherit ve.Element and use this.$$ for iframe friendliness
* Make the toolbar separately initialized so it's possible to have a surface without one, as well as control where the toolbar is

Some change notes:

VisualEditor.php
* Added standalone module for mediawiki integrated unit testing

ve.ce.Surface.js
* Remove requirement to pass in an attached container to construct object
* Inherit ve.Element and use this.$$ instead of $
* Make getSelectionRect iframe friendly
* Move most of the initialize stuff to a new initialize method to be called after the surface is attached to the DOM

ve.init.mw.ViewPageTarget.js
* Merge toolbar functions into setup/teardown methods
* Add toolbar manually (since it's not added by the surface anymore)

ve.init.sa.Target.js
* Update new init procedure for editor, surface and toolbar separately
* Move toolbar floating stuff to ve.Toolbar

Change-Id: If91a9d6e76a8be8d1b5a2566394765a37d29a8a7
2013-05-15 10:39:12 -07:00
Ed Sanders 89b0dce8ec ListAction tests
Unwrap and wrap cases.

Change-Id: If4df07eae1d70347dc55b57dc117f2ff5c7385df
2013-05-13 18:59:53 +01:00
Krenair 4f7859895b Don't use VE on non-wikitext pages
Bug: 47456
Change-Id: Iae6510f661feedec181fd8697d799353edb5eac8
2013-05-11 22:26:51 +01:00
Catrope a65ff4fdb9 Use pageLanguage rather than pageViewLanguage for the surface's lang&dir
Bug: 33175
Change-Id: Ica006404227dcd286c387de4f637036341b17eae
2013-05-10 11:04:31 -07:00
jenkins-bot 638bf98e98 Merge "Fix ContentBranchNode test broken by ve.ce.ProtectedNode" 2013-05-07 21:54:18 +00:00
Catrope f6d28e6117 Fix ContentBranchNode test broken by ve.ce.ProtectedNode
Also make sure Jenkins actually runs that test suite

Change-Id: I72b10db3875370da95cb20e127ac8f1efee425bf
2013-05-07 14:48:23 -07:00
Catrope 317a404ece Make .static.storeHtmlAttributes more versatile
It now allows you to specify which attributes to preserve in various
ways rather than just setting true or false.

Removed unused factory methods that exposed the old value.

Change-Id: I914164adcf1f0e48fa3fa85277e68c72dbad393e
2013-05-07 14:45:26 -07:00
James D. Forrester 96683370b4 Do not have ignoreHidden set to true
We're no longer doing dark-launch deployments for the VisualEditor
so this is unnecessary and a bit messy.

Bug: 42936
Change-Id: I0e55faca4eabe910d9b4d8ca8c6b4b0bd42e8539
2013-04-25 15:12:47 -07:00
Catrope f3b03a64f6 Move config vars that are global in nature to the startup module
If they're in the per-page config, we'll have to deal with caching
nightmares when changing them.

Change-Id: Ic8866500b1f20aee36c436dcc3d132c8fde0a8fc
2013-04-18 20:00:55 -07:00
Ed Sanders fd23c9522f Separate experimental features out into a new module
Currently some issues, probably with loading nodes
after factories.

Toggled by global $wgVisualEditorEnableExperimentalCode.

Change-Id: Idab3dd68572c037289c6742d03fd327285110f67
2013-04-18 17:20:11 -07:00
Catrope a20ec306a5 Fix missing global in 116321afe5
Change-Id: Ia76ce0cdd3fed3de1829ae397f1ab3cf3686d8dc
2013-04-17 15:29:58 -07:00
Catrope 116321afe5 Make the "Report problem" POST URL configurable
Defaults to "$wgVisualEditorParsoidURL/_bugs/"

Change-Id: I4847d54b0effe433d5d179d91fdf361c249515ad
2013-04-17 17:05:58 +00:00
Timo Tijhof f669d14569 Test: Fix 404 error.
Follows-up I89f7c2afd815f3050.

Change-Id: Icdc9919b0b9b6f285795ea0d2753cd367cb6ae99
2013-04-02 23:29:20 +02:00