Commit graph

3995 commits

Author SHA1 Message Date
jenkins-bot f8fd236a05 Merge "Stop floated transclusions floating out of themselves" 2013-06-28 23:46:00 +00:00
Inez Korczyński 887255500a Stop floated transclusions floating out of themselves
This is done by setting renderHtmlAttributes to false, for both block
and inline transclusions.

Bug: 49925
Change-Id: I975cf1de3b273a5189e6edf7db937c4388fa4fbe
2013-06-28 16:44:00 -07:00
Trevor Parscal de48c88ee3 Use template data for new templates and fix alias bug
Objectives:

* Use template data for templates added to a transclusion using
  the list controls
* Cache template data between different instances of the dialog
* Allow placeholders to be replaced with templates asynchronously
* Save http request and abort pending requests on close

Also:
* Fix breakage of (unused) method getParameterAliases
  (dont delete aliases)
* Remove unused method getTemplateSpec.

Bug: 49778
Change-Id: I391e51cb900ef5560455d6f3d4d2a8b99ed2b034
2013-06-28 23:34:58 +00:00
jenkins-bot 6e447ce45c Merge "ve.dm.MWTemplateSpecModel: Implement getParameterOrigin" 2013-06-28 22:47:26 +00:00
Christian Williams ca0d79f340 Firefox misplaces cursor when moving between lines
When the cursor is programmatically moved, as we need to do
from time to time, Firefox's internal reference for the appropriate
cursor location on nearby lines is maintained, creating an
unexpected experience.

The fix is to wiggle the selection. This tricks Firefox into thinking
that it adjusted the selection natively.

Bug: 48289
Change-Id: I75e7e4467ec1c3faf344709886b9be5b1423cd3e
2013-06-28 15:37:26 -07:00
Rob Moen 57673643a2 Don't draw highlights over hidden elements.
Rational is that you wouldn't want to highlight something that is not
visible.  And, obtaining offsets for hidden slugs in this case does not
return correct values.

Bug: 49818
Change-Id: Ic2818423c26f5bbb2c056c3c94740d822be4f1b8
2013-06-28 15:30:17 -07:00
Trevor Parscal e60c357cfa ve.dm.MWTemplateSpecModel: Implement getParameterOrigin
Change-Id: I5970cbefd8eba9afcf37dff90d0f2a72b4bd7627
2013-06-28 15:07:15 -07:00
jenkins-bot 40f39c0886 Merge "Disable inspection of references with unknown contents" 2013-06-28 03:36:14 +00:00
Ed Sanders 9df1a59818 Disable inspection of references with unknown contents
Ed & Roan:
 Disable editing of references of which we are unable to find the
 source (e.g. <ref name="x"> without a target, or when the target is
 currently nested in something we don't yet process such as inside a
 <references> block or a template).

Timo:
 Improve UI to not be a regular focusable node where the inspector just
 won't show up but add a not-allowed cursor and explanatory tooltip.

James:
 Fix messages to refer to VisualEditor instead of "the" VisualEditor.

Change-Id: Ib2bca092ce13c9187fa8b27ad6a6404cae02aea2
2013-06-27 20:34:32 -07:00
Roan Kattouw f538fcf6be mw.ViewPageTarget: Add sanity check for DOM roundtrip
The sanity check converts the linear model back to DOM, then
compares this DOM to the original DOM and rejects the deferred
if they are not equal.

The DOM creation has to be done synchronously (before we unlock
the surface), but the actual comparsion can be (and is) done
asynchronously.

To make the UI flow of the save dialog easier we just keep the
save button on the toolbar itself disabled until the sanity
check is done. Though this should finish before the user starts
editing the document (let alone start saving), we do add a class
to the button to indicate a progress cursor.

To simulate a slow sanity check, set the setTimeout in
startSanityCheck to 5000, load VE, make a change, hover the
button, and see it change from disabled + progress-cursor to
enabled after 5 seconds.

To simulate the sanity check failing, change !== to === in
the first "if" in startSanityCheck.

Bug: 47521
Bug: 50067
Change-Id: I04f71fe8e00c6257fbc953cc9de3323e24709b0f
2013-06-27 19:20:14 -07:00
jenkins-bot 9a8cb712b1 Merge "Reference insertion, new and existing" 2013-06-28 01:13:53 +00:00
Trevor Parscal 0aac4c7e60 Reference insertion, new and existing
Objectives:

* Split reference dialog (at least for now) an edit and an insert dialog
* Add reference search widget for selecting an existing source, or
  choosing to add a new one
* Abstract reference names, don't allow editing them and generate them
  when needed
* When editing groups, move the internal item and update all references
  to it
* Resolve name conflicts when moving a reference to a new group by
  generating a new list key

Bonus:

* Add getNodeGroups method to internal list
* Add getUniqueListKey method to internal list
* Add destroy functionality to ce.node to release events and references

Bug: 49733
Change-Id: Ib244ff6ad9b4cee1decfd9b9e1d3d4e9cdcfb78c
2013-06-27 18:11:31 -07:00
jenkins-bot db38bd835f Merge "Automatically focus on the query input on insert media dialog open" 2013-06-28 00:47:05 +00:00
jenkins-bot d467c5a05e Merge "Unhack detached protected CE node shields" 2013-06-28 00:45:06 +00:00
jenkins-bot 22db613b34 Merge "Fix class attribute preservation for images" 2013-06-28 00:43:50 +00:00
Trevor Parscal fb789c7ff7 Automatically focus on the query input on insert media dialog open
Change-Id: I03d44d09e3abfffb67adeba5ebe3a52451cc5be5
2013-06-28 00:43:34 +00:00
jenkins-bot 079b4930d5 Merge "Option widget improvements" 2013-06-28 00:43:06 +00:00
Trevor Parscal ae6f91677e Unhack detached protected CE node shields
Objectives:

* Make protected CE nodes only add shields when attached to a surface
* Remove hack in reference list node used to work around this issue

Change-Id: I48d4478558b49037b80b6131e1b2e01dc4f9ec47
2013-06-28 00:42:34 +00:00
jenkins-bot d5d4d2a220 Merge "Pasted content is annotated" 2013-06-28 00:42:02 +00:00
jenkins-bot f1124f17c4 Merge "Fix edit | edit source link tabbing in Firefox" 2013-06-28 00:40:42 +00:00
Roan Kattouw 026102abe3 Fix class attribute preservation for images
* Port the class preservation logic from BlockImage to InlineImage
* Add preservation for unrecognized classes
* Add the logic for collapsing spaces in the class attribute in more
  places

Change-Id: I26faad7e00ab2f0a0f5d076552e56b32c692ae74
2013-06-27 17:39:43 -07:00
Roan Kattouw d6594dd612 Fix edit | edit source link tabbing in Firefox
When you selected the "edit" link by tabbing, the links would expand.
In Chrome, you could then tab to the "edit source" link, but in Firefox,
the links would just contract back and you couldn't reach "edit source".

This happened because in Chrome, the "edit source" link is already
considered to be focused when the blur event happens on the "edit" link.
But in Firefox, this is not the case: the blur fires first, and only
after that does Firefox determine what to focus next.

Fixed by waiting 100ms to contract after blur, just like we do on
mouseleave.

Change-Id: I9a38b629ca5e580003d82a3dca8dbf7564486fa0
2013-06-27 17:39:11 -07:00
Trevor Parscal 3e8a070faa Put the link inspector in the menus overlay
Change-Id: Id8446e0a9d9b0dd7bd04f48405b6818fa39a86e6
2013-06-28 00:36:47 +00:00
Christian Williams 68f635b482 Local Overlay Stacks
After a spirited discussion, localOverlay is getting some children.

* localOverlayBlockers - UI elements that are meant to prevent
interaction with the element. This includes Phantoms and
Highlights.

*localOverlayControls - UI elements that are meant to be
interacted with in order to modify the element. This includes
resize handles and drag marker.

*localOverlayMenus - UI elements that should always position
above all other controls. This includes the context menu.

Bug: 50159
Change-Id: Ic69c2ad275389a31c9fbaf47f3665dcdbb7ac2af
2013-06-28 00:30:54 +00:00
Christian Williams 7d5d779320 Pasted content is annotated
Applying insertionAnnotations to pasted content.

Change-Id: I8f8a240ae8970624c34ae005290acc77cea73180
2013-06-27 17:30:31 -07:00
jenkins-bot efd5882f88 Merge "Fix bug where the floating toolbar was on top of the save dialog" 2013-06-28 00:23:15 +00:00
jenkins-bot 80b4a43d7d Merge "Don't compute the end offset to pass to insertMeta()" 2013-06-28 00:12:11 +00:00
jenkins-bot c6fceaa1e2 Merge "Close dialogs on escape" 2013-06-28 00:10:36 +00:00
Trevor Parscal 256ed827d9 Option widget improvements
Objectives:

* Make options unable to be selected or highlighted when disabled
* Add default styles for selected state
* Fix line-height for option labels
* Use default cursor when field is disabled

Change-Id: I8a535cd6b259b092c2abce27ddb10882cdde6cf5
2013-06-28 00:08:00 +00:00
Trevor Parscal 20585c956a Close dialogs on escape
Objective:

* Make the escape key close dialogs, like pressing the X button
* Auto-focus the iframe on window open

Bonus:

* Add ESCAPE and SHIFT to ve.Keys and use instead of hardcoding numbers
* Use ve.Keys in some other places too

Bug: 49809
Change-Id: Ibf1fce5e24efcd83d9e1465c3cdaac24ff3fb45d
2013-06-27 17:00:35 -07:00
Trevor Parscal ed7d42592f Move some of MediaSelectWidget into SearchWidget
Objectives:

* Break apart MediaSelectWidget for re-use
* Rename classes to follow search/result naming scheme

Change-Id: I65aab3dc3d41e31af13e2754e77b7dd185ac90f1
2013-06-27 23:51:09 +00:00
jenkins-bot af46714316 Merge "Get rid of mw-figcaption class (Parsoid does not use it anymore)" 2013-06-27 23:38:35 +00:00
jenkins-bot 72d8bd0053 Merge "Init surface after toolbar is setup vs. before." 2013-06-27 23:23:38 +00:00
Roan Kattouw 70458e6e78 Don't compute the end offset to pass to insertMeta()
Omitting the offset causes insertMeta() to automatically use the
end offset, so we don't need to compute it in two places. The two
computations were also slightly different.

Change-Id: I55543fdd113a6a986899c093733191df948acb2e
2013-06-27 16:21:02 -07:00
Rob Moen 5046ff8e75 Init surface after toolbar is setup vs. before.
This fixes all tools being loaded with proper state on mw integration.

Bug: 50141
Change-Id: I501b1efec2a2eedbf16a191a8be6b96b02290e09
2013-06-27 16:18:27 -07:00
Inez Korczyński 8d6f2f9c42 Get rid of mw-figcaption class (Parsoid does not use it anymore)
Change-Id: Id4aed15b7db6a3a42bb75637c3d31b52677a8a4d
2013-06-27 16:13:28 -07:00
Ed Sanders bf4faa9f77 Fix logic for populating reference content
Force clearing of mwData.body if setContents is unset, and clear
mwOriginal when cloning.

Change-Id: I3150b5da7b50e14f400602c5842994e242ad182a
2013-06-28 00:04:26 +01:00
Roan Kattouw c219771a34 Fix bug where the floating toolbar was on top of the save dialog
The save dialog has z-index: 3;, which succeeds in overlaying it on the
toolbar in its normal position, but fails once the toolbar starts
floating, because the floating toolbar has z-index: 100;

