Commit graph

2725 commits

Author SHA1 Message Date
Roan Kattouw ce138adbdb Kill domAttributeWhitelist in favor or renderHtmlAttributes
domAttributeWhitelist wasn't actually being observed. Instead, we
already had the code in place to treat renderHtmlAttributes as a
boolean/whitelist/blacklist hybrid, it just wasn't used that way
yet.

This makes the interface nicer and fixes the bug where all attributes
(including data-parsoid and even things like onmouseover) were
rendered by CE.

Change-Id: I02e266c7c7dc197ed845164b7a705d786846a33b
2013-08-26 18:37:50 -07:00
Ed Sanders fd410c03a7 Give document real focus after cut
If only a FocusableNode is selected the document doesn't have
real focus, so we must do it manually.

Bug: 53362
Change-Id: I781f59dda7f2884ff02f6688c2c8c037ac7ed1a6
2013-08-26 23:06:13 +00:00
Ed Sanders 99692230b1 Copy-paste data fixes
* Assign cut/copy/paste events to the document so that
  they are triggered when the CE doesn't have real focus
  e.g. only a FocusableNode is selected
* Use clipboardData.setData when available. The key can
  be stored and retrieved perfectly in text/xcustom but
  this technique doesn't work in FF or IE
* Just use text content for key as this is what is written
  to the clipboard, so this can be used directly without
  having to get the content from the pasteTarget.

Bug: 48604
Bug: 49396
Change-Id: Ib3702f9441f6ee3fa34ec071f00994dd7e591d99
2013-08-26 15:25:15 -07:00
Timo Tijhof d0d0e156b8 doc: Restore and clean up documentation for Platform subclasses
- Added missing @inheritdoc so that generated documentation is
  not empty.
- Fixed type of mw.Platform#getMessage from (implied) @property
  back to @method.
- Removed notes from mw methods. They are prepended instead of
  appended, thus overriding the useful single-line summary
  of the method with this random note. Description should either
  be replaced entirely (e.g. no @inheritdoc) or inherited.
- Rephrased a few description to be consistent with the others
  (e.g. "Get .." and "Add .." instead of "Gets .." or "Adds..").

Follows-up cbe35632f1.

Change-Id: Ie55bb9e18f1524b706f0e195300170e4d552bf73
2013-08-26 12:47:28 -07:00
Moriel Schottlender 47f9c66798 Language Inspector Default Fix
Fixes the situation where there's a language set but not a direction.

Change-Id: If353b36ff0700717f1b8fd917b39c230de5ec272
2013-08-26 03:17:45 -04:00
jenkins-bot 56ff25cb7c Merge "Fix copy and paste of backwards selction" 2013-08-22 18:14:17 +00:00
jenkins-bot 9a7b7e9176 Merge "getAnnotationsFromRange should only ignore non-content data" 2013-08-22 18:12:03 +00:00
Ed Sanders f9b92e8909 Fix copy and paste of backwards selction
Was previously broken as getSlice was using ve.Range#equals to
compare ranges which is direction-sensitive.

Bug: 51538
Change-Id: Ib58d1d8fd11b62388c111a5da66171d13a9db9c2
2013-08-22 18:10:34 +00:00
jenkins-bot 97c03da395 Merge "Don't emit Surface changes back to the Surface" 2013-08-22 09:48:23 +00:00
Ed Sanders 380b368986 getAnnotationsFromRange should only ignore non-content data
Currently ignores all non-element data, but element content (e.g.
images) can be annotated.

Added test cases and updated the test runner to only compare
store indexes for a more readable output.

Bug: 50127
Change-Id: I234586a28072811c8288aab56f6abaaa0da0c88d
2013-08-21 22:32:34 +01:00
David Chan 24dae99065 Don't emit Surface changes back to the Surface
modules/ve/ce/ve.ce.SurfaceObserver.js
* add emitContentChanges argument to poll (and start and stop)

modules/ve/ce/ve.ce.Surface.js
* Pass emitContentChanges=false to calls to start/stop in certain places
* Explicitly pass emitContentChanges=true elsewhere, to preserve prior
  behaviour

modules/ve/ui/ve.ui.Surface.js
* Explicitly pass emitContentChanges=true to poll

modules/ve/test/ve.test.js
* Escape non-BMP unicode text literals (to prevent potential editor
  problems)

Bug: 50105
Bug: 50346
Bug: 50631
Bug: 51477
Bug: 52716
Change-Id: I19ec7eaa0e3224cbfc7e7188e964183d7393c9a7
2013-08-21 17:26:32 +00:00
jenkins-bot ffdbc92a41 Merge "Toolbar API" 2013-08-20 23:17:42 +00:00
Trevor Parscal 332e31fb00 Toolbar API
Objectives:

* Make it possible to add items to toolbars without having to have all
  toolbars know about the items in advance
* Make it possible to specialize an existing tool and have it be used
  instead of the base implementation

Approach:

* Tools are named using a path-style category/id/ext system, making them
  selectable, the latter component being used to differentiate extended
  tools from their base classes, but is ignored during selection
* Toolbars have ToolGroups, which include or exclude tools by category or
  category/id, and order them by promoting and demoting selections of
  tools by category or category/id

Future:

* Add a way to place available but not yet placed tools in an "overflow"
  group
* Add a mode to ToolGroup to make the tools a multi-column drop-down style
  list with labels so tools with less obvious icons are easier to identify
  - and probably use this as the overflow group

Change-Id: I7625f861435a99ce3d7a2b1ece9731aaab1776f8
2013-08-20 16:08:26 -07:00
jenkins-bot 841a414c31 Merge changes Id2328d6e,I840b689d
* changes:
  Remove language variants from bold/italic now we have fallbacks
  Implement fallback langauges
2013-08-20 21:38:33 +00:00
jenkins-bot cd5ee730ab Merge "Remove duplicate comments from platform code" 2013-08-20 21:25:48 +00:00
jenkins-bot 4f6e42b699 Merge "Subscript is one word (and so is superscript for that matter)" 2013-08-20 20:37:49 +00:00
Trevor Parscal 4e6694c75e Subscript is one word (and so is superscript for that matter)
Objective:

* Unify the capitalization of subscript and superscript

Change-Id: I5a7fbc2d864c896ebb26177cf05c7adddacd8829
2013-08-20 13:34:50 -07:00
Ed Sanders 433f1eebcb Remove language variants from bold/italic now we have fallbacks
Bug: 53094

Change-Id: Id2328d6e7f89cd9deddde67b57cd7e3fc55683e6
2013-08-20 20:18:37 +00:00
Ed Sanders 069b757afc Implement fallback langauges
Return an array of languages instead of a single language. Languages
containing hyphens return themselves along with the root code e.g.
'en-GB' => ['en-GB', 'en']

Change-Id: I840b689d0021d865f93d16d075473a2ed0a9f0d8
2013-08-20 20:12:46 +00:00
Ed Sanders cbe35632f1 Remove duplicate comments from platform code
Inherited methods don't need to repeat documentation.

Change-Id: I05c4efe8e4a394411922add5f11259d47d44e3bb
2013-08-20 21:12:33 +01:00
jenkins-bot b2c65f2f87 Merge "Fix issue in 7673a398" 2013-08-20 19:15:38 +00:00
jenkins-bot e38bb7714f Merge "Change be-tarask to use Te instead of Te-El for bold" 2013-08-20 18:13:31 +00:00
jenkins-bot 34b143eb36 Merge "Increase line height in beta warning" 2013-08-20 17:30:42 +00:00
jenkins-bot bfc87b6d08 Merge "Don't change config during toolbar setup" 2013-08-20 17:20:44 +00:00
Ed Sanders f0c99b9c1e Change be-tarask to use Te instead of Te-El for bold
Bug: 53094
Change-Id: Ia442285e0d3f868fdda0bf06b8bb8f034c6c039f
2013-08-20 17:49:31 +01:00
Trevor Parscal a51fbbb300 Don't change config during toolbar setup
Problem: When the toolbar is created twice with the same config object,
the second time around the tools are still bound to the old surface

Reason: The tool config is overwritten such that symbolic names of tools
are replaced with instances of tools, bound to a specific surface. The
second time around, the creation fails (silently in a try-catch) and then
the already translated list of tools is used to create a new toolbar
filled with old tools still bound to the wrong surface.

Solution: Leave the config object alone, and instead build a new list of
tool instances while iterating through tool names.

Bonus: Don't fail silently. Using a try-catch to detect whether a
requested tool is supported masks other errors, and is evil. Instead,
just do a lookup and skip tools in which the lookup's result is falsey.

Change-Id: Ic43ec29173e556592bb3db9399ff83787e0a6857
2013-08-19 23:41:22 +00:00
Jforrester 40fc1b1bed Revert "Don't emit Surface changes back to the Surface"
This reverts commit 1987d3aa2b.

Change-Id: I5aaa6b0c743fbf6292030f566b6f7d993de740a7
2013-08-19 22:27:32 +00:00
Ed Sanders 4a3cc06ac5 Increase line height in beta warning
See bug for screenshots.

Bug: 53045
Change-Id: Ia4e97f42786cb8ced9ab1c94b1cce9f4abd17750
2013-08-19 20:22:18 +01:00
David Chan 1987d3aa2b Don't emit Surface changes back to the Surface
modules/ve/ce/ve.ce.SurfaceObserver.js
* add emitChangeEvents argument to poll (and start and stop)

modules/ve/ce/ve.ce.Surface.js
* Pass emitChangeEvents=false to calls to start/stop in certain places
* Pass async=false in the onDocumentKeyDown call to stop
* Explicitly pass emitChangeEvents=true elsewhere, to preserve prior behaviour

modules/ve/ui/ve.ui.Surface.js
* Explicitly pass emitChangeEvents=true to poll

modules/ve/test/ve.test.js
* Escape non-BMP unicode text literal (to prevent potential editor problems)

Change-Id: Ia96efad0c808b9a02e508bbfda65fdf4f5cedeff
2013-08-19 14:20:08 +00:00
jenkins-bot 27c0866d8a Merge "Check for past/future state in undo/redo before setting breakpoint" 2013-08-16 02:44:45 +00:00
Ed Sanders 5bff162bff Check for past/future state in undo/redo before setting breakpoint
This isn't a problem when using the UI buttons as they get disabled
but the command keys can still trigger these methods.

