Commit graph

6056 commits

Author SHA1 Message Date
Roan Kattouw 1bf58252ce Implement ve.dm.Surface.prototype.undo() and redo() in terms of change()
...or really changeInternal(), so we can avoid adding undo transactions
to the undo stack.

Also get rid of the pattern where undo() and redo() return a selection
which the caller then has to restore, and instead just restore the
selection.

Bug: 53224
Change-Id: If5a3b4d4162e9f0713ee9cd26e79a66efe52770f
2013-10-25 18:29:48 +01:00
Roan Kattouw b7ee30d4e4 Enslave dm.Surface to dm.Document
* Replace surface 'transact' event with 'documentUpdate' event
* Have surface listen for all document transactions and update selection
  as appropriate (as well as emitting 'documentUpdate')
* Implement change() in terms of setSelection()
** Queue 'contextChange' events so contextChange is only emitted once
** Use this.transacting flag to prevent setSelection() (which is called
   because the model emits transact events) from doing too much
** Behavioral change: lock/unlock now emitted separately for
   transaction and selection changes

Change-Id: I44425d260ec70758f99d13f99e41f5c993d260c2
2013-10-25 18:29:48 +01:00
David Chan 04cbbef4ee Remove dm.Surface's 'change' event
ve.dm.Surface.js:
* Stop emitting 'change' and remove its event documentation

ve.ce.Surface.js:
* Listen to 'select' instead of 'change'
* Perform a CE surface update after model-based keydown handling

ve.dm.Surface.test.js:
* Stop asserting that 'change' is emitted

Change-Id: I8f16289493e835d890709c6dfe093d04c18522b6
2013-10-25 18:29:13 +01:00
Zeljko Filipin aa3c569e28 [browser test] Workaround for the problem when Cucumber hook executes twice
Bug: 56116
Change-Id: I99bf48b1452647b42edd97dc47e8664b08b7667a
2013-10-25 17:26:05 +02:00
Zeljko Filipin e6cd405abf [browser test] Use the latest version of mediawiki-selenium gem
Change-Id: I14baca7b9cfb6a76a4e026ea5c6673b87ced3c0f
2013-10-25 15:10:56 +00:00
Translation updater bot 0128c0d92c Localisation updates from http://translatewiki.net.
Change-Id: I7aabcf823be64924fd40b0733ac1d6aa23529871
2013-10-24 20:51:52 +00:00
jenkins-bot 044e2e289c Merge "Split ext.visualEditor.experimental into specific modules" 2013-10-24 14:05:33 +00:00
Ori Livneh 56a9484149 Filter DOM load/save deferreds through ve.track callback
Binding ve.init.mw.Target#onLoad and the anonymous function which calls ve#track
with timing data to the resolution of the same deferred makes the timing
measurement sensitive to how long it takes ve.init.mw.Target#onLoad to yield,
which in turns depends on whether the requisite ResourceLoader modules for
setting up the editing surface are ready. This muddles the definition of what
we're actually measuring, making it dependent on a race condition.

This patch moves the tracking call to a filter function through which the jqXHR
deferred is threaded. This ensures that the 'duration' datapoint on the domSave
and domLoad events captures just the time spent talking with the API.

Change-Id: I6e162014a4043d4ff9422131ae87fb25d0ab4c29
2013-10-23 22:44:27 -07:00
Roan Kattouw 412eb34de8 Split ext.visualEditor.experimental into specific modules
Math, hiero, language and alienextension are now each in their own
module. Kept the experimental module for backwards compatibility,
it just has all of its constituent modules as dependencies.

MWExperimentalTool.js was split up, and ExperimentalTool.js was
renamed to LanguageInspectorTool.js.

Change-Id: I63b49dfbdb59dc9a494049553cc0c01e89e48826
2013-10-23 16:20:30 -07:00
jenkins-bot 43e96d7927 Merge "doc: Adding missing @static to a static dm.GeneratedContentNode method" 2013-10-23 20:38:07 +00:00
Ed Sanders 58fba521e0 Use jsdifflib for QUnit diff
Because QUnit's inline diff is terrible for large diffs,
especially when there are block whitespaces changes.

Change-Id: I786fb981b02777ede38c4bee261f9e32f8f908ed
2013-10-23 20:31:17 +00:00
jenkins-bot 7c4e3cb35b Merge "Revert "Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check"" 2013-10-23 20:31:08 +00:00
Krinkle 661e43c245 Revert "Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check"
> Uncaught TypeError: Cannot call method 'connect' of undefined

This reverts commit fb4dcf3030.

Change-Id: I9db92e7bf339260d8de0a9406842bdb241b8ee80
2013-10-23 20:28:55 +00:00
Timo Tijhof e7d27cd04b doc: Adding missing @static to a static dm.GeneratedContentNode method
Follows-up 62c06d0.

