instanceof Node doesn't work with nodes generated by the iframe hack
for some reason. Instead, use duck typing by checking for a .cloneNode
method.
>>> ve.createDocumentFromHTML('<body><tt>Foo</tt></body>').body.childNodes[0]
<tt>Foo</tt>
>>> ve.createDocumentFromHTML('<body><tt>Foo</tt></body>').body.childNodes[0] instanceof Node
false
Change-Id: I1ea1253bd204d1070cd01b666b8a90f1cb7e5e14
CSSJanus flips left for right for RTL languages. To ensure proper positioning of phantoms, the phantom container must actually be set to left:0, not right:0. Added the @noflip option before the phantoms selector to prevent CSSJanus from modifying it.
Change-Id: Id7662362d117d6c5719b9b98d7a0dbf62e9ba3ff
The toolbar has a high z-index when being floated, it doesn't need one
otherwise. This was causing an issue where the Vector actions drop-down
menu was being obscured.
Change-Id: I3c0ff7c4cf3b4a6c3d94f00ef56d7f299aeb6020
Currently when running this maintenance script it outputs
the full path to the i18n file. This was done that way because
of .docs/generate.sh (which pipes it to php through stdin).
This however means that currently the output is not suitable
for pasting into demo and test index files (as the path should
be relative for those).
The --fixdir option will function as toggle between a fixed
path to the directory on disk, or a dynamic resolution at
run-time. The default is the latter. generate.sh passes --fixdir.
Change-Id: Idebca553587aaff9b31255d884461f4a51e70afd
As jQuery hash problems in some cases converting HTML, it is
easier just to store the original DOM elements.
The bulk of this commit is fixing the tests as although we have an
assertion for comparing DOM elements, we don't have one for comparing
objects or arrays which may contain DOM elements.
ve.js
* copyObject & copyArray fixed to run cloneNode(true) on any item
of type Node.
* Added callback function so an object/array can be copied with
modifications.
ve.qunit.js
* Added deepEqualWithDomElements: Using the new copyObect/Array
callback, we can copy the incoming object and convert any nodes
to node summaries, then just run the normal deep equal comparison.
ve.dm.AlienNodes.js
* Instead of storing HMTL we store cloned DOM elements which we can
send straight back to the converter without any processing.
ve.dm.example.js
* Updated tests to expect DOM elements instead of HTML.
ve.dm.Converter.test.js
* Updated tests to use deepEqualWithDomElements
Bug: 47737
Change-Id: I3df8f49b170c31da9610129d53cf8cb65dd5d5f8
In this case, selectNodes() returns the paragraph, which is not a content
node, and so newFromContentBranchConversion() decides to do nothing at all.
This change makes newFromContentBranchConversion() more intelligent about
finding the content branch to operate on, fixing cases such as these
where selectNodes() returns the content branch itself rather than one of
its children.
Bug: 41203
Change-Id: I710fbf184ef5ef84d9c2f5bca2b115e0660f5b8f
Matma Rex (Bartosz Dziewoński <matma.rex@gmail.com>) has done some useful
things for us and it's time to note him in the AUTHORS.txt file. :-)
Change-Id: I903437833e119e4f8eb89991cee1b9a0821954ce
fixUpInsertion now returns an object with both data and offset
which allows offset changes.
Within fixUpInsertion we lazy-generate first/lastChildStack which
is a list of parent nodes for which the current node is the first/last
child. Whenever we try to close off a node we check these stacks and
if they are populated we instead use a recursive call to start
fixUpInsertion again but with the offset shifted by 1.
Bug: 46799
Change-Id: Ic51dd03725c11f1f7e279929534ee3afea14d662
Previously, if we didn't know about a property type we would just drop it.
This led to various fixes to add support for booleans, nulls, etc. We're
now having problems again, this time with functions not being copied.
So instead of only copying types we know how to copy, deep clone the ones
we know how to and shallow copy the ones we don't know about. This seems
like a saner approach to me. Besides, it doesn't seem like cloning a
function is even possible in JS.
Change-Id: Idd1546ce3a43087a8b96a37101431e466e02f04f
The tests passed just fine in Gerrit, because it runs the tests via
MediaWiki using ResourceLoader, which was able to load jquery.client
just fine from MW core.
Change-Id: I004514ab761107b687be2fe1ff49ecfd25bead5b
Changed:
VisualEditor.i18n.php
* Updated Link inspector i18n messages
ve.ui.MetaDialog.js -> ve.ui.PagedDialog
* Moved paging functionality into Paged dialog
ve.ui.EditorPanelLayout -> ve.ui.PagePanelLayout.js
* Renamed from EditorPanelLayout to work nicely with the concept of
stacks and pages
ve.ui.GroupElement.js
* Added addItem method and change addItems to use it
ve.ui.Dialog.css
* Updated classname as per refactor of meta dialog
ve.ui.StackPanelLayout.js
* Set currentItem property on showItem
* In addItems method, show currentItem with class method
** rather display block on element
ve.ui.Layout.css
* Make editorPanel layout 100% in width.
ve.ui.Widget.css
* Added CategoryWidget and CategoryPopup styles
* Other adjustments
ve.ui.PopupWidget.js
* Added auto-close on loss of focus
* Made friendly with being initialized inside a frame
ve.ui.MWLinkTargetInputWidget.js
* Mixin ve.ui.PendingInputWidget and remove pending methods
* Prevent querying on spaces
* Reintroduce i18n messages for menu sections
ve.ui.MenuWidget.js
* Update cases of $input config property to input
New:
ve.ui.PagedDialog.js
* Refactored base-class for mwMeta dialog (and probably other dialogs
too)
* Abstracts adding and accessing pages
ve.ui.PendingInputWidget.js
* Moved pushPending and popPending methods into pending class
Change-Id: I29bcd92b7b5641941a4e98e65b2a56424a5263ff
Because we have a node for <table>, we also need one for <caption>,
otherwise we'll try to alienate it and fail.
Added the test case as a separate example document so Ed can use it
for his tests.
Removed test case asserting <caption> is alienated.
Change-Id: I3a917db58e6c0eb97899b214b07d01fc8d86b56d
Firefox fires key press events for arrow keys - but we handle them
already in keydown - so the solution is to just ignore those
key presses in the handler.
Change-Id: I1aff295a0958b75697c4d362e0d6095283f37fe8
Previously, they were only being deduplicated based on the transaction,
which meant that an undo was seen as a duplicate (but then if you undid
again, that wasn't a duplicate).
Change-Id: If432ea28e6c206a2ad5562e529e2d3ed808c20e4
Parsoid switched from <!doctype> to <!DOCTYPE>, which exposed the fact
that our dirty regex to detect whether we're dealing with a full
document or a fragment was case-sensitive. Made it case-insensitive.
Change-Id: Ia8a38488e06ca7d7a6fb9a9699b5d9b5c5eb03f2
Clearing by type in SurfaceFragment didn't actually work. Instead,
it followed a code path intended for setting and created an annotation
of that type with no data, then tried to clear that. What we really
want to do there is clear anything with that type.
This fixes the bug where unbolding of text that was already bold in
the article didn't work.
Bug: 47680
Change-Id: I77f00e63c8732420063b0453fede7f453083c913
We're no longer doing dark-launch deployments for the VisualEditor
so this is unnecessary and a bit messy.
Bug: 42936
Change-Id: I0e55faca4eabe910d9b4d8ca8c6b4b0bd42e8539
In most places we call .contains we already know the index, so we
can avoid store lookups by using .containsIndex.
Change-Id: I45a9a421473f9bec479ab8ccceceb162b7004c3a