In practice this meant that if you were scrolled down and the toolbar
was floating, you could open the save dialog just fine, but you
couldn't close it because its controls were below rather than on top of
the toolbar.

Hacked around this by detecting the floating-ness in the toolbarPosition
handler and setting a class on the toolbar tracker accordingly.
There may be a more elegant way to fix this; an actual UI engineer
should figure that out, not me :)

Bug: 50324
Change-Id: I8c6ab1026705d00baa20f115255d0d7e74ee72bf
2013-06-27 22:45:50 +00:00
Ed Sanders 138a4ba1d2 Fix getClonedElement
Change-Id: I019d1a5bd753ac5be7bda459ad85354265a55e3d
2013-06-27 23:45:09 +01:00
jenkins-bot da866e1c33 Merge "Invoke getClonedElement() on each element on copy" 2013-06-27 22:31:39 +00:00
Roan Kattouw 52f4711f4a Fix treatment of elements in addAnnotationsToData()
It should skip annotating elements, but doesn't.

Change-Id: I28fa83832748eb76fa9238e52074bb785ab1cf49
2013-06-27 22:25:54 +00:00
jenkins-bot 01e1cb1e71 Merge "Fix escapeParams in transclusions to not escape other transclusions" 2013-06-27 21:30:06 +00:00
jenkins-bot 4362869de4 Merge changes I45028ed2,I934888ce
* changes:
  If cursor is obscured by toolbar, on keypress scroll to cursor.
  Don't advance cursor when adding new line at start of node
2013-06-27 21:23:39 +00:00
Roan Kattouw c3340e273c Invoke getClonedElement() on each element on copy
This ensures that attributes and properties that are supposed to be
stripped on copypaste are actually stripped.

Bug: 49307
Change-Id: I8c90f4a0b33acba6eea3180cc077f8dc440e6e7b
2013-06-27 14:20:53 -07:00
Rob Moen 1b9c077b83 If cursor is obscured by toolbar, on keypress scroll to cursor.
Bug: 48735
Change-Id: I45028ed2f13148332518badd5f4647d4d652884e
2013-06-27 14:09:22 -07:00
jenkins-bot 7d9d8e677d Merge "mw.ViewPageTarget: Performance improvements for section edit links" 2013-06-27 20:36:08 +00:00
Ed Sanders d17dc86f51 Fix escapeParams in transclusions to not escape other transclusions
Use a stack counter to work out if we are inside a another template
call.