Change-Id: I7746ab1d0a445c69e29a0fde96773a89b4108dd5
2013-10-23 22:08:47 +02:00
jenkins-bot 2f2a2207aa Merge "Make category suggestions dropdown appear below the input box" 2013-10-23 19:38:10 +00:00
jenkins-bot 3132bc8a24 Merge "Followup c41f96c: doc parameter in ve.dm.InternalList constructor is not optional, remove check" 2013-10-23 19:31:15 +00:00
jenkins-bot a75dd77ada Merge "Add Moriel Schottlender to AUTHORS.txt and authors string" 2013-10-23 19:21:29 +00:00
jenkins-bot 3191c47d10 Merge "Added SVG logos in new style, rm'd old pngs" 2013-10-23 19:20:40 +00:00
Translation updater bot a1700b0dc2 Localisation updates from http://translatewiki.net.
Change-Id: Ie35d9436bf267ee758f9bfa773a26c06d6dcee66
2013-10-23 19:03:51 +00:00
Roan Kattouw 53e4c370ea Migrate away from using the 'change' event in dm.Surface
Instead, listen to 'select', or to 'transact' on the dm.Document.

This commit only fixes uses outside of the dm/ce.Surface ecosystem.
ce.Surface still listens to 'change'.

ve.init.mw.ViewPageTarget.js:
* Rename onSurfaceModelTransact to clearSaveDialogDiff and bind it to
  the document's transact event instead
* Rename onSurfaceModelChange to checkForWikitextWarning and bind it
  to the surface's transact event. This is needed because the function
  inspects the surface's selection, which isn't yet in a consistent
  state when the document's transact event fires

ve.ui.MWReferenceDialog.js:
* Rename onSurfaceChange to onDocumentTransact and rebind accordingly

ve.ce.ProtectedNode.js:
* Get rid of onSurfaceModelChange
* Instead, bind positionPhantoms to the document's transact event
  directly, and only bind it while phantoms are visible

ve.ui.Context.js:
* Rename onChange to onModelSelect and rebind accordingly
* Rename afterChange to afterModelSelect
* Drop check for undefined selection, no longer needed now that we're
  listening to a finer-grained event

ve.ce.Surface.test.js:
* Listen to 'select' instead of 'change'

Change-Id: Ifeb1a1fc5427696f2aae5441d4b54dde366793e0
2013-10-23 11:54:35 -07:00
Roan Kattouw ede989445e Make dm.Surface's 'select' event more useful
It was previously emitted before the selection was updated and with the
old selection as a parameter. Instead, emit it afterwards, and make sure
it's emitted even if the selection changes because it was translated
for a transaction.

Also correct its event documentation, which seems to have been copied
from a UI class somewhere.

Change-Id: I521eff0095959572587c0ecffd24dbf322e12d82
2013-10-23 11:28:09 -07:00
James D. Forrester 89f039f62d Add Moriel Schottlender to AUTHORS.txt and authors string
Change-Id: Id6e540aaa4d7b51e068a41f8eceba6b386fa2064
2013-10-23 11:24:03 -07:00
Zeljko Filipin 904c5a48ad [browser test] Moving shared code to mediawiki-selenium Ruby gem
Bug: 53579
Change-Id: I4ef8b63f485b0274f252cf95e566f0484615e8cf
2013-10-23 16:43:51 +00:00
jenkins-bot 1b13df5155 Merge "Use update rather than show in focusable node re-render" 2013-10-23 15:57:19 +00:00
Roan Kattouw febc0f567f Defer selection-triggered updates in ve.ui.Context
Move selection change handling (closing the popup if open, and updating
the context toolbar) to .afterChange(). Every time .onChange() detects
a selection change, it schedules a call to afterChange(). These calls
are batched so that multiple selection changes in the same tick cause
afterChange() to be called only once.

Deferring these updates causes them to no longer occur while a 'change'
event is being emitted. This means that if an inspectors' close handler
calls .change(), that call is now no longer nested inside another
.change() call and doesn't run afoul of any render locks set by the
caller of the outer .change().

Bug: 54675
Change-Id: Iae2f41a83b5d64251a54e42303100e84a5c25561
2013-10-23 15:12:47 +00:00
Roan Kattouw a12446d795 Ignore change events while opening and closing inspectors
AnnotationInspector changes the selection from both its open and close
handlers, which can cause recursive calls to .hide() and .update()

Change-Id: Ic334f9b8b335fe1aaac2dc98dc6ea9fd9d5707ff
2013-10-23 14:41:24 +00:00
jenkins-bot fad9ae6c50 Merge "Use a sane recursion guard in ve.ui.Context.prototype.hide()" 2013-10-23 13:49:45 +00:00
jenkins-bot 7f7c29cde2 Merge "Fix typo in documentation for ve.ce.View.prototype.getModel" 2013-10-23 13:45:26 +00:00
Ed Sanders ac2a839607 Use update rather than show in focusable node re-render
Update checks if there's actually a context menu to show. We also need
to pass through the parameters for show.

