Commit graph

5173 commits

Author SHA1 Message Date
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
jenkins-bot 43dbd6babb Merge "Added credits for English messages" 2013-08-01 12:19:16 +00:00
Amir E. Aharoni 5695d58708 Added credits for English messages
Change-Id: I04c33ae4941207333b9d3b438dc07a34c6d5b597
2013-08-01 12:53:11 +03:00
Ori Livneh 56649046d9 Remove registration of nonexistent hook function
Hook was part of survey code which I removed in I8be6198a6. I neglected to
remove the statement which registered the hook handler, however.

Change-Id: Ia4e2a7854b3a2a5cbbe4da7657f7afe18f3c1d6a
2013-07-31 21:09:01 -07:00
jenkins-bot ee858eddb3 Merge "Use new class to detect Cite errors inside templates" 2013-08-01 03:10:43 +00:00
Ed Sanders 2ba8f8c8b5 Use new class to detect Cite errors inside templates
Bug: 51337
Change-Id: I1cd9e2beaa64a84ddc6d690fbc483f16d9350b68
2013-08-01 03:09:06 +00:00
Timo Tijhof 9e89c019f1 mw.ViewPageTarget.init: Don't depend on mediawiki.user
Follows-up 5036099. We don't have that dependency.

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

Change-Id: Id2b68e521ab68862f0f635925708a35d10795342
2013-08-01 02:10:23 +02:00
Timo Tijhof 8f05cdbf70 doc: Add placeholders for unindexed methods
Not having a description yet is fine, but they should at least
be indexed as blocks so that they are searchable and listed
in the jsduck generated pages. jsduck defaults to @method + name
of prototype property. And it even guesses parameters sometimes.

Search: \n\n([a-zA-Z\.]+\.prototype\.[a-zA-Z]+)
Where: modules/ve,modules/ve-mw
Where-Not: modules/ve/test
Replace: \n\n/** */\n$1

Added @return in a few places where it was easy to add.

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

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

Bug: 52317
Change-Id: Ibd8053768e82b1df91081bd77a172628ea855db7
2013-07-31 21:59:30 +00:00
jenkins-bot f50086b2da Merge "mw.ViewPageTarget: Emit position event after toolbar is animated" 2013-07-31 21:58:46 +00:00
Timo Tijhof 5b48d7f1e8 ce.ProtectedNode: Use surface initialize event instead of toolbarPosition
Follows-up 867ec44a9.

Because:
- #toolbarPosition is emitted more than once (so this
  should at least have been a once() bind, not a connect)
- It is emitted for more than 1 toolbar (includes context menu
  toolbar)
- Semantically incorrect (we want to know when the surface changes
  not the toolbar)
- We want to get rid of that event entirely and this is the last
  use of it.

Change-Id: Ica5ed04052f48fe84607abab72bcf65f97d689ed
2013-07-31 21:57:54 +00:00
jenkins-bot bc78624cfe Merge "Add ve.now utility function" 2013-07-31 21:56:56 +00:00
Timo Tijhof cde62acf4b doc: @inheritDoc -> @inheritdoc
Follows-up db3da5d. Also scanned code base for more matches but
looks like those have been cleaned up already.

Change-Id: I62d1c4367e1ed7b7162d7b688227dfa5dca562aa
2013-07-31 23:06:29 +02:00
jenkins-bot ed8133e317 Merge "Link inspector bug fixes" 2013-07-31 20:54:46 +00:00
Translation updater bot 28ad47f82b Localisation updates from http://translatewiki.net.
Change-Id: Ib0b384998feab8599ba784d119304ee2d908a1af
2013-07-31 20:52:05 +00:00
Timo Tijhof 5036099906 ve.init.mw.ViewPageTarget.init: Pass default values
Though this is already handled by Ie50b63ba5064e85d26 for the
server-side, and that should automatically reflect to the
client-side. Since we're dealing with cache conditions in
wmf-production where the user.options manifest does not yet
contain an entry for these relatively new preferences, lets
transfer the default value here as well. This does not affect
logged-in users (since their user options are always up-to-date
and embedded in the page).

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

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

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

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

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

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

Change-Id: I826986794630c04c34cef6da36ccb15ff7dde49a
2013-07-31 22:15:33 +02:00
Jforrester 221cef36a1 Revert "Localisation updates from http://translatewiki.net."
Based off old version, re-added removed messages and re-un-sorted keys.

This reverts commit 93b74fe25c.

Change-Id: I8eb45ca7aeb611176decb4cd4f6dd89b60b92db7
2013-07-31 20:11:34 +00:00
Translation updater bot 93b74fe25c Localisation updates from http://translatewiki.net.
Change-Id: I86b6ce2d9fa9a29ce4041187a8421a2f11788ad8
2013-07-31 20:01:19 +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
Trevor Parscal db3da5d16b Link inspector bug fixes
Formerly known as "The greatest commit in the history of the world*".