Also fix hasPastState to include check for small stack. This fixes
an existing bug where the undo button doesn't become active until
~1s after the first change is commited (i.e. after the small stack
is committed to the big stack).

Bug: 52113
Change-Id: Idbd34953c805620881a609409290256462af80a5
2013-08-15 19:37:36 -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
jenkins-bot 103bd6e499 Merge "LanguageInputWidget Generalization" 2013-08-16 01:18:24 +00:00
Moriel Schottlender 0fd2b619c9 LanguageInputWidget Generalization
This commit prepares the LanguageInputWidget to handle both annotation
and node, so it can be used as the GUI for both the LanguageInspector
and the LanguageBlockInspector that's coming up.

Cleaned up the way annotations are read into LanguageInspector and
AnnotationInspector. The attributes are kept in the Widget (without regard
to what datamodel they will serve) and are then read from the inspector.
The LinkInspector had to be adjusted slightly to accomodate a small change
in the AnnotationInspector too.

Change-Id: I17954707c00ffc4c32fbb44a6807a61760ad573c
2013-08-15 20:48:17 -04:00
Roan Kattouw c772431927 Fix issue in 7673a398
The update event passes in a transaction object, which was interpreted
as a config object and fragmented the cache. Explicitly wrap the
update() call in an event handler to make sure the config parameter is
undefined.

Change-Id: I641c68230b92d23626fb8b12aeab6a8904a35bcc
2013-08-15 16:32:41 -07: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
Ed Sanders 37b461fe56 Reposition context menu after rerender
Add rerender event to all image loads in MWExtensioNode.
MWHieroNode's implementation of onParseSuccess is now the same as
its parent so can be deleted.

Change-Id: Iaa4999372f1ba88a7bdf1490fc3f8640af77ceae
2013-08-15 10:43:31 +01:00
jenkins-bot 2c4e9d8323 Merge "Support previews and concurrent updates in ce.GeneratedContentNode" 2013-08-14 22:00:12 +00:00
jenkins-bot c84c47aeba Merge "Prevent the creation of invalid MWInternalLinks" 2013-08-14 21:58:27 +00:00
Ed Sanders 79b3dbf386 Fix rendering of inspector for embedded buttons
Previously we assumed that embedded icons mean we weren't
dealing with an inspector, but that is not always the case
(e.g. MWExtensionInspector).

Bug: 52845
Change-Id: Ifc5b054568661cb9badf6d7991f512b81e649b36
2013-08-14 18:50:54 +00:00
Ed Sanders 599ad772ed Allow inspectors to not show the delete button
This functionality makes sense for annotations, but not for extensions.

Change-Id: I64fea941f8e01d0464eb9a045257f4810d789d60
2013-08-14 18:50:39 +00:00
jenkins-bot ddf748e53b Merge "Generic support for multiple tags in TextStyleAnnotation" 2013-08-09 04:42:32 +00:00
Ed Sanders 00c681f0d9 Generic support for multiple tags in TextStyleAnnotation
Bug: 52477
Change-Id: If8e2f541adb045f9b84a913829a5b7430ca83299
2013-08-09 04:15:45 +00:00
Ed Sanders c89495d014 Darker toolbar group border
Roan and I think this is way too light. The only way
I can tell it's a group is by mousing over all of
the icons back and forth really quickly :)

Increasing to 10% alpha.

Change-Id: Iab55bf64921de5247d10d611318e545efe74fe4a
2013-08-08 14:12:33 +08:00
jenkins-bot 3a83811701 Merge "Handle <tt> as textStyle/code" 2013-08-08 03:45:34 +00:00
Roan Kattouw 7673a39878 Support previews and concurrent updates in ce.GeneratedContentNode
GeneratedContentNode didn't track concurrent updates at all, so a
race condition was possible: if the node was updated a second time
before the first update had been rendered, the second update might
render first and then be overwritten by the other one.

To prevent this, we track the promise associated with the current
render. If a new update is launched while a previous one is still
pending we attempt to abort the old one by calling .abort() on it,
and ignore any future resolution or rejection from it.

Also allow rerenders based on non-model data by calling
.update( { config object } );

Change-Id: I8feefd9e8fb6c41d06b8b20131e3be5e37954e83
2013-08-08 11:34:50 +08:00
Roan Kattouw cbadaa8d8b Fix deprioritization of regex matches in ModelRegistry
If you had an HTML element that was matched by two models, one with
a direct string match and one with a regex match, then the string
match would beat the regex match (which is correct) if they both
specified a tag name, but the regex match would win (which is wrong)
if they both didn't specify a tag name.

The fix is to only check for tagName === null if we're in tag-agnostic
mode (tag === '').

Change-Id: I9943611111e4c4ff498cdd95b7b3e72f95fb413b
2013-08-08 02:52:45 +00:00
Ed Sanders 1428ea9c27 Allow customisation of ui.Window titles
Provide getTitle() so subclasses can do something fancier than just
set a message.

Change-Id: I5eb82f70e39a991fa577aae4b0e7344908134d89
2013-08-08 02:49:18 +00:00
Ed Sanders b0ae68dd99 Add .static.getMatchRdfaTypes() wrapper
This allows abstract classes to specify RDFa types based on a static
property overridden by a child class. The default implementation is to
just use .static.matchRdfaTypes.

Change-Id: Ic71fc552a6a1626d94f998e9517af971e8198e79
2013-08-07 17:39:24 +08:00
peter-coti 5014e122e3 Create strikethrough text style button
Experimental to avoid making toolbar too long

Bug: 51610
Change-Id: I1eb5b1361d6058a6e1533ab62c0aa7e21c9fc090
2013-08-07 16:14:19 +08:00
jenkins-bot aeace0be29 Merge changes Ic3a64363,Ib5ae8f70,I738209d1
* changes:
  Add ve.ui.ToolGroup and use within toolbar setup
  Cleanup tool styles
  Make drop down tool work with generic toolbars
2013-08-07 05:11:57 +00:00
Trevor Parscal 2717ea1645 Add ve.ui.ToolGroup and use within toolbar setup
Objectives:

* Use a class for toolbar groups to add more functionality later
* Rename addTools method to setup

Changes:

*.php
* Add link to new file
* Move ui element classes up for more general use

ve.init.mw.ViewPageTarget.js, ve.init.sa.Target.js, ve.ui.Context.js,
ve.ui.SurfaceWidget.js
* Update use of addTools method

ve.ui.Tool.css, ve.ui.Toolbar.css
* Move styles between sheets

ve.ui.Toolbar.js
* Rename addTools to setup
* Use ve.ui.ToolGroup objects when building tools

ve.ui.ToolGroup.js
* New class, encapsulates tools

Change-Id: Ic3a643634a80a8ac7d6f6f47f031d001c7efaee7
2013-08-07 05:08:20 +00:00
Trevor Parscal 9426dfd54b Cleanup tool styles
Objectives:

* Make drop down tools look more like buttons and less like inputs, since they aren't text input and are buttons
* Make context toolbars inside surface widgets render correctly
* Show outlines of groups on hover to hint tool relationships
* Make neighboring active tools look cleaner

Changes:

ve.ui.Tool.css
* Merge ButtonTool and DropdownTool styles as much as possible
* Add styles for DropdownTool active states
* Only round the corners of the first and last tool in a group
* Soften the borders between consecutive active tools

ve.ui.Toolbar.css
* Add border to groups on hover

ve.ui.Widget.css
* Isolate surface widget toolbar styles by using stricter selector

ve.ui.Tool.js
* Fix incorrect capitalization of class name

ve.ui.SurfaceWidget.js
* Add classes to toolbar and surface for better style targeting

Change-Id: Ib5ae8f705ef1e9c481e5bdf8c8dcef9c1eb22c4d
2013-08-07 05:08:08 +00:00
Trevor Parscal 5a0faf5389 Make drop down tool work with generic toolbars
Objective:

* Remove ve.ui.DropdownTool's dependency on ve.ui.SurfaceToolbar so it
  can be used with any ve.ui.Toolbar

Changes:

ve.ui.DropdownTool.js
* Bind onBlur to document mousedown in capture mode instead of trying to
  add more and more things we are listening to which is a losing battle
* Refactor activate/deactivate mode changes
* Get rid of isEnabled check - surface should disable toolbar, the tools
  shouldn't be checking if the surface is enabled after the fact (also,
  this is harmless and doesn't change any actual interactions)