Bug: 49854
Change-Id: Ic0b97520b1696c3cf292111c7052502d5ccad648
2013-06-27 21:19:51 +01:00
Timo Tijhof e3cdfaa9fe mw.ViewPageTarget: Performance improvements for section edit links
Follows-up I4b9c47fd65a700a:
* Remove unused closingBracketSymbol.
* Moving veSectionEditUri and sectionEditUri inline as it is
  only used once. This will allow it to be easily dereferenced
  (instead of likely staying in memory due to being claimed by
  remaining closures "expand" and "expandSoon" which will
  continue to claim and enjoy access to this scope.
  Also changed it to use the attr() callback so that we
  don't access `$editLink.attr( 'href' )` twice.
* Add various comments explaining this non-obvious approach.
  Though it makes sense (eventually) and more elaborate details
  are in the original commitmsg, that is no excuse for a 100 line
  function without a single comment, especially with all these
  things going on.
* Use "shrink" instead of "contract" (seems more common in
  context of web UI elements and less ambgiuous in English).
* Remove redundant toString in `new mw.Uri( veEditUri )`.
  Aside from redundant, it also had more overhead (serialising
  uri object to string and re-parsing). It revoked its ability
  to make an efficient clone by taking the mw.Uri object as input
  as opposed to having to parse it again. mw.Uri#clone does the
  same internally.
* Avoid variable names like $this, that or self. Using a more
  descriptive name instead.
* Re-use $closingBracket instead of using last() 3 times which
  makes 3 clones of the jQuery object with the same last element
  in it.
* Refactor odd swapping of closingBracket-hide and
  middleBracket-clone-show.
  It now keeps the original opening/edit/closing in tact and adds
  devider/hidden/edit-source/outerClosing at the end.

Change-Id: I5f093f2927b769fed0c6d1a40f99e73f9b653b9a
2013-06-27 13:11:38 -07:00
Rob Moen 4f773438fb Don't advance cursor when adding new line at start of node
Bug: 48735
Change-Id: I934888ce727258cf3feb3e28d822e507554da701
2013-06-27 12:03:43 -07:00
jenkins-bot afe99d400a Merge "Fix comparison of MW internal links" 2013-06-27 17:30:00 +00:00
jenkins-bot 370caaf1ef Merge "Separate out MW specific converter tests" 2013-06-27 17:28:14 +00:00
Ed Sanders 14fa3b0999 Fix comparison of MW internal links
We need to normalise titles so 'user:foo_bar' == 'User:Foo bar', and
we also need to some HTML attribute removal as links from Parsoid
will have href and rel set (again, this should be fixed in by Parsoid
when the do the merging at their end).

Bug: 49985
Change-Id: I5fb5bfc69c344ca4ce4803d7b6116074648a8d7e
2013-06-27 17:43:34 +01:00
Ed Sanders d1aca4503e Separate out MW specific converter tests
They are only run in the MW test runner, where the MW dependencies
are available. Create a ve.test namespace for storing shared
test runners.

Change-Id: I079cb18b1c73614d25a12c5d6afcf0700469e52e
2013-06-27 17:10:25 +01:00
jenkins-bot 73e460c5bb Merge "ve.ui.ViewRegistry annihilation" 2013-06-27 01:51:53 +00:00
Trevor Parscal 6b5310c562 ve.ui.ViewRegistry annihilation
Objectives:
* Associate models with tools, rather than dialogs and inspectors
* Move tool/model association utilities to ve.ui.ToolFactory
* Obliterate the view registry

Notes:

The only special case for leaving modelClasses definitions in place is
for the linkInspector. It uses these for selection expansion.
Because tools can now override the static canEditModel method, we can
dynamically evaluate a model, rather than be restricted to only
comparing classes. This will be useful for disabling editors for models
that are for some reason incomplete or otherwise broken and cannot be
safely edited.

Change-Id: I7adf254990112d90f1f808593a9111afc7a116b5
2013-06-26 16:52:10 -07:00
Roan Kattouw cfc65ae9e5 Followup to 39fdb135f8: not everyone has a Mac, so check e.ctrlKey too
Bug: 49993
Change-Id: I5245ab19ae16b79d2c562c05b94649a58e04a4fd
2013-06-26 16:35:18 -07:00
Christian Williams eee17a8f09 Fix overlay for Monobook
Because of the z-indexes of major elements of the mono book
skin, and because the overlay containers are appended to the
body, the overlays can't be positioned between the surface and
the toolbar. Before this fix, the overlays are appearing beneath
the surface. This fix will retain proper positioning of the overlays
between the surface and the toolbar for Vector, and will overlay
everything in Monobook.

Later, we will have the overlay container more tightly integrated
with the surface to avoid this stacking problem.

Change-Id: Ibb1553099cc1e35e6a0928a99b584885508ca5b6
2013-06-26 16:10:56 -07:00
jenkins-bot e2099e5a01 Merge "ve.isInstanceOfAny utility function" 2013-06-26 22:01:48 +00:00
Trevor Parscal 1fcba7335f ve.isInstanceOfAny utility function
Convenient way to check if an object is an instance of one or more classes.

This should probably be moved to oo.js.

Change-Id: I2be55d9501cf62fde006281f1cf4813095b39b41
2013-06-26 14:49:04 -07:00
jenkins-bot 1a0fe26819 Merge "mw.ViewPageTarget: Don't handle edt tab clicks from special mouse buttons" 2013-06-26 21:09:36 +00:00
Timo Tijhof 39fdb135f8 mw.ViewPageTarget: Don't handle edt tab clicks from special mouse buttons
Regular mouse button click is normalised to which=1 by jQuery.

Change-Id: I08a711d8251613144ba6b463d4d240aedd98bb2a
2013-06-26 13:56:25 -07:00
jenkins-bot 3b0d5734fb Merge "Remove the preference to use the wikitext editor for editing sections" 2013-06-26 20:48:49 +00:00
jenkins-bot d323477b21 Merge "Show "edit source" section edit links in addition to VE ones" 2013-06-26 20:43:03 +00:00
jenkins-bot e83cb3f2b5 Merge "Position toolbar if loading with non-zero scroll offset" 2013-06-26 20:17:17 +00:00
MatmaRex 7a2811b6de Remove the preference to use the wikitext editor for editing sections
No longer useful now that I4b9c47fd exposes both ways of section
editing.

Change-Id: I93958413b4b6ad870306d9f06f540cdde47f7499
2013-06-26 19:25:29 +00:00
James D. Forrester eafe5d844c Discourage (ab)use of H1s, and relabel them
Re-label the headings in the MWFormatDropdownTool with MW-specific
headings per bug 43334, reduce the size of the dropdown's contents a
little to make the headings less vibrant, and move the H1 option to the
end of the list to further discourage its use.

Note that there are some issues with the underlying structure here and our
ability to split the repos into VE-core and VE-MW will need this to be
refactored.

Bug: 43334
Change-Id: I5a58b4dcebd6ceae0ffcd24f663429f25bdc3db9
2013-06-26 19:19:51 +00:00
Trevor Parscal c1ea21739f Show "edit source" section edit links in addition to VE ones
Objective:

* Provide quick access to section edit links for both source and visual
  editing

Story:

After using this prototype of my mockup, I realized how bad my mockup
was. Hooray for prototyping!

The issues were twofold:

1. Adding down-arrows to the edit links made the page look worse, and
was sure to incite rage and panic throughout the community.
2. The menu was just too heavy. Matmarex made an observation early on
after seeing it, that it wasn't very "Vector", and while I agreed, at
the time I didn't have any better ideas.

Thank you to Matma Rex for prototyping this feature. Aparently there was
also a previous attempt (I13bbb9549). We appreciate your help.

The new design is simple.

* Section edit links look normal
* On hover or focus, the edit source link also appears next to it

To make the two links look separate, we needed a divider. To make the
divider look good we needed to add space around it. To balance the
space, we needed to add space to the brackets. To avoid changing the
view, we needed to only add space to the brackets on hover. To avoid
the text moving around, we needed to make the brackets move away from
the text, rather than the text move away from the brackets. To make
this change smooth, we needed to use transitions. To make the links not
force the heading to wrap in one state but not the other, we needed to
reserve the space, using visibility rather than display. To reserve the
space we had to use closing brackets as spacers, hiding/showing one of
them on mouse enter/leave and leaving the other always hidden. To avoid
the right bracket from getting clipped by the edge of the screen when in
expanded mode, we needed to add a bit of padding to the right side of the
section edit link top level span. To prevent the extra links from
flashing as you move your mouse down the page, we needed to wait 100ms
before showing or hiding them due to mouse enter/leave.

We use negative margins to move the brackets. Animation implemented
using CSS transitions. We bring the pipe divider in from the core
'pipe-separator' message.

To style the brackets independently we needed to wrap them in spans and
add classes to them. Change Id27555c6 in core will make the wrapping
unnecessary, but the two should still get along just fine.

Interestingly, we needed to @noflip the bracket styles because CSS
Janus flipping is triggered on UI language, but the brackets need to be
styled according to the content language.

Changes:

ve.init.mw.ViewPageTarget.css
* Add styles for extra section edit link components

ve.init.mw.ViewPageTarget.js
* Add edit source link, and make it visible when the mouse is over the
heading or either section edit link is focused

*.php
* Links to new messages

Bug: 48429
Change-Id: I4b9c47fd65a700a81c880144247fec524edff7e5
2013-06-26 12:13:44 -07:00
jenkins-bot 85b3808c9f Merge "Expand recursive call protection in ve.ui.Window#close" 2013-06-26 16:18:28 +00:00
jenkins-bot 1a8d06988e Merge "Preserve scroll position after dialog close" 2013-06-26 15:30:11 +00:00
Ed Sanders 45e9ca181e Prevent overlapping link annotations
Use the 'all' mode of SurfaceFragment#getAnnotations to correctly
handle the selections which include linked and non-linked text
in the LinkInspector.

Bug: 50208
Change-Id: I1cab7f3cc4fc9589eced01ad38c59fe5b9622a57
2013-06-26 16:20:51 +01:00
Ed Sanders 4e728ebf26 Expand recursive call protection in ve.ui.Window#close
Focussing the view leads to another call of 'close' which
must be protected against.

Bug: 50140
Change-Id: I8c68468a95cddbc7efb222cf3a1f9868b2949285
2013-06-26 14:00:32 +01:00
Ed Sanders bc04b08892 Position toolbar if loading with non-zero scroll offset
The scroll event doesn't fire if the page is already scrolled
when ve is loaded.

Change-Id: I5b5a2dff2055d9ff1a8b2a2e0016a3fe7aaf22fb
2013-06-26 13:16:20 +01:00
Ed Sanders 10948ba91f Preserve scroll position after dialog close
Bug: 49977
Change-Id: I8cc12ba7845eebc6199fbcd2d355bf0d5f38264b
2013-06-26 13:03:59 +01:00
jenkins-bot 01a0ae93b9 Merge "Fix callout position when popup widget has been moved" 2013-06-26 11:07:40 +00:00
jenkins-bot ac8d5eccb2 Merge "Fix reserialization of mw-data.body.html" 2013-06-26 11:04:43 +00:00
jenkins-bot 9b5c0b825d Merge "Set href attribute of newly inserted image to image title" 2013-06-26 02:42:01 +00:00
jenkins-bot a7844ec34a Merge changes Icbf9ac6c,I1e7a1e67
* changes:
  Prevent visual effect on disabled toolbar buttons
  Remove use of filter property for CSS opacity
2013-06-26 02:37:14 +00:00
Roan Kattouw 92ffa0739d Fix reserialization of mw-data.body.html
This bug caused all references containing complex content (e.g. links
or templates) to be dirty-DOMed and reformatted by Parsoid.

ve.dm.MWReferenceNode.js:
* Parse the original body.html and check if it's semantically equal to
  the new value. If so, don't set it.

ve.dm.Converter.js:
* .normalize() the converter output to remove empty text nodes and
  merge adjacent text nodes

ve.dm.example.js:
* Update reused reference test to have body.html absent, not empty
* Add a link to one of the reference tests so this bug is triggered
** The link's attributes are ordered specifically so that toDomElements
   will reorder them, at least in Chrome (may behave differently in
   other browsers)
** This test fails without this fix in place

Change-Id: Idc091a14422fbb117a3d06fc6bb9497768086fc3
2013-06-25 19:24:18 -07:00
jenkins-bot 0332f1569f Merge "Reposition phantoms on init" 2013-06-26 01:40:18 +00:00
Christian Williams 867ec44a9f Reposition phantoms on init
When the toolbar animates, the position of the surface changes.
ProtectedNode now listens for the toolbarPosition event and
repositions the phantoms.

I also tried moving the localOverlay to be a sibling of the surface
(instead of child of body), but the same problems persisted.

Bug: 49853

Change-Id: I8ae1c8f66c6083b4ffee7107a78a298126e1064c
2013-06-26 00:59:46 +00:00
jenkins-bot 00b72ea0b6 Merge "Don't depend on iframe load events" 2013-06-26 00:26:57 +00:00
jenkins-bot f050ef954f Merge "Fix z-index of local overlay" 2013-06-26 00:02:09 +00:00
Christian Williams a7f471e6e7 Fix z-index of local overlay
Local overlay z-index is positioning overlay items (phantoms, etc)
above the floated toolbar. The overlay container is a sibling to the
toolbar's parent and is later in the DOM. z-indexing is
unnecessary and has been removed.

Bug: 50096
Change-Id: Ib46f66b1d1bea36d761f793e9966e09db6e675ca
2013-06-26 00:00:27 +00:00
Rob Moen 8e8584cc9e Prevent visual effect on disabled toolbar buttons
Bug: 33113
Change-Id: Icbf9ac6cff5e3f914268fe14d1b430609dedd49e
2013-06-25 16:58:14 -07:00
Trevor Parscal c2196b1fe7 Remove use of filter property for CSS opacity
Was used for IE8 support, no longer needed.

Change-Id: I1e7a1e676022dd7607c808bd44848cbf22a9e958
2013-06-25 16:44:06 -07:00
Trevor Parscal e962373e83 Don't depend on iframe load events
It was discovered that nested iframes inside firefox do not fire load
events: http://osdir.com/ml/dev-apps-firefox/2010-03/msg00134.html

Since we no longer care when the iframe is loaded, changing the frame
onLoad method name to load and manually calling it was sufficient.

Bug: 50115

Change-Id: I65c0c404a2a384566701b1c6b1bb978e0b99c90d
2013-06-25 23:12:58 +00:00
jenkins-bot 2b7e47b8ab Merge "Don't drop annotated comments in wrappers" 2013-06-25 22:54:42 +00:00
jenkins-bot 324e7558c9 Merge "Revert "ve.dm.Transaction: Implement newFromDocumentInsertion"" 2013-06-25 22:14:15 +00:00
Inez Korczyński 537e431466 Set href attribute of newly inserted image to image title
I'm not sure if that's the long term solution, however for now it fixes bug 49844 and bug 49848.

Change-Id: I75dbbfdd248a6f5696252ef3a2d7ca6ede0fa156
2013-06-25 15:09:09 -07:00
Catrope 721f8e0443 Revert "ve.dm.Transaction: Implement newFromDocumentInsertion"
Broke reference insertion because it removed
newFromNodeReplacement(), which is still in use.

This reverts commit 1765e39b40

Change-Id: I043997715474ad4850329ff903eb7a8c61c8b453
2013-06-25 22:08:37 +00:00
Roan Kattouw f9e698db22 Don't drop annotated comments in wrappers
HTML like <td><span>Foo<!--bar--></span></td> would lose the comment
when converting to linmod, and so we'd drop the comment when converting
back to HTML.

This happened because we were queueing up meta items to possibly move
them and their whitespace out of the wrapper paragraph even if we were
inside of an annotation and there was no way we could move things out
at all. The fix is simply to detect these case and not queue up meta
items in that case.

[12:11]	marktraceur	Let the comments hit the floor, let the comments hit the floor
[12:11]	marktraceur	(to the tune of the Drowning Pool "Let the Bodies Hit the Floor")

Bug: 50071
Change-Id: I5a844e2e0655bc1db152b3805718324ca0bb04df
2013-06-25 12:38:17 -07:00
Ed Sanders 6b5ed9c711 Fix callout position when popup widget has been moved
We calculate an overlap offset for when the popup widget has been moved
to avoid going out of the viewport, but that offset is only applied to the
body and not the callout.

Change-Id: Ib9d08d60ccfa6562378640c526faf1e8363abbba
2013-06-25 11:07:44 -07:00
Ed Sanders 29d61dbea4 Only use HTML attributes when comparing annotations for serialisation
The UI still needs a simplified version of annotation comparison
so it can clear/set annotations, whereas for serailisation we need
to compare selected HTML attributes (and once Parsoid is fixed,
compare all attributes).

Change-Id: I1a5521a3f51ea373a21cfbc9a007a2381c12f4fe
2013-06-25 17:57:08 +01:00
Inez Korczyński d31918d145 Proper handling for block level frameless images
Change-Id: Idd438dd256e1877ee7c18b8286a2c32fe2326f23
2013-06-24 17:47:03 -07:00
Inez Korczyński 58d752331e Do not add empty <figcaption> to <figure> tag
Change-Id: I7527f88e05318bfa6f0dbd5663294e7f0dd31a3e
2013-06-24 17:22:03 -07:00
jenkins-bot 12bd0ab325 Merge "Don't set rel="mw:thumb" on the <a> inside a block image" 2013-06-25 00:05:25 +00:00
jenkins-bot 3e6db2cb19 Merge "Use this.$$ for $relocatableMarker" 2013-06-25 00:03:42 +00:00
Roan Kattouw c48af4de1f Don't set rel="mw:thumb" on the <a> inside a block image
Causes DOM diffs

Change-Id: I54bd90cfcbdff4baa06f67cbeb2865dca357be19
2013-06-24 17:02:54 -07:00
jenkins-bot 1a8bb8c6ab Merge "(bug 50113) Do not display captions for block images which are neither frame nor thumb" 2013-06-24 23:57:28 +00:00
jenkins-bot eea2f640d7 Merge "Preserve the class attribute for block images" 2013-06-24 23:51:51 +00:00
jenkins-bot 904cdbbb79 Merge "Preserve the <a> inside of a reference <span>" 2013-06-24 23:46:17 +00:00
Roan Kattouw eafbac3412 Preserve the <a> inside of a reference <span>
This was a big gaping DOM diff that's been in there since the beginning,
but which we only found today.

Change-Id: Ie4e791b212ddd3210bc1d5c11308452bb57ae3ce
2013-06-24 16:20:45 -07:00
Inez Korczyński 4ddf123b7c (bug 50113) Do not display captions for block images which are neither frame nor thumb
There is still a problem that those images would get inspector for opening media edit dialog
displayed, and that dialog let's edit caption, which does not make sense in this case, however
that should be a separated bug.

Change-Id: I24491979bc7a27d2380924e48cb677b01e9f8f9b
2013-06-24 15:40:30 -07:00
jenkins-bot 0c13ca6780 Merge "Don't put slugs after internal nodes." 2013-06-24 22:22:17 +00:00
Rob Moen 8f005fa1ae Don't put slugs after internal nodes.
Bug: 50132
Change-Id: I3818ebe9816e7d781233f087b15694bf7ba12965
2013-06-24 15:20:08 -07:00
jenkins-bot 809579a4e4 Merge "Clean up static stuff in dm.GeneratedContentNode" 2013-06-24 21:52:08 +00:00
Roan Kattouw e9395273de Clean up static stuff in dm.GeneratedContentNode
Remove enableAboutGrouping from GCNode and move it to the subclasses
so we can have GCNodes without grouping.

Having matchTagNames there doesn't make sense now that GCNode is a
mixin rather than a base class.

Also removed unused .static.generatedContent property.

Change-Id: I2b5350e70b7829cf009c752d066919e5a3593db0
2013-06-24 21:50:38 +00:00
jenkins-bot 0c094837fb Merge "Place cursor at start of paragraph, not heading, when section-editing" 2013-06-24 21:30:18 +00:00
jenkins-bot 488664e3d2 Merge "Scroll to correct offset after using a section edit link" 2013-06-24 21:29:31 +00:00
Ed Sanders 138b9365c2 Place cursor at start of paragraph, not heading, when section-editing
Also checks for subheadings, i.e. we keep moving forward one sibling
as long as the next sibling is a heading of higher order than the
previous one. If the heading is of the same or lower order then we
assume there is an empty section, so we just stop.

Bug: 49563
Change-Id: I6fcc463aeeae40278f5caf04ae251c8ecfe65472
2013-06-24 22:27:01 +01:00
Ed Sanders 983847bfbc Setup section edit links again after page save
Bug: 49620
Change-Id: Idf938c0dc8535c30ce63a05d56abeee210a67380
2013-06-24 22:22:54 +01:00
Roan Kattouw 5212505648 Preserve the class attribute for block images
Build the new set of classes as an array (avoiding the leading space),
and only set it if it differs from what was there before. This avoids
reordering the class attribute.

Change-Id: I863ec8de2e7637f76690c4e0b7db5e153fb7e408
2013-06-24 12:34:15 -07:00
Ed Sanders 1889495aa2 Scroll to correct offset after using a section edit link
Needs to wait 200ms so it account for toolbar height.

Bug: 49563
Change-Id: I3a57e64f54289a3263814b4fbfe00c63de4a490b
2013-06-24 19:52:24 +01:00
Roan Kattouw 89c45edda1 Use this.$$ for $relocatableMarker
Change-Id: I39d4b8bc4f7c88068ad7e290130389f6c532743d
2013-06-24 11:01:14 -07:00
Ed Sanders 2352613b66 Code style fix: (X) -> ( X )
Change-Id: I7f3ac95621f70d9a89e70e9a51905673240cb51f
2013-06-24 18:51:59 +01:00
jenkins-bot 4c792ba385 Merge "Implement triple click functionality" 2013-06-24 16:04:59 +00:00
jenkins-bot 281f91d581 Merge "Store original DOM elements of transclusions" 2013-06-24 16:02:32 +00:00
Ed Sanders 7cc8e495aa Store original DOM elements of transclusions
Prevents changing of DOM attributes on unmodified transclusions
as they can clash in the store.

Also use 'original' over 'orig' consistently.

Bug: 50079
Change-Id: Ib13bb206c49b1f5b186e40632a5c109def0f042e
2013-06-24 15:50:52 +00:00
jenkins-bot 1176f69887 Merge "ve.dm.Transaction: Implement newFromDocumentInsertion" 2013-06-24 14:22:08 +00:00
Ed Sanders 89e1bd1a51 Implement triple click functionality
On detecting a triple click the nearest non-content node
is selected.

Bug: 38011
Change-Id: Ic80d24581535766714d80104222924f7a0d20f1a
2013-06-24 12:10:13 +01:00
jenkins-bot 37f11e03e2 Merge "Clean up inconsistent variables in ReferenceNode/TransclusionNode" 2013-06-24 02:40:52 +00:00
Timo Tijhof c4f1b5eaf4 Clean up inconsistent variables in ReferenceNode/TransclusionNode
Made them match the local variable names in MWRefereneListNode.

Change-Id: Id314779323c3a7347cfcd6f40b0e2b63e4d9b0c5
2013-06-23 19:17:29 -07:00
Roan Kattouw 0bf155bb36 Fix empty inspector popout bug in Firefox
Due to some sort of mysterious race condition (probably deferred reflow)
calling this.$menu.show() set style="" rather than style="display:block;"
because Firefox believed the parent was still hidden.

Work around this by removing display:none; from the context's CSS rules.
We don't need it because we always manually .hide() these things anyway.

Bug: 50073
Change-Id: I29e210aba9a6265d8364ff8ae49408cb4c2428b9
2013-06-23 19:12:13 -07:00
jenkins-bot cf062adbfc Merge "Pass full data (including meta) to converter in references" 2013-06-24 02:07:01 +00:00
jenkins-bot e8dabd8f37 Merge "Preserve data-mw verbatim if unchanged" 2013-06-24 02:05:44 +00:00
Ed Sanders b963747a45 Pass full data (including meta) to converter in references
Previously we were just passing a slice of the visible data, instead
of using getFullData.

Bug: 50059
Change-Id: I3bbea49132ef4a720a147ba9b170c39a0c00f711
2013-06-24 02:04:57 +00:00
Roan Kattouw 5a70aa5685 Preserve data-mw verbatim if unchanged
Previously we would reserialize the JSON blob in data-mw even if we
didn't change it, which potentially reordered keys and caused a DOM
diff.

Bug: 50066
Change-Id: If0a5bcc67d3a172de0e8839cfda11efacfbf36ff
2013-06-23 19:02:54 -07:00
jenkins-bot 2502f2e3ac Merge "mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved" 2013-06-24 01:31:43 +00:00
jenkins-bot a8590c8ba2 Merge "Allow metadata to be annotated" 2013-06-24 01:13:27 +00:00
jenkins-bot 0a0265cb77 Merge "ve.dm.MWTemplateSpecModel: Expand parameter aliases" 2013-06-24 01:02:56 +00:00
Timo Tijhof 947da63502 mw.ViewPageTarget: Clear slide history when closing the save dialog
Bug: 49481
Change-Id: I297a7d1458e5a1c33b9dcb85272fe5f40893dd88
2013-06-23 17:35:04 -07:00
Timo Tijhof 49179c7c31 ve.dm.MWTemplateSpecModel: Expand parameter aliases
We were previously ignoring this data leading to situations
where a template that can be invoked like {{foo|1=bar}} and
{{foo|thing=bar}} (where the template data documents param
thing with alias '1') will show up in the editor with no
parameter information or label for the 1= call, but will show
up for the thing= call.

Now they are properly aliases so both will appear the same
in the editor dialog.

Bug: 49838
Change-Id: I37ec0e152df905844ac58ed1834fca29dccb4eec
2013-06-23 17:25:52 -07:00
Timo Tijhof ef6fae606f mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved
Bug: 49187
Change-Id: I2ee2e33c89cac58863c9911fc3ad250c72a46206
2013-06-23 17:04:44 -07:00
Ed Sanders 4bcc07b120 Allow metadata to be annotated
To prevent dirty diffs when inline metadata appears inside annotations.

Bug: 50060
Change-Id: I40da3d5e8e987571195142304b1a853e177e36ff
2013-06-23 18:48:32 +01:00
jenkins-bot dbabfe5514 Merge "Restore selection after dialog close" 2013-06-23 05:49:24 +00:00
jenkins-bot d22053c017 Merge "Resize focus highlights on generated content update" 2013-06-23 05:48:45 +00:00
jenkins-bot f10925bf79 Merge "Create ref list insertion tool" 2013-06-23 03:24:53 +00:00
Timo Tijhof 8a2c9431e6 Create ref list insertion tool
Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
  of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
  object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
  in a detached tree.
* Fix deep property access that can fail. mwData is set to
  either JSON parse of data-mw attr or empty object.
  Accessing mwData.attrs.group needs to be guarded by whether
  mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
  (especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
  data element (similar to what MWReferenceNode already has).

Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
2013-06-22 20:23:22 -07:00
jenkins-bot 9f3b36da7a Merge "ve.ce.BranchNode: Use DOM rather than jQuery in #onSplice" 2013-06-23 03:11:56 +00:00
jenkins-bot 3327f0fa7d Merge "Use DOM methods rather than jQuery in setupSlugs()" 2013-06-23 03:10:38 +00:00
jenkins-bot f1aba583a9 Merge "getRenderedContents() optimizations" 2013-06-23 03:09:58 +00:00
Roan Kattouw d9fb612538 ve.ce.BranchNode: Use DOM rather than jQuery in #onSplice
Change-Id: I75337048e9ae81c95333da5c0277dbf7dc562b1c
2013-06-23 03:09:46 +00:00
Roan Kattouw 1459bb418b Use DOM methods rather than jQuery in setupSlugs()
Also use .importNode() rather than .cloneNode() so the slugs are
created in the right document.

Change-Id: Ia0b6ee5f4e4ef0fbcc9a3fe16f20587da027ae2e
2013-06-23 02:39:56 +00:00
Roan Kattouw fe5f4fdce0 getRenderedContents() optimizations
* Use plain text rather than HTML in TextNode
** Bypasses HTML parsing, and doesn't cause regeneration of nodes like
   appending to .innerHTML does
** We were only using HTML so we could use entities, so replace those
   with \uNNNN sequences
* Use native DOM functionality rather than jQuery
* Inline flushBuffer()

Change-Id: I7c6376b55cc0f1420a01a77b365b073fe1636263
2013-06-22 19:37:10 -07:00
Timo Tijhof fb007eb4f5 ve.dm.example: Use jQuery#toArray instead of jQuery#get
Better for performance (lower level, #get calls #toArray when
called without arguments) and more semantically correct.

Change-Id: I8e615674e51fd148367fd397bd169fa203a240ad
2013-06-21 18:03:59 -07:00
Ed Sanders 847edb4fb5 Restore selection after dialog close
Change-Id: I534e38633700191782a7b088de0ae46a5f800fa8
2013-06-22 00:39:21 +01:00
Ed Sanders f1e1dd7fcb Resize focus highlights on generated content update
Create a new rerender event. Also added a check to see
if the node is actually focused.

Change-Id: I9f74e82f72a9ddfd1e4a9ab7d1c0c8289b6525e8
2013-06-22 00:29:32 +01:00
jenkins-bot 22f4c6454a Merge "RelocatableNode for Inline and Block Images" 2013-06-21 21:54:49 +00:00
Christian Williams e71655304e RelocatableNode for Inline and Block Images
HTML5's drag and drop has a ton of benefits and a couple of
limitations. To achieve a native drag marker, an image tag helper
is used to indicate the size of the relocatable node. Chrome
shades the marker gray natively, Firefox is styled to match.

Change-Id: I755b698a3d968cc7e6ff125109d68ac83fd8a8a2
2013-06-21 14:53:10 -07:00
jenkins-bot e10ba45a81 Merge "mw.ViewPageTarget: Use native .focus() rather than jQuery's .focus()" 2013-06-21 21:28:03 +00:00
jenkins-bot dcb0d04cc8 Merge "Don't build the CE tree and DOM for the internal list" 2013-06-21 21:25:58 +00:00
Roan Kattouw 3a5ec39ab5 mw.ViewPageTarget: Use native .focus() rather than jQuery's .focus()
jQuery's implementation does some sort of traversal, so on large pages
it took 300-400ms just to focus the document node.

Change-Id: I0de95d8800a1aedeb19b27d204dfd8fd08cec533
2013-06-21 21:25:44 +00:00
Roan Kattouw 921a95de78 Don't build the CE tree and DOM for the internal list
This is a waste of time, because we hide it anyway. This took
quite a bit of time for long articles.

Change-Id: I1bcfd5b908c89dc2e08d5520e8870b145177ca10
2013-06-21 14:19:55 -07:00
jenkins-bot 3a3270486a Merge "Match data inserted from MWMediaInsertDialog with MWBlockImageNode" 2013-06-21 21:01:09 +00:00
jenkins-bot 5cfd21754a Merge changes If3d01346,I4e5317f1
* changes:
  Fix incorrectly written CSS that was affecting all table cells on the page instead of cells in mwMetaDialog only
  Fix for rendering block images
2013-06-21 21:00:33 +00:00
jenkins-bot 014b6ed33a Merge changes I379bc2b3,I99acbd16
* changes:
  Straighten out variances in parent method invocation
  ve.ui.MWReferenceDialog: Clean up
2013-06-21 20:53:25 +00:00
jenkins-bot 2bc37bfc29 Merge "Fix logic in link input widget" 2013-06-21 20:14:49 +00:00
jenkins-bot a344396b47 Merge "Remove format tools from mw reference dialog" 2013-06-21 20:13:33 +00:00
jenkins-bot c32378b571 Merge "Delete default sort key if set to empty string" 2013-06-21 20:10:12 +00:00
jenkins-bot b9c386e49c Merge "Fix splitClusters usage in ve.ce.Surface#onContentChange" 2013-06-21 19:50:23 +00:00
jenkins-bot ecbb941038 Merge "Allow UI context to update when selection is from 0" 2013-06-21 19:39:57 +00:00
Inez Korczyński 50ec8c507a Match data inserted from MWMediaInsertDialog with MWBlockImageNode
Change-Id: I145beba19a8f69f6fd8c29302350c399b4c51c55
2013-06-21 12:36:14 -07:00
Inez Korczyński 25d8d2895d Fix incorrectly written CSS that was affecting all table cells on the page instead of cells in mwMetaDialog only
Change-Id: If3d01346d7267aec444d573ac83516083a3689bc
2013-06-21 12:33:38 -07:00
Timo Tijhof 2fb1a11a1a Straighten out variances in parent method invocation
Follows-up I99acbd1699:
* "Parent method" comment
* Remove redundant slice() call to convert arguments to array,
  native JavaScript methods that take array-like arguments such
  as Function#apply and Array#slice are both compatible with
  the Arguments objects, no need to convert it. Most invocations
  already did this right but a few were recently introduced again.
* Removed silly "Document dialog." descriptions.
* Removed a few redundant "@method" tags in the near vicinity
  of code I changed.
* Fixed function invocation to be either on one line or
  one parameter per line. Having all arguments on one line
  but the name + "(" looks confusing as it suggest there
  is only 1 parameter. Same as object literals:
  so:
  { foo: 1, bar }
  or:
  {
    foo: 1,
    bar: 2,
  }
  not:
  {
    foo: 1, bar: 2
  }

Change-Id: I379bc2b32603bcf90aba9b4cd0112e7f027d070e
2013-06-21 19:20:37 +00:00
Inez Korczyński 659bb8e6d0 Fix for rendering block images
Change-Id: I4e5317f128f2b3f6742e7ed280c96fde37f52bb4
2013-06-21 12:19:38 -07:00
jenkins-bot 4d73aaa737 Merge "Change nested annotation test to test recursiveness" 2013-06-21 18:53:48 +00:00
Ed Sanders bf621b3454 Change nested annotation test to test recursiveness
Change-Id: I16f39bd0f6e2b6719ff26f69a561145bb4ca0c2b
2013-06-21 19:47:10 +01:00
Timo Tijhof 0c2e35593e ve.ui.MWReferenceDialog: Clean up
* Optimise initialisation by building the tree from the bottom up
  and applying the class last.
* Actually document the dialog. Documenting it as "Document dialog"
  is useless and confusing. If there is no documentation yet, leave it
  empty so it is included in jsduck's optional "no_doc" warning list.
* Remove the redundant "Call" prefix in the parent method description,
  we don't do this else where either.

Change-Id: I99acbd1699b2c99a2c9b58f34dc1e07bea58203d
2013-06-21 11:36:44 -07:00
jenkins-bot f16e641ab4 Merge "Handle nested empty annotations" 2013-06-21 18:23:22 +00:00
jenkins-bot a03601683f Merge "mw.ViewPageTarget: Move non-annotation buttons to a new tool group" 2013-06-21 18:19:34 +00:00
jenkins-bot 722b9560a1 Merge "Workaround for adjacent annotations bug" 2013-06-21 18:15:06 +00:00
jenkins-bot 096dcced1b Merge "There is no need to apply CSS changes (width and height) to an image inside ve.ce.MWBlockImageNode because it is already handled in ve.ce.ResizableNode" 2013-06-21 18:12:39 +00:00
Inez Korczyński e91fee2ca7 There is no need to apply CSS changes (width and height) to an image inside ve.ce.MWBlockImageNode because it is already handled in ve.ce.ResizableNode
Change-Id: I416008688b967cbbbe3e585abb3be9924ca47dc6
2013-06-21 10:38:07 -07:00
Trevor Parscal 469cb4aa99 Add reference icon
Objectives:

* Introduce new icon for a reference
* Repurpose existing reference icon for references block

Change-Id: I1bfcdbeda3b9730d62d6b264ef72921e93623f7e
2013-06-21 10:31:43 -07:00
Ed Sanders 8bfbef1c5e Handle nested empty annotations
At the moment we create an alien meta item if an annotation
wraps contents of zero length, however we also need to handle
nested empty annotations, i.e. where the contents is other
empty annotations (i.e. alien meta items).

As alien meta items simply preserve DOM elements we don't
mind what type of alien meta items they are, so this also fixes
the case of an annotation wrapping another alien meta
e.g. a comment or <meta> tag.

Bug: 48605

Change-Id: I98d88b341efcd6384ee1fda5d6d7e1e1acb107aa
2013-06-21 17:20:06 +01:00
jenkins-bot 210019de59 Merge "ve.dm.MWTransclusionModel: Don't create undefined normalisation target" 2013-06-21 16:18:20 +00:00
Ed Sanders 51be472159 Fix logic in link input widget
Previously pageExists thought matchingPages was an indexed object when
in fact it was an array. This didn't manifest as a bug as we subsequently
check the normalised URL in the correct manner (using indexOf), but it
did remove the optimisation of not running mw.Title if there was an exact match.

Change-Id: Ic616cbfa0d7ed5447e032dd1f772779db2dc19e5
2013-06-21 16:42:54 +01:00
Ed Sanders 4116742bcb Remove format tools from mw reference dialog
Because you can't put a heading in a reference.

Bug: 49715
Change-Id: Ic823a90398dafca1caf8fa4142d98133ab661d7c
2013-06-21 16:23:29 +01:00
Ed Sanders 746763a2e7 Workaround for adjacent annotations bug
Until this is fixed by Parsoid, this is a dirty hack that compares
HTML attributes on annotations, excluding data-parsoid. Obviously
we shouldn't have any parsoid specific code so this should be removed
as soon as it is fixed properly.

Bug: 48194
Change-Id: Ibb18b4f653c664e8ab7876498dc8395d878f7aaa
2013-06-21 12:31:36 +01:00
Ed Sanders 7b1df21aeb Delete default sort key if set to empty string
Bug: 49724
Change-Id: Ie3caaf4811f87911444462f83d511c0cc46c0716
2013-06-21 11:48:20 +01:00
Timo Tijhof 03dbf56f76 mw.ViewPageTarget: Move non-annotation buttons to a new tool group
Change-Id: I04784357d3590c43af90c60da4b5a67bbf10ac70
2013-06-20 19:55:55 -07:00
Timo Tijhof 1ea9016cf8 doc: Clean up documentation related to ES5 in ve.js
Also removed redundant ve#filterArray.

Change-Id: I80a2e7fdfdb8f26510196995044124afeda4e682
2013-06-20 17:43:24 -07:00
Ed Sanders 3a44ae9be3 Fix splitClusters usage in ve.ce.Surface#onContentChange
Was previously doing the text slicing before the cluster split
using substring, instead of after using splice.

Bug: 49233
Change-Id: If9c0860e2fe7b01eb0b27aae67c671062799a0fa
2013-06-21 00:28:56 +01:00
jenkins-bot 93686139f5 Merge "mw.ViewPageTarget: Move save dialog out of toolbar tree" 2013-06-20 22:14:50 +00:00
James D. Forrester eb35b92f8f Update initialisation scripts for demo, test
Apparently we should be keeping these up-to-date by
running makeStaticLoader :-)

Change-Id: I06f5cdad64b67bb10b6c6a470c818fc9c688560f
2013-06-20 22:10:57 +00:00
Timo Tijhof 8f9093ea07 ve.dm.MWTransclusionModel: Don't create undefined normalisation target
The API gives us normalisation information about all titles,
including titles of which it couldn't provide any template data.

Spec storage should only have properties with valid values
(has property means to have a valid value, like database). The
absence of this check was causing it to turn this:

{
  pages: {
    'Template:Unsigned': { params: { .. } }
  },
  normalised: [
    { from: 'foo bar', to: 'Foo_bar' },
    { from: 'template: unsigned', to: 'Template:Unsigned' }
  ]
}

into:

{
  pages: {
    'foo bar': undefined
  },
  normalised: [
    { from: 'foo bar', to: 'Foo_bar' }
  ]
}

Bug: 49493
Change-Id: I0b661744d0388345561897c9631f15e691737031
2013-06-20 15:09:42 -07:00
Timo Tijhof 85c4ebf373 mw.ViewPageTarget: Move save dialog out of toolbar tree
Bug: 49275
Bug: 49361
Change-Id: I2fbc4c8af943f1b096b8912191924961405d5c47
2013-06-20 14:16:50 -07:00
Ed Sanders 8730a913dc Allow UI context to update when selection is from 0
Previous condition was put in as part of I9ed6f9fb as a
temporary fix for bug 42842. However this code was causing
the popup widget to not appear for items at the start of
the document. It appears the bug it was put in to fix
has since been fixed elsewhere.

Bug: 49421
Change-Id: I8bcdea0f7a6951216bf8368865d23ef6246880ea
2013-06-20 19:33:44 +01:00
Ed Sanders 2c421258f8 Delete/don't insert transclusion if object is empty
The transclusion dialog lets you completely delete all templates
within it. If this happens we should delete the node completely, or
not insert it if it's a new instance.

Bug: 49831
Change-Id: Ic5d4fbf73f3d1be9cf877bc8b98096de9e98991a
2013-06-20 17:23:29 +01:00
jenkins-bot ed1c06ee6b Merge "Match MediaWiki's rendering of non-thumb/-frame block images" 2013-06-20 03:49:09 +00:00
Inez Korczyński bed2c1d00d Match MediaWiki's rendering of non-thumb/-frame block images
Change-Id: I43ad72ef2d6b650692e1a0fd4460e4dec70fde7f
2013-06-19 17:44:55 -07:00
jenkins-bot 43af678ad4 Merge "ve.ui.PanelLayout: Set default to span accross available space" 2013-06-20 00:29:42 +00:00
Catrope 1765e39b40 ve.dm.Transaction: Implement newFromDocumentInsertion
This function builds a transaction that takes a document slice and
inserts it back into the document it came from, applying any changes
that were made.

This makes editing document slices simple:
    slicedDoc = doc.getDocumentSlice( captionNode );
    // Edit slicedDoc using a surface
    tx = ve.dm.Transaction.newFromDocumentInsertion( doc, captionNode, slicedDoc );
    surface.change( tx );

Specifically, newFromDocumentInsertion replaces the node's contents
with the document's contents (meaning any changes made to the node in
the meantime are lost). It also merges the stores internal lists
of the two documents and remaps indexes accordingly. This means editing
of references inside of references is supported.

