Commit graph

384 commits

Author SHA1 Message Date
Timo Tijhof c3f6a2f561 mw.ViewPageTarget: Tag our state changes and reject foreign states
Store a bit of data with the states we push or replace in the
history so that when the user navigates back to them, we know
for sure this is a state we pushed in the history.

This allows us to filter out popstate events triggered by the
user browsing to states create by other software, as well as
states triggered by the browser that have no state data at all
(Chrome is known to, in contrast with other browsers, trigger a
blank popstate event on load, which we were mistaking for a user
event where the user navigates back to veaction=edit).

Bug: 57901
Change-Id: I142777d0d2ae96d3afee224782f0d2d1522da1eb
2014-03-12 22:26:52 +01:00
Roan Kattouw 7cdaa2a290 Fix JS error trying to access this.saveDialog from switch to source mode code path
The switch to source mode code path was causing onSerializeComplete to
be called, which accesses this.saveDialog because it assumes it's being
called from onSaveDialogReview.

In fact, onSaveDialogReview was calling it twice, once as the callback
it passes to serialize() and once in response to the serializeComplete
event. Cleaned this up by renaming the function and removing the
event binding, so it's now only called once and only for reviewing
changes to new pages, not in the switch to source mode code path.

Bug: 62544
Change-Id: I86eea57806a20408c8dc89a234c39cae1d969bca
2014-03-12 12:05:02 -07:00
jenkins-bot 9eea7240b7 Merge "Rename 'wasve' parameter to 'veswitched'" 2014-03-12 18:14:12 +00: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
Roan Kattouw 66a94861e6 Followup 4bd80b62: fix JS error on page save
Remove stray access to removed this.timings property.

Bug: 62508
Change-Id: I9a6fb802302bbc25ff3e9a657b983d98a0de7fd2
2014-03-10 22:12:07 +00:00
Juliusz Gonera ec6c76d619 Add createSurface() to Target
This can be overriden in subclasses (such as MobileViewTarget) so that
we can customize the way the surface is created.

Change-Id: Id17695c8c75c7ae6c549f915625667389aad5f2f
2014-03-10 14:52:06 -07:00
jenkins-bot fb483849e6 Merge "Abstract tracking and specify which target it came from" 2014-03-08 01:01:08 +00:00
jenkins-bot d86b6a0f02 Merge "Re-enable VisualEditor's toolbar icons on mobile." 2014-03-07 21:55:23 +00:00
jrobson 2ea1eec10c Re-enable VisualEditor's toolbar icons on mobile.
The experience should be consistent between mobile and desktop.
We should explore re-styling these buttons to look like
Ib3c94d19231b018a509b78269001223ad0568795 in desktop as well
at a later date.

Change-Id: Ic9e4c5d12c3c75fcb195432c9155ec0a7eecac04
2014-03-07 10:59:09 -08:00
Rob Moen 4bd80b625e Abstract tracking and specify which target it came from
Split tracking out of the base target and from viewPageTarget

Primary reasons for this change:
 * Makes it possible to resolve an issue with tracking in mobile
 * Lets us reuse the viewPage save workflow tracking
 * Support existing and new targets with tracking
 * Simplification of target classes

Change-Id: I036e4f2129d929db0a3b9a4baa87c946a4b194a9
2014-03-06 09:50:11 -08:00
Timo Tijhof 8735ea2ef9 mw.ViewPageTarget: Check elementsThatHadOurAccessKey before accessing
Follows-up I31d6b9ea065b3be85ed0.

