Commit graph

495 commits

Author SHA1 Message Date
Moriel Schottlender 8130acebfd Changing image size in MWMediaEditDialog
Adding the ability to edit image size in the media edit dialog.
The size is now a separate widget.

The following changes were made:
* The dialog was changed to a booklet with 'general settings' and
  'advanced settings', in preparation for other edit features.
* The original image maximum size is fetched from the API and cached.
* Maximum size is limited to the image's original maximum size.
* Aspect ratio is kept when changing height or width, using original
  image size to preserve a sane ratio through the MediaSizeWidget.
* If an error is found in the size, the image will retain its previously
  set dimensions.

Depends on MediaSizeWidget: I3d0f9348a52

Bug: 38129
Change-Id: I2946fb21c46ce05583b219f665ef68928188899e
2014-01-22 18:43:45 -08:00
Trevor Parscal 7994eae8c2 MediaWiki language inspector updates
* Add ULS, which was removed from VE core
* Add experimental mwlanguage module which adds ULS integration
* Hook in ULS to the existing language widget

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

Bug: 47759
Change-Id: I325a4dcc316d0334fadfcaa46ad3acd45c6bf84b
2014-01-18 01:02:23 +00:00
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 c8a1e16749 Merge "Display indicators for required parameters in template dialog" 2014-01-15 22:23:20 +00:00
Trevor Parscal c8f7845def Display indicators for required parameters in template dialog
Update submodule for changes in OOUI (I1c047b55c7a0d5cf3e0aa0cc3f9a4da7d45c0304)

Change-Id: I8f84a9ae277e5093356f591f7a56e8cebf4a1893
2014-01-15 14:15:21 -08: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
jenkins-bot 38c0206c53 Merge "Refactor extraModules to $wgVisualEditorPreferenceModules" 2014-01-09 12:38:48 +00:00
Roan Kattouw 8d5ee0e3a0 Unwrap unnecessary array_key_exists() in BetaFeatures hook registration
Change-Id: Ib4ea05729854c6e9e2da36073451d51a10d0febd
2014-01-08 11:31:09 +08:00
jenkins-bot 2016380ac5 Merge "Let users set __NOEDITSECTION__ status" 2014-01-06 09:45:49 +00:00
James D. Forrester 707f7c93a5 Let users set __NOEDITSECTION__ status
Adds a checkbox to the page settings pane of the meta dialog that lets
users set or unset the __NOEDITSECTION__ flag on the page.

Change-Id: If1eca58e28d214021f5f5582856e595d4d0fbc43
2014-01-06 17:42:57 +08:00
Roan Kattouw dc882baab6 Refactor extraModules to $wgVisualEditorPreferenceModules
Instead of having a hard-coded array of preference-triggered modules
that we need to maintain in multiple places, manage this data in one
place in a configuration variable, and explicitly declare the preference
and module names rather than interpolating both of them from a name.

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

Change-Id: I9eb14349cd39125d5c11ffb44c962cc5febb6ba0
2014-01-06 16:57:45 +08:00
James D. Forrester 0ffd654bed Bump copyright like it's 2014
Change-Id: Ic469ebda2c061dc7da0b4c1625f43a7be55da4fa
2014-01-05 20:06:50 +08:00
Roan Kattouw 9d8a5f0f2d Fix path to VE core i18n
Hadn't been properly updated for the repo split

Change-Id: I1d6db13aeab9012b3a87a5f43d1a32fd510615cd
2014-01-05 11:02:35 +00: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
Roan Kattouw 880a972166 Use JSON support in core for i18n messages
Replace VisualEditor.i18n.php with a shim that uses the
LocalisationCacheRecache hook to read messages from JSON files
and add cache dependencies.

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

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

Change-Id: I14ab4bd641077d993ac235d8bcdcf8e50a1a72a7
2013-12-19 23:02:52 +01:00
Roan Kattouw abd85fda36 Fix mw.util dependencies
ext.visualEditor.base doesn't and shouldn't depend on mw.util,
but some other modules do. viewPageTarget.init has a dependency
on mw.util meaning that if VE is loaded through it, we'll always
be fine, but for correctness (and support for other targets),
explicitly indicate the dependency on mw.util for every module that
uses it.

Change-Id: I63821938d899897088799bde4d46b04cd2f9a3e2
2013-12-17 20:56:19 +00:00
Roan Kattouw b61813b935 Move visualeditor-languages-tool message from ve to ve-mw
I intially thought it was associated with the language inspector, but
it's not, it's the label for the languages pane in the meta dialog.

Change-Id: I478e3951862a25eee056e3df6cc3c9f9f7d9d935
2013-12-17 20:56:13 +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 94879a98b7 Use jquery.i18n for standalone i18n
VisualEditor.php:
* Make jquery.i18n a dependency of ext.visualEditor.standalone

makeStaticLoader.php:
* Remove ve.init.platform.addMessages() call with PHP-generated messages
* Add fake module for jquery.i18n
** Needed because the module might come from MW core
** Also add special treatment for fallbacks.js and language scripts