This functionality is not specific to slices, and can also be used to
safely insert data from a paste buffer, with internal list data being
transplanted correctly.

ve.dm.MetaLinearData:
* Make merge( [ undefined, undefined, ... ] ) return undefined rather
  than [].

ve.dm.Document:
* In getDocumentSlice, store a pointer to the original dm.Document in
  the new one, and also store the length of the internal list. This
  allows us to figure out which internal list items the two documents
  have in common when we insert the modified slice back into the main
  document.
* In getMetadataReplace, optionally take the inserted metadata as a
  parameter, to allow for operations that insert both data and metadata.
  Per Ed's review, rewrite this function to return null rather than {}
  if no metadata needs to be replaced.

ve.dm.InternalList:
* Add method to merge two internal lists

ve.dm.Transaction:
* Remove newFromNodeReplacement and replace it with newFromDocumentInsertion.
* In pushReplace, optionally take the inserted metadata as a parameter.

Change-Id: I786ee7bad796aa54bc242993b4de3ad18ad0773e
2013-06-19 17:27:50 -07:00
jenkins-bot 58c7db50e3 Merge "Always float toolbar to top of page, not last branch node" 2013-06-20 00:27:06 +00:00
Timo Tijhof 82997d73e8 ve.ui.PanelLayout: Set default to span accross available space
Without these properties set, the layout is collapsed into a 0x0px square due to the
parent having overflow-x: auto; and no width/height set.