This was causing the last-shown context menu to appears after resizing
an inline image (which has no context menu).

Change-Id: I8f46f71e2fba6896fe10054f0d2a679c6f23eb9c
2013-10-23 14:35:55 +01:00
jenkins-bot f3565f2ed8 Merge "Followup 1878c7c5: fix check for nonexistent property .draggingAndDropping" 2013-10-23 12:49:01 +00:00
Timo Tijhof 6560cfda2b Remove simpleArray utilities from ve.js and use oojs instead
Change-Id: I23710ff50378f4069b8a0dea89f0491884acd377
2013-10-23 03:26:53 +02:00
jenkins-bot 5bd6ea0e93 Merge "Update oojs to v1.0.5" 2013-10-23 01:19:27 +00:00
Timo Tijhof b7a4dcdbdf Update oojs to v1.0.5
Code:
  http://trevorparscal.github.io/oojs/releases/oojs-1.0.5.js

Release notes:
  https://github.com/trevorparscal/oojs/blob/v1.0.5/History.md

Change-Id: I1117bd5bef70783039db18849f85215fcb346ada
2013-10-23 03:16:21 +02:00
Roan Kattouw 20bdb78512 Followup bb03e8f: fix toolbar floating
Small mistake splitting the ooui commit, whoops

Change-Id: I166df38234f432ab2ef00e7d156e49cba16ede99
2013-10-22 23:19:22 +00:00
Timo Tijhof c42840541e Add bin/ directory with updateStaticLoaders and generateDocs
Adding a symlink in .docs/generate.sh because of Jenkins and
possibly other uses.

Change-Id: Ieb56852d0d0b978fbc1cbb873204d9e457cf969c
2013-10-22 23:51:51 +02:00
jenkins-bot f2be711ee0 Merge "Rename ui.Tool.static.canEditModel to isCompatibleWith" 2013-10-22 20:53:46 +00:00
jenkins-bot 30c429bd9d Merge "Rename oo.js to oojs.js per library name" 2013-10-22 20:52:53 +00:00
jenkins-bot a011603ef2 Merge "Remove oo from ve.js closure" 2013-10-22 20:52:01 +00:00
jenkins-bot ad8a95ead5 Merge "Remove ve.Factory and ve.Registry and use oojs instead" 2013-10-22 20:51:09 +00:00
jenkins-bot 6c6fcf1dbd Merge "Cache multiple requests for $resizable's offset" 2013-10-22 20:30:18 +00:00
jenkins-bot a2587ce927 Merge "Recalculate $resizable offset when positioning resize label" 2013-10-22 20:28:27 +00:00
Ed Sanders c543fef85f Cache multiple requests for $resizable's offset
Both the resize handles and the size label position themselves
using $resizable's relative offset, so we can optimise by
caching that result.

Change-Id: Ic225b15cfcece8d5c2e782e1e667d854f805c6fb
2013-10-22 20:27:36 +00:00
Ed Sanders 1efa327121 Recalculate $resizable offset when positioning resize label
Because it can change. Currently the resize label is not
positioned correctly if you use three of four resize handles.

Change-Id: I1a28bc57fda1097c94047fd7690ad8d403cdd478
2013-10-22 20:23:42 +00:00
Translation updater bot 776e9d4b9c Merge "Localisation updates from http://translatewiki.net." 2013-10-22 19:25:48 +00:00
Translation updater bot bc45e38a7a Localisation updates from http://translatewiki.net.
Change-Id: I93cd3eba912f2ae9aac9e1fb45cb38ae7d775e3a
2013-10-22 19:22:15 +00:00
Trevor Parscal e41d4d470f Rename ui.Tool.static.canEditModel to isCompatibleWith
Change-Id: Ic7583f0966946c870f38a2e7ad06e558238c8794
2013-10-22 21:20:09 +02:00
Roan Kattouw 36fc3b5911 Rename oo.js to oojs.js per library name
Change-Id: I9f02a4438a18243022506b5a2fcc445af03aa945
2013-10-22 19:18:32 +00:00
Trevor Parscal fae7f130e4 Remove oo from ve.js closure
Instead use OO directly. Also remove ve.createObject, which is
unused now that ve.Registry and ve.Factory have been moved to oojs.

Change-Id: I3470b6660107ddd0bdf4a43c50d191a1bb1cc4d8
2013-10-22 19:18:27 +00:00
Trevor Parscal 26a1d8986b Remove ve.Factory and ve.Registry and use oojs instead
Change-Id: I2717300e6cc6102296a2b8d063d344fa5897c825
2013-10-22 19:15:18 +00:00
Trevor Parscal b635541de2 Remove ve.getHash and use getHash from oojs instead
Change-Id: Ib688a3ba0ab07e0d0dc328a3878440756d1103fe
2013-10-22 19:14:23 +00:00