Commit graph

5636 commits

Author SHA1 Message Date
Timo Tijhof 429587df7d VisualEditor.php: Set default preferences values
This not being here caused and causes various unexpected
scenarios to evolve around preferences being falsy (undefined)
or set to 0, and inability to distinguish between a user having
not set the preference, the preference not existing due to cache
or the preference being disabled explictly by the user.

Change-Id: Ie50b63ba5064e85d26dad8b622554bbe809c2634
2013-07-26 22:26:17 +02:00
Timo Tijhof 2e091b0509 VisualEditor.php: Re-order and clean up
Match the conventional layout for this file.

Change-Id: Ic437c1a9423af47a3a1f3068afec6daa4ba7eefc
2013-07-26 22:25:52 +02:00
Trevor Parscal f822e2b7c6 Cleanup code icon
Sharper!

Change-Id: I68a8895ca1bb652e09d66db4ce7abd68cf0a3e99
2013-07-26 13:07:40 -07:00
jenkins-bot d9615e711b Merge "Make sure 'user.options' is loaded before 'ext.visualEditor.viewPageTarget.init'" 2013-07-26 19:42:57 +00:00
jenkins-bot 57be610976 Merge "Consistency in MW*ButtonTool comments and naming" 2013-07-26 19:42:14 +00:00
jenkins-bot b8ea6a22ac Merge "Code annotation button" 2013-07-26 19:41:34 +00:00
Ed Sanders fadd7c46a2 Code annotation button
Pretty straightforward, although we should start thinking about
grouping/hiding 'advanced' formatting options in the toolbar.

Making this button experimental for now until we've come up with
a way to deal with this problem.

Bug: 51590
Change-Id: Ieb1935b742aced4b883d8a194e6cb69be68473d0
2013-07-26 12:36:34 -07:00
jenkins-bot d477bfeb6c Merge "Infrastructure for loading plugins in the MW integration" 2013-07-26 19:35:08 +00:00
jenkins-bot 8768d59e13 Merge "Code annotation icon" 2013-07-26 19:33:42 +00:00
jenkins-bot 04c95eb8c6 Merge "Alphabetise icon styles in ve-mw" 2013-07-26 19:33:40 +00: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
jenkins-bot afcd539eb1 Merge "'CodeScript' => 'Code'" 2013-07-26 19:31:18 +00:00
Helder.wiki f568439b0e Make sure 'user.options' is loaded before 'ext.visualEditor.viewPageTarget.init'
The function init.isAvailable uses mw.user.options, so this dependency needs
to be specified.

Change-Id: Ia2c87a32f692da2347ad670cdbcf6d6e6d171f15
2013-07-26 10:54:29 -03:00
Ed Sanders f689c8735b Code annotation icon
Change-Id: I16330c11a2f67a8b5fb09be70a809460b3731484
2013-07-26 11:21:36 +00:00
Ed Sanders cc92b1e629 Alphabetise icon styles in ve-mw
Change-Id: I6d0e5aa7e17abbe88c6bd06e7e9c605cdb5ad9a1
2013-07-26 11:19:36 +00:00
Ed Sanders 07821f5f55 Consistency in MW*ButtonTool comments and naming
Change-Id: Id71c7f862e43125599ecfc6eeb27719e1891489d
2013-07-26 12:04:19 +01:00
Ed Sanders 7c452a234f 'CodeScript' => 'Code'
I assume this was a copy-paste error from subscript above.

Bug: 51590
Change-Id: I8351fd7e272812017e0e9cfdd76e3da4745119d3
2013-07-26 11:26:51 +01:00
jenkins-bot e055bf82c6 Merge "Fix MWBlockImageNodes' default horizontal location code" 2013-07-25 22:50:02 +00:00
Inez Korczyński c24820140b Fix MWBlockImageNodes' default horizontal location code
Introduce method ve.ce.MWBlockImageNode.getCssClass and use it instead of
accessing ve.ce.MWBlockImageNode.static.cssClasses - it gives a better
way of handling special cases.