Change-Id: I77aef8afa3327b11f453196badcdfad3f51f7c3d
2013-06-19 16:20:10 -07:00
jenkins-bot 38d6c6ba73 Merge "Add resource attribute to newly created images" 2013-06-19 22:31:20 +00:00
jenkins-bot 5cc6faaa1f Merge "(bug 49837) Handle correctly figure tags with typeof="mw:Image"" 2013-06-19 21:56:16 +00:00
Inez Korczyński 0f380f1fc5 (bug 49837) Handle correctly figure tags with typeof="mw:Image"
Change-Id: I6bc74973671e7046130278b9658bb8f6f62904a1
2013-06-19 21:15:30 +00:00
Ed Sanders 8d2ba6effe Add resource attribute to newly created images
Bug: 49596
Change-Id: Ifbde0f5a4c8eb01df7b429abbb8ab0d4431c1c6f
2013-06-19 20:47:14 +00:00
jenkins-bot 3d98a73cba Merge "One method onAttributeChange in ve.ce.MWBlockImageNode is plenty" 2013-06-19 18:47:05 +00:00
jenkins-bot cd2d6d1663 Merge "Fix inconsistencies and errors with Dialog onOpen/Close" 2013-06-19 18:46:02 +00:00
Ed Sanders 0072e66183 Always float toolbar to top of page, not last branch node
The check for the toolbar not overlapping the last branch node
'fixes' an edge case where the user has scrolled too far, and
the viewport is shorter than the last branch. A more common
problem caused by this is that if the last branch is very tall
the toolbar disappears whenever you scroll past it.

