Commit graph

2818 commits

Author SHA1 Message Date
Catrope 6ef9fa78ff Fix ve.batchSplice() to behave in line with docs
* Actually return the spliced data like the docs claim we do
* Remove false claim that offset can be negative
* Add that data=[] && remove=0 is invalid; native splice() doesn't allow
  this, and there is a case where we call native splice() directly
* Add tests

Change-Id: I90e77c1b22ea1c36cb61e89ea47831885a0b1cb9
2012-10-30 10:05:49 -07:00
Trevor Parscal 82a15d66fc Merge "Fix copyObject/copyArray behavior with null values" 2012-10-30 16:59:02 +00:00
Trevor Parscal f5edece001 Merge "Add InspectorFactory to tests" 2012-10-30 16:58:28 +00:00
Catrope d30096ebd3 Fix copyObject/copyArray behavior with null values
Previously copyObject and copyArray would silently drop null values,
which is bad, especially considering we have example data for meta nodes
that has { 'key': null } somewhere.

Also added a test case that failed prior to this change.

Change-Id: I4f233cce041fbf38f701c494f1f78ac3d8535d88
2012-10-29 19:45:25 -07:00
Catrope 6df508cf8b Add InspectorFactory to tests
Tests were completely broken because the link inspector threw a JS error
when trying to register itself with the nonexistent inspector factory.

