ve.ui.Context#updateDimensions does two things: it updates the position
of the popup by measuring where the selection is, and it updates the
width and height of the popup by measuring the contents of the inspector
or the context menu.
In some cases, measuring where the selection is fails, and
ve.ce.Surface#getSelectionRect returns null. This seems to only happen
1) in phantomjs while running the test suite and 2) when an inspector
is opened and doesn't adjust the selection while opening. I suspect
it has something to do with the selection not having been recently
set or the documentNode not having focus, but I haven't investigated
this in depth yet.
Prior to 5d7673eb, the editor would simply crash of the position
measurement failed. 5d7673eb changed this to just bail completely if
the position couldn't be measured, but that's also wrong. Without a
position measurement, we can't update the position of the popup, but
we can still adjust its width and height, and we should.
The failure to adjust the popup's width and height in this case was
causing a bug where opening the link inspector with the selection
set exactly to what the inspector would expand it to would cause the
popup's width and height to never be adjusted, and most of the inspector
to be invisible.
Bug: 58301
Change-Id: Ia6504e0a7b0cd1affbff2632e9f573684f1d5dcb
Captions were not in the allowed lists of children for tables.
This causes an exception to be thrown if you try to do fixUpInsertion
on a transaction containing captions.
Bug: 58318
Change-Id: I866e015c14e787830c45da93dfed9d2119fb0865
Bonus: give both the language name and page name
lang and dir attributes.
Further bonus: reintroduce message that was deleted
earlier with all of its original translations.
Change-Id: Id137ff9a069799b6c09574b72f450eac6665d144
It appears that if the pasteTarget is given focus too close to the
range being set it may not take effect in time. Moving up to before
any of the selection setting logic seems to fix the issue.
Bug: 58283
Change-Id: I9bfb0ab6952863496fb3548e6804cb347d52cc57
The shim triggers bug 58249, but that's not as bad as we thought.
It turns out LocalisationUpdate still finishes despite the scary
exception, it just skips VisualEditor and finishes the rest successfully.
I will work on making the LU error more useful, and eventually
making it support JSON blobs, but the shim isn't causing a
lot of damage for now.
Change-Id: I92f11524d891e901f1a089dd8cad1232478a5ee4
Move containsElementData to FlatLinearData next to isElementData. Move
tests for both methods to FlatLinearData.test.js.
Change-Id: I07a192f5925da7cc763efe5e41427f1f47d85850
In Chrome you can paste the empty string which triggers
the paste events but doesn't change the paste target. This
results in the insertion of the context character on empty
lines. To avoid this we can detect if the selection we put
around the context character is still there and abort the
paste.
Bug: 58138
Change-Id: Ib73465a2376cd316dbac6ce2567ecb64bc500307
This reverts commit 9abad0385d.
I guess for now we'll just have to keep these in sync manually until MW core is updated.
Bug: 58249
Change-Id: I243303bdcbd048248776866fa12a17fc8279b80f
It used to be that when you closed a dialog, the thing that the dialog
inspected or inserted would be selected. For insertions, the selection
will now be collapsed immediately after the inserted node.
For modifications, the original behavior was kept, as it makes sense to
keep selecting the node that the user had to select in order to access
the dialog. For removals (only possible in the transclusion dialog),
the selection ends up as a collapsed selection at the location where
the removed node used to be; this was already behaving correctly,
as we get this behavior for free with offset translation.
Bug: 54957
Change-Id: Ibd14e8084d67a9ee85e3bac075c3fb50f27b05b2
And other focus behavior fixes.
ve.ce.Surface.prototype.focus:
* Restore focus to the pasteTarget if a focusedNode was selected.
This function is invoked when a dialog is closed, and we were
always focusing the documentNode, which means the selection was
restored incorrectly when the selection was really in the pasteTarget.
ve.ce.Surface.prototype.documentOnFocus:
* Don't rerender the model selection if the documentNode was focused but
a focusedNode is selected. Otherwise the user can never deselect a
focusedNode.
ve.ce.Surface.prototype.onModelSelect:
* Rerender the selection even if prev === next. This function was
already called as a means to rerender a lost selection, and it didn't
work if it so happened that the selection was still the same and was
on a focusedNode.
* Clear the surfaceObserver state when moving focus from the
documentNode to the pasteTarget. If we don't do this, then placing
the selection back in the documentNode at the exact same place where
it was before will not be noticed by the observer.
ve.ui.Context.prototype.onSurfaceFocus:
* Hide the context only when an inspector is open, not just when the
context popup is visible. This ensures that the context is still
hidden when the user clicks out of an inspector, but fixes a bug
where the context was hidden when the selection was restored on
an inspectable focusedNode.
Bug: 58090
Change-Id: I0658f025a9c6005d769fd0291380fcb9c1ba4f32
This is a full export of the recently converteted i18n of
VisualEditor. The conversion script should generate output in
this format, so that future diffs for localisation updates
remain as small as possible.
Change-Id: I03c3223f51027b97d7962553e80afd741991c9af
Stripping all HTML atributes (to avoid CE-added styles such as
'font-size: 1em;') also strips data-parsoid which can cause
round trip errors. As an improvement only strip the style
attribute.
Bug: 58136
Change-Id: I34386bd847d1cf0583317a8b07916e43ff7af029
For performance we might also want to provide a conversion script
that generates a static PHP file.
Change-Id: I6a72bb3ec23c90fc5740327a7e46b4d805562779
These were accidentally dropped when I rebased my commit
that imported all i18n messages into the JSON files.
Change-Id: I2f5611f3dbe1a31134426184a9d5648ffc751947
Split the i18n messages into four groups:
* oojs-ui (moved to the oojs-ui repo in a separate commit)
* VE core
* VE-MW (MediaWiki-specific things)
* VE-WMF (Wikimedia-specific things)
The VE-WMF group is new, and we'll split WMF-specific code out into
it later, for now it's just messages associated with that code.
Each language has its own JSON file at modules/MODULE/i18n/LANG.json
Kept messages in VisualEditor.i18n.php as the master copy, because
TranslateWiki can't deal with the JSON files just yet. Added a script
to rebuild the JSON files from the PHP file.
Change-Id: I94e084b2f10994f41324fd08a05ff7f8391ea2eb
Becuase big/small stack doesn't really mean anything.
Bonus: rename the transactions property of the stack item from
'stack' to 'transactions'.
Bug: 49754
Change-Id: I361dda49f4c1e58a541df5b9e478cf20957939a1
These aren't optional in SVG files. Browsers will display them without,
but dropping them breaks MIME type detection, which breaks data URI
embedding: the underline-u icon was being embedded as data:text/plain,...
Bug: 58119
Change-Id: Ia790877fcd536f2714626ccf47beadd09cb4fac9