ve.init.sa.Platform.js:
* Remove basic message system, replace with jquery.i18n
* Add initialize method that loads messages for current language and
  fallbacks

ve.init.sa.Target.js:
* Wait for the platform to initialize before actually doing things
* Add .setup() method to allow callers to short-circuit this process
** This is convenient for callers of ve.init.sa.Target in the test suite

ve.ce.test.js:
* Use existing ve.test.utils function for creating a surface

ve.test.utils.js:
* Call .setup() on the target so we can get a surface synchronously

ve.init.Platform.test.js:
* Make these tests async, wait for the platform to initialize
* Allow for missing messages to be output either as <foo> (MW)
  or foo (jquery.i18n)
* Get rid of message clearing code, namespace test messages instead

Change-Id: Iac7dfd327eadf9b503a61510574d35d748faac92
2013-12-17 21:16:26 +01:00
Roan Kattouw 4c98f753a0 makeStaticLoader: Update fake standalone init module
* Don't add ext.visualEditor.base to it, and strip of ve-mw stuff
** .base doesn't contain ve-mw stuff any more, so no stripping needed
** Instead of appending .base, just load .base and create a
   separate fake module for Standalone init.

* Don't manually register .sa files
** Instead use ext.visualEditor.standalone, it's right there.
** Add missing CSS file to .standalone.

* Documented the purpose of 'Dependencies' and removed scripts
  from that fake module that don't fall under that rationale and
  instead add them as regular modules (rangy, unicodejs).

* Removed weird 'jquery' dependency in 'ext.visualEditor.core'
  module. This is strongly recommended against, and might
  actually cause jQuery to be reloaded due to outstanding bugs
  in core with the state machine in the startup queue (jquery, mediawiki).

* Unlist unused 'jquery.client' dependency in makeStaticLoader.
  As per the module definitions in VisualEditor.php, this is
  only used by the .mediawiki module. Grepped modules/ve/ and
  found 0 uses.

* Update dependency order to roughly match the dependency tree
  as it is specified in ResourceLoader (e.g. rangy is for .core,
  not .base).

* Keep fake modules out of ResourceLoader.

Change-Id: I2a31543e5ad2fc39f5980fea855172108eda4428
2013-12-12 03:34:42 +01:00
James D. Forrester bd94ff92bb Initial re-styling of the toolbar
Move all text styles, and the remove styles button, into a new 'list' toolbar
group, using the text-styles icon. Less-used text styles (strikethrough, code
and underline) are demoted, with remove styles at the end, and bold and italic
promoted.

Now re-label the "More" catch-all to now be "Insert", which is what's left.

Change-Id: I66a1bba347ea64e540106b1090995b3117a8b1b2
2013-12-11 23:41:12 +00:00
Roan Kattouw 536df35ed1 Add language code to language dialog
Bonus: give both the language name and page name
lang and dir attributes.

Further bonus: reintroduce message that was deleted
earlier with all of its original translations.

Change-Id: Id137ff9a069799b6c09574b72f450eac6665d144
2013-12-11 02:42:20 +00:00
jenkins-bot 9bf0f5b93e Merge "Show full language names in the MW language dialog" 2013-12-10 17:00:53 +00:00
Ed Sanders 1a5bdd5bd2 Show full language names in the MW language dialog
Bug: 54086
Change-Id: I099ac552638d666a447eb3aeaef68329ffacdfce
2013-12-06 13:10:33 +00:00
Moriel Schottlender cf237b882e Insert special character tool
A tool to add special characters and diacritics to text.

Also added a new button type ve.ui.GroupButtonWidget that includes a
group of PushButtonWidget objects and returna the individual button's
value upon click

Wikis can edit <visualeditor-specialcharinspector-characterlist-insert>,
a JSON string, to include their own desird special characters to insert
through the tool.

Bug: 50296
Change-Id: I26d1f437feef1c8b61ed3be5f74ef524b33baf49
2013-12-05 22:51:14 -08:00
Trevor Parscal 51e096d6f2 Refactor Transclusion and Meta dialogs to use BookletLayout
Use OOJS-UI's newly-extended paged dialogs (in e08eb2a03b) to refactor
how the Transclusion and Meta dialogs work, splitting out the code for
each of the panels into its own file and simplifying extensibility.

The Meta dialog (ve.ui.MWMetaDialog) now has two self-managing panels:
* ve.ui.MWCategoriesPage for categories and the default sort key
* ve.ui.MWLanguagesPage for language links

The Transclusion dialog (ve.ui.MWTransclusionDialog) now has four:
* ve.ui.MWTemplatePage for a template's primary panel
* ve.ui.MWTemplateParameterPage for each parameter of a template
* ve.ui.MWTemplatePlaceholderPage for a placeholder to insert a template
* ve.ui.MWTransclusionContentPage for non-template transclusion

Additionally, the Transclusion dialog has been slightly cleaned up:
* Replace add/remove events with replace events in transclusion model
* Actually return and resolve a promise (as documented)
* Get rid of "origin" info in template models
* Add method for adding required parts

TODO:

* Decide how and when we will choose between advanced transclusion and
  template dialogs