Bug: 62329
Change-Id: I83a6f20cafd6193d64142914f72c1496d03294a5
2014-03-06 18:12:13 +01:00
Moriel Schottlender 89aecd54ba Deal with 'none'/'border' and default size in media edit
There are several conditions to defaultSize behavior of thumbnails and
frameless images and other images when it comes to default size. In the
same principle is 'border' which is not quite a type despite the fact
it 'behaves' as such in wikitext (and has a unique identifier that comes
instead of the other types.

This commit aims to organize this behavior for the user in an
understandable manner.

* Add 'basic' image type for images that have no specified type ('none')
* Handle the difference in 'default' size behavior between basic images
  and thumbnails/frameless. The thumb/frameless images have the default
  wiki size. Other images' default size is their original dimensions.
* Force wiki-configured default size for thumbnails and frameless images
  in the DM. This is done because at the moment Parsoid's output is of
  Wikipedia's default size rather than the local wiki's. The size is
  adapted if needed, directly in the DM.
* Added 'border' as a pseudo-type checkbox flag that sets css class
  'mw-image-border' is for parsoid rendering on save.
* Add 'make full size' to the size widget select and treat it as a faux
  default button for basic and frame images.

Bug: 62013
Bug: 62024
Bug: 61155
Bug: 61059
Bug: 61282
Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed
2014-03-05 03:53:46 +00:00
James D. Forrester 3efa7490d6 Add tooltip to page options menu widget in the toolbar
Currently "Page options" but better suggestions are welcome.

Bug: 61892
Change-Id: I5cf7a4cabaaf7a5d5d0bd1b806f8d95ea4d88033
2014-02-28 11:26:47 -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
Timo Tijhof 58c647e3ac Ensure we use our references to certain native or upstream methods
Checked:
 ve.cloneObject       (oo|OO).cloneObject
 ve.getObjectValues   (oo|OO).getObjectValues
 ve.getObjectKeys     Object.keys
 ve.compare           (oo|OO).compare
 ve.copy              (oo|OO).copy
 ve.isPlainObject     ($|jQuery).isPlainObject
 ve.isEmptyObject     ($|jQuery).isEmptyObject
 ve.isArray           Array.isArray
 ve.bind              ($|jQuery).proxy
 ve.indexOf           ($|jQuery).inArray
 ve.extendObject      ($|jQuery).extend

Fixed:
* ve.dm.MWBlockImageNode.js (added in Iebb2081de)
* ve.dm.MWInlineImageNode.js (aded in I62ec12a6b)
* ve.dm.MWConverter.test.js (added in I90273786a)
* ve.ui.MWMediaInsertDialog.js (added in Ia5ad9a8c0)
* ve.dm.MWTemplateSpecModel.js (added in Ic3eb66538)
* ve.init.mw.MobileViewTarget.js
* ve.init.mw.ViewPageTarget.js
* ve.init.mw.Target.js

Skipped:
* ve.init.mw.ViewPageTarget.init.js
  - Feature test (which is for the very references from ve.js
    being ensured in this commit).
  - Misc code using $.inArray (can't use ve.js yet since that
    isn't loaded yet there).

Change-Id: I73ae005d3692e871fdcaea938641558c0b98ec69
2014-02-20 22:30:29 +01:00
James D. Forrester 0b97870d8c Simplify new INDEX/NOINDEX language, order and panel order
Just say "Default" rather than "Like other pages in this namespace" (let's
put that in the help string/tooltip at some point); order the "default"
value between "yes" and "no" (like for TOC); make sure the panel for the
advanced settings is in the same position in the page menu as the meta-
data dialog.

Follow-up to I30d483b5b6c3df7e

Change-Id: I902eb4f8504866b2dcde32333cf365a59716c2ce
2014-02-20 02:44:08 +00:00
jenkins-bot 78bdbb4c43 Merge "Let users set __NOINDEX__ & __INDEX__ status" 2014-02-20 01:50:29 +00:00
James D. Forrester 051c3498ae Let users set __NOINDEX__ & __INDEX__ status
Add a trinary option to the page settings pane of the meta dialog that
lets users set the page to have __INDEX__, __NOINDEX__ or neither (and so
have the default behaviour).

Bug: 57167
Change-Id: I30d483b5b6c3df7ee56a52c744bbdc610a01873d
2014-02-19 17:48:03 -08:00
Roan Kattouw a7d5751c80 Move some non-skin-specific styles back into ve.ce.Node.css
Rules like "right-aligned images get float: right;" should
be in the generic image CSS, they're not skin-specific.

I haven't exactly teased apart what is and it's skin-specific,
this is just a first stab.

Change-Id: Ie374685d2c66e2275f7a98a590e563bf36da7f87
2014-02-20 00:12:48 +00:00
jenkins-bot 0d2ea63596 Merge "Use accesskey=s on the save buttons" 2014-02-19 21:42:13 +00:00
kaldari 9f1179938c Move some skin styling from ve.ce.Node.css to a shared skin css file
The styling of the image thumbnails should be controlled at the
skin level, not by the generic VE styles. Moving the thumb/figure
styles from ve.ce.Node.css to ViewPageTarget-shared.css. Otherwise
no changes to the styles themselves.

Also adding minerva (the mobile skin) to the list of supported skins.

Bug: 60542
Change-Id: I67ab6d5b91cee7e587f61df26e7dae74c1068788
2014-02-19 13:30:30 -08:00
Krenair ec8234f183 Use accesskey=s on the save buttons
Bug: 50897
Change-Id: I31d6b9ea065b3be85ed07fba7437bed71010512b
2014-02-19 19:34:13 +00:00
jenkins-bot 4944dff419 Merge "Let users set #REDIRECT and __STATICREDIRECT__ status" 2014-02-14 03:46:12 +00:00
Juliusz Gonera ae2f5134b2 Make MobileViewTarget scroll to desired section
Implements
https://wikimedia.mingle.thoughtworks.com/projects/mobile/cards/1626

Also, rename $el to $container so that it matches the docs.

Change-Id: I9f41ec6fb88f6f21e698553216ccf2c3231589c1
2014-02-13 00:22:53 +00:00
Juliusz Gonera a6b149decc Move restoreEditSection() to mw.Target
It can be reused in mw.ViewPageTarget and mw.MobileViewTarget.

Also, check if this.section is undefined instead of not null and update
docs. restoreEditSection() does not accept any arguments.

Change-Id: Ibbcf4cb936a89d3ae77bb61ee97b8ad00a8d8a53
2014-02-13 00:22:33 +00:00
James D. Forrester 5af9f61520 Let users set #REDIRECT and __STATICREDIRECT__ status
Adds setting and unsetting the #REDIRECT status of the page from the page
settings pane of the meta dialog, and toggle whether this is a static
redirect (i.e., it is not automatically changed when its target is moved).

If the page has a redirect set, the meta dialog will be shown on opening
the page so that users can adjust the redirect more swiftly.

Bug: 47328
Bug: 50878
Bug: 57173
Change-Id: Ibd89cf04486799f292b9fd045dae5bc23fcf6fd4
2014-02-12 15:24:12 -08:00
jenkins-bot 4ac1b42690 Merge "Add tooltips to the drop-down menus explaining what they do" 2014-02-12 22:10:32 +00:00
jenkins-bot 2f9c71edd3 Merge "(Stand back again) Even moar label manias! (label refactoring) + VE core update" 2014-02-12 22:08:27 +00:00
James D. Forrester e4f983356b Add tooltips to the drop-down menus explaining what they do
Needs Ic967b88d55daf48d365487e17f76488b3f02c60f to work properly.

Bug: 59719
Change-Id: I449be926e830de241a870d96bf30c835f60ca77d
2014-02-12 22:07:24 +00:00
Trevor Parscal eca0a08ad9 (Stand back again) Even moar label manias! (label refactoring) + VE core update
Update VE core submodule to master (84ced37) and update calling code
for changes in OOUI.

Depends on Ic967b88d55daf48d365487e17f76488b3f02c60f and Ib599b9bd5028e2df084fcc3da657aeb7f1569d2a

New changes:
94f03c3 Undefined variables first in selectNodes
62b5648 Localisation updates from https://translatewiki.net.
10c5a18 Don't descend into handlesOwnChildren nodes in selectNodes
4ed2432 Update jquery.client to MW's master (45192156d7)
d7e24b8 Localisation updates from https://translatewiki.net.
babb9da Localisation updates from https://translatewiki.net.
4639d18 Localisation updates from https://translatewiki.net.
a561537 Localisation updates from https://translatewiki.net.
8f7053a Localisation updates from https://translatewiki.net.
7112cc2 Update OOjs UI to v0.1.0-pre (a290673bbd)

Change-Id: Ie7d58472619509782f23a7dedc1ec27c3dcc7543
2014-02-12 14:05:23 -08:00
jenkins-bot b9aa9d2f27 Merge "Include edit status in the ve.deactivationComplete event" 2014-02-12 22:02:20 +00:00
Sam Smith 5ebacd389d Include edit status in the ve.deactivationComplete event
Rather than setting the wgPostEdit configuration variable when the
user uses VisualEditor, i.e. communicating via mutable global
state, include whether or not the user edited the page in the
ve.deactivationComplete event.

Bug: 52955
Change-Id: I0f5067550921008f74221d6c92882adfe404b3a5
2014-02-12 13:59:04 -08:00
jenkins-bot 25276e2a5a Merge "Fix margins after they were broken in 9d988924" 2014-02-12 21:12:02 +00:00
Ed Sanders c95e404a30 Give the document focus on save dialog open to resolve inspectors
Bug: 60837
Change-Id: I624a76f5d09db270e651ac004813acfba249f5f6
2014-02-12 14:14:23 +00:00
Trevor Parscal 79082ebf82 Fix margins after they were broken in 9d988924
Changes in MediaWiki core to the padding of div#content in Vector
(see 9d988924a0350228745375e074420a0e1214f7e3 ) made the toolbar in
VisualEditor's ViewPageTarget integration for Vector render incorrectly.

This adjusts the toolbar margins to match the changes in content padding.

Bug: 61224
Change-Id: Ie6b47f5d1929533669118ba51202c1fccda4a0d6
2014-02-11 23:08:58 +00:00
jenkins-bot 604d52244d Merge "Make this.loading abortable" 2014-02-08 00:25:40 +00:00
jenkins-bot c5157ac79a Merge "Fixes for 239bae7512 (mobile toolbar)" 2014-02-08 00:18:26 +00:00
Roan Kattouw 2cf871415b Make this.loading abortable
.then() removes the .abort() method from the promise, even though
we had return jqxhr; in the then() callback. So store xhr in
a variable and put the abort method back.

This fixes a JS error upon calling this.loading.abort();

Change-Id: I50460782e58399198bacc02d028984682ddbed56
2014-02-07 15:56:55 -08:00
jenkins-bot 814513113a Merge "Hide wikitext warning notification when the user removes the markup" 2014-02-07 22:54:56 +00:00
Roan Kattouw bb465b22a5 Fixes for 239bae7512 (mobile toolbar)
* Use correct class name for setUpToolbar() in MobileViewTarget
* Move shared setUpToolbar() code into ve.init.mw.Target
* Fix iconModuleStyles documentation, remove leading space

Change-Id: Icf5ed36fd817837c0434db8202bef8a78e6cb898
2014-02-07 14:15:17 -08:00
jrobson 684c9887cd Fix toolbar placement
The selector is too weak and results in the toolbar being placed
in positions it shouldn't be! Whoopsy!

Change-Id: I63540130e4de01f9326fe110d606985fea70b644
2014-02-07 11:09:10 -08:00
jenkins-bot c93f54e1b8 Merge "Fix crashes in onLoadError()" 2014-02-07 18:34:31 +00:00
jrobson 239bae7512 Allow better toolbar customisation for VisualEditor
The toolbar in very desktop vector skin specific
In mobile we want to have more control over the toolbar,
and its placement.
* Thus make setUpToolbar abstract
And move the function to ViewPageTarget

* Introduce ve.init.mw.Target.static.iconModuleStyles to
allow the use of different icons
* Update the mobile toolbar to only have B and I tools

Change-Id: I4c72b4b9128b3a74de8b8b5bce7664fbb315216b
2014-02-06 15:45:08 -08:00
Ed Sanders cf62801694 Move paste rules to Target
Because ViewPageTarget isn't always loaded.

Bug: 60912
Change-Id: I16bd6a329120b3dd7dcb0de3e76e69e84c18553f
2014-02-06 22:41:51 +00:00
Roan Kattouw b49adadcc7 Fix crashes in onLoadError()
The jqXHR parameter is optional, so handle the case where it's null
gracefully.

Also fix the documentation for this method, it was full of lies.

Change-Id: I6ab799846a4d4b0d10cc5fd4d8c47264b1845bdf
2014-02-06 21:17:23 +00:00
Ed Sanders 1e6daf1ee6 Implement surface paste rules for media/ref dialogs
Extend default paste rules to prevent lists/tables/references/headings
as applicable.

Also update submodule to master (76ff210).

New changes:
f1a927f Internal paste rules and type conversions

Bug: 59603
Change-Id: I952f98477219a55d25a2bd817344bde58a4862d4
2014-02-05 11:17:33 -08:00
Krenair 9a38ccfe12 Hide wikitext warning notification when the user removes the markup
Bug: 51701
Change-Id: I2b24b91175768334c5111bf8e550be9c34c12f69
2014-01-30 01:41:00 +00:00
Krenair ff95f88e58 Stop API error dialog popping up if you navigate away from the page while Parsoid loads
By checking response.status per this page:
http://stackoverflow.com/questions/9229005/how-to-handle-jquery-ajax-post-error-when-navigating-away-from-a-page

Bug: 51546
Change-Id: I80830b4af1f950369b73497c767cdee4806e7ce6
2014-01-29 00:22:55 +00:00
Ed Sanders 3612914509 Fix toolbar margins in vector
In HD mode, the left margin was 0.25em off.

In narrow mode, the margins were completely wrong.

Bug: 51000
Change-Id: I7fd9cbc925b828fd780adb9ab2c71bcf15dc7284
2014-01-27 20:11:22 +00:00
jenkins-bot 3cdc8e59b4 Merge "Tee tracked events to MediaWiki's mw.track" 2014-01-17 22:49:24 +00:00
Trevor Parscal f4156bd09f Update VE core submodule to master (e7e2833)
New changes:
* e7e2833 - Update uses of Push/IconButtonWidget to ButtonWidget
* d9d9eb5 - Update OOjs UI to v0.1.0-pre (d9bab13)
  * d9bab13 - The Great Button Refactor of 2014
* 22b93ef - Update OOjs UI build (88b2871)
  * 88b2871 - Fix png transparency on required.png
  * 670c468 - Add i18n

Also:
* Update uses of Push/IconButtonWidget to ButtonWidget as there
  is a breaking change in new OOjs UI version.
  This was separated from commit I325a4dcc316d0.

Change-Id: I82220d15221c52be03feafcfc85c2bd6c12ba462
2014-01-17 16:29:36 +01:00
Ori Livneh 753d87e618 Tee tracked events to MediaWiki's mw.track
When running in the context of MediaWiki, VisualEditor should tee its event
stream to MediaWiki's main event bus, mw.track(), so that MediaWiki event
subscribers have a unified interface for subscribing to events. Each
VisualEditor event topic is prefixed with 've.'

To test this patch, you can use this snippet:

  mw.trackSubscribe( 've', function ( topic, data ) {
    console.log( this, topic, data );
  } );

Change-Id: I6b3f10b0dd0aa7fa47c3b35e2fc554622960ce52
2014-01-16 13:34:20 -08:00
jenkins-bot adf8249688 Merge "Ultra-basic gallery editing" 2014-01-15 23:27:06 +00:00
James D. Forrester 842688c51b Ultra-basic gallery editing
'Cos Erik doesn't like things he can't edit.

Change-Id: I1d9fb1215bb16b1245eddd87c977fb5bfdee4da9
2014-01-15 15:13:12 -08:00
jenkins-bot 96f638d2ce Merge "Add multipart/form-data emulation to ve.init.mw.Target#apiRequest" 2014-01-15 22:28:29 +00:00
Ed Sanders a703086e61 Keyboard shortcuts MW integration
Also adds a button to the utilities menu.

Depends on I806343b42c5fc63d.

Bug: 52844
Change-Id: Ia488362f4b8c9b99b615c84a7341d97e28bdb295
2014-01-15 14:04:06 -08:00
Trevor Parscal 4f0b988fbc Rejigger-ify the insert tool order
Change-Id: I9e37561eaac17689378af2c6a14dbf24b9326e9e
2014-01-15 20:08:10 +00:00
Roan Kattouw edd2bcd34e Add multipart/form-data emulation to ve.init.mw.Target#apiRequest
On my example main page, this reduces the size of the POST body by 45%

Bug: 59660
Change-Id: I7f04f403e0081188b8b4024c4431ae43b127434c
2014-01-15 17:17:29 +00:00
jenkins-bot 2284cb9aae Merge "Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()" 2014-01-15 10:37:43 +00:00
Trevor Parscal 278bcd9a20 Added indicators to toolbars
The down arrow is no longer default, so it needs to be specified
explicitly.

Updates submodule to include indicator changes
(see I0a1faef11a1e7e6ea3e44275c85f2efafae4dc9a)

Change-Id: I32aef3ea2e66fd823aeb07dac06cfefba9954270
2014-01-13 18:32:01 -08:00
Roan Kattouw 97c4c6c71b Factor out AJAX defaults into ve.init.mw.Target.static.apiRequest()
Change-Id: I90b0858ccd657b7183ae5327903449d17d9f0bef
2014-01-13 11:45:30 -08:00
Timo Tijhof 6f90f9364e Remove unused ve-init-mw-viewPageTarget-transform-hidden
Follows-up I2d6157708bd7b.

Change-Id: I62c7d7bb179719165df92499cb66b62aa2c6785d
2014-01-13 20:18:42 +01:00
jenkins-bot 542871bcf2 Merge "Update categories HTML on page save" 2014-01-13 18:35:47 +00:00
Ed Sanders 5acabd693f Hide #contentSub properly
It is treated specially which results in it being set to opacity=0 instead
of hidden, and leaves a large space at the top of the document. Removing
special treatment of it results in it being hidden properly.

Bug: 52243
Bug: 54325
Change-Id: I2d6157708bd7b4c3a7c6474b1612862120f963b7
2014-01-13 17:05:42 +00:00
Ed Sanders c74d7f1a21 Update categories HTML on page save
Because there's an API for that.

Bug: 48560
Change-Id: I410647d2b1aa740f606ddca64052b8d2b54671bf
2014-01-12 14:55:39 +00: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
James D. Forrester 0fadc2bc77 Let users set __NOTOC__ & __FORCETOC__ status
This creates a new panel in the meta dialog, "Page settings", where page-
level settings will be, err, set. For now, this exposes just the
behavioural switches for the presence/absence of the Table Of Contents –
__NOTOC__ and __FORCETOC__.

As part of this change, the meta dialog is renamed to "Options" to be
less confusing, and the icon for the meta dialog is changed to the
generic one for dialogs, which was previously unused. The page settings
pane is provided first in this list, given that the categories pane
(amongst others) is now directly accessible through the toolbar menu.

Bug: 56866
Bug: 56867
Change-Id: I33ce05c19d2e19b249e1cefd26fd0e3697d0085d
2014-01-05 18:56:53 +08:00
Moriel Schottlender 580a3f3d8d Use image sources from the fileRepo API
This commit switches from using hard-coded media source urls to utilizing
MediaWiki's API call for meta=filerepoinfo. The API call is done only if
needed when the media insertion dialog is loading, and is done only once
per session.


Bug: 50673
Change-Id: Ia5ad9a8c00cca6cbbbc890359dc529e29e1a6be7
2014-01-04 01:21:24 +00:00
Timo Tijhof ca40077866 Clean up Target properties
Move target.surface from mw.Target to Target
* All targets use this, let's standardise it.

Move target.$document from mw.ViewPageTarget to Target
* It was initialised with null in mw.ViewPageTarget, but the
  assignment happened in mw.Target. So it should be moved up
  at least to mw.Target.
* Since it is useful to have in sa.Target as well, moved it up
  to the abstract Target, and implemented in sa.Target and
  immediately used in the standalone demo where we were already
  duplicating the find( '.ve-ce-documentNode' ).

Add missing target.setupDone = false; in sa.Target

Add missing target.toolbar to Target
* Was used in all subclasses, but never initialised in any of
  the constructors. Let's standardise this property name as well
  (instead of initialising it in three places).

Move target#event-surfaceReady from mw.Target to Target
* sa.Target uses it as well, and considering Platform#initialize
  is already standardised in the abstract class, Target#setup
  being deferred is most likely to happen in each target as well
  so let's avoid different events being invented for the same
  thing and consistently use 'surfaceReady'.

Change-Id: Ia8bde188a4cde7e1615c2ae9c5b758eefc5d9cb7
2013-12-19 02:16:20 +00:00
Rob Moen 212e5b231b Prevent getSaveFields from returning a property named undefined
Change-Id: Id7326ee8b951ba2219d3ea6767370ece9aba3c23
2013-12-18 15:32:49 -08:00
Rob Moen 790d2c1307 Move additional module loading from mw.Target to mw.ViewPageTarget
This resolves some experimental mode dependencies on Mobile integration.

Bug: 58551
Change-Id: Id6c498ae19a5d5b1e5d1698f5e149a9b5d6f3b26
2013-12-18 07:11:36 +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
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
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
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
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
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
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
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
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
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
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
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
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
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 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
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
Timo Tijhof 98bc6adf1f Use mw.util.getUrl instead of mw.util.wikiGetlink (deprecated)
Change-Id: I72afbbd909ce2394d54f78d465bd8ad245c1694f
2013-11-12 18:34:05 +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
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
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
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
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 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
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 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 564605711c Merge "Convert the mass Beta Feature into feature-level ones, enabling formulæ" 2013-10-30 00:08:31 +00: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 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
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 18eb08dc6b Merge "Filter DOM load/save deferreds through ve.track callback" 2013-10-28 18:14:15 +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 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
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 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
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
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
Trevor Parscal efafed3231 Remove ve.{inheritClass,mixinClass} and use OO instead
Change-Id: I8df9226a358a76b661eab6e967ff0d63d361f691
2013-10-18 18:58:08 +02:00
jenkins-bot 5dd44dab93 Merge "Rename performance.parsoid.domLoad to performance.domLoad" 2013-10-17 19:30:58 +00: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
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
jenkins-bot 1f8d2fd9a7 Merge "Log DOM save timing; update existing ve.track calls" 2013-10-16 14:50:16 +00:00
Rob Moen 87629a99e1 Use existing ve config for pluginModules
Change-Id: I16a50f342e0794a98e648afc7251e8341270e9c9
2013-10-15 11:36:06 -07: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