Commit graph

5279 commits

Author SHA1 Message Date
Timo Tijhof f1ab7c1b09 ApiVisualEditor: Separate save/diff switch case
They no longer overlap (except for 3 lines of code). The
double switch case for save/diff 90% of the body being if-save
and elseif-diff doesn't make sense.

Change-Id: Ic6f014393e72901bb5ab4449d946d94b87429e52
2013-06-28 15:54:55 -07: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
Translation updater bot 9e81731ff1 Localisation updates from http://translatewiki.net.
Change-Id: Id6a1a3cade03355049f713585407e005aa699c8b
2013-06-28 13:58:30 +00: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
Translation updater bot 3a1cc27aaa Localisation updates from http://translatewiki.net.
Change-Id: Iacd23ddc7096a766606a8b76e04ce285b96fc2d8
2013-06-27 19:56:54 +00: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