Change-Id: I738209d17649358c2f9812f9abac576960af867b
2013-08-07 03:27:30 +00:00
MatmaRex 487197278a Actually fix bug 47793 for Opera for real this time
I trusted you guys when you told me to use DOM .focus() instead of
jQuery's .focus() and didn't test well enough :( The former doesn't
work, the latter does.

Follow-up to I7962f59b.

Bug: 47793
Change-Id: Iddfb8d7c99325b6c7a5d151948b57cfa5f0a6a62
2013-08-04 23:09:56 +02:00
Ori Livneh 246c655b28 Add ve.track, a generic dispatch of analytic events
This patch adds ve.track; it provides a means for VisualEditor code to log
various changes of state that are of potential analytic interest. This is done
without coupling VisualEditor to a particular analytics framework by providing
a method, ve.hook.registerHandler, by which event data may be routed to a
particular analytic framework for processing and dispatch.

ve.track uses a $.Callbacks-like object for tracking analytic events which can
remember an arbitrary number of past events. This is done by maintaining an
array containing the arguments of past calls and maintaining a counter for each
callback indicating its position in the queue (i.e., how many events it has
already received.) This ensures handlers are called for each event, including
events which were fired before the handler was registered. This allows the
load-order of VE and analytics components to remain unspecified.

Change-Id: I29740fa7a0ac403e484e0acee6dfcadaf6fc4566
2013-08-03 02:51:07 +00:00
Ed Sanders d47cfe7d02 Handle <tt> as textStyle/code
Also store the node name so we round-trip correctly.

Bug: 52352
Change-Id: Id1fc85540804f5724ac7ded649a2d3ed0eb26770
2013-08-02 23:07:40 +01:00
Trevor Parscal a226716d70 Split ve.ui.Toolbar and ve.ui.SurfaceToolbar
Objective:

* Make it possible to make a toolbar without a surface

Changes:

*.php
* Links to new file

ve.ui.Toolbar.js, ve.ui.SurfaceToolbar.js
* Split toolbar into generic and surface specific classes

*.js
* Update symbol names

Change-Id: Ice063a2fb67b5ce5155cdc96a0d47af49eee48cb
2013-08-02 14:33:25 -07:00
jenkins-bot cd9c38aa9a Merge "Remove inserted leading whitespace" 2013-08-02 19:03:52 +00:00
Ed Sanders f153f932a2 Remove inserted leading whitespace
This is bit of a hack, as leading whitespace could be
significant if styled with white-space:pre.

Long term VE shouldn't be editing the user's HTML, and
should just highlight potential formatting issues.

We avoid the stripping in preformatted elements as we
expect they will have that styling.

Bug: 51462
Change-Id: I654d98e17dd604cb2a192831ff3f3597f95b9962
2013-08-02 19:01:22 +00:00
jenkins-bot ed0203f6d0 Merge "Include element HTML in QUnit summary for diff" 2013-08-02 18:53:37 +00:00
jenkins-bot b85fc12b7c Merge "doc: Add missing @static to static ve.Element methods" 2013-08-02 18:44:48 +00:00
Ed Sanders 42f82cf15f Include element HTML in QUnit summary for diff
Because trying to work out how broken your test case is
by looking at two (potentially multi-page) serialisations
of the DOM summary is a pain in the arse. Diffing two
HTML strings may highlight the problem much more clearly.

TODO: Is it possible to defer the calculation of the HTML
infused summary object until we have determined the assertion
has failed. Otherwise we're slowing down our tests for no
reason.

Change-Id: I873bf2479ab81d15389792bd59d15580da63941a
2013-08-02 16:10:05 +01:00
Timo Tijhof 19a705de87 ve.ui.Toolbar: Use closure instead of ve.bind for event handlers
Code speaks for itself, see also bug 52441.
Though not introduced by 14343c7bf7, that made the bug worse.

Bug: 52441
Change-Id: Ie2b80b22df03eb563de8812a47fb25152527e786
2013-08-02 09:36:43 +02:00
Timo Tijhof d3b0d94d27 doc: Add missing @static to static ve.Element methods
They were incorrectly showing up in generated documentation
as instance methods.

Change-Id: I3668311d9e6bc25d63a1f49cc7a1abe4f6f350aa
2013-08-02 08:49:53 +02:00
Eloquence 8ab81cfe4c Expand beta message a bit.
Change-Id: I6a49da57540d1702d4477619fb002f9fa0a314de
2013-08-01 21:45:53 -07:00
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
Ed Sanders 04c0a0d2ee Prevent the creation of invalid MWInternalLinks
By testing against a regex of legal title characters we can determine
if the entered text is a valid internal link. If it isn't we should
prevent the link inpsector from creating/changing the annotation.

Bug: 33094
Change-Id: Ia1df602601e4e82fc351279e432c28c425f5157a
2013-08-01 17:38:55 +01: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 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
jenkins-bot ed8133e317 Merge "Link inspector bug fixes" 2013-07-31 20:54:46 +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
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
jenkins-bot 6828804d27 Merge "Language Inspector UI" 2013-07-31 07:14:56 +00: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
jenkins-bot 40e712985c Merge "Add keyboard shortcut for 'clear' button" 2013-07-30 00:51:19 +00:00
jenkins-bot 19a2b7d018 Merge "Add the special 'clear' (12) button to ve.ui.Trigger" 2013-07-30 00:47:13 +00:00
Roan Kattouw 55aaf56038 Don't duplicate categories when unlisting
op !== operation in all iterations of this loop except the first,
and using information from one operation to apply another one
doesn't work very well.

The fact that undefined cast to a number is NaN rather than 0
is very unhelpful :(

Also fixed some commas that should be semicolons.

Bug: 52238
Change-Id: I4138c023c955f2866881084506e24bb8b6db5a4d
2013-07-29 17:23:42 -07:00
James D. Forrester bc3cc9bbdc Add keyboard shortcut for 'clear' button
Now Ctrl+\ (Cmd+\ on Mac) will trigger the 'clear annotations' button
on the current context. Ideally we'd also bond to the 'clear' keyboard
button (ASCII 12) but it does not seem possible to do that yet.

Bug: 51507
Change-Id: I300ec1ffa237e51418ec429be39001f820f053ae
2013-07-30 00:14:17 +00:00
Timo Tijhof 14343c7bf7 ve.ui.Toolbar: Refactor floating logic for performance
== Renamed methods ==

* enableFloating  -> enableFloatable
* disableFloating -> disableFloatable
* setPosition     -> float
* resetPosition   -> unfloat

== Scroll and resize event ==

Timeline for scroll event reduced from about half a dozen
"Recalculate style" and various forced "Paint" down to 0.

New timeline for scroll is clean (for me: from ~35 to ~59 fps):
* 1 Event (scroll)
* 1 Composite Layer

The composite layer action is the browser changing the viewport
to a different portion of the document drawing. Exactly the one
thing a simple scroll should do.

Timeline for resize event is still pretty crowded and low fps,
but it has improved. Further improvement would likely be around
using requestAnimation and going outside ve.ui.Toolbar.

== Changes ==

* New: ve.ui.Toolbar#initialize.
  Similar to what surface has. Users of Toolbar should decide
  whether to call enableFloatable, append it to the DOM at some
  point and then call initialize() once.

* Don't compute offset() every time.
  Eliminated by doing it once in #initialize. These 'top' and
  'left' offsets do not change.

* Don't compute outerWidth() and $window.width() every time.
  Reduced by doing it once in #initialize to compute the 'right'
  offset. Updating it only on resize.

* Don't set 'top' every time.
  This is already in the stylesheet. It was never set to anything
  else so the abstraction for it in #float has been removed.
  This also made it obvious that code for "ve-ui-toolbar-bottom"
  was unused and left behind. Tha class was only ever being
  removed from something (never added).
  The one addClass call for it was in a condition that is always
  false ("if top > 0").

* Don't set 'left' every time.
  Eliminated by doing it once in #float.

* Don't set 'right' every time.
  Reduced by no longer doing it on scroll. Done once in #float,
  and on resize after computing the new value for it.

* Remove no-op style operations.
  Wrapped methods in if-floatable, if-floated etc. to reduce a
  fair amount of easily avoided re-paint overhead.

* Avoid double re-paint in mw.ViewPageTarget.
  Though we prevent a lot of redundant re-paints now, whenever
  we do repaint we want to do it in 1 repaint instead of 2.

  ve.ui.Toolbar emits #toolbarPosition, which tells
  mw.ViewPageTarget to update toolbarTracker which would read
  the new $bar style properties and copy them over to the
  $toolbarTracker. However, this read operation forces the browser
  to do an immediate re-paint half-way just for $bar.

  Browsers only repaint when style properties are changed and
  JS has yielded. The exception to this is JS reading style
  properties: in that case the browser is forced to do those
  deferred repaints directly and reflect the new values.

  We can avoid this double repaint by passing the updated values
  as data instead of requiring the receiver to read the DOM (and
  thus a keep the deferred repaint). Now toolbarTracker can use
  them directly whilst the browser hasn't even repainted $bar yet.

== Clean up ==

* Redundant "border-radius: 0". This would reset something, but
  it never does. None of the things it inherits from set a
  border-radius. There is one subclass where toolbar is used
  with a border-radius (".ve-ui-surfaceWidget .ve-ui-toolbar-bar"
  sets a border-radius) which overrides this on purpose, so the
  default of 0 is redundant.

* Pattern "if ( .. ) addClass() else removeClass()" changed to:
  "toggleClass( , .. )"

Bug: 52014
Change-Id: I9be855148962eee068a77fe83e98eb20bbdcfeec
2013-07-30 01:47:54 +02:00
Timo Tijhof 44623c9b2a ve.copy: Remove obsolete copyArray and copyObject
These have been pointing to the same method for a while now,
we can safely remove these obsolete aliases and just use it
as generic copy.

* Each file touched by my editor had its new line at EOF fixed
  where absent
* Don't copy an otherwise unused empty object
  (ve.dm.Converter)
* Use common ve#copy syntax instead to create a link
  (ve.dm.Document, ve.dm.example)
* Remove redundant conditionals for isArray/copyArray/copyObject
  (ve.dm.example)

Change-Id: If560e658dc1fb59bf01f702c97e3e82a50a8a255
2013-07-30 01:44:22 +02:00
James D. Forrester f4882b3b49 Add the special 'clear' (12) button to ve.ui.Trigger
Change-Id: I407d9a026348e5385c6e3d3476970e64948fc2f6
2013-07-29 16:41:28 -07:00
jenkins-bot 0ec6008c32 Merge changes Icce6c192,If1bcc3ee
* changes:
  Make <nowiki>s non-experimental again
  Don't compare annotations directly with ve.compare()
2013-07-29 19:47:26 +00:00
jenkins-bot 7021e0ab46 Merge "ve.ce.Surface: Prevent focus loss on the document node in Opera" 2013-07-29 17:17:47 +00:00
Moriel Schottlender 59079978ff Language Inspector UI
This is the language inspector UI engine with ULS core.
The Language Inspector works alongside ULS to choose and change language
blocks in text. The inspector was based on ve.ui.TextInputWidget and
now changed to inherit ve.ui.Widget and display details in a table
instead of an input textbox.

Added jQuery.ULS module:
* Repository: https://github.com/wikimedia/jquery.uls
* Latest Commit 728f112ffc90b03b50c0109487886a2647f12020
* Taken 'src' / 'images' and 'css' folders into modules/jquery.uls

Bug: 47759
Change-Id: I3c9fd6c135c05a54f6c7fc28c5962fc0a6677806
2013-07-29 00:38:59 -04:00
Roan Kattouw 83e1888275 Don't compare annotations directly with ve.compare()
Annotations' attributes might contain DOM elements, which cause infinite
recursion in ve.compare(). Annotation classes can protect against this
by overriding getHashObject() to summarize DOM nodes, but that doesn't
help if that's not respected everywhere.

Instead, compare the hash objects, those are safe. This does not appear
to be a problem in practice, currently, because the nowiki annotation
is experimental, oo.compare() now short-circuits if a === b, and because
of optimizations in openAndCloseAnnotations() which lead to the relevant
compareToForSerialization() code path being taken very rarely.

Bug: 51948
Change-Id: If1bcc3eee4fd14d107db1935d89dcc5516643b53
2013-07-28 00:10:42 +00:00
jenkins-bot 6355d9937f Merge "Fix the newline bunny-hop bug" 2013-07-27 18:07:07 +00:00
jenkins-bot 4bdc621e62 Merge "ce: Don't set backgroundColor transparent for every node in debug mode" 2013-07-27 04:06:52 +00:00
Timo Tijhof 3b6810eeec ce: Don't set backgroundColor transparent for every node in debug mode
This only affects debug mode, but things look broken when the
background of every single node is set to transparent (e.g. a
<pre> looks weird with a white instead of grey background).

It also leaves the DOM dirty full of inline styles.

Though setting a grey background isn't guaranteed to be visible
either, and all of these redraws and stuff really slow things
down (we should perhaps only start doing these after the initial
document is painted).. the least we can do is undo it and not
leave it there.

Change-Id: I9abfd46765914828ad8618748be5716a8c6b185c
2013-07-27 04:05:07 +00:00
Ed Sanders a9d391272e Speed up openAndCloseAnnotations by using store indexes
By using annotation indexes only we can avoid a lot of
ve.getHash calls. This reduces the number of getHash calls
on load of [[:en:Argentina]] from ~60,000 to ~2,000.

Bug: 52013
Change-Id: I0bc9aa8feea5f7e4e90a5fcd829de57cab803c15
2013-07-26 18:11:01 -07:00
jenkins-bot cd898d07b6 Merge "Rename index to offset in AnnotationSet" 2013-07-27 01:06:01 +00:00
Roan Kattouw 4041d3f342 Fix the newline bunny-hop bug
We would dirty-diff "</span>\n<!-- comment -->\n<span>" to
"</span>\n\n<!-- comment --><span>", i.e. the second newline made
a bunny-hop to the left over the comment.

The actual bug turned out to involve a double bunny-hop, with
"</span> <!-- comment -->\n<span>" turning into
"</span>\n <!--comment --><span>", i.e. the newline bunny-hops
both the comment and the space.

This happened because outputWrappedMetaItems() didn't take
wrappedWhitespace into account when restoring meta items and
associated whitespace. I hacked a check for wrappedWhitespace into it,
but we should really just rewrite this pile of hacks into a unified
system for queuing and processing both whitespace and metadata.

Change-Id: I4375f4c07983ffec6877d0371aeaa9bf6e65fd6e
2013-07-26 16:24:27 -07:00
jenkins-bot fe40b86e74 Merge "Quick optimisation to avoid containsComparableForSerialization" 2013-07-26 23:14:01 +00:00
Ed Sanders f11db48234 Rename index to offset in AnnotationSet
To avoid confusion between IV store indexes and the index
within the set, rename them to storeIndex and offset.

Change-Id: Ic7d741bd5d39240d63fdc04a2df45658a64441de
2013-07-26 23:04:01 +00:00
Ed Sanders 017b947464 Quick optimisation to avoid containsComparableForSerialization
As that method makes expensive ve.compare calls, we can quickly
avoid most cases by testing AnnotationSet#contains first.

On page load this reduces the number of ve.compare calls on
[[:en:Argentina]] from ~6,000,000 to about ~2,000.

Also reduces ve.compare calls per backspace keystroke from
~300 to 2.

We can optimise this further, but this is a good simple start.

Bug: 52013
Change-Id: Ie3b4517fd13383c48acb64b3c4e82051c34e7484
2013-07-27 00:03:11 +01:00
Trevor Parscal f822e2b7c6 Cleanup code icon
Sharper!

Change-Id: I68a8895ca1bb652e09d66db4ce7abd68cf0a3e99
2013-07-26 13:07:40 -07: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 8768d59e13 Merge "Code annotation icon" 2013-07-26 19:33:42 +00:00
jenkins-bot afcd539eb1 Merge "'CodeScript' => 'Code'" 2013-07-26 19:31:18 +00:00
Ed Sanders f689c8735b Code annotation icon
Change-Id: I16330c11a2f67a8b5fb09be70a809460b3731484
2013-07-26 11:21:36 +00: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 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 7b84716b55 Merge "Optimise history stack truncation" 2013-07-25 22:11:30 +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
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
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 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
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 12b250a929 Merge "Handle meta-only transclusions as meta items" 2013-07-24 14:29:21 +00:00
Ed Sanders cdfed7039f Handle meta-only transclusions as meta items
To achieve this we need to evaluate the DOM contents of
transclusion nodes to see if it consists solely of meta items
and whitespace.

To check for meta items we do a model registry match, but with an
additional parameter to exclude mwTransclusion types as a possible
result (as the first item may be a meta tag, but with a mw:Transclusion
typeof attribute).

Bug: 51322
Change-Id: I89a220350fb7e10e15f3682d21438539196a5846
2013-07-24 14:27:24 +00:00
Ed Sanders 3f3e0c0721 Split continued link annotations on wordbreaks
For now this approach is bit of a hack and will hopefully
be replaced with an ability to cursor either side of an
annotation.

Bug: 51463
Change-Id: I701e3d26e06a28fed2d4950b1d418eda80a1fac5
2013-07-24 11:50:26 +01:00
jenkins-bot 8b201c7dc4 Merge "Quickfix for Transclusion icon in RTL wikis" 2013-07-24 03:45:01 +00:00
Moriel Schottlender 5bb15c4332 Quickfix for Transclusion icon in RTL wikis
Added GUI-level and Page-level "getDir()" methods to get the direction
of the GUI and Page respectively in the ve.ui.Surface and ve.ce.Surface
respectively.

The correction to the direction-test condition in ve.ui.Context reflects
the new method of getting these directions, and fixes the problem with
the transclusion icon. The icon position depends on the wiki/page-level
directionality, regardless of the GUI-level direction.

Bug: 51819
Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
2013-07-23 20:31:08 -07:00
jenkins-bot 292981746c Merge "Add bold/italic for cyrillic/georgian languages" 2013-07-24 02:24:56 +00:00
jenkins-bot 8b493a7e02 Merge "Add bold/italic for more latin langages" 2013-07-24 02:23:38 +00:00
jenkins-bot 6ca420ab60 Merge "Prepend section title to edit summary" 2013-07-23 23:02:15 +00:00
jenkins-bot 598b975171 Merge "RTL Fix for Category & Suggestion Popups" 2013-07-23 22:44:56 +00:00
Moriel Schottlender 12372b41c9 RTL Fix for Category & Suggestion Popups
Flipped the generated positions of the MWCategoryPopupWidget and the
suggestion popup in the TextInputMenuWidget. The RTL position within
TextInputMenuWidget is only adjusted if the popup appears inside another
frame. This fix also corrects the suggestion popup positions in general
when inside another frame.

Bug: 51490
Bug: 51828

Change-Id: I83436d50a4a0596fdae9526c3fc2804cf880a530
2013-07-23 15:43:06 -07:00
Ed Sanders 4e17496fa6 Prepend section title to edit summary
When section edit links are used.

Bug: 50872
Change-Id: I44cef7a892b4f2f22f60f8f7f531f4e9dcfe8363
2013-07-23 22:27:33 +00:00
jenkins-bot 6728b24f1c Merge "Add ve#graphemeSafeSubstring method" 2013-07-23 21:08:38 +00:00
jenkins-bot 2ceead1258 Merge "Ensure ve-ui-panelLayout-scrollable is actually scrollable" 2013-07-23 18:57:41 +00:00
Ed Sanders c6c6a431d1 Add ve#graphemeSafeSubstring method
Allows us to take a substring without splitting a multibyte grapheme.

Change-Id: I811bdc7f010d10bf3c9509a73677939486751fec
2013-07-23 10:45:23 +01:00
MatmaRex e6fd823d6f ve.ce.Surface: Prevent focus loss on the document node in Opera
Opera triggers 'blur' on the document node when clicking on any <a>
link and never trigger 'focus' until after the user blurs the document
node *again* (by clicking outside of it or pressing 'Esc').

This causes the change polling to stop (SurfaceObserver#stop is called
without a subsequent call to SurfaceObserver#start).

To avoid this let's bind a delegated 'focus' event on all <a> links
inside the document and refocus it whenever that happens.

Bug: 47793
Change-Id: I7962f59bd02e075f91e42e6514b390c0d0feb3ab
2013-07-22 21:09:52 +02:00
jenkins-bot e57d8709cf Merge "Array.prototype.splice polyfill for Opera" 2013-07-22 18:40:01 +00:00
Ed Sanders e7d423dd53 Add bold/italic for cyrillic/georgian languages
ru, ky, os, ka now covered

Bug: 51711
Bug: 51712
Bug: 51713
Change-Id: I07987361f18719e96f5cb1b5a2b5eb8987fbf207
2013-07-21 18:32:47 +01:00
Ed Sanders 1b5d950904 Add bold/italic for more latin langages
es, eu, fr, gl, hu, it, nl, pt(-br) all covered now.

Bug: 51702
Bug: 51703
Bug: 51704
Bug: 51705
Bug: 51706
Bug: 51707
Bug: 51709
Bug: 51710
Change-Id: Ie75cc0941245dffabf64f09d649982ba48fae340
2013-07-21 14:09:19 +01:00
MatmaRex 47edc8d7d0 Ensure ve-ui-panelLayout-scrollable is actually scrollable
Due to CSS specificity rules the styles defined for
.ve-ui-panelLayout-scrollable and .ve-ui-panelLayout-padded in
ve.ui.Layout.css were being overriden by more general rules for
.ve-ui-pagedDialog-pagesPanel .ve-ui-panelLayout in ve.ui.Dialog.css.

Bug: 51739
Change-Id: If2d5ec3168a874eb4f856450583d6c89967513df
2013-07-20 13:21:05 +02:00
jenkins-bot 47fec91adb Merge "Set Malayam to use B/I rather than A/A for toolbar icons" 2013-07-19 20:27:28 +00:00
James D. Forrester 7c477d3021 Set Malayam to use B/I rather than A/A for toolbar icons
This is how it is configured in WikiEditor; presuming that this is not
incorrect. :-)

Bug: 51314
Change-Id: If285c14d8a798c57924af04c1dabfe6cf53e018b
2013-07-19 13:19:07 -07:00
jenkins-bot 21e47c5a33 Merge changes I2edc46b6,Iea905f2b,Ia572fd06,Id81da87b,I98a7d3eb
* changes:
  Add a node class for mw:Nowiki
  Move getHashObject() from dm.Node up into dm.Model
  Allow annotations to render nothing
  Pass child DOM elements to annotations' toDomElements()
  Process annotations bottom-up rather than top-down in data->DOM
2013-07-19 19:11:38 +00:00
James D. Forrester 79aff53400 De-alienate <code>foo</code> blocks (code element)
Adding the <code> element as a matched text style annotation, plus some
tests (for all the other un-tested text styles as well, whilst I'm at
it).

We'll need an icon, a button and a way of the buttons not forever
extending the length of the toolbar to properly edit <code> spans, but
this is a start.

Bonus: unit test coverage for all TextStyleAnnotations

Bug: 51590
Change-Id: I5438bcf2ec6eeb2e50400f8013964f91c33ce455
2013-07-19 00:48:46 +00:00
jenkins-bot a2ea33fb95 Merge "Handle backspace correctly when in a slugs" 2013-07-18 22:20:05 +00:00
Trevor Parscal 61ba07d409 Reference dialog commingling
Objectives:

* Merge reference insert and edit dialogs
* Change workflow to put editing/creating a new reference first
* Add secondary page in dialog for selecting an existing reference

Changes:

*.php
* Cleanup unused files/messages

ve.ui.Dialog.css
* In the footer; make primary, constructive and destructive buttons
  appear on the right; all others on the left

ve.ui.MWReferenceSearchWidget.js
* Fix documentation
* Remove create option and reuse section header items

ve.ui.MWReferenceInsertButtonTool.js,
ve.ui.MWReferenceEditButtonTool.js,
ve.ui.MWReferenceButtonTool.js
* Merge reference button tools

ve.ui.MWDialog.css
* Remove body styles, use padded option of layout instead
* Update selectors as per merging of dialogs

ve.ui.MWReferenceInsertDialog.js
ve.ui.MWReferenceEditDialog.js
ve.ui.MWReferenceDialog.js
* Merge reference dialogs
* Add buttons to switch between edit and select mode

ve.init.mw.ViewPageTarget.js
* Update reference button name as per merging of tools

ve.ui.SurfaceWidget.js
* New widget!
* Encapsulates a "sub-surface"

Bug: 51152
Bug: 50458
Change-Id: I8265febf4fd8f64d2ac40470ff033bac68b24d99
2013-07-18 14:14:14 -07:00
jenkins-bot 565cb99e23 Merge "Update static loaders" 2013-07-18 16:40:10 +00:00
jenkins-bot 458c8757db Merge "Fix ordering of store items in converter tests" 2013-07-18 16:38:55 +00:00
Ed Sanders c414147b5a Handle backspace correctly when in a slugs
We need to detect if the endNode we are trying to move is
inside our original delete selection, and not perform the
move if it is.

Bug: 50076
Change-Id: Ib89706c8717d13829bf89e44c4fb39e16a00821e
2013-07-18 12:33:42 +01:00
Timo Tijhof 1c97668377 Update static loaders
Ran makeStaticLoader.php:
- Synced mis-match of css in demos.
- Added missing experimental.
  We originally had experimental in static. They were removed
  because the section became empty (not because we no longer
  wanted them in static loader). If we don't want them here, we
  should remove the entry from makeStaticLoader.php.

Change-Id: I275133d1cfebf174e54bf1b8f44465495949991a
2013-07-18 04:19:42 +02:00
Trevor Parscal 51ecf6d096 Fix for scrollable panels
Fixes mistake made in I50e996b9d2fde361238cde75e09baa5872e12223 which made scrollable panels not be, well scrollable.

Change-Id: I0ec59a1b76acf047b1a4d6de426a0ddb554a3e42
2013-07-17 17:17:01 -07:00
Trevor Parscal ef262dc241 Add padded option to layouts
Objectives:

* Add option to layouts to control whether it's padded or not
* Rename "scroll" option to "scrollable" to better fit with it's boolean value

Changes:

ve.ui.Layout.css
* Add styles for scrollable and padded options

ve.ui.StackPanelLayout.js, ve.ui.PagedDialog.js, ve.ui.ReferenceListDialog.js
* Update use of scroll option

ve.ui.PanelLayout.js
* Add padded option
* Rename scroll option to scrollable
* Switch to using a class for scrollable option, rather than hardcoding CSS properties

Change-Id: I50e996b9d2fde361238cde75e09baa5872e12223
2013-07-17 19:10:44 +00:00
Trevor Parscal 3da34d7107 Fix getAnnotationIndexesFromOffset for last offset in doc
If the element is undefined, it would stand to reason that there are no annotations there.

Just sayin'.

Change-Id: I2b66e7adc2b3af19df1a3f490ab479627807636e
2013-07-17 19:10:38 +00:00
Roan Kattouw 779099e660 Fix ordering of store items in converter tests
In the DomFromData tests, we put the provided storeItems in the store
first, then run preprocessAnnotations (which puts annotations in the
store). However, in DataFromDom we ran preprocessAnnotations first
(which puts annotations in the store), then ran getDataFromDom (which
is expected to put the asserted store items in the store). Because the
order was reversed between these two tests, it was impossible to write
a test for an annotation whose toDataElement function adds to the store.

Fix this by reordering the operations in the DataFromDom test, doing the
conversion first and only then running preprocessAnnotations on the
expected data. This preprocessAnnotations call will not write to the store
if the test passes, because all annotations in the expected data should
already have been put in the store by the conversion.

Change-Id: I8f741d96fe12590fd711542794570fb95b1132d0
2013-07-16 19:06:48 -07:00
Roan Kattouw 4098e47b8b Move getHashObject() from dm.Node up into dm.Model
This way annotations inherit it too.

Also add htmlAttributes to the hash, and implement getComparableObject()
in terms of getHashObject().

Change-Id: Iea905f2b430f8e51c6026065be17b89b9a03cfab
2013-07-16 19:04:53 -07:00
Ed Sanders 56ef8cb5b5 Create MWResizeableNode mixin to control defaultSize flag
Previously wasn't being updated to 'false' after a width/height
attribute change.

Bug: 50645
Change-Id: Id5dcd6998e0125757238426f8052505d131d712d
2013-07-16 23:13:40 +01:00
Roan Kattouw 46c5192477 Allow annotations to render nothing
This effectively unwraps the annotation. Annotations can do this by
returning an empty array from their toDomElements() function.

Right now this is only supported for annotations, but once the converter
is rewritten to be entirely bottom-up, this is trivial to support for
other model types, and could even be used to implement unwrapping of
wrapper paragraph.

Change-Id: Ia572fd0610afccccfe795c257c0de9d003330f13
2013-07-16 15:09:08 -07:00
Roan Kattouw 2942fa8fa0 Pass child DOM elements to annotations' toDomElements()
This is special-cased for annotations but should be supported for
all model types once the converter is rewritten to be bottom-up
entirely.

Add a toDomElements() stub to ve.dm.Annotation overriding the stub
in ve.dm.Model so there's a place for the new parameter to be documented.

Change-Id: Id81da87b8b83d556a3618cc6187b22443a1e37e6
2013-07-16 15:09:08 -07:00
Roan Kattouw 15a7822df1 Process annotations bottom-up rather than top-down in data->DOM
This means that instead of creating a DOM element for an annotation,
then appending stuff to that DOM element, we queue up the things to
append and only create the DOM element after we've built everything
that's going to be in it.

Most significantly, this moves the toDomElements() call to the close
function, which paves the way for passing in the annotation's contents.

Change-Id: I98a7d3ebb0f3eb8627c22348b48596906db2646e
2013-07-16 15:09:05 -07:00
Roan Kattouw ce3014c768 Remove superfluous clear() when pawning
We already call clear() 4 other times in this code path, including
one right at the end of change(), which is called right before this
clear() call.

Change-Id: I6d5ba5075e1b24a981546243977c6a8501748c5f
2013-07-16 00:37:51 +00:00
jenkins-bot a4558108b8 Merge "Adjust padding for surfaces inside dialogs" 2013-07-16 00:37:22 +00:00
jenkins-bot 55493f7f9e Merge "Reset context menu on selection change while inspector is open" 2013-07-16 00:34:16 +00:00
Roan Kattouw f9864e9288 Continue links
This isn't as simple as just dropping applyToAppendedContent = false
on LinkAnnotation, because browsers differ in their continuation
behavior. Firefox continues links, but Chrome doesn't.

To work around this, add a property indicating that the annotation
needs its continuation behavior to be forced.

Rename areAnnotationsCorrect() to needsPawn() accordingly.

Bug: 49931
Change-Id: Id6424af89c92bba2be87736e8a937e0f2067c007
2013-07-16 00:29:55 +00:00
jenkins-bot 0ffc4d15ca Merge "Remove field set label on reference edit dialog" 2013-07-15 23:56:16 +00:00
jenkins-bot 78d58e637c Merge "Make the clear button clear insertion annotations too" 2013-07-15 23:54:45 +00:00
Trevor Parscal 0ba331afdc Reset context menu on selection change while inspector is open
Objective:

* Make the inspector close and context menu reset when the selection is
  changed while an inspector is open

Changes:

ve.ui.PopupWidget.js
* Add isVisible method

ve.ui.Context.js
* Check if popup is visible when the selection changes and close the
  inspector and reset the context if it is

ve.ui.AnnotationInspector.js
* Don't update the selection when closing if the selection has changed
  since opening

Bug: 50895
Change-Id: Ie7f0b7ac76b0460b39ec002705172376e4e602dc
2013-07-15 23:51:40 +00:00
Roan Kattouw fd6238d62f Make the clear button clear insertion annotations too
There previously was no way to clear them other than to manually
unset each one.

Change-Id: I553d224595e424cb8a743ea70031503d1fe00b6a
2013-07-15 16:48:08 -07:00
Trevor Parscal 09f920fcac Remove field set label on reference edit dialog
Objective:

* Allow fieldsets to not have labels
* Remove label from reference edit dialog field set

Changes:

ve.ui.Layout.css
* Only apply negative top margin if fieldset label is being used

ve.ui.FieldsetLayout.js
* Only add label element to DOM if icon or label are used

ve.ui.MWReferenceEditDialog.js
* Remove label from reference edit dialog's first fieldset

*.php
* Remove unused message

Change-Id: I4a36e819ec6ef73aad80d3fb2f06000cb35ec109
2013-07-15 23:44:07 +00:00
Trevor Parscal 130e446e52 Single-click insertion
Objectives:

* Reduce the number of clicks and mouse maneuvers required to insert
  media, references or template parameters
* Make use of highlighting with mouse movement or arrow key presses,
  similar to menus, to suggest action when clicked
* Improve the way media search results look and feel

Changes:

ve.ui.SelectWidget.js
* Add mouseleave handler to un-highlight when the mouse exits the widget
* Document highlight events (already being emitted)

ve.ui.SearchWidget.js
* Propagate both select and highlight events from results widget
* Make arrow keys change highlight instead of selection
* Get rid of enter event, make enter key select highlighted item instead
* Provide direct access to results widget through getResults method

ve.ui.MenuWidget.js
* Use the selected item as a starting point if nothing is currently
  highlighted when adjusting the highlight position

ve.ui.Dialog.js
* Add footless option to hide the foot element and make the body extend
  all the way down to the bottom
* Remove applyButton, which only some dialogs need, and should be creating
  themselves, along with other buttons as needed

ve.ui.Widget.css
* Change highlight and selected colors of option widgets to match other
  selection colors used elsewhere
* Leave selected and highlighted widget looking selected

ve.ui.Frame.css
* Add background color to combat any color that might have been applied to
  the frame body in the imported CSS from the parent frame

ve.ui.Dialog.css
* Add rules for footless mode

ve.ui.MWReferenceResultWidget.js,
ve.ui.MWParameterResultWidget.js,
ve.ui.MWMediaResultWidget.js
* Allow highlighting

ve.ui.MWParamterSearchWidget.js
* Switch from selecting the first item when filtering to highlighting

ve-mw/ve.ui.Widget.js
* Adjust media result widget styling to better match other elements

ve.ui.MWTransclusionDialog.js,
ve.ui.MWReferenceListDialog.js,
ve.ui.MWReferenceEditDialog.js,
ve.ui.MWMetaDialog.js
ve.ui.MWMediaEditDialog.js
* Add apply button, as per it being removed from parent class

ve.ui.MWTransclusionDialog.js,
ve.ui.MWReferenceInsertDialog.js,
ve.ui.MWMediaInsertDialog.js
* Insert parameter/reference/media on select, instead of clicking an
  insert button
* Use 'insert' instead of 'apply' as argument for close method

Bug: 50774
Bug: 51143
Change-Id: Ia18e79f1f8df2540f465468edb01f5ce989bf843
2013-07-15 23:42:56 +00:00
Ed Sanders 267ccf9040 Compare annotations by name only when clearing/toggling
Otherwise links don't get removed as an empty link is not
comparable to a real link with an href.

Bug: 50461
Change-Id: Id8b421bd44cd5c427d0e5cd738c380bc2b1ea719
2013-07-16 00:05:11 +01:00
Trevor Parscal 64548428ca Adjust padding for surfaces inside dialogs
Objective:

* Make horizontal and vertical padding of surfaces inside dialogs equal

Change-Id: I8672a4506cdbda59795b12236526b048aaadfa58
2013-07-15 15:44:46 -07:00
jenkins-bot 4854b00770 Merge "Replace text strings with grapheme arrays in onContentChange" 2013-07-15 22:10:20 +00:00
Ed Sanders 4af4f7928d Replace text strings with grapheme arrays in onContentChange
Was previously generating incorrect transactions when document
contained multibyte characters.

Bug: 51140
Change-Id: Ie5f749768f970b2aef09e667f844d2ef5961207b
2013-07-15 22:57:40 +01:00
James D. Forrester 9b1bc14779 Set bold/italics icons for cs/he/pl; da/no/nn/sv
Per bug 51330, cs (Czech), he (Hebrew) and pl (Polish) should use the same icons
as English (B for bold, I for italics), rather than the generic As; da (Danish),
no (Norwegian Bokmål), nn (Norwegian Nynorsk) and sv (Swedish) should use those
that German (F for bold, K for italics).

Bug: 51330
Change-Id: I1d5937bed658d45ba6a18d8eb77e9e20d55a16cc
2013-07-15 12:29:04 -07:00
jenkins-bot 5a5fb6030d Merge "Extend empty document check to check for meta-only data" 2013-07-15 16:18:50 +00:00
jenkins-bot bc1f499e72 Merge "Move common linear data methods into LinearData.static" 2013-07-15 16:10:28 +00:00
jenkins-bot cc391e1643 Merge "Actually use op.retainMetadata in structural replace mode" 2013-07-15 11:45:13 +00:00
Ed Sanders aaf4f5b134 Extend empty document check to check for meta-only data
An empty document is one which contains no 'real' data, so
we should check for meta-only documents when deciding whether
to add in a wrapper paragraph.

Bug: 50289
Change-Id: Ib3ebf0717aa0c6c51fd1d0b14e95de50b2842647
2013-07-15 12:12:00 +01:00
Ed Sanders 784ebc16e3 Move common linear data methods into LinearData.static
Some methods apply to all types of LinearData. Also moved to
static so they can be used by the converter on raw data.

Change-Id: I79066d6d3ccde48aea7c0848d56ef86bc70f6656
2013-07-15 11:29:54 +01:00
Ed Sanders f2b4998faf HACK: Don't merge adjacent annotations from Parsoid
Adjacent annotations should not be merged if they both
originate from Parsoid. This is a hack because this logic
should be in Parsoid, not VE.

Bug: 49873
Change-Id: If1e23e3039178300d72b1c0c585931417bb603b5
2013-07-14 18:36:33 -07:00
Roan Kattouw bab7689feb Actually use op.retainMetadata in structural replace mode
It was being used correctly in the textual replace case, but it was
omitted in the structural replace case. This caused rare, insidious
metadata placement bugs that I haven't been able to reproduce outside
of newFromDocumentInsertion testing, but this might explain some of
the odd category bugs that have been reported.

Change-Id: I1424e482303853f285e4516a93c9609076648eff
2013-07-12 15:57:26 -07:00
jenkins-bot e65baa886f Merge "Make link inspector re-usable by splitting it up" 2013-07-12 21:17:49 +00:00
jenkins-bot 587079401e Merge "Fix annotated element alien metadata inside wrapped paragraph" 2013-07-12 20:48:58 +00:00
Ed Sanders d2778b1df4 Fix annotated element alien metadata inside wrapped paragraph
Add check that we can close the wrapper to meta items, also
annotate them correctly.

Bug: 51235
Change-Id: Idd4a2304f588ea74b9a9814ce86c1fd0c026e441
2013-07-12 20:13:15 +01:00
Trevor Parscal a4491c12f8 Make link inspector re-usable by splitting it up
Objective:

* Make the majority of link inspector, which is generic to any annotation,
  usable for other annotation inspectors

This was merged earlier (f7107fa20d) but broke master, so it was
reverted (092fa74dee). This commit also incorporates 5dcf5d1c49.

Change-Id: Ib9190dee66ce064d69962f9c4c5b3a710be8ad07
2013-07-12 17:58:04 +00:00
jenkins-bot 0926fd0656 Merge "Optimise png images with optipng" 2013-07-12 17:34:39 +00:00
Rob Moen 25b937c496 Adjust toolbar group margins for equal vertical alignment
Change-Id: I4596e50c941b1cb628f2ccba983d4b60b7939174
2013-07-11 11:22:45 -07:00
jenkins-bot e317792028 Merge "Tighten up outlines and fieldsets" 2013-07-11 16:32:27 +00:00
Trevor Parscal 1c637008e5 Tighten up outlines and fieldsets
Objective:

* Make outline widgets and fieldset layouts take up a little less space

Bonus:

* Fix option icons always showing up on the first item because the option
  wasn't position relative

Changes:

ve.ui.Widget.css
* Add position: relative to option widgets
* Cleanup unused background properties for outline items
* Reduce padding for outline items
* Move icons to match padding changes

ve.ui.Layout.css
* Reduce margins for fieldset layouts, including using a negative top
  margin to compensate for the overly tall legend

Change-Id: Ida6147b8171dcb4152ca9be0e099a5f9b81ac1c0
2013-07-11 16:22:38 +00:00
jenkins-bot ca15571b2f Merge "Reuse the rules variable" 2013-07-11 00:23:00 +00:00
Roan Kattouw 7345e63961 Reuse the rules variable
Change-Id: I8ce666dad712a99e471930132e3d123dfcf5466d
2013-07-10 17:21:07 -07:00
jenkins-bot bc6a4ee8e1 Merge "Work around Firefox's excessive style security paranoia" 2013-07-11 00:20:21 +00:00
Roan Kattouw 9938186cab Work around Firefox's excessive style security paranoia
Apparently it's possible for a stylesheet's .cssRules to be accessible,
but for the individual items' .cssText not to be, in which case Firefox
throws a nice security exception that kills the entire editor.

Wrap all inspector of cssRules in a try-catch, and fall back to cloning
the ownerNode if anything weird happens.

Change-Id: I0187ad308e395e92aea587c00fd8d8eb0280822e
2013-07-10 17:16:00 -07:00
jenkins-bot ac6c10dad7 Merge "Bind listener to keyup to capture arrows & better math for scrolling." 2013-07-10 21:22:58 +00:00
Rob Moen 31104d5788 Bind listener to keyup to capture arrows & better math for scrolling.
Listen to keyup to properly capture and respond to up and down arrows.
Rewrite calculation for scroll to better follow toolbar obscured cursor.

Bug: 48787
Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa
2013-07-10 14:21:03 -07:00
jenkins-bot 691d9fe462 Merge "Language Inspector: CE / DM" 2013-07-10 19:13:40 +00:00
Moriel Schottlender fdcec169d1 Language Inspector: CE / DM
This is the infrastructure for the Language Inspector prototype, defining
the dm and ce pieces of the <span lang='xx' dir='yy'> annotations. It also
sets up a visual indicator for language blocks (with informational tooltip
for the user while editing. The UI is built on top of this.

Bug: 47759
Change-Id: I239eef5124e29369ea9c5d8c0f49b2f6a61bc053
2013-07-10 12:11:27 -07:00
Rob Moen ef36b753da Focus link inspector input prior to lookup.
Since the menu only shows while it's input is focused, input must be focused
prior to suggestions being popuplated.  Fixes race condition where
look up request is near instantaneous.

Change-Id: Icf645d051415ac3ee9e15bc85f22f29dc9b64666
2013-07-10 10:22:20 -07:00
jenkins-bot f8184ebeb9 Merge "Lock surface while inspectors are animating open" 2013-07-10 01:54:05 +00:00
jenkins-bot 06faf92a12 Merge "Make parameter search widget have a horizontal limit" 2013-07-10 01:42:44 +00:00
jenkins-bot 15f2ff6f20 Merge "Tool and context menu size and alignment fixes" 2013-07-10 01:37:34 +00:00
Trevor Parscal 703328d770 Make parameter search widget have a horizontal limit
Objective:

* Cut off really long parameter names with ellipsis

Changes:

ve.ui.Widget.css
* Use ellipsis when option labels get too long

ve-mw/ve.ui.Widget.css
* Limit the size of a parameter result widget label - this is a hack, but
  since there are strange bugs with using ellipsis together with % based
  width, it's the best we can do for now

Bug: 50800
Change-Id: Idbfa336d2bba376b0d078fdd0ece65926d610d81
2013-07-10 01:35:38 +00:00
jenkins-bot 9d5ba2bf78 Merge "Remove dead CSS code" 2013-07-10 01:35:30 +00:00
jenkins-bot 164094ee6c Merge "RTL Improvements" 2013-07-10 01:34:06 +00:00
Trevor Parscal 9297f33989 Tool and context menu size and alignment fixes
Objectives:

* Make context menu toolbar consistently sized and aligned, especially
  in monobook

Changes:

ve.ui.Toolbar.css
* Remove vertical line between groups, just use whitespace
* Switch from padding to margins to avoid size calculation issues

ve.ui.Tool.css
* Remove tiny margin on button tools, tightening them up a bit
* Replace 50% 50% with center center

ve.ui.Context.css
* Switch from padding to margins to avoid size calculation issues
* Use different margins depending on text direction
* Reverse the 0.8em rule used in the dialog - this is a hack, it should
  be cleanup up later with a better strategy for normalizing the size
  of text within VE elements

Change-Id: If65f12382625efa33777e284bd23a94dc509436a
2013-07-10 01:33:37 +00:00
Trevor Parscal 461e518fca Remove dead CSS code
Reference counting indicates these styles are not in use, so they can now be safely garbage collected.

Change-Id: I432f73490eeb00ff414f150fcf26c718607bac95
2013-07-10 01:32:57 +00:00
Trevor Parscal 33e2c8f280 Lock surface while inspectors are animating open
Objective:

* Prevent input while the inspector is animating open

Changes:

ve.ui.LinkInspector.js
* Disable and then re-enable the surface while the inspector is opening

ve.ce.DocumentNode.js
* Remove opacity changes on disable/enable

ve.init.mw.ViewPageTarget.js
* Change the opacity of the document when save dialog is open

Bug: 51075
Change-Id: Ic7910a666b33b41b57b035a15cf1f8c9264e7111
2013-07-09 17:16:25 -07:00
Trevor Parscal 3a6e91dfb7 RTL Improvements
Objectives:

* Make option widget icons correctly placed in RTL
* Make embedded context toolbar correctly placed in RTL

Approach:

Use separate elements for icons within option widgets which have more
flexibility when rendering in either LTR or RTL when compared to CSS
background position. The simpler approach, using CSS background
position offsets, isn't cross-browser compatible at this time.

Changes:

ve.ui.OutlineItemWidget.js
* Remove custom icon implementation, using parent class implementation
  instead

ve.ui.OptionWidget.js
* Add icon option, which adds an icon element only if an icon was
  specified

ve.ui.MenuItemWidget.js, ve-mw/ve.ui.MWParameterResultWidget.js
* Add override for icon config option
* Document icon config as private

ve.ui.Context.js
* Add detection and special handling for positioning embedded context
  toolbar when rendering in RTL

ve.ui.Widget.css
* Add styles for option widget's new icon option
* Add styles to make indentation still work for outline item widgets
* Adjust styles for menu item widget as per changes in option widget

ve-mw/ve.ui.Widget.css
* Adjust styles for parameter result widget as per changes in option
  widget

Change-Id: Ibfa4b613e0fd7902f8a2c78b5717de402c5f82b8
2013-07-10 00:09:22 +00:00
jenkins-bot 2e0f80e0d3 Merge "ve.dm.Surface: Fix incorrect @return for #getDocument" 2013-07-09 23:48:29 +00:00
Timo Tijhof ec9fc830a6 ve.dm.Surface: Fix incorrect @return for #getDocument
This returns a ve.dm.Document object, not ve.dm.DocumentNode
(very different classes).

Change-Id: Ia8d4eda3e4a51cef58ab816453703a33c8d5f7d5
2013-07-10 01:46:55 +02:00
jenkins-bot d0b0c7b3eb Merge "Affordances for MenuWidget to be optionally focusable." 2013-07-09 23:44:11 +00:00
jenkins-bot ca87540eac Merge "Be sure lookupMenu input is focused before showing" 2013-07-09 23:32:49 +00:00
Roan Kattouw e9ca44c86c Transplant CSS from the main document to each iframe
We previously manually loaded CSS into these frames, which is flawed
because it completely bypasses ResourceLoader (so CSSJanus didn't flip
them, necessitating a bunch of hacks for RTL), and doesn't pull in
MediaWiki styles (so templates inside references don't render correctly).
Instead, this commit copies all styles from the main document into each
frame's document, inlining what it can.

Loading all styles in dialogs and inspectors caused some problems,
initially. We didn't namespace our styles for dialogs vs. inspectors
at all; the only reason inspector styles weren't being applied to dialogs
and vice versa was because we controlled which files were being loaded
in which context. This commit namespaces the inspector and dialog styles
where needed so they don't conflict and try to override each other.

Tested in Vector and Monobook, but not in Apex and not in RTL.

ve.init.mw.ViewPageTarget*.css:
* Namespace styles that are only intended for the main document
* Undo Monobook's font-size: x-small; in frames

*Dialog.js:
* Remove addLocalStylesheet() calls, we don't need those any more
** ve.ui.MWDialog seems to be unneeded now, we may want to remove it

*.css:
* Remove @noflip-ped RTL rules where they were just flipped versions of
  their LTR counterparts

ve.ui.Dialog.css, ve.ui.Inspector.css:
* Namespace styles with .ve-ui-dialog-content / .ve-ui-inspector-content

ve.ui.Frame.css:
* Move the margin:0 and padding:0 here (were in the frame <body>'s style
  attribute) and add background:none to prevent frames from getting
  the skin's background (grey in Vector, a book in Monobook)

ve.ui.Dialog.js, ve.ui.Inspector.js:
* Add ve-ui-dialog-content / ve-ui-inspector-content class to the
  frame's content <div> so we can restrict styles to only apply in
  dialogs / inspectors

ve.ui.Frame.js:
* Replace infrastructure for @import-ing stylesheets with transplantation
* Remove code polling to see when the stylesheets were loaded
** We can't do this in the new approach AFAIK, since all styles in the
   frame are either inlined or inaccessible due to the same-origin policy
** We also shouldn't need it because the browser should have cached the
   styles when it loaded the main document
* Apply ve-ui-frame-body class to the frame's <body> so we can style it
** Move inline padding:0;margin:0; into ve.ui.Frame.css
** Move the ve-ltr/ve-rtl class up to the <body>

ve.ui.Window.js:
* Remove infrastructure registering stylesheet URLs to load

Change-Id: I4a37115301811ad860f4578344a04873ea8c2b69
2013-07-09 16:13:28 -07:00
Rob Moen d6761f3ec3 Be sure lookupMenu input is focused before showing
Resolving this bug reveals a completely unrelated bug where hitting
enter while making a link prior to the input being focused, the
selected text gets replaced with a new line.

Bug: 51075
Bug: 49941
Change-Id: I61a90eeaa40b8b66886c17152544c46fa8ca396a
2013-07-09 22:59:53 +00:00
Catrope 30ebc9a656 Revert "Add support for <blockquote> elements"
Whoops, merged too soon. The dropdown part of it doesn't
actually work right.

This reverts commit 3c51ebad93.

Change-Id: Ieafbf18ca8a43b07e33a787772abbc77aef63e4c
2013-07-09 21:35:47 +00:00
James D. Forrester 3c51ebad93 Add support for <blockquote> elements
Bug: 51009
Change-Id: I7ba1635e4f856a021e1a7a2d26a8714230c9364a
2013-07-09 13:15:06 -07:00
Rob Moen 61c708ef1c Affordances for MenuWidget to be optionally focusable.
* ve.ui.MenuWidget.js
MenuWidget no longer creates an embeded input element by default.
In the case of no configured input element, we bind the keydown
handler to window with addEventListner while using the useCapture
flag.  This nicely prevents elements lower in the dom from triggering
( document node ) Supported in IE9 and above and all modern browsers.

* ve.ui.ListAction.js
Since MenuWidget is no longer stealing focus from the surface,
we no longer need to restore focus after a list item conversion.
This is the end goal, as browsers like Chrome like to scroll to
the top of elements that gain focus.

Bug: 50792
Change-Id: I5b6969bca1a58b040708f8ac9d3dc8b07ddf9e6b
2013-07-09 12:53:35 -07:00
MatmaRex a01b92dcc4 Array.prototype.splice polyfill for Opera
Apparently they can't get their basic ECMAScript right. In 2013.

It doesn't come up that often, because you don't splice an array with
more than 256 elements every day. Only implemented in ve.batchSplice
for now, as that function does handle thousands of elements routinely.
Other callers of .splice() can simply use that instead.

Bug: 50385
Change-Id: I281a61d55c6f7df5f28627a1df80f2a001110607
2013-07-09 20:38:10 +02:00
jenkins-bot c328e3deff Merge "Make all annotations additive" 2013-07-08 19:51:56 +00:00
Ed Sanders e91cd00a2f Make all annotations additive
Any annotation could have a style attribute which has
a compound effect, and this also prevents roundtrip
errors. Button tool logic should prevent any annotation
from being applied twice which shouldn't be.

Bug: 49755
Change-Id: I8502a55cd2b195d28d0e2ecd63f15de670f80d60
2013-07-05 21:01:20 +00:00
Ed Sanders 11453371c6 Fix CSS lint error ('0px' => '0')
Change-Id: If9bfd8b061c0cd8240980cbd4ee4db5f24d40104
2013-07-05 22:22:31 +02:00
jenkins-bot 4621c083a1 Merge "makeStaticLoader: Update output and re-sync" 2013-07-05 18:47:47 +00:00
jenkins-bot 3456c7c441 Merge "Moved embed statement where it does something" 2013-07-05 18:41:37 +00:00
Moriel Schottlender 1dc21c01e3 Page settings fix-fix
This re-fixes the fix to the frame fix. fix fix.
Two things changed: Background position flipped to the right properly
(was somewhat off before) and text-alignment flipped as well.

Bug: 49613
Change-Id: I0aa317ef674537d20d7ed64e74eaa3cfe8030c8c
2013-07-05 13:44:13 -04:00
Niklas Laxström 5957065043 Optimise png images with optipng
Change-Id: Id014ad0a0aa99c9440360e32d2e10bc99fa64738
2013-07-05 09:47:12 +00:00
Niklas Laxström 96b7dbacb5 Moved embed statement where it does something
Followup to Ibdc2410cc

Change-Id: I5e665f5d720366650c362ed603693a223c96ee77
2013-07-05 09:47:12 +00:00
Timo Tijhof 50ffdeb729 makeStaticLoader: Update output and re-sync
This was broken after 92c38ea removed ve-mw files from the
static loaders but didn't update makeStaticLoader.php so
it was harder to keep the files in sync and a few minor issues
on the documentation pages.

Since the files are still mixed in the non-mw modules the only
way to exclude them is to do what was manually done in 92c38ea:
Filter out paths starting with "ve-mw/" from non-mw modules.

Change-Id: Id58ee89ac18c63c01719dc11ec7a07ddeee3ea0b
2013-07-04 05:11:13 +02:00
Catrope 092fa74dee Revert "Make link inspector re-usable by splitting it up"
Breaks MWLinkInspector initialization behavior

This reverts commit f7107fa20d.

Change-Id: If93d1092eeb14f6ba23e6368834a6f80df765d21
2013-07-03 18:39:31 -07:00
Rob Moen a3e2507cfe Listen to keypress in ve.ce.surface.$ rather than window
Bug: 50538
Change-Id: Ifddf1bae1ee799ec3467a81c597702fc3f8be089
2013-07-03 22:28:17 +00:00
Trevor Parscal 5dcf5d1c49 Add @inheritable to modelClasses in annotation inspector
Change-Id: Ic9b2a9c530a85d36078337d20ca8252efaf74c99
2013-07-03 15:24:55 -07:00
jenkins-bot bd6f1f22c1 Merge "Make link inspector re-usable by splitting it up" 2013-07-03 22:20:51 +00:00
Trevor Parscal f7107fa20d Make link inspector re-usable by splitting it up
Objective:

* Make the majority of link inspector, which is generic to any annotation, usable for other annotation inspectors

Change-Id: I1f7e9c13537105da7aa0351c9c92e8af5eb5a3f4
2013-07-03 15:13:47 -07:00
MatmaRex 3279029ded Revert "Address error caused by changing focus from context menu to window."
Just a proof-of-concept that this would work on Opera. I'm figuring out
what was this for initially...

This reverts commit 30dadb6c8c.

Bug: 47794
Change-Id: Ie4f1334e0beb7ba7d4f4aa3b42464fa219c4778c
2013-07-03 15:05:50 -07:00
Christian Williams 1e298ffbc0 Fix focusable highlights
!$element.is( ':visible' ) - jQuery .is() returns boolean based on the
parameter.

$element.not( ':visible' ) - jQuery .not() returns a filtered jQuery
collection with elements matching the parameter removed.

Change-Id: Iedf55f3453514ee710bbb6d702bbf9a5570a4a1d
2013-07-03 13:49:11 -07:00
Roan Kattouw 92c38eab85 The great directory split of 2013
Move all MW-specific files into the ve-mw directory, in preparation
for moving them out into a separate repo.

All MW-specific files were moved into a parallel directory structure
in modules/ve-mw . Files with both generic and MW-specific things were
split up. Files in ve/init/mw/ were moved to ve-mw/init/ rather than
ve-mw/init/mw ; they're still named ve.init.mw.* but we should change
that. Some of the test files for core classes had MW-specific test cases,
so those were split up and the test runner was duplicated; we should
refactor our tests to use data providers so we can add cases more easily.

Split files:
* ve.ce.Node.css
* ve.ce.ContentBranchNode.test.js (MWEntityNode)
* ve.ce.Document.test.js (some core test cases genericized)
* ve.dm.InternalList.test.js (uses mwReference test document)
* ve.dm.SurfaceFragment.test.js, ve.ui.FormatAction.test.js
** Made core tests use heading instead of mwHeading
** Updated core tests because normal headings don't break out of lists
** Moved test runners into ve.test.utils.js
* ve.ui.Icons-*.css
* ve.ui.Dialog.css (MW parts into ve.ui.MWDialog.css)
* ve.ui.Tool.css
* ve.ui.Widget.css (move ve-ui-rtl and ve-ui-ltr to ve.ui.css)

ve.dm.Converter.test.js: Moved runner functions into ve.test.utils.js

ve.dm.example.js:
* Refactored createExampleDocument so mwExample can use it
* Removed wgExtensionAssetsPath detection, moved into mw-preload.js
* Genericized withMeta example document (original version copied to mwExample)
* Moved references example document to mwExample

ve.dm.mwExample.js:
* Move withMeta and references example documents from ve.dm.example.js
* Add createExampleDocument function

ve-mw/test/index.php: Runner for MW-specific tests only

ve-mw/test/mw-preload.js: Sets VE_TESTDIR for Special:JavaScriptTest only

ve.ui.Window.js:
* Remove magic path interpolation in addLocalStyleSheets()
* Pass full(er) paths to addLocalStyleSheets(), here and in subclasses

ve.ui.MWDialog.js: Subclass of Dialog that adds MW versions of stylesheets

ve.ui.MW*Dialog.js:
* Subclass MWDialog rather than Dialog
* Load both core and MW versions of stylesheets that have both

ve.ui.PagedDialog.js: Converted to a mixin rather than an abstract base class
* Don't inherit ve.ui.Dialog
* Rather than overriding initialize(), provide initializePages() which the
  host class is supposed to call from its initialize()
* Rename onOutlineSelect to onPageOutlineSelect

ve.ui.MWMetaDialog.js, ve.ui.MWTransclusionDialog.js:
* Use PagedDialog as a mixin rather than a base class, inherit MWDialog

bullet-icon.png: Unused, deleted

Stuff we should do later:
* Refactor tests to use data providers
* Write utility function for SVG compat check
* Separate omnibus CSS files such as ve.ui.Widget.css
* Separate omnibus RL modules
* Use icon classes in ViewPageTarget

Change-Id: I1b28f8ba7f2d2513e5c634927a854686fb9dd5a5
2013-07-02 20:51:38 -07:00
jenkins-bot e32f19ce36 Merge "Add container option to popup widgets" 2013-07-03 01:32:41 +00:00
Trevor Parscal 3059cd99cf Add container option to popup widgets
This actually fixes a hack done in a previous commit where an undocumented
surface option was being passed, but not always. And in some cases there
were uses of the popup which didn't really have a surface to pass in.

Change-Id: I08b5dc2dc879f6abd1b16d1d66ac1d8b5624f673
2013-07-03 01:31:04 +00:00
Trevor Parscal 69c10c5c66 Restore callout image white-space
Oops.

Change-Id: I24039e7f4ee83cc26c7d600252ac8b9290eeda19
2013-07-02 17:17:33 -07:00
jenkins-bot 2089bc37a5 Merge "Allow annotations to be additive" 2013-07-02 20:46:11 +00:00
Ed Sanders 37cf529d73 Allow annotations to be additive
Set a static property on big, small, sup, sub to allow them
to be added multiple times to an annotationSet.

Fix the converter to count out annotations when opening/closing.

Bug: 49755
Change-Id: Ifbede9345a66434022dbd681eada447ab81ab025
2013-07-02 21:43:47 +01:00
Trevor Parscal 4568274949 Template parameter adding
Objective:

* Allow browsing, searching and adding documented parameters

Changes:

ve.ui.MWTransclusionDialog.js
* Replace regular text input with ve.ui.ParameterSearchWidget
* Fix uses of $(), this.frame.$$ is correct

ve.ui.Dialog.css
* Change rules for addParameterFieldset to make search widget auto-size vertically

ve.ui.Widget.css
* Add styles for ve.ui.MWParameterResultWidget

ve.ui.MWParameterSearchWidget.js, ve.ui.MWParameterResultWidget.js
* New classes
* Provides a way to search and select parameter for a template
* Displays parameter label, name, aliases and description

*.php
* Links to new files and messages

Change-Id: Ie5dbe8c44ce5d64c4b49b09517fb66cd30dd7304
2013-07-02 13:40:54 -07:00
jenkins-bot 21476b37ef Merge "Dir fix for iframes and widgets" 2013-07-02 20:22:34 +00:00
Moriel Schottlender c4c9923c91 Dir fix for iframes and widgets
This fix adds a directionality property to the frame objects so directions
can be inherited and manipulated inside the frame <body> tags.
There are also several corrections to flipping positioning of panels
in the GridLayout and of the icons in fieldsets and labeled elements
so they appear properly (right instead of left).

I've added a 've-rtl' / 've-ltr' class to frame content divs to serve as
selectors for rtl fixes and general language fixes. Most CSS corrections
would likely be fixed when CSSJanus works in iframes, but the selectors
would still be useful.

This sets the stage for directionality inheritance inside iframes,
and fixes most of the problem with the Page Settings window in RTL wikis.
It also fixes all the labels with icons across VE interface.

Bug: 49613
Change-Id: I418e669b0999552167683352acb365a4249ab9cc
2013-07-02 20:20:43 +00:00
jenkins-bot e55f0f7b95 Merge "Icon cleanup" 2013-07-02 20:19:23 +00:00