Bug: 48662
Change-Id: I1c7662f2b6f1ced6f80dec16c6ed69a8cc0c06c8
2013-06-19 18:44:38 +00:00
Ed Sanders 1469575082 Fix inconsistencies and errors with Dialog onOpen/Close
Removed inherited (and often wrong) documentation, replaced direct
usage of onApplyButtonClick with more standard onClose handling,
and one case of calling the wrong parent method.

Change-Id: I86ed16860e996b42c141a6499eefb9084d759a72
2013-06-19 18:35:45 +00:00
Inez Korczyński c632bfc65b Ignore shortcut keys inside key press handler
Bug: 49732
Bug: 49760
Bug: 49816
Change-Id: I8f814a0f369c470038896041f157b3dbd0d7f1a7
2013-06-19 17:31:45 +00:00
Inez Korczyński 44c174734b One method onAttributeChange in ve.ce.MWBlockImageNode is plenty
Change-Id: Ibcf93047c93e411c6c7167720e5d92a311d647f1
2013-06-18 19:31:01 -07:00
jenkins-bot ebddcf9239 Merge "Transclusion editor template naming goodness" 2013-06-19 01:37:07 +00:00
Trevor Parscal ece74379de Transclusion editor template naming goodness
"Template" parts should be labeled with a normalized version of what you would actually write inside a set of curly brackets.

Change-Id: I4b9c541a01da86cb078d38012e5a9fead2fa233c
2013-06-18 18:33:58 -07:00
jenkins-bot 7289df9674 Merge "Make media insertion queries less horrible" 2013-06-19 01:19:43 +00:00
Trevor Parscal bf268e82a5 Make media insertion queries less horrible
Objectives:

* Clear this.titles when resetting, otherwise results are shown once and
  then blacklisted forever.
* Attach done() before always(), so done() gets called first and not
  after always() has dereferenced the request object.
* Remove use of imaginary variables like this.loading, which were never
  set, and were referencing even more imaginary methods on other imaginary
  objects like this.request.abort()...

Change-Id: Ifbe74346f68b6a91f425b56a2696fd1e46b61e02
2013-06-18 18:17:05 -07:00
Inez Korczyński a886952563 Support for editing captions of block images
Bug: 38129
Change-Id: I02207e78f5c28eaccd9bc97a48baa78280192255
2013-06-18 17:57:10 -07:00
jenkins-bot fedcf454a0 Merge "Added ve.ce.FocusableNode mixin to ve.ce.MWReferenceListNode" 2013-06-19 00:53:56 +00:00
jenkins-bot 89cc6f21fb Merge "Add templates from toolbar" 2013-06-19 00:27:08 +00:00
jenkins-bot 3d5c6f8b0f Merge "Fix transclusion button message" 2013-06-19 00:26:29 +00:00
Trevor Parscal 4a7503ac10 Add templates from toolbar
Change-Id: I0aa21bed13d1dbc693c1db03eab903af55a1517a
2013-06-19 00:23:23 +00:00
jenkins-bot a60e469b03 Merge "Handle media select widget empty queries properly" 2013-06-19 00:18:23 +00:00
Trevor Parscal 2044a5796b Fix transclusion button message
Change-Id: I90cdb600ffb6e7d80cf6042b50ef0bf8a22c6cbd
2013-06-19 00:17:46 +00:00
Trevor Parscal a8fcfb4a14 Handle media select widget empty queries properly
If the query is cleared, we should still clear all items and abort any
loading that may be going on. We should still not try and load results
for an empty query though.

Change-Id: If23c6e0469247b1c1c47ab85b9a5a010e8a4fe26
2013-06-18 17:11:38 -07:00
Roan Kattouw c027b43d04 Improve template title normalization logic
Only remove the namespace prefix if it's in the template namespace,
and prepend a colon for main namespace titles.

Change-Id: Ie910bae172274e36c7c9a675a631a0876ff13ed1
2013-06-18 17:09:46 -07:00
Trevor Parscal 1ee10790e9 Don't show Template: in the outline for template items
1. It's redundant and ugly.
2. We already have an icon.
3. It's unnatural for anyone used to working with templates.

Change-Id: I821e124158a14679e411324620dc9d7c40252383
2013-06-18 23:49:14 +00:00
Trevor Parscal 23b2da91fd Template and content adding
Objectives:

* Allow adding content or templates within a transclusion
* Add template placeholder to model and view which resolves to nothing
  when saving (thus disappearing if not resolved)

Changes:

*.php
* Add links to new messages and files

ve.ui.OutlineControlsWidget.js
* Organize controls into "adders" and "movers"

ve.ui.Widget.css
* Add styles for adders/movers sections of outline controls
* Make adders appear on hover to reduce clutter

ve.ui.Icons-*.css
* Add icon for "add item"

ve.ui.Dialog.css
* Add styles for add template fieldsets
* Make placeholder items in the outline italic

ve.ui.PagedDialog.js
* Pass adders config to outline controls

ve.ui.MWTransclusionDialog.js
* Add support for adding content and templates

ve.dm.MWTransclusionModel.js
* Add addPlaceholder method

ve.dm.MWTemplatePlaceholderModel.js
* New class, pretty much an empty part
* Using this makes the UI much easier to work with - no need to special
  case the outline control for new items
* Because it's not supported specifically in
  ve.dm.MWTransclusionModel.getPlainObject, it produces nothing and goes
  away naturally on apply