* Work out design issues with how template descriptions will be visible
  and how adding parameters will work if only showing parameters in
  outline
* Add preview to template dialog
* Consider ways to further improve pages for use in continuous mode

WARNING:

* Right now the template dialog gets overridden by the advanced
  transclusion dialog because they have the same symbolic name and the
  latter is registered later than the former. To test the template
  dialog, just change the symbolic name of the advanced transclusion
  dialog.

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

Change-Id: I5dbb480e8330ceaf0531c194b8ef6cc6c65f537e
2013-12-04 18:28:59 -08:00
Roan Kattouw b3eb415e37 Remove ooui-inspector-* messages
Move existing uses over to the already existing visualeditor-inspector-*
messages.

Change-Id: I6da7f3d61256d1c2b4c1f9583da8bc59a2d7473d
2013-12-04 19:04:51 +00:00
James D. Forrester 769f3ef0db Blacklist all versions of IE, as IE11 is now out
… and is completely broken still.

Change-Id: Ib8ddd40892688bd919ccc9d690e7bd3f2de6645e
2013-12-02 19:29:08 -08: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
Roan Kattouw 93b645a453 Make autonumbered external links inspectable
When the target of an autonumbered link is changed to a URL, it's kept
as an autonumbered link and its target is updated. When the target is
changed to a MediaWiki page, the autonumbered link is removed and
replaced with an internal link with the text set to the target.
So for instance, if you inspect [http://www.example.com] and change
its target to "Foo", the result will be [[Foo]].

The core of this commit adds support for inspecting nodes to
ve.ui.LinkInspector. This support should probably move into a
class in between AnnotationInspector and LinkInspector, perhaps
called HybridInspector or something, but I'm deferring that for now.

LinkInspector allows changes to inspected nodes to be reflected either
as attribute changes on the node, or by replacing the node with something
else. MWLinkInspector uses this feature to replace the autonumbered
external link node with an internal link annotation when the target is
set to an external link.

Bug: 53505
Change-Id: Icb404af84c24574438e4de3ef05bbd1993b593f7
2013-11-30 00:14:41 -08: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
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
jenkins-bot 153ca79518 Merge "Implement serialization cache in VisualEditor API" 2013-11-22 16:39:40 +00:00
Roan Kattouw fd4495e2df Pass the mw.user directly into {{GENDER:}}
Apparently we can do that ^^

Change-Id: I646bc7df29ad2ae605148089a53f1b5b238dca22
2013-11-20 10:51:32 +00:00
Roan Kattouw 0f21329770 Implement serialization cache in VisualEditor API
Add paction=serializeforcache, which serializes the given HTML, stores
the resulting wikitext in memcached, and returns a cache key. This
cache key can then be passed instead of HTML to paction=diff or
action=visualeditoredit for quick diff/save operations using the
cached wikitext, or to paction=serialize to just retrieve the wikitext.

This lays the groundwork for front-loading serialization in the editor,
and for avoiding the double serialization that occurs when the user
first views the diff, then saves.


Bug: 55979
Bug: 56011
Change-Id: I223b1717890632c39e2509967149551f807119f8
2013-11-20 10:26:47 +00:00
Timo Tijhof 4cbf220bd8 Use __DIR__ instead of dirname( __FILE__ )
Change-Id: I7ea4cb82ec7b3c6077a7485b0fb618d4c1dd00f9
2013-11-20 09:39:02 +00:00
Timo Tijhof de979ff293 Replace raw oojs-ui files with v0.1.0-pre (0267100ab3)
Change-Id: I792bc0335269976ff29433227b6fa562a1026aeb
2013-11-20 10:27:48 +05:30
kaldari 0aeab0d573 Restoring messages that seem to have been deleted prematurely.
ooui-inspector-close-tooltip and ooui-inspector-remove-tooltip are
still in use by OO.ui.

Change-Id: I241acc5f2b7822adeeab626efc1c5b12384ae54b
2013-11-18 15:15:16 +05:30
Trevor Parscal 3dcba7679a Add OO.ui.ToggleWidget
Compact toggle widget with short labels for on/off states.

Change-Id: I582e81126d5f1564302409c1b262e28e4a9505ac
2013-11-12 16:54:35 -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
jenkins-bot 71efc9c2cb Merge "Support private wikis by forwarding Cookie: headers to Parsoid" 2013-11-05 19:00:30 +00:00
Roan Kattouw 6eabc783c3 Support private wikis by forwarding Cookie: headers to Parsoid
If configured to do so, the VE API will forward the Cookie: header to
Parsoid. This allows VisualEditor to be used on read-restricted wikis.

Bug: 44483
Change-Id: If4a0cf1e5785b332ec9b014b783412805cf8af75
2013-11-01 11:14:04 -07: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
James D. Forrester 211727a2fd Add visualeditor-enable-mwmath preference to default user prefs
Stopping a warning for an undefined index created by I28862f3e62f5c.

Change-Id: Ic4ce78c769706332dc399d9b876af01c84845b9b
2013-10-30 17:07:09 -05:00