Bug: 51995
Change-Id: I236b08c8345a10d144f392ec37fd130cf5f7737d
2013-07-25 15:48:08 -07:00
jenkins-bot 0fbff1e580 Merge "Fix font size for overlays in Monobook" 2013-07-25 22:38:44 +00:00
jenkins-bot 33f6588216 Merge "Regress RTL fix transclusion icon" 2013-07-25 22:38:05 +00:00
jenkins-bot 5fdc9abdc8 Merge "doc: Clean up spacing that caused <pre> or broken <ul>/<ol>" 2013-07-25 22:36:41 +00:00
jenkins-bot 4166cfd8a2 Merge "oojs: Update to upstream v1.0.2" 2013-07-25 22:35:06 +00:00
jenkins-bot 7b84716b55 Merge "Optimise history stack truncation" 2013-07-25 22:11:30 +00:00
Translation updater bot 7ecc640bd4 Localisation updates from http://translatewiki.net.
Change-Id: If4f801da0325564e1480b4207b06ef7eecefc076
2013-07-25 19:32:08 +00:00
jenkins-bot ad63335bd1 Merge changes If571bb99,I2e3637af
* changes:
  Parse category names correctly
  Rename 'CategoryList' to 'Category' for consistency
2013-07-25 18:16:49 +00:00
Timo Tijhof 01f9c702b4 oojs: Update to upstream v1.0.2
* http://trevorparscal.github.io/oojs/releases/oo-1.0.2.js
* https://github.com/trevorparscal/oojs/blob/v1.0.2/History.md
* https://github.com/trevorparscal/oojs/compare/v1.0.1...v1.0.2

Change-Id: I7378b7cbef55243845d3f4cbc96406b3267c8c01
2013-07-25 17:57:41 +00:00
jenkins-bot 280e05afb1 Merge "Fix CSS lint error" 2013-07-25 17:21:55 +00:00
Ed Sanders 7874b39291 Fix CSS lint error
"Background image 'images/icons/italic-k.png' was
used multiple times"

Change-Id: Ib6a497021fe871c4597a80be91a259689b5d537b
2013-07-25 18:19:40 +01:00
jenkins-bot 0830d24a04 Merge "Add bold/italic icons for be-tarask" 2013-07-25 16:48:08 +00:00
Ed Sanders 7e9b4fafd3 Optimise history stack truncation
If undoIndex is 0 then we don't need to do anything, or even
emit the history event which is quite expensive as it triggers
various node redraws.

Bug: 52012
Change-Id: I09ca2d6cd0f4cbaf8316819dab0bd6edfc5de62c
2013-07-25 14:33:51 +01:00
Ed Sanders d7bbb1d206 Parse category names correctly
Category names containing colons now parse correctly.

Bug: 51902
Change-Id: If571bb9922399c5a5f77f0b304bec3f2b6f5f7dd
2013-07-25 13:50:49 +01:00
Ed Sanders 8c87553761 Rename 'CategoryList' to 'Category' for consistency
Change-Id: I2e3637af38b789e588ce186497238f197e5fd5d3
2013-07-25 13:34:25 +01:00
Timo Tijhof 08610a4ecb doc: Clean up spacing that caused <pre> or broken <ul>/<ol>
Whenever there is more than 2 spaces (except the extra space
on a continued line of an @ tag, or the extra space on a
continued line of a list item) it causes a <pre> context.

Removed both spurious spaces that caused a <pre> and ones that
didn't but looked like it could.

When making an ordered or unordered list, the first item needs
to be on a new line and in block context (e.g. an empty line
before it). Otherwise it is rendered inline as 1. Foo 2. Bar
(such as in #rebuildNodes where both the ordered and unordered
lists were broken).