* Within a 3 block radius of Drayton Park and Auburt Park, starting
from July 30th at about 9pm or so.

Bugs:

* (bug 51404) Allow escaping out of the link inspector when in creation
  mode (no text is selected, text will be inserted based on link target)
  and the text input is empty
* (bug 51065 and bug 51415) Keep model and view in sync when changing the
  link inspector's text input value and showing options in a menu
* (bug 51523) Either restore selection at the time of close to what it was
  before opening the inspector (when using back) or to what it was before
  closing (might be changed by transactions processed during the close
  method) - this makes it simpler and more natural when clicking away from
  the link inspector, even when there are changes that must be saved by
  the link inspector on close

Bonus:

* Use only the light blue highlight color for menu widget items - the
  checkmark already displays the selected item, the dark blue is just
  masking the current highlight position and confusing the peoples
* Remove links when the user deletes everything from the link inspector's
  text input and then closes the link inspector
* Replace select menu's evil "silent" selectItem/highlightItem argument
  with a new method called initializeSelection which sets both selection
  and highlighting to an item without emitting events - this is needed
  when synchronizing the view with the model so the model isn't
  immediately told to change to a value it already has
* Make the MWTitle lookup menu not flash like crazy as you type (this was
  caused by a copy-paste oversight overriding
  initializeLookupMenuSelection unnecessarily)

Bug: 51404
Bug: 51065
Bug: 51415
Bug: 51523
Change-Id: I339d9253ad472c2f42c3179edc84a83d27561270
2013-07-31 17:42:14 +00:00
Ori Livneh e98d54078b Remove gender micro-survey from VisualEditor
The 'ext.visualEditor.genderSurvey' module was introduced in I2b4aba6a9
for the purpose of instrumenting a short-lived microsurvey that would be
concomitant with the deployment of VisualEditor. The survey has now run
its course; this patch removes its code.

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

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

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

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

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

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

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

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

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

Bug: 52228
Change-Id: Id40d53c72a35412d612ae9441ae3d561622c1bec
2013-07-30 15:08:19 -07:00
jenkins-bot 19c9be5d4f Merge "Ref in references support" 2013-07-30 21:53:00 +00:00
jenkins-bot 667d27aa7b Merge "Revert "Check MW version before loading VE"" 2013-07-30 21:08:45 +00:00
Catrope 0f723a8c23 Revert "Check MW version before loading VE"
Doesn't play nice with the version we use in production :(

catrope@tin:/a/common$ mwscript eval.php enwiki
> wfUseMW('1.22alpha')
MediaWiki 1.22alpha required--this is only 1.22wmf11

This reverts commit f673725f10.

Change-Id: I6d022eef001f80198c6c4be20586f334cb8e0262
2013-07-30 21:04:27 +00:00
jenkins-bot 36db36db3d Merge "mw.ViewPageTarget: Fire 'wikipage.content' hook after saving" 2013-07-30 20:47:28 +00:00
jenkins-bot 927d3ad644 Merge "Check MW version before loading VE" 2013-07-30 20:46:39 +00:00
jenkins-bot 139eaf653a Merge "Partial revert of gerrit 8ed6dfa542 to avoid i18n mis-links" 2013-07-30 20:29:17 +00:00
Translation updater bot 971830cf3b Localisation updates from http://translatewiki.net.
Change-Id: I322a1108e65556e5535a24fc132e17b3ebc55653
2013-07-30 20:14:33 +00:00
James D. Forrester 50974166e0 Partial revert of gerrit 8ed6dfa542 to avoid i18n mis-links
Bug: 52276
Change-Id: Ie72ac3f33e1abda03a6fdcf54c5b0e7615302fad
2013-07-30 12:49:36 -07:00
Timo Tijhof bdd7aa5e3c mw.ViewPageTarget: Fire 'wikipage.content' hook after saving
Bug: 51565
Change-Id: I5b6dcd3cb425d2763cc3069e3cbc04be7a57af4c
2013-07-30 19:35:31 +02:00
Ed Sanders 6d921067d7 Ref in references support
When we encounter a ref tag inside the mw-data of a references
tag, we pass it off to the converter and store it as nested data.

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

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

Bug: 51741
Change-Id: I31d06616849a00449df0fc77f3b33e46207cdc7f
2013-07-30 15:41:48 +01:00
Ed Sanders f5c8af541a Set links in wikitext warning to load in new window
Bug: 52093
Bug: 49820
Change-Id: I20ef246b6382ce801ce7a2cb0c82bc698471b88e
2013-07-30 13:11:53 +00:00