Commit graph

530 commits

Author SHA1 Message Date
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
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 0ee35c99d0 Add OO.ui.PopupTool
Tool that launches a popup when clicked.

Change-Id: Ie35b51f8160ad3fb844491e2799656413d4029c0
2013-10-29 05:57:40 +00:00
Trevor Parscal 6774cd74f3 Detangle triggers from OOUI
Changes:

* Pass toolGroup into tools instead of toolbar
* Split tool labels into title and accel
* Make toolbars provide accelerator labels
* Remove getLabelText method since it's not being used and is likely not useful
* Make tools update their own labels
* Only show accelerator information for triggers that are active in the surface
* Make surface toolbars listen to commands being added and update tools accordingly
* Introduce command object to encapsulate command info

Change-Id: Ieac4bfa63b63ac0a9dee154af3007a33b4d447ff
2013-10-29 05:50:30 +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
jenkins-bot 044e2e289c Merge "Split ext.visualEditor.experimental into specific modules" 2013-10-24 14:05:33 +00:00
Roan Kattouw 412eb34de8 Split ext.visualEditor.experimental into specific modules
Math, hiero, language and alienextension are now each in their own
module. Kept the experimental module for backwards compatibility,
it just has all of its constituent modules as dependencies.

MWExperimentalTool.js was split up, and ExperimentalTool.js was
renamed to LanguageInspectorTool.js.

Change-Id: I63b49dfbdb59dc9a494049553cc0c01e89e48826
2013-10-23 16:20:30 -07:00
James D. Forrester 89f039f62d Add Moriel Schottlender to AUTHORS.txt and authors string
Change-Id: Id6e540aaa4d7b51e068a41f8eceba6b386fa2064
2013-10-23 11:24:03 -07:00
Roan Kattouw 36fc3b5911 Rename oo.js to oojs.js per library name
Change-Id: I9f02a4438a18243022506b5a2fcc445af03aa945
2013-10-22 19:18:32 +00:00
Trevor Parscal 26a1d8986b Remove ve.Factory and ve.Registry and use oojs instead
Change-Id: I2717300e6cc6102296a2b8d063d344fa5897c825
2013-10-22 19:15:18 +00:00
Trevor Parscal 6018e77d70 Use OO.EventEmitter instead of ve.EventEmitter
Change-Id: Ie35e5f51a8d3c0d7f4fa46230b7b37112df610b9
2013-10-22 16:57:33 +00:00
jenkins-bot 324b04137b Merge "Add requirements to BetaFeatures hook" 2013-10-21 15:18:24 +00:00
Roan Kattouw d3c706ff93 Add a node type for numbered external links
Since I0f0a826c in Parsoid, numbered external links are now empty
<a rel="mw:ExtLink"></a> tags. This means we have to put in a node type
for them to prevent them from being considered empty annotations and
getting converted to alienMeta.