Change-Id: Id0f154854afbdc8e5a8387da92e6b2cdf0875f69
2013-07-25 04:02:50 +02:00
Moriel Schottlender c81228f8ea Regress RTL fix transclusion icon
The fix to the transclusion icon messed up the way inspectors appear in RTL
wikis. The rtl check/correction (inside 'this.embedded') seems to be the only
rtl fix necessary. Something completely different will have to be done to the
transclusion icon.

Change-Id: I2417e125c99de9b0c5fd922a47de43ed9952d6fd
2013-07-24 20:28:32 -04:00
Ed Sanders 326347b5a9 Fix font size for overlays in Monobook
Bug: 50058
Change-Id: I751682c4bc51299c15e7efef487ae32e70049b16
2013-07-25 00:12:01 +01:00
jenkins-bot faeb27c477 Merge "ve.ce.MWBlockImageNode: Use this.constructor to refer to class" 2013-07-24 21:22:34 +00:00
Timo Tijhof 586696fc4d ve.ce.MWBlockImageNode: Use this.constructor to refer to class
Minor clean up for maintainability.

Change-Id: I14729cba683964177ef807dca1139e3887a767ad
2013-07-24 23:20:40 +02:00
Roan Kattouw acb30c3f51 Fix the save button disappearing on certain pages in Firefox
If the first thing on the page is an image, then we'll try to select
it in Firefox, and get a JS error because .data( 'view' ) is undefined.

It turned out that MWBlockImageNode's onSetup() didn't call the parent
implementation, and all the way up in ve.ce.View.onSetup is where
we set .data( 'view' )

Bug: 51986
Change-Id: I0de3692566b0aa02a229054e07767e45fd5d4a49
2013-07-24 14:02:08 -07:00
Translation updater bot d4207eb6cf Localisation updates from http://translatewiki.net.
Change-Id: I5d4210481c8a2ec625c4726bf2c42af1535bd237
2013-07-24 19:57:53 +00:00
jenkins-bot ee9d5a2e27 Merge "Fix copyright warning, which wasn't populated due to a missing .end()" 2013-07-24 18:58:09 +00:00
Roan Kattouw 81d3bde440 Fix copyright warning, which wasn't populated due to a missing .end()
Change-Id: I1a04a40415f3fcf8d11b49e5c90672ee625a85f7
2013-07-24 11:51:35 -07:00
James D. Forrester 98977e02a8 Put <nowiki> edting in experimental for now
Bug: 51948
Change-Id: I18c89e8fba04a1ad515e5db611381a4c937853e5
2013-07-24 09:21:09 -07:00
Ed Sanders 541bd0b063 Add bold/italic icons for be-tarask
Also move 'en' into alphabetical order, because we're not special.

Change-Id: I4a34a570444655460d470deb1d624877a38d3adb
2013-07-24 16:35:23 +01:00
jenkins-bot 8e8aec5f3a Merge "Split continued link annotations on wordbreaks" 2013-07-24 14:43:45 +00:00
jenkins-bot 7b5af5bc79 Merge "Make ButtonWidgets more accessible" 2013-07-24 14:40:36 +00:00
jenkins-bot 9e8ce997db Merge "Show error when trying to save in read-only mode" 2013-07-24 14:35:52 +00:00
Ed Sanders 049bbf7b73 Make ButtonWidgets more accessible
* Give them a role=button, and a default tabIndex of 0
* Listen for a keypress of 'space' and emit a click event
  (you'd have thought role=button would do this, but oh well)

Bug: 50047
Change-Id: I429ad165c95f34d26975daf81db18cc966802cde
2013-07-24 14:34:06 +00:00
jenkins-bot 859ed359e4 Merge "Replace "Edit source" by "{{int:visualeditor-ca-editsource}}"" 2013-07-24 14:34:05 +00:00
jenkins-bot 10e21e4742 Merge "Show newarticletext(anon) when creating a new page" 2013-07-24 14:33:20 +00:00