.text() returns empty for comment nodes, where textContent returns
the contents of the comment node.
Change-Id: I5e2798a6dba9d0f8fc13d5c0f78fe1fd255f1ebe
When you cursor onto a FocusableNode, it's selected, and we focus the
paste target as part of our hack to make copying FocusableNodes work
in Firefox. But then when you press the arrow key again, that event
isn't picked up by anything, and you can't move the cursor off the
FocusableNode using the keyboard.
Fixed by attaching the EventSequencer to this.$ (which is the parent
of $documentNode and $pasteTarget) and listening for focus/blur on
both $documentNode and $pasteTarget.
Bug: 54443
Change-Id: I7bddcfa9fa6f38908e315c97623bd27133daa98d
ve.ce.Surface.js
* changeModelSelection: store selection temporarily for bounce detection
* onChange: do nothing if bounce is detected
Change-Id: I758e7a72a5690463f12f456419c6e471dd29a9db
Due to Firefox' Ctrl-A creating an outer selection (0,len) as
opposed to inner select like in Chrome (1,len-1), deleting leaves
the document completely empty (with no cursor anywhere in the
document).
However, setupSlugs() wasn't inserting a slug because the internal
list still existed (so this.model.length !== 0).
Using this.$.children().length instead.
Bug: 50947
Change-Id: I1517ebcc5b31e2544559b851174482b0c872b24b
Logic was failing because we were passing the index of the annotation
within the AnnotationSet, instead of the index within the Store, to
containsIndex().
Bug: 54332
Change-Id: Ibfd9abe6e4b44d9db744e0c5019418eee12f84a4
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
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
Pass an extra parameter to show() to let it know when the menu is
just being moved, and therefore doesn't need to perform the fade-in
transition.
Change-Id: I2cf2ff07db6cc7d226f3d626755792a06dfcbe54
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
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
* 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
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
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
This is obviously necessary, but wasn't done, so calling update()
with a config object was broken.
Change-Id: I30d67bcb117885c792c0f08ea55d60cb294de18b
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