MWNumberedExternalLinkNode is protected and focusable to avoid making
the link text (which isn't editable) clickable. It isn't inspectable
yet, we need to work on that.

Bug: 53505
Change-Id: I83f69695f3974089e51a84e799f31ab6ed879e05
2013-10-18 22:31:45 +02:00
Trevor Parscal 81bbba4932 Split out popup functionality from ve.ui.PopupButtonWidget to ve.ui.PopuppableElement
Change-Id: I522d852d81d9674723a3262da3f030417f4fc3be
2013-10-17 10:21:03 -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
Trevor Parscal bb03e8f17e Misc UI fixes
* Followup 75270e24: use this.surface directly in MWMetaDialog
* Document that MWDialogTools need a SurfaceToolbar
* Namespace CE events and CSS classes with ve-ce- rather than ve-ui-
* Namespace SurfaceToolbar CSS classes correctly and put them in their
  own CSS file

Change-Id: I9e70917d9c220b39e68833f67ed49fae7f7cbe6a
2013-10-16 12:40:40 +02:00
Ed Sanders e8082ba968 Add requirements to BetaFeatures hook
Change-Id: Ifc809f49e1cf03015dbb295b6b092b4181edc38b
2013-10-11 14:50:41 +01:00
Roan Kattouw 75bee13db5 Remove SyntaxHighlight from the experimental set
This completely disables it while we fix the issues it causes.

Bug: 55533
Bug: 55453
Change-Id: I76e5d81957187535aab870e6ddbd1dbbb88f1315
2013-10-10 01:28:14 +02:00
jenkins-bot 6c3ee0dca7 Merge "Move skin support into $wgVisualEditorSupportedSkins" 2013-10-08 00:27:23 +00:00
Ed Sanders 972c9a46b7 Make the save dialog an actual dialog
Major changes:
* Create a MW specific save dialog class
* Widgetize save dialog elements
* Simplification of viewPageTarget

Minor changes:
* Added getWindow method to windowSet and setTitle methods to window class
* Add transition css properties to dialog styles

Bug: 48566
Bug: 50722
Bug: 51918
Bug: 52175
Bug: 53313
Change-Id: I8c0db01fb8477a9b3d3dfe2a6073ac67869ce40e
2013-10-07 15:59:00 -07:00
James D. Forrester 0bff45959f Move skin support into $wgVisualEditorSupportedSkins
$supportedSkins is mostly an artefact of the currently-unrefactored init code that
will have a sub-class for each skin (so skin's maintainers can add VisualEditor
support without hacking around inside VisualEditor itself), but until then let's
split it out into a global configuration variable at least, so that they have a
hope.

Change-Id: I0742cea6469678c5599768340dfb1f6d2f4debf4
2013-10-07 15:55:22 -07:00
jenkins-bot bcbefc63cc Merge "Track DOM retrieved events" 2013-10-07 22:15:07 +00:00
jenkins-bot 1e0c24da49 Merge "Make dialogs, inspectors windows and window sets generic" 2013-10-07 18:55:07 +00:00
Trevor Parscal 4aa86d0f87 Make dialogs, inspectors windows and window sets generic
Objective:
* Remove surface dependencies in dialogs, inspectors, windows and window sets
* Introduce surface-specific versions of dialogs, inspectors and window sets

Change-Id: I2db59127d2085b02e173a3605e174317e419e213
2013-10-07 10:37:47 -07:00
jenkins-bot 00b6de429b Merge "Use FlatLinearData for storing converter results" 2013-10-07 14:47:21 +00:00
Ed Sanders 44b1fdebe4 Use FlatLinearData for storing converter results
Previously we returned ElementLinearData from the converter, then
stripped out the MetaLinearData. This meant that before processing
the ElementLinearData from the converter actually contained metadata
which is confusing.

The new document constructor stores the converter results in a
FlatLinearData object and simultaneously populates element and meta
data stores.

Also in this commit I have moved various methods from ElementLinearData
to FlatLinearData, from which ElementLinearData inherits.

Change-Id: I64561bde2c31d8f703c13ac7b0a0c5f7ade9f3d4
2013-10-06 20:27:32 +01:00
Ori Livneh e8aad4d4a7 Track DOM retrieved events
When the editor finishes retrieving the target DOM, fire a 'DOM retrieved'
analytic event with the following properties:

* Response time in millisecond.
* Response size in bytes.
* Whether request was a cache hit.
* Value of X-Parsoid-Performance header (or null if unset).

jQuery.byteLength is now a dependency for ext.visualEditor.mediawiki.

Change-Id: I74d3964238927645e847b6e215991bd6b1ebad59
2013-10-05 23:24:06 -07:00
Trevor Parscal 6ec34a3dee Toolbar action widgetization and UI refactoring
Objectives:

* Use widgets to render toolbar actions
* Remove labels next to help notices and edit notices buttons
* Add a close button to the help notices and edit notices

Overview:

* ve.ui.ButtonWidget is now abstract, use ve.ui.PushButtonWidget instead
* ve.ui.IconButtonWidget now inherits from ve.ui.ButtonWidget
* ve.ui.PopupWidget's display method no longer takes x and y arguments
* Fixup naming issues in MWCategoryPopupWidget
* Fixup naming issues with some ve-init-mw CSS classes
* Rename ve-mw/ui/styles/ve.ui.Widget.css to ve.ui.MWWidget.css
* Change uses of "callout" to "tail"
* Add hyperlink functionality to buttons
* Make buttons accessible through focusing, but make unfocusable by
  clicking
* Add head option to popup for rendering a title and close button

Bug: 52386
Change-Id: Iea2c8df1be64d40f9c039873d89ee540cc56e687
2013-10-04 16:26:13 -07:00
jenkins-bot e1c49ace99 Merge "Refactor ve.ui.PagedDialog" 2013-10-04 20:25:43 +00:00
Kyle Florence 4efc6cadb7 Refactor ve.ui.PagedDialog
This commit extracts the page and outline handling logic from
ve.ui.PagedDialog (RIP) and moves it into two layouts: ve.ui.PagedLayout
and ve.ui.PagedOutlineLayout, respectively. These layouts are now implemented
inside the dialogs that used to mixin the ve.ui.PagedDialog class. This
brings a much cleaner separation of concerns between Dialogs and Layouts
and allows the use of page handling logic without the accompanying
outline logic.

Change-Id: I5efa2f893f4b7e962438b3aff34b737573bbd5ca
2013-10-04 12:09:15 -07:00
jenkins-bot c21c8556fc Merge "Make ve.Factory require static name property" 2013-10-03 22:03:26 +00:00
Trevor Parscal 61ddfb76e4 Make ve.Factory require static name property
Objective:
* Make ve.Factory behave like ve.NamedClassFactory
* Remove the only remaining use of ve.Factory (actions)
* Remove ve.NamedClassFactory

Change-Id: Ie302ef5ea31081de7ab0db6091058a59946aef4c
2013-10-03 14:52:19 -07:00
jenkins-bot dd9511f249 Merge "Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData" 2013-10-03 18:45:55 +00:00
Ed Sanders 5c31d3215b Change ve.dm.DocumentSlice to a mixin to ve.dm.LinearData
Document slice only ever contained linear data, with extra functionality
to preserve the range. It pre-dated LinearData, but now we should
refactor it to reflect its purpose.

Change-Id: Ifc908f7526c83a43a51372c8d2494d7260e7facd
2013-10-03 19:38:59 +01:00
jenkins-bot 0c3014c968 Merge "Add specific message for empty ref group list" 2013-10-02 21:05:07 +00:00
Ed Sanders 912e0b1aef Add specific message for empty ref group list
Currently we just say 'group ""' which is a bit weird, so
instead have a specific message which talks about the
'default group'.

Bug: 51873
Change-Id: I4a17f15ee18175fac11b36b102a06cc9714426ee
2013-10-02 14:01:37 -07:00
Tongbo Sui 62ec9d92e2 SyntaxHighlight node support
Update: Switched to generic ve.ui.Toolbar and ve.ui.Tool for consistency
with VE in general. Changed searchbox to floating and hidden by default.
Call for search using shortcut key. Overriden ESC key.

Node handler for <syntaxhighlight>'s Rdfa type.
Embedded in VisualEditor.php with its own ResourceLoader module.
Use $wgVisualEditorEnableExperimentalCode in LocalSettings.php
to load the module.

Supported languages (for testing): text, javascript

Features:
(1) Internal mechanisms:
	(1.1) Tokenizer. Tokenize input code string.
	(1.2) Highlighter. Highlight based on predefined rules.
	(1.3) Syntax checker. Validate based on predefined rules.
(2) SimpleSurface:
	(2.1) Auto indenter. Works with (){}[] blocks.
	(2.2) Reformatter. Reformats spaces and remove trailing
	whitespaces.
	(2.3) Language selection dropdown.
	(2.4) Basic editing. Insert, deletion, selection.
	(2.5) Clipboard & edit history support.
		(2.5.1) Undo (Ctrl + Z), redo (Ctrl + Y)
		(2.5.2) Copy (Ctrl + C), cut (Ctrl + X), paste (Ctrl + V)
	(2.6) Search & replace. Ctrl + F to quickly move focus to search
	box.

Bug 47742

Change-Id: I4adede9e05fd2236cee50ce03f597e8ff6b1914d
2013-10-02 11:01:06 -07:00
jenkins-bot 48c60153a6 Merge "Extend SurfaceToolbar into TargetToolbar" 2013-09-23 23:48:41 +00:00
jenkins-bot ede7dad318 Merge "Don't break core's parserTests if VisualEditor is installed" 2013-09-18 19:57:30 +00:00
C. Scott Ananian 21cd7bad53 Don't break core's parserTests if VisualEditor is installed
VisualEditor's hook changes the edit section link, which changes the
output of certain parser tests so that they no longer match the
expected text.  Use the `ParserTestsGlobal` hook (which cleans up
after itself when the parserTests ends) to disable the
`onDoEditSectionLink` hook when we're running parserTests to avoid
the spurious failures.

Change-Id: Ic958d88f443ac37ba304d3256e2bb5ea2fde820d
2013-09-18 13:03:40 -04:00
Ed Sanders 4d1d632ebd Extend SurfaceToolbar into TargetToolbar
Toolbars may want to control the target as well as the surface (spoiler alert!).
The new TargetToolbar has a pointer to its target as well as its surface.

Change-Id: I928316d9e23ac3f3de3e76c34ef0ac3d27855ab3
2013-09-17 17:05:01 +01:00
Trevor Parscal 143b086c74 Scroll into view support
Objectives:

* Scroll when needed to show highlighted (with keyboard) or selected (by
  any means) options in select widgets
* Allow clipping and automatic scrolling for certain elements when they
  are otherwise going to be rendered partially out of view

Changes:

*.php
* Add links to new file

ve.ui.Widget.css, ve.ui.Dialog.css
* Removed unneeded x-axis overflow rules

ve.ui.ClippableElement.js, ve.ui.Element.css
* New mixin, adds visible area clipping support to an element

ve.ui.PopupToolGroup.js, ve.ui.MenuWidget.js
* Mixin clippable element

ve.ui.OptionWidget.js, ve.ui.OutlineItemWidget.js
* Add scroll-into-view configuration for option widgets

ve.ui.SearchWidget.js
* Scroll items into view when highlighting with keyboard

ve.Element.js
* Add getBorders, getDimensions, getClosestScrollableContainer and
  scrollIntoView static methods
* Add getClosestScrollableElementContainer and scrollElementIntoView
  methods

Bug: 53610
Change-Id: Ie21faa973a68f517c7cfce8bd879b5317f536365
2013-09-16 16:46:58 -07:00
James D. Forrester 1a1ef97336 Move text style tools out of experimental
These were meant to have been de-experimental-ised with the toolbar
commit; oh well. This moves the following text styles from being in
"experimental" mode to being regular annotations:

* Code
* Strikethrough
* Subscript
* Superscript
* Underline

Change-Id: I21be2dc844b47b825d7a1e48a592067166ecd122
2013-09-11 19:41:14 -07:00
Ed Sanders 4f768f3734 Integrate with BetaPreferences
Look at logo Michael.

Bug: 52686
Change-Id: I3cfada2ea264184698de5f322c1fe5041b37b8c8
2013-09-10 10:20:14 -07:00
Ed Sanders 0c52ab64e1 Sort i18n messages
Change-Id: Ic736fd63aa76c324edb67b303aadb269221ab213
2013-09-05 15:35:06 -07:00
jenkins-bot 8dfa827a97 Merge "ve.EventSequencer: Post-event listening" 2013-09-04 20:08:42 +00:00
David Chan 793172e41e ve.EventSequencer: Post-event listening
modules/ve/ve.EventSequencer.js
* Class to sequence pre-event and post-event listening correctly

demos/ve/eventSequencer.html
* Plain HTML example page for testing EventSequencer and event sequences

Change-Id: I4ddb10a30c2f44015136a7978a185d0b13f0690b
2013-09-04 11:20:46 -07:00
Trevor Parscal 8dfbc5baa5 Make tools generic and add fancy tool groups
Objectives:

* Got rid of mw prefixing in tools, inspectors and dialogs
* Simplify tool classes so they can be generically used as items in bars, lists and menus
* Add support for a catch-all toolbar group
* Simplify tool registration, leaning on tool classes' static name property
* Move default commands to command registry
* Move default triggers to trigger registry
* Get language tool working in standalone

Change-Id: Ic97a636f9a193374728629931b6702bee1b3416a
2013-09-03 11:27:39 -07:00
Ed Sanders a72099af66 Expose version information in the client
By passing in the information via a ResourceLoaderModule this
gets around any concerns with performance (version information
is read from the file system).

The version information is appended to the beta toolbar dialog.

Bug: 53050
Change-Id: I7836e1d4003416cbb7e18e3435aa87d82fd5c2e2
2013-08-29 18:19:40 -07:00
Timo Tijhof bdd1a73eaa data: Rename MessagesModule to DataModule
Also..
* removed an incorrrect comment referring to the old module
  name (standalone didn't use the VisualEditorMessagesModule).
* made it use debug mode to determine whether to minify or
  prettify the js code.

Change-Id: I493007649fba27e7faab0cf743eded5f68714c50
2013-08-29 18:07:35 -07:00
Ed Sanders 62c7358af9 Add David to author lists
Change-Id: If46dc34381e5cc7c3fbfc9886868cd1a63bf7a47
2013-08-29 11:11:10 -07:00
Roan Kattouw a03c512f33 Actually move the experimental LanguageInspector messages into the experimental module
Change-Id: I91453bfa535b1b5a8c6c495a5857977a646434d6
2013-08-28 17:25:52 -07:00
jenkins-bot 916d1c2b69 Merge "Create a subscript tool" 2013-08-16 02:16:25 +00:00
jenkins-bot c01499fb66 Merge "Create a superscript tool" 2013-08-16 02:15:42 +00:00
jenkins-bot ffc513fcf3 Merge "Create an underline tool" 2013-08-16 02:13:02 +00:00
Ori Livneh 825322d4ac Use internal ve.track to log events
This patch rounds off change I29740fa7a by replacing calls to EventLogging's
eventLog.logEvent with calls to VisualEditor's ve.track. ve.track publishes
events by providing an interface, ve.trackRegisterHandler, which event handlers
use to subscribe to VisualEditor events. By making it the responsibility of the
web analytics framework to register itself as a handler, VisualEditor can
remain decoupled from (and indeed ignorant of) any particular event logging
implementation. This allows VisualEditor to be integrated with many different
web analytics platforms with nothing more than a bit of glue code for mapping
ve's event semantics to those of the target platform.

The practical difference that this makes is that it frees VisualEditor from
having to know about EventLogging or from having to load EventLogging
components, which means we can remove quite a lot of gnarly code. My current
plan is to migrate the code for registering and loading the 'Edit'
schema module to Extension:CoreEvents, which is also where I'll commit the
handler for VE events. (CoreEvents exists precisely to provide an organized
place for persistent but WMF-particular instrumentation.)

Once this patch is merged and deployed, the following two configuration
variables may be removed from mediawiki-config:

- $wgVisualEditorEnableSplitTest
- $wgVisualEditorEnableEventLogging

Change-Id: Idfdf692668d2adfbe029e8f0c4ff9e96c60ff741
2013-08-15 19:43:36 +00:00
James D. Forrester 23af88edc3 Create a subscript tool
Bug: 51612
Change-Id: Ia05e09a411213cbc035ad9dd3d3156d57f8e102c
2013-08-15 19:40:15 +00:00
jenkins-bot cec28fe287 Merge "Add ve.track, a generic dispatch of analytic events" 2013-08-15 19:39:24 +00:00
James D. Forrester 34a37471c6 Create a superscript tool
Bug: 51611
Change-Id: I74b6418542927eeeb7e80d664a30fcaf07b93a13
2013-08-15 12:36:35 -07:00
Steven Zhang 3c65d830f2 Create an underline tool
Bug: 51609
Change-Id: I65246d7eeb154950c35a1cb70909a113080c2323
2013-08-15 12:16:01 -07:00
jenkins-bot c84c47aeba Merge "Prevent the creation of invalid MWInternalLinks" 2013-08-14 21:58:27 +00:00
Ed Sanders ad3a7c95c8 Alien extensions
VisualEditor.i18n.php, VisualEditor.php
* Button title
* New experimental files

ve.*.MWAlienExtensionNode.js
* Very basic extension of ve.*.MWExtensionNode

ve.ui.MWAlienExtensionInspector.js
* Default to inline-block for wrapper. Should probably
  get rid of styled wrappers for GeneratedContent eventually.

ve.ui.MWAlienExtensionInspector.js
* Basic extension of MWExtensionInspector. Override title to
  use tag name e.g. '<easytimeline>'. Could be changed in future
  to 'Extension: easytimeline' or similar.

*.png, *.svg, *Icons*.css, ve.ui.MWAlienExtensionButtonTool.js
* Angle bracket icon for button (open to suggestions)

ve.ui.MWInspector.css
* Make extension inspector text input tall by default.

Change-Id: I07f0686839192cad3cd8dfd3233ae907fe5cdf6a
2013-08-08 14:27:49 +08:00
Roan Kattouw 8f2c897c11 Don't set a group for VE ResourceLoader modules
The grouping behavior is unnecessary for the main payload, and
actively hurting us for the init-init module.

Change-Id: I111e28e5c759bf43412c5b1432ec9c8a2102d7dc
2013-08-07 18:20:01 +08:00
Ed Sanders 0d1617a627 Hieroglyphics support
Mostly as a demonstration of how easy this is with MWExtensionNode.

The icon was chosen with the following criteria:
1. Recognisable (the ankh is quite common in popular culture, right?)
2. Doesn't look idiotic to academics (I've consulted an Egyptology
   PhD and they can confirm it's not the glyph for penis)
3. Renders well at <16x16

That said it does look a little like a stick man...

Bug: 43118

Change-Id: I9f9e8af501401866bfeecf0eec3690a705fbd4db
2013-08-07 09:43:04 +00:00
Ed Sanders 671c7d3b25 Create base MWExtensionNode for simple extension support
MWMath and other simple extensions all behave in a similar way, e.g.
<tagname>Foreign syntax</tagname>.

This creates a base class that should make supporting such extensions,
and editing their contents in a plain text box, very simple.

Change-Id: Icc0acb33fe32704f71dacb552d9dfa3142eaef2b
2013-08-07 17:39:31 +08:00