Change-Id: I3478560fb53ba2ccd3fb26bafb6a61e6415565eb
2013-06-18 23:37:44 +00:00
Roan Kattouw dfbd870e16 Fix copyDomElement issues
* Fix bug in MWTransclusionNode sometimes passing a NodeList rather
  than an array (caused an error because NodeLists can't be .map()ped)
* Use copyDomElements in ce.AlienNode as well

Change-Id: I11c6483d3c062047be80f75a3fac03f13bff9662
2013-06-18 23:37:09 +00:00
jenkins-bot 60da007ab9 Merge "Copy DOM elements properly, into the correct document" 2013-06-18 22:52:14 +00:00
Roan Kattouw dc798befcf Copy DOM elements properly, into the correct document
* Provide a utility for copying an array of DOM elements into a
  different document
* Copy the DOM elements returned in toDomElements(), otherwise weird
  issues arise when the same data is converted to DOM twice

Change-Id: Ie927420624f0d4af0692e18d1bc6f952c8013d61
2013-06-18 15:40:33 -07:00
Trevor Parscal c4791ceeae Make MWTransclusionModel#addTemplate take target object instead string
Change-Id: I6067e9de7d6029c36938b2758dffe4afdb0bf2ad
2013-06-18 15:19:10 -07:00
Trevor Parscal 0410b936e4 MWTransclusionModel: Make #getPartById support a param model id
Change-Id: Ia2829ef2c24f63ce46e05790aa089fca563bc563
2013-06-18 15:08:44 -07:00
Trevor Parscal 7c171ae0a5 Whitespace cleanup
Change-Id: I49417b95a6c4c2538715e09b74ed3607f6741c3a
2013-06-18 21:53:03 +00:00
Trevor Parscal e8d8308d9a dialog: Remove background color body
This was causing strange rendering problems, and it's really not even
needed.

Change-Id: I130e9e5c5f2c5ab99b5245de6c0243e9be9cf558
2013-06-18 21:52:43 +00:00
jenkins-bot 9ba2bab2de Merge "ve.ui.IconButtonWidget: Extend css transition from 100ms to 200ms" 2013-06-18 21:48:41 +00:00
jenkins-bot 61879a93ed Merge "ve.ui.LookupInputWidget: Hide lookup input widget menu when empty" 2013-06-18 21:46:39 +00:00
Trevor Parscal 00d5c41e02 ve.ui.IconButtonWidget: Extend css transition from 100ms to 200ms
Makes make it look nicer.

Change-Id: Ib7c1021a31f607b6e697f16fe797358c0167acee
2013-06-18 21:45:33 +00:00
Trevor Parscal db48513465 ve.ui.LookupInputWidget: Hide lookup input widget menu when empty
Change-Id: Iac397c2ddcb7ea54c751485bdd922f7b19494d1e
2013-06-18 21:42:41 +00:00
Timo Tijhof 01f9e560b4 mw.ViewPageTarget: Use ES5 methods instead of strict mode as test
In aaa5ad2 we introduced a feature test. However though we do require
ES5, we don't (yet) use strict mode. It is an easy and solid one to
feature test, but it the unfortunate reality is that IE9 does not fully
support ES5. Strict mode is among the features it didn't (correctly)
implement. As a result commit aaa5ad2 locked out IE9 completely.

Replacing it with a more explicit (and harder to maintain) test that
does pass in IE9. We now need to be very careful about using ES5
features in our code. It has to be in this list here to avoid breaking
in a browser that doesn't support it.

Change-Id: I77b623e15a0791bfaa2cd835e43107cefb3c25f5
2013-06-18 14:22:29 -07:00
jenkins-bot 8e4177c960 Merge "Only undo on MWMetaDialog close if small stack is non-empty" 2013-06-18 19:34:15 +00:00
jenkins-bot 4fdebb5679 Merge "doc: Tag ve.ui.Window static properties as inheritable" 2013-06-18 19:33:12 +00:00
Trevor Parscal 42f0321b84 Element fixes
Objectives:

* Make get$$ work with empty jQuery selections
* Reset the $items selection when clearing a group

Changes:

ve.Element.js
* Add existing context property to possible solutions

ve.GroupElement.js
* Reset this.$items after detaching them

Change-Id: I73b46649d7ecd5045941086c4e1bb3241c8f4ef3
2013-06-18 11:35:07 -07:00
jenkins-bot cea0c2e0b6 Merge "Store originalIndex instead of mwOriginal in Transclusions" 2013-06-18 18:24:14 +00:00
Timo Tijhof 48dd042068 doc: Tag ve.ui.Window static properties as inheritable
Also updated outdated reference to dialog in demo.

Change-Id: I6c9997d4b4059348b400f592d6ae95cd9f43996c
2013-06-18 11:22:27 -07:00
jenkins-bot 388faa8d58 Merge "Correctly distinguish between Deferred and Promise" 2013-06-18 18:01:38 +00:00
Roan Kattouw d5365d2b5a Correctly distinguish between Deferred and Promise
Deferred is read-write, Promise is read-only. Document and return
the correct types.

Change-Id: Icfd6efb07b222c73d49b97ddbfe6565b8542ad00
2013-06-18 10:56:56 -07:00
Ed Sanders 84fbd1db2c Only undo on MWMetaDialog close if small stack is non-empty
Added return boolean to ve.dm.Surface#breakpoint to indicate if
and transactions were pushed to the big stack. Use this value in
MWMetaDialog to see if we need to undo on close.

Added tests for ve.dm.Surface#breakpoint.

Bug: 49630
Change-Id: Ieb2e9e361afe057af93c4d374acc85df58bfb4c3
2013-06-18 16:55:03 +01:00
Ed Sanders 81bdb7cf3e Store originalIndex instead of mwOriginal in Transclusions
Slightly more efficient way of seeing if the template has changed,
and results in a cleaner set of data element attributes.

Change-Id: I1507520005bfb8a88bfa6038dac5c3b15506425d
2013-06-18 15:23:37 +01:00
jenkins-bot 2d4101168b Merge "Actually normalize page titles correctly in MWLinkTargetInputWidget" 2013-06-18 08:41:36 +00:00
Roan Kattouw 9c19bc385e Actually normalize page titles correctly in MWLinkTargetInputWidget
matchingPages contains titles with spaces, but .toString() returns titles
with underscores, so normalizing with .toString() is incorrect. Use
.getPrefixedText() instead.

This caused a bug in the link dialog where, if the link was an internal
link pointing to an existing page with a space in its name, the "New page"
section would be displayed but would be empty, and the link's target would
be displayed in the "Existing page" section but colored red.

Change-Id: I59d8b87b996d80da1b25124b942bd2b72ef50845
2013-06-18 00:37:17 -07:00
jenkins-bot 720fa978f9 Merge "Address Krinkle's review comments from I51c441d61" 2013-06-18 02:05:59 +00:00
Ori Livneh f11b9e8c79 Address Krinkle's review comments from I51c441d61
See <https://gerrit.wikimedia.org/r/#/c/69161/1/modules/ve/init/mw/ve.init.mw.splitTest.js>.

Change-Id: I14442070c0998d724d67ec41cca813ef5bce2c19
2013-06-17 19:04:27 -07:00
Roan Kattouw 177159b388 Test case for 95733390dc
Change-Id: I8c2e239e945466f3e46c92efab03f7e615bc6887
2013-06-17 17:13:45 -07:00
Roan Kattouw 95733390dc Use indexes in .children, not .childNodes, for attribute preservation
The difference is that .children excludes non-element nodes (text nodes
and comment nodes). These can't have attributes anyway, so there's
nothing lost by skipping them, and this way we avoid bugs where a
text node split causes the indexes to be off.

(Text node splits are probably due to an interaction between whitespace
preservation and paragraph unwrapping, and aren't necessarily bad. We
just shouldn't rely on indexes into .childNodes)

Change-Id: I905a50e1c299ebafcbd4eaa0f938b06a1b5849ff
2013-06-17 15:41:22 -07:00
Inez Korczyński b6fc9d9217 Added ve.ce.FocusableNode mixin to ve.ce.MWReferenceListNode
So its selection looks better after a user clicks on it

Change-Id: I4343a67d7b488c42e40270d25b9b4104a07872fb
2013-06-17 21:22:34 +00:00
Ori Livneh ccfb14b99d Split test: instrument edit events for standard editor interface
This change adds 'page-edit-impression', 'page-save-(attempt/success)',
and '(section-)edit-link-click' events to the standard (non-VE) editor
interface, mirroring the events we added to VE. This makes the event data
usable for split-test analysis.

Change-Id: I51c441d61daa18d58ca7f62a9e5f07902a099050
2013-06-17 14:14:57 -07:00
Roan Kattouw d32abe903e Fix selectNodes() bug with empty non-content branch nodes
These kinds of empty nodes shouldn't occur since the converter fills
them with empty paragraphs, but selectNodes() should still behave
correctly for them.

Change-Id: Ia37f3db1c2a84b842e2311cf70642fa66af04d91
2013-06-17 19:09:12 +00:00
Roan Kattouw df97f759b1 Refactor selectNodes tests
* Move them from ve.example.js to ve.dm.example.js
** Also move lookupNode() and createDomElement() there
** Delete ve.example.js because there's nothing left in it
* Make main example document implicit, but allow override
* Specify nodes as arrays and do the lookup later
* Specify range and mode separately rather than calling selectNodes()
  during construction
* Construct statically rather than in a function
* Use expect( cases.length );

Change-Id: I620e949c5e612b32eaa57c5d9b60cc91f9ddbf02
2013-06-17 20:08:08 +01:00
jenkins-bot 8b414bf426 Merge "grunt: Also delete QUnit temp files when test fails" 2013-06-17 18:29:21 +00:00
Ed Sanders 4986576cc4 grunt: Also delete QUnit temp files when test fails
Move post-qunit task to qunit.done event which fires both on
success and failure.

Define pre-qunit + qunit as a group test 'unit', so they can
be run from the command line (previously 'grunt qunit' would
fail) as 'grunt unit'.

Also add override comment to css file using non-standard
property so csslint passes again (follows-up b2fbe35).

Bug: 49431
Change-Id: I5079d00a63d43276a12dd78c306bb3819470631d
2013-06-17 11:27:52 -07:00
jenkins-bot 59bf9966b4 Merge "Fix logical conflicts from the transclusion merge." 2013-06-17 18:14:29 +00:00
jenkins-bot 4cad5463d4 Merge "Code style fix: @return -> @returns" 2013-06-17 17:53:54 +00:00
jenkins-bot e02d9445b2 Merge "Build the internalList linmod even if it's empty" 2013-06-17 14:09:39 +00:00
Roan Kattouw 393925a868 Build the internalList linmod even if it's empty
Otherwise fun exceptions occur when you have a <references /> tag
with no <ref>s, for instance.

Also disregard the internalList in the data->DOM conversion, to prevent
a nasty interaction where the whitespace information on the last element
is considered invalid because it doesn't match the internalList's.

Plus test updates from hell because this touches ve.dm.example.data

Change-Id: I62881d9fc27fa081123856d1b35a6021af469271
2013-06-17 13:23:20 +01:00
Ed Sanders dcbea2328c Code style fix: @return -> @returns
Change-Id: I26daca6313bf09055af8f980ba0065782257fd54
2013-06-17 11:50:24 +01:00
Ed Sanders 642a84483e Fix logical conflicts from the transclusion merge.
Change-Id: Ic9d708cdba74c908d14839def5050c8825134c56
2013-06-17 10:36:47 +01:00
jenkins-bot 409afcbce9 Merge "Remove handling of old 'editsection' class" 2013-06-17 01:12:51 +00:00
David Chan a1eb56c14f splitClusters uses Grapheme Cluster Boundary rules
unicodejs.graphemebreak.js
* New file: singleton class with splitClusters method
* On load, builds graphemeBreakRegexp from unicodejs.graphemebreakproperties.js

unicodejs.js
* Remove old splitClusters method (was just a placeholder)
* Change "conjunction" -> "disjunction", for consistency and correctness

unicodejs.textstring.js
* Use new splitClusters method

modules/ve/ve.js
* Use new splitClusters method

unicodejs.wordbreak.text.js
* Add new splitClusters test
* Refactor charRangeArrayRegexp test to use splitClusters

PHP files
* add unicodejs.graphemebreak.js, unicodejs.graphemebreakproperties.js

.docs/categories.json
* add unicodeJS.wordbreak class

Change-Id: I8f512e2fc2c46eb4b5f00994a8dac88f3c8f7dd2
2013-06-16 21:46:02 +01:00
MatmaRex 704440eb56 Remove handling of old 'editsection' class
It's been replaced with 'mw-editsection' and all cached renders on
Wikimedia wikis have expired by now. All backwards-compatibility
occurences have been removed from MediaWiki core already.

Change-Id: Id3731222445b588de8aec0e86892879ac4472636
2013-06-15 20:02:48 +02:00
jenkins-bot df4e191020 Merge "Handle deletion programmatically always" 2013-06-15 00:12:21 +00:00
Inez Korczyński ec92614906 Handle deletion programmatically always
Change-Id: Ic68f80d92d32169ff60258b81a438e342b136128
2013-06-14 17:05:28 -07:00
Trevor Parscal fc8c46dd74 Reference name and group editing
Objective:

* Allow editing reference groups and names in the reference dialog

Bonus:

* Modify attribute transaction builder to support multiple attribute
  changes in a single transaction

Changes:

ve.ui.MWReferenceDialog.js
* Load ref name and group from model
* Save ref name and group, if changed, to model

ve.ui.ListAction.js, ve.ui.Transaction.test.js, ve.ce.ResizableNode.js
* Update use of newFromAttributeChange to newFromAttributeChanges

ve.dm.SurfaceFragment.test.js
* Add test for new changeAttributes method

ve.dm.InternalList.js
* Missing new line at end of file

ve.dm.Transaction.js
* Change newFromAttributeChange to accept an list of attribute changes and
  produce a single transaction that applies one or more attribute changes
  at once

ve.dm.SurfaceFragment.js
* Fix bug in getCoveredNodes where the wrong mode name was being used
* Add changeAttributes method, which applies attributes to all covered
  nodes and allows filtering of which types of nodes the attributes are
  applied to

ve.dm.MWReferenceNode.js
* Actually write key and group back to DOM
* Separate onRoot functionality into addToInternalList so it can be called
  separately (similarly onUnroot/removeFromInternalList)

ve.ce.MWReferenceListNode.js
* Clone internal item CE node before appending to avoid rendering bug.

*.php
* Add links to messages and sort them

Change-Id: Ic4121e4fcfc09265d5863af6f078cdeb77926c8e
2013-06-14 15:29:56 -07:00
jenkins-bot 3e1e544e48 Merge "Add group field to reference dialog" 2013-06-14 22:24:38 +00:00
jenkins-bot 86406d5e48 Merge "Outline controls" 2013-06-14 21:47:36 +00:00
Trevor Parscal ac26f5fc69 Outline controls
Objectives:

* Allow reordering items in outline widgets using an outline control
  widget
* Use an outline control widget to reorder transclusion parts

Changes:

ve.ui.SelectWidget.js
* Emit add and remove events

ve.ui.OutlineItemWidget.js
* Add movable config options
* Add isMovable method

ve.ui.OutlineControlsWidget.js
* New class
* Displays move up/down buttons which are synchronized with an outline
  widget
* Doesn't actually move items (since an outline widget is probably
  data-driven) just emits events

ve.ui.Widget.css
* Add disabled style for icon button widgets
* Add styles for outline controls widget

ve.ui.Icons*.css
* Add missing icon styles

ve.ui.Dialog.css
* Add styles for outline and controls in editable paged dialogs

ve.ui.GroupElement.js
* Fix bug where items are insertions are in the wrong place when "moving"
  them

ve.ui.PagedDialog.js
* Add editable config option which shows outline controls under the
  outline
* Pass through movable config option when creating pages

ve.ui.MWTranclusionDialog.js
* Configure paged dialog outline as editable
* Add initialize method to connect outline controls widget events
* Make addPart method automatically add parameters when templates are
  added
* Add handler for outline controls move event which re-orders parts
* Make parts movable (params are automatically ordered, so they aren't
  movable)

ve.dm.MWTransclusionModel.js
* Add addPart method and use it within the addContent and addTemplate
  methods
* Fix documentation lies
* Add getPartFromId method

*.php
* Add links to new files and messages

Change-Id: I919d4c3e9b85d07a97a99c0b2e8739a859bdf2b1
2013-06-14 11:56:30 -07:00
Ori Livneh fe54db5141 Log user ID; 'pageViewSessionId' to alphanum string
By default, EventLogging uses INT columns for integers, which pageViewSessionId
overflows. I changed it to a STRING type in the schema and am now generating it
using 'mw.user.generateRandomSessionId()'. I also introduced a 'userId'
property, per bug 49585.

Bug: 49585
Bug: 49586
Change-Id: Iddb9eb9c64b55b25445ddf9e474d312b685978a6
2013-06-14 11:19:24 -07:00
Trevor Parscal acea97263b Add group field to reference dialog
Change-Id: Icf9ea348cd97bdb09ddf18769f53c01ea5a8b7ef
2013-06-14 10:30:03 -07:00
Ed Sanders beaf7a588c Pass selection to ve.dm.Surface.change when pasting over text
Bug: 49551
Change-Id: I7497b5195961e46718c7382409a66b7eec1162a9
2013-06-14 11:50:08 +01:00
Roan Kattouw 0c16066eb3 Kill attribute order preservation
Per the bug report, it's useless because Firefox does not preserve order
in the .attributes array (but sorts it alphabetically instead), and so we
actually get the same exact behavior regardless of whether we use ordering
cleverness or just a straight-up plain object: order is preserved in Chrome,
and alphabetized in Firefox.

Bug: 48980
Change-Id: I1463d06db4900083dd4c565292bbabef09194b43
2013-06-13 23:17:08 -07:00
jenkins-bot bb59895d92 Merge "(bug 48335) Use more generic approach to filter out non-character key presses." 2013-06-14 03:34:44 +00:00
jenkins-bot 6144976c1e Merge "(bug 43082) Fix problem by calling surfaceObserver.stop( true ) first - before calling handleEnter." 2013-06-14 00:16:51 +00:00
jenkins-bot f814842108 Merge "Update 'wgCurRevisionId' after successful save" 2013-06-13 22:12:06 +00:00
Roan Kattouw 3674c8937b Send section edit links to VE by default
Add a preference to disable this behavior. Requires rewording by James.

Bug: 49260
Change-Id: I5ce7ea8c1e47e8243b619fc61aa957f767d22b48
2013-06-13 15:04:02 -07:00
Ori Livneh 1780b4e39c Update 'wgCurRevisionId' after successful save
Also updates the EventLogging code to use a computed property for
'wgCurRevisionId'.

Change-Id: Ida648c77f56c0e455d6fb49a779a831734f6776b
2013-06-13 13:30:14 -07:00
jenkins-bot 0bffa7b119 Merge "Improve category widget styling" 2013-06-13 19:27:57 +00:00
Trevor Parscal 6fba13b453 Improve category widget styling
Objectives:

* Get rid of the border and ensure pixel-perfect positioning of the input.
* Always render the arrow on the top right of the category item
* Make the popup positioning based on the arrow div's position and size

Bug 49420
Change-Id: I3ad4ff1c41e6108161b5b7c8718c676eb850de68
2013-06-13 19:26:29 +00:00
jenkins-bot dc4ceb9f56 Merge "Add ability to log analytic events using EventLogging" 2013-06-13 17:20:21 +00:00
Ori Livneh efba2cf8da Add ability to log analytic events using EventLogging
This change adds a '$wgVisualEditorEnableEventLogging' configuration
variable, accessible client-side as
'wgVisualEditorConfig.enableEventLogging'.

When true, the 'schema.Edit' ResourceLoader module will be loaded on the
page, and calls to ViewPageTarget.logEvent will forward to
mw.eventLog#logEvent.

When false, the module is not loaded, and ViewPageTarget.logEvent is a
no-op.

The change also adds a few calls to ViewPageTarget.logEvent to log certain
editor actions, documented in https://meta.wikimedia.org/wiki/Schema:Edit.

Change-Id: Iccd171d7cde15b0302d1b4c292bcbcc2a4b337ef
2013-06-13 10:14:53 -07:00
jenkins-bot 03127491b2 Merge changes Ic189011e,I7617a35b
* changes:
  Make references dialog scroll
  Make fieldset layout icons optional
2013-06-13 17:04:19 +00:00
jenkins-bot 628fd18930 Merge "Category popup fixes" 2013-06-13 15:30:07 +00:00
Inez Korczyński 44f57135f0 (bug 43082) Fix problem by calling surfaceObserver.stop( true ) first - before calling handleEnter.
Change-Id: I35c892581943057acbf9ddd638576e998cc82c1a
2013-06-12 17:14:57 -07:00
Trevor Parscal e2b7504b8e Category popup fixes
Objectives:

* Make category popup show "Category" rather than missing message -
this is more similar to other popups like inspectors, which identify
what that thing is that you are working on
* Fix alignment of icon and label in category popup

Changes:

ve.ui.Widget.css
* Make popup title align properly with the remove button

ve.ui.MWCategoryPopupWidget.js
* Update message key

*.php
* Add new message

Change-Id: Ia8051125bbc9bde47ceb931e1ebf42b2955481ff
2013-06-12 16:44:10 -07:00
Trevor Parscal d3a2fab2c4 Transclusion editing
Objectives:

* Rename just about every use of "template" to "transclusion"
* Make a proper data structure for transclusions
* Abstract away template data
* Use more template data in the user interface
* Allow adding parameters
* Allow removing templates, parameters and content

Changes:

ve.ui.Dialog.css
* Add rule to place add param controls on a single line

ve.ui.MWTemplateDialogs.js
* Move template spec loading into transclusion class
* Add remove button for parts and parameters
* Add parameter adding form
* Use template data for labels and descriptions

ve.dm.*
* Add new transclusion data structures

*.php
* Add links to new files

*.*
* Rename all things "template" to "transclusion"

Bug: 39598
Bug: 49403
Change-Id: I3bcf924a3e179cb65f19e833277a39dfd3dad8bd
2013-06-12 16:39:13 -07:00
Trevor Parscal caa16737d5 Make references dialog scroll
If the content in the sub-editor gets big enough, this can be a problem.

Change-Id: Ic189011e64090186d87a397b2b047057a97f2a3d
2013-06-12 16:24:38 -07:00
Trevor Parscal 91d615e684 Make fieldset layout icons optional
Change-Id: I7617a35bd9e8322d0b9f8e225885ccbe5fa230ee
2013-06-12 16:23:48 -07:00
Inez Korczyński 4e377629e3 (bug 48335) Use more generic approach to filter out non-character key presses.
Change-Id: Ie00becf1162f145134f006b0b4514ba874de9c43
2013-06-12 15:03:40 -07:00
James D. Forrester 9d40239e06 Media display and insertion no longer an experimental feature
Media item dialog for settings; drag-and-drop placement; caption
editing still to come.

Bug: 37870
Change-Id: I547e06dcdb92e19f0159660314187c4f1a62f3ed
2013-06-12 12:39:35 -07:00
jenkins-bot 5f30bd9ed6 Merge "References dialog cleanup" 2013-06-12 19:25:59 +00:00
jenkins-bot ed2018e58c Merge "Store empty annotations as alienMeta nodes" 2013-06-12 18:55:50 +00:00
jenkins-bot ddd88043fa Merge "Store alien meta items' dom nodes only" 2013-06-12 18:54:00 +00:00
Trevor Parscal 8f9d2a607e Cleanup unused dialogs
Objectives:
* Remove unused dialogs

Changes:

*.js
* Remove unused stuff
*.php
* Cleanup links to files and messages

Change-Id: Ie670afa3aef1757151e385bf922464b85f662a7d
2013-06-12 11:49:44 -07:00
Ed Sanders da51566d56 Store empty annotations as alienMeta nodes
Not a perfect solution, but better than deleting them completely.

Bug: 48605
Change-Id: I0f3a194f629b054f193a61af105733a555775d79
2013-06-12 19:46:41 +01:00
Trevor Parscal 2d044518bd References dialog cleanup
Objectives:

* Remove the whole toolbar subset thing, it's up to the creator of the
  subsurface to know what is and is now allowed, and the commands were
  still passing through unfiltered
* Correctly separate initialization from opening - fix issue where opening
  the reference dialog multiple times will keep adding more and more
  controls

Changes:

ve.init.Target.js
* Remove getToolbarSubset method

ve.ui.MWReferenceDialog.js
* Add toolbar tools and surface commands configs to reference dialog,
  including the things that are safe to use in references
* Move creation of field sets and reused controls to initialize method
  to prevent re-creation each time the dialog is opened
* Move static initialization stuff to the top near the other static stuff

Change-Id: I1c8577d17c506bac76e61b2b036655c59ef5a218
2013-06-12 11:27:49 -07:00
jenkins-bot 2bccb3da85 Merge "Replace alpha notice with beta label hiding the feedback link" 2013-06-12 17:16:42 +00:00
Ed Sanders 59bfc081df Store alien meta items' dom nodes only
We don't need to decompose and rebuild alien meta items
as they are uneditable, so just store the dom node and return that
in toDomElements.

Update test cases and several tests now need to use
assert.deepEqualWithDomElements.

Change-Id: I4d2eed267dac7855cb929a17d7aef566eaf0e287
2013-06-12 16:37:37 +01:00
jenkins-bot 06bf3b7864 Merge "mw.ViewPageTarget: Implement veaction=edit history state" 2013-06-12 11:16:31 +00:00
Trevor Parscal 18cde8a420 Actually fix bug 48556
Turns out that by skipping the last item, the following logic which
depended on that item being in the existing items list failed to keep
it's grubby hands off it.

Yes, I know I +2'd it. Shame on me too.

Bug: 48556
Bug: 48565
I93ce05f7cbb28313a3f0827539f0528c366aeb7e

Change-Id: If48e001b92c217bee0a35b6da41d1c1ff0e3271c
2013-06-12 01:53:14 +00:00