Change-Id: I8a47222f0a5a37348262ed939b37fbc47d14e222
2012-10-29 18:36:54 -07:00
Translation updater bot b81a88d75a Localisation updates from http://translatewiki.net.
Change-Id: I68ad405772ddbb85e56524563decfc8c0aeb8740
2012-10-29 21:53:00 +00:00
Rob Moen 765f7589ac Fix bug where link inspector / context overlay would no longer show.
Change-Id: I73281dc32eae5660662898d0290468434e7326d9
2012-10-29 10:56:11 -07:00
Translation updater bot 779356243f Localisation updates from http://translatewiki.net.
Change-Id: If8b4ce3c06dd78c26d44d0f73d00f3bdeac0226b
2012-10-28 21:17:46 +00:00
Translation updater bot 03ed368fd9 Localisation updates from http://translatewiki.net.
Change-Id: Ib9b8748fc9c687f17669d983373758006c47db91
2012-10-27 21:16:43 +00:00
Trevor Parscal f2a83960f8 (bug #41434) Converting format across 2 lists with paragraphs in between fail
Thanks to Roan for suggesting this fix.

Change-Id: I754dc34fbd3aaf2bdcb78bf89bfc896b612b4ee6
2012-10-26 15:18:44 -07:00
Trevor Parscal 21ea11c161 Really properly initialize static member before adding stuff to it
Kill them console log errors 'til they're dead.

Change-Id: I7329f4c869f46a9ef664af8ab49cb2504abdf972
2012-10-26 15:10:01 -07:00
Trevor Parscal cd0b28d407 Properly initialize static member before adding stuff to it
This was causing a console error

Change-Id: Ic394cf4d4821bd7c03fd32bb9e202801dccde085
2012-10-26 15:02:24 -07:00
Catrope a87ffeefa1 Merge "Whitespace and comment cleanup on ve.ce.SurfaceObserver" 2012-10-26 21:59:00 +00:00
Catrope 62cf91cd24 Merge changes I0de5d327,I589ecba3,I840f7242,Ie786fa3d,I04723499,Ibde934d5,I993f4cbe
* changes:
  Add commands to ve.Surface
  Tools changes
  UI context reorganization, inspector rewrite, iframe refactor, icon generalization
  Add ve.Action, ve.ActionFactory, subclasses
  Add ve.dm.Surface.has{Past,Future}State, add docs
  Add ve.dm.Node.hasAttributes()
  Add ve.dm.Node.hasMatchingAncestor()
2012-10-26 21:54:02 +00:00
Trevor Parscal 3142a4e66f Add commands to ve.Surface
First stab at a simple command interface. This and commandFactory
will be refactored significantly before this code is put into
action.

Change-Id: I0de5d3271198c987baf06fb3011aebdc1671f498
2012-10-26 14:50:23 -07:00
Trevor Parscal 238feeb881 Tools changes
* Rewrite of all tools, dramatically simplifiying them and decreasing
  duplication
* Tools are now created using a tool factory instead of
  a make-shift facility built into the toolbar
* All UI object have a surface or a toolbar reference instead of a
  surface view

Change-Id: I589ecba36bf715b452d03c8fd5c0547dc3c1dc61
2012-10-26 14:48:27 -07:00
Rob Moen 9563f0880d UI context reorganization, inspector rewrite, iframe refactor, icon generalization
* Only show the inspector if the selected text has an inspectable annotation
* Replace the inline menu with a toolbar containing inspectable annotations
* Change the appearance of the inspector to match new mockups
* Add the trash can icon for removing annotations
* Move iframe handling code into a class that manages all that nonsense

Change-Id: I840f72426f9a9e50054a28de950393f0e9913153
2012-10-26 14:46:11 -07:00
Trevor Parscal 735ed96f5f Add ve.Action, ve.ActionFactory, subclasses
Moved implementation of all the tools into a reusable action
system. To execute an action just call

surface.execute( actionName, method, param1, param2, ... );

This helps keep tools simple, and opens the door to key commands
reusing the same code.

Change-Id: Ie786fa3d38d1ea17d39b5dfb8eeeb5f2256267ce
2012-10-26 14:44:17 -07:00
Trevor Parscal ed7273da25 Add ve.dm.Surface.has{Past,Future}State, add docs
Will be used by the history tools in a future commit, providing
a reasonable interface to this information rather than the tool
reaching into private members.

Change-Id: I0472349968e9b48ec17eb47b6845ec9ccf3811e2
2012-10-26 14:43:09 -07:00
Trevor Parscal fcbe1d7b9c Add ve.dm.Node.hasAttributes()
Will be used in future commits to reduce duplication.

Change-Id: Ibde934d5a55b980010e84b6242f8d968e88cea54
2012-10-26 14:42:40 -07:00
Trevor Parscal 79944333a4 Add ve.dm.Node.hasMatchingAncestor()
Will be used in future commits to avoid traversing up the tree and
comparing type and attributes.

Change-Id: I993f4cbe20018406dbb4a3c9d1ce2f8766f8e1ba
2012-10-26 14:41:49 -07:00
Catrope b05616892d (bug 37843) Trying to edit a blank page fails
Explicitly check for false, because the empty string does not signify a
failure.

Change-Id: I8857d39e1a20080c8419c6165be2b5ad0cdbacd2
2012-10-26 14:00:43 -07:00
Translation updater bot 93e089cf38 Localisation updates from http://translatewiki.net.
Change-Id: I12c7cea5120485b963ea1dad105fbab579426485
2012-10-26 19:45:13 +00:00
Trevor Parscal 7d741253f3 Add ve.dm.SurfaceFragment.getAnnotations()
Change-Id: Ifb731e8fdd0f111f5da4ac0d882adaad3f48fdce
2012-10-26 11:03:51 -07:00
Catrope bc8b042e5f Merge "Fix annotation object creation in SurfaceFragment" 2012-10-26 17:53:10 +00:00
Trevor Parscal 44a78129c4 Whitespace and comment cleanup on ve.ce.SurfaceObserver
Change-Id: Ice4058f1041f3d0118c7955122b8ea4d538790e0
2012-10-26 10:27:54 -07:00
Trevor Parscal 52f1aac90a Merge "Test: Enforce # of expected assertions." 2012-10-26 16:48:18 +00:00
Krinkle b6b899c396 Merge "Documentation fixes" 2012-10-25 21:19:05 +00:00
Timo Tijhof 4cc2101ffd Test: Enforce # of expected assertions.
Change-Id: I041c792d1841f69677f8c7d38f67108475a0afc9
2012-10-25 22:06:07 +02:00
Translation updater bot 1cb270417e Merge "Localisation updates from http://translatewiki.net." 2012-10-25 20:05:11 +00:00
Translation updater bot a764d0b350 Localisation updates from http://translatewiki.net.
Change-Id: Ib8b826ea7d5d2b6080d71a9cf2fc4ac6f375bd6a
2012-10-25 20:04:29 +00:00
Krinkle dae235111c Merge "Fix JS error in ve.setProp()" 2012-10-25 19:55:16 +00:00
Catrope 84efb81e7e Fix JS error in ve.setProp()
Attempting to descend into a string or number would cause a JS error,
because we would attempt to create prop[arguments[i]] as an empty object
(which is ignored), then try to descend into it (which blows up because
it's undefined, even though we've just set it). Guard against this by
explicitly checking for non-object-ness.

Change-Id: Ie65550baaae0ab88476c9a1ff40cc136090740a0
2012-10-25 21:54:45 +02:00
Trevor Parscal 4e87a7a79b Fix number of doc sync tests
Follow up to I84f0368b1d7b601ed0766806607152dc97f34603

Change-Id: Ic1e9de1e755b8966b6e964b01b00f4d99d27245e
2012-10-25 11:06:12 -07:00
Catrope 2c1683ecff DocumentSynchronizer fix and cleanup
* Adjust the range in the annotation synchronizer, otherwise we emit
  events for the wrong node
* Expanded test suite to the point where it was able to catch the bug
  caused by not adjusting annotated ranges
* Removed selection.length === 0 check, no longer needed because
  selectNodes() now throws an exception in this case
* Added a FIXME comment about duplicate update events that occur when
  length adjustments are combined with something else
* Add a few more comments

Change-Id: I84f0368b1d7b601ed0766806607152dc97f34603
2012-10-25 11:02:58 -07:00
Trevor Parscal 551a30bc64 Merge "Actually use nodeOuterRange, selectNodes() has provided this forever" 2012-10-25 18:00:15 +00:00
Trevor Parscal fe5c5b78f9 Merge "Reorganize text-only replacement detection" 2012-10-25 17:56:45 +00:00
Trevor Parscal 8e7facf222 Merge "Guard transactions against double commit/rollback" 2012-10-25 17:55:56 +00:00
Trevor Parscal 9c51bb2d7b Merge "No longer copy data in ve.dm.Document constructor" 2012-10-25 17:54:23 +00:00
Catrope f1dbdac3d8 Actually use nodeOuterRange, selectNodes() has provided this forever
Change-Id: Ie1d3cbb6e475248927d10f411cf383f701a3ad71
2012-10-24 17:48:48 -07:00
Catrope 5d5335b498 Reorganize text-only replacement detection
* Lift node assignment out of the if/else
* Flip the condition so we detect text-only replacements rather than
  non-text-only replacements
* Additionally assert that there is exactly one selected node, and that
  it is a text node

Change-Id: Iaaddf532f06709e860ac44457470e6d8bfcb6dd9
2012-10-24 17:48:20 -07:00
Catrope 29cff8c105 Guard transactions against double commit/rollback
* Store the applied state in the Transaction
* Store the Transaction in the TransactionProcessor (previously, only
  its operations were stored)
* Have commit() and rollback() throw exceptions when passed transactions
  with the wrong applied state
* Add tests for this behavior

Change-Id: I27b7a96fdf4d3555d78f64c05a03702ea560c802
2012-10-24 17:47:41 -07:00
Catrope 43f1612324 No longer copy data in ve.dm.Document constructor
The data array is now taken by reference, and the caller must perform
any copying required.

Changed tests to make a deep copy of shared data sets (mostly
ve.dm.example) before passing them to ve.dm.Document().

Change-Id: Iedc64f9fd9cd689640de9a19379cf5f3db94a2bb
2012-10-24 17:32:35 -07:00
Catrope aa2836aa6e Remove 'internal' property from DM nodes
There's no use case for keeping a deep copy of the 'internal' property
in the node tree, and it was breaking some of my new tests concerning
change markers. We could keep internal data in the node tree if we
wanted to, but to be correct we'd have to synchronize every time we
changed it, which is a pain.

Change-Id: I024de1ff8b6b6154da82c103c4bb21db8ff2ec14
2012-10-24 16:47:14 -07:00
Trevor Parscal 8c3802308e Fix annotation object creation in SurfaceFragment
Also add a comment about how the way data is passed to a new annotation
needs to be improved

Change-Id: I693e4f5632b4eae0d2ee3468ee979454314f6364
2012-10-24 16:47:04 -07:00
Trevor Parscal f17fc65c41 Documentation fixes
Change-Id: I5020623ba59cd9d1794b7d1f97d3adf77b833d6e
2012-10-24 16:47:04 -07:00
Trevor Parscal b8dc697f17 Merge "ve.ui.CommandFactory: Initial implementation" 2012-10-24 18:48:40 +00:00
Timo Tijhof 34cbc729db ve.ui.CommandFactory: Initial implementation
Based on https://github.com/ccampbell/mousetrap.

Cleaned up to fit our coding standards, pass JSHint, and assume
jQuery's fixes where possible (e.g. no need for an addEvent
utility, no need for filling e.target, e.which, etc. cross-browser
which jQuery.Event already does).

Initially all were local functions in the constructor, but to
allow some customisations in subclasses moved various methods
to the prototype instead and marked with @private.

Really, only .register() must be called from the outside. The rest
assumes normalisation etc. or might break things if called
incorrectly.

Change-Id: Ic69a3c70759052094aefbeab623d885f8b118e14
2012-10-24 17:48:16 +00:00
Timo Tijhof 37f3a288ec Standards: Fix global variables and pass JSHint.
Follows-up:
* IK 714e29d30f
* IK 3b8a5ae4d5
* IK 72eb2825e5
* RK 7fe7182f43
* ...

Change-Id: I671f08e4899bfb9508cef272190ec72721a0af9a
2012-10-23 00:53:48 +02:00
Timo Tijhof 5b8aa91fe8 Upstream: jQuery 1.8.2, QUnit 1.10.0.
* http://code.jquery.com/jquery-1.8.2.js
* http://code.jquery.com/qunit/qunit-1.10.0.js
* http://code.jquery.com/qunit/qunit-1.10.0.css

Change-Id: Id254d377557ee690acfd44cf6b33a5f60f152f6e
2012-10-23 00:31:27 +02:00