Commit graph

5585 commits

Author SHA1 Message Date
cmcmahon f5e18e45a2 refactor to use Scenario Outline and REUSE_BROWSER env var
Change-Id: I65970c0df35bcac48f16899090cadc8df8c560c6
2013-09-27 11:36:53 -07:00
cmcmahon 7849be8ec0 indent/outdent is conceptually different than bullets strings
Change-Id: I8fec64d6d01148f18588a8af7336e9791f88640b
2013-09-27 09:08:37 -07:00
jenkins-bot 7a7b31b267 Merge "Move repeated code for creating a test ve.ui.Surface in utils" 2013-09-27 12:03:03 +00:00
jenkins-bot 8a5d4c55eb Merge "Fix JS error in ve.ui.ClippableContainer" 2013-09-27 10:59:33 +00:00
Ed Sanders 807df9827e Move repeated code for creating a test ve.ui.Surface in utils
Pattern is used in half a dozen places, so let's use a utility function.

Change-Id: I3e2d0024f0a2887c32ba96537195dd374a11c560
2013-09-27 11:53:51 +01:00
jenkins-bot 8fc5fd5822 Merge "Implement live preview in MWMathInspector" 2013-09-27 08:12:35 +00:00
Roan Kattouw 069eefe343 Fix JS error in ve.ui.ClippableContainer
Sometimes, .clip() would be called when clipping had already been
disabled again, and accessing this.$clippableContainer would cause
an error. This happened to me when typing quickly in MWLinkInspector.

This probably happens when enabling and disabling clipping right after
each other in response to the same event, such that the setTimeout()
for the initial clip is run after clipping has already been disabled.

Change-Id: I0f85ea5f10955188bae51160e1c88eca858ea1bf
2013-09-26 17:39:35 -07:00
cmcmahon 2fb1313f7e VE link not immmediately present since opt-in change, especially in Chrome
Change-Id: Ia0baff017b3b887f06182b1c8630b2270bc8823b
2013-09-26 23:11:02 +00:00
Roan Kattouw b8a0512237 Implement live preview in MWMathInspector
250ms after the user stops typing, we rerender the node with what they've
typed so far.

Bonus:
* When using MathJax, tell it which node to rerender
* Avoid crash when trying to unwrap wrapper paragraph

Change-Id: I623eef48e40d480cc98766cf7daf75dacd0bde19
2013-09-26 14:59:16 -07:00
jenkins-bot 164d16eb86 Merge "Fix timing of rerender event in GC nodes" 2013-09-26 21:46:09 +00:00
jenkins-bot bea113fee2 Merge "Introduce newFromDocumentReplace() transaction builder" 2013-09-26 20:45:54 +00:00
Ed Sanders 515ad01713 Fix timing of rerender event in GC nodes
Move the triggering of the rerender event into an overridable method
'afterRender'. Some nodes don't have the correct dimensions
immediately after rendering their DOM elements as they may need
to wait for images to load, or for a script to run (e.g. MathJax)

Change-Id: If204f665dcb2fd69d00a183279056d11188ddd74
2013-09-26 21:39:39 +01:00
jenkins-bot 52a26ebd8e Merge "make test DRY, use Before hook" 2013-09-26 19:32:00 +00:00
jenkins-bot 23dd5f9fb9 Merge "'Config' -> 'Configuration' in all comments" 2013-09-26 19:02:30 +00:00
cmcmahon 5d84372f36 make test DRY, use Before hook
Change-Id: I6f127e675a3c9e7b6126c0f052dce781d1103b52
2013-09-26 18:01:37 +00:00
jenkins-bot f2c48e82b9 Merge "Missing param comments in methods updating popup widget" 2013-09-26 17:58:34 +00:00
Ed Sanders a69ce9b2b6 Missing param comments in methods updating popup widget
Change-Id: Id90ba76719472fe0b61e9d232b5cf72f086af915
2013-09-26 15:26:54 +01:00
jenkins-bot d01cd4cb0e Merge "Allow MWExtensionNode to render with arbitrary text/attributes" 2013-09-26 13:12:19 +00:00
jenkins-bot 642e6e7b97 Merge "Pass config object from ce.GeneratedContentNode.update() to forceUpdate()" 2013-09-26 13:03:57 +00:00
jenkins-bot 9fbdd32986 Merge "Make undo work for changes to MWExtensionNodes" 2013-09-26 12:40:39 +00:00
Roan Kattouw cf17789985 Introduce newFromDocumentReplace() transaction builder
Replaces newFromNodeReplacement(). newFromNodeReplacement was very
simplistic and didn't support metadata or internal list items, so
if you had comments or references inside of the data you were editing
(reference contents or an image caption), they'd get mangled.

With this, you can do:
newDoc = doc.getDocumentSlice( node );
// Edit newDoc
tx = ve.dm.Transaction.newFromDocumentReplace( doc, node, newDoc );
surface.change( newDoc );

and that takes care of metadata, internal list items, and things like
references that reference internal list items.

ve.dm.Document.js:
* In getDocumentSlice(), store a reference to the original document
  and the number of items in its InternalList at the time of slicing
  in the created slice. This is used for reconciliation when the
  modified slice is injected back into the parent document with
  newFromDocumentReplace().

ve.dm.InternalList.js:
* Add a method for merging in another InternalList. This provides a
  mapping from old to new InternalList indexes so the linear model data
  being injected by newFromDocumentReplace() can have its InternalList
  indexes remapped.

ve.dm.Transaction.js:
* Replace newFromNodeReplacement() with newFromDocumentReplace()

ve.ui.MWMediaEditDialog.js, ve.ui.MWReferenceDialog.js:
* Use getDocumentSlice/newFromDocumentReplace for editing captions/refs
* Change insertion code path to insert an empty internalItem/caption, then
  newFromDocumentReplace into that
* Add empty internalList to new mini-documents

ve/test/dm/ve.dm.Transaction.test.js:
* Replace newFromNodeReplacement tests with newFromDocumentReplace tests

ve-mw/test/dm/ve.dm.Transaction.test.js (new):
* Add tests for newFromDocumentReplace with mwReference nodes

ve.dm.mwExample.js:
* Add data for newFromDocumentReplace with mwReference tests

VisualEditor.hooks.php:
* Add new test file

Bug: 52102
Change-Id: I4aa980780114b391924f04df588e81c990c32983
2013-09-25 21:46:38 +00:00
Ed Sanders 81d8699249 Various context menu display issues
* Check the popup fits within the node horizontally as well
  as vertically before embedding.
* Calculate the position of the node relative to the document.
  Previously we assumed the parent was the document and so used
  jQuery#position but this is not the case if a custom $focusable
  is passed to FocusableNode.
* Forcefully re-show the context menu on resizable node mouse up.
  This is apparently done automatically by a redraw event, but if
  the user just clicked on a resize node without dragging the context
  menu would be lost.

Change-Id: Id477a30827c9393a446e9c44466c83dabc7e0ab4
2013-09-25 21:54:59 +01:00
Ed Sanders e6f48c5c93 'Config' -> 'Configuration' in all comments
Because the former isn't a real word.

Change-Id: Ie6ed15f9e390b357bbaa768b57f3c3fd7cf21181
2013-09-25 11:23:16 +01:00
jenkins-bot 26de3d7d51 Merge "Fix use of removed function isUniqueListKey" 2013-09-25 10:11:41 +00:00
jenkins-bot 05ec83657e Merge "Fix variable names in newFromInsertion" 2013-09-25 03:44:27 +00:00
Ed Sanders 0a49efe9e7 Fix variable names in newFromInsertion
Documentation says third argument is 'data' when in fact it is
'insertion' which is then re-used as the result of fixupInsertion :/

Change-Id: I17c959f858eddddc90a6fa839da0d32da69a784f
2013-09-24 20:06:01 -07:00
Roan Kattouw 336029d11f Fix use of removed function isUniqueListKey
Function was removed in eb64743436 but one caller was still left,
which caused VE to throw a JS error when opening the reference dialog
to insert a new reference.

Change-Id: I827381bfe3bdeecdbaa1fba55a09b3e8e03575a6
2013-09-24 19:18:36 -07:00
Roan Kattouw c5ccc9fcbc Allow MWExtensionNode to render with arbitrary text/attributes
The config object in GeneratedContentNode exists for this purpose,
so let's use it :)

Change-Id: I567c3eee5fc26979aa0dff93071a9c461d27058b
2013-09-24 16:57:51 -07:00
Roan Kattouw 7ed197c7a6 Pass config object from ce.GeneratedContentNode.update() to forceUpdate()
This is obviously necessary, but wasn't done, so calling update()
with a config object was broken.

Change-Id: I30d67bcb117885c792c0f08ea55d60cb294de18b
2013-09-24 16:57:51 -07:00
Roan Kattouw 885c0a5495 Make undo work for changes to MWExtensionNodes
If you changed the contents of an alien tag extension, then tried to
use undo, the change wouldn't be undone, but the undo state would
toggle.

This was because we only kept one copy of the data-mw object for these
nodes and modified that one copy. Instead, create a new copy every time
we modify it, so we can actually go back to previous states.

Change-Id: Ib4d5d460a6fdda9c3b0968f269585d620b47fdd8
2013-09-24 16:57:51 -07:00
jenkins-bot 1546485fed Merge "No more configuration overrides" 2013-09-24 22:11:06 +00:00
jenkins-bot 8ecbfa05b5 Merge "Add abstract method for getMediaSources." 2013-09-24 19:47:43 +00:00
Ed Sanders 888de344d9 Delete empty nodes instead of merging into them
When you press delete inside an empty node (e.g. Heading) that
node should be removed, instead of the paragraph beneath it being
merged into and effectively converted. If the heading is non-empty
then merging is still the correct behaviour.

Also add in test case.

Bug: 50254
Change-Id: If9cee79feb4b4ee9d7c367e392b00fee5e8c0669
2013-09-24 18:27:07 +00:00
jenkins-bot 37c416dd24 Merge "Detect collapsed range inside focusable node in ve.ce.Surface#onChange" 2013-09-24 17:21:43 +00:00
cmcmahon a855dd067a don't run VE test on beta for anon, since VE is now opt-in
Change-Id: If6690ff82c23fe69544d087efb51ae4c6b1891fb
2013-09-24 10:18:19 -07:00
Ed Sanders 0c2b6c353e Detect collapsed range inside focusable node in ve.ce.Surface#onChange
When the document starts with a focusable node, and we try to initialise
the selection to [1,1], the current logic does not detect that as being
on the focusable node and tries to do a native selection.

Bug: 54446
Change-Id: Ib515c435314c35c4e9b3802da117b963b3ef4169
2013-09-24 16:53:55 +01:00
jenkins-bot e4a05cef7b Merge "Allowing for config data when instantiating dialogs" 2013-09-24 15:53:50 +00:00
jenkins-bot 4717bd9248 Merge "Revert drag marker GIF to previous version" 2013-09-24 15:52:03 +00:00
jenkins-bot fbf126e972 Merge "Add basic ve.ce.tests and fix documentation" 2013-09-24 15:38:46 +00:00
jenkins-bot 5625071142 Merge "Updates to support jsduck 5.x" 2013-09-24 15:37:56 +00:00
Ed Sanders 8547dbc032 Tests for handleDelete in ve.ce.Surface
Trigger fake delete/backspace events and assert changes to the DM.

Change-Id: I69659a3e49b6520376cac3c795e8a96e7fbda9ae
2013-09-24 15:32:37 +00:00
jenkins-bot d1b2ef6525 Merge "Don't apply attributes to GC wrapper" 2013-09-24 15:31:38 +00:00
Ed Sanders e1b158880e Don't apply attributes to GC wrapper
this.$ on a GC node is just a wrapper, so shouldn't take the
HTML attributes from the model, otherwise you may end up with
double borders and padding.

Change-Id: I5641df341c9b118461e7e8fb89266dd300e09755
2013-09-24 11:04:30 +01:00
jenkins-bot 9740d1683e Merge changes I9e065aa4,Iac7649f4
* changes:
  MW*ImageNode's can't take link annotations
  Node annotation blacklists
2013-09-24 00:09:22 +00:00
Erick Guan 30f1ed4c75 No more configuration overrides
In various places in the UI code, certain properties of config objects
were overridden and in some cases the configurations were documented as
private as a strange hack to prevent them from being advertised in the
docs.

I, Trevor, have been convinced of the error of my ways, and gladly
reverse this situation, allowing all configurations to always be
overridden when desired, while still allowing default values.

Change-Id: I242e3b1902dec8e09eeea38fa64381e69ee04215
2013-09-23 23:59:14 +00:00
jenkins-bot 48c60153a6 Merge "Extend SurfaceToolbar into TargetToolbar" 2013-09-23 23:48:41 +00:00
jenkins-bot 2f4c41ae01 Merge "Add opacity-setting class to GC nodes when generating" 2013-09-23 23:47:13 +00:00
Ed Sanders 3541502b97 Make more types of node relocatable
In this instance, MW(Extension|Reference|Transclusion)Nodes.
In general anything that is focusable should probably be relocatable
by default. We should considered this when we sorting out the
focusable/protected/relocatable mess in the near future.

Change-Id: Ifc55e251cba3e875798d5103540d02ad651399ad
2013-09-23 23:38:16 +00:00
jenkins-bot 5144b8b23c Merge "Cleanup action methods" 2013-09-23 23:35:20 +00:00
jenkins-bot 9a6fa4fb77 Merge "Ignore all node attributes in clipboard hash" 2013-09-23 23:01:43 +00:00