Commit graph

6276 commits

Author SHA1 Message Date
jenkins-bot 29f047ea89 Merge "Fix issues with copy-pasting MWTransclusionNodes" 2013-12-12 00:45:28 +00:00
jenkins-bot 9a68595f71 Merge "Add recursion to removeHtmlAttribute" 2013-12-12 00:44:29 +00:00
Ed Sanders f0e9ec7922 Fix issues with copy-pasting MWTransclusionNodes
ve.dm.MWTransclusionNode
* Implement getClonedElement to remove originalDomElements
  and originalMw. We don't want to put these in the clipboard
  as there is no guarantee they are the rendering of the current
  set of parameters (a refresh may be in progress) and they may
  confuse the converter on the way back in.
  Remove about attribute to prevent about grouping of duplicated
  nodes.
* Set an extra attribute to flag that the outputted DOM doesn't
  have any generated content attached to it that can be stored
  on load.
* Check for said attribute in toDataElement and skip the
  storeGeneratedContents step. This will trigger an async update
  of the generated contents on paste.

ve.ce.Surface
* Call cloneElements before writing to pasteTarget so data in external
  clipboard is stripped of generated contents.

ve.dm.Node
* Only strip data-parsoid as other attributes may be meaningful.

ve.dm.mwExample, ve.dm.Node.test
* Update tests

Bug: 58241
Change-Id: I3e15cc97e94747647078204a0b398e6ac3ec6382
2013-12-12 00:02:11 +00:00
Ed Sanders ba2636c787 Add recursion to removeHtmlAttribute
This is pretty straightforward because the htmlAttributes data
structure is so simple...

Change-Id: Ie46fcc0715c4aecb984e73dc81a5297673f2c3ea
2013-12-12 00:02:11 +00:00
James D. Forrester bd94ff92bb Initial re-styling of the toolbar
Move all text styles, and the remove styles button, into a new 'list' toolbar
group, using the text-styles icon. Less-used text styles (strikethrough, code
and underline) are demoted, with remove styles at the end, and bold and italic
promoted.

Now re-label the "More" catch-all to now be "Insert", which is what's left.

Change-Id: I66a1bba347ea64e540106b1090995b3117a8b1b2
2013-12-11 23:41:12 +00:00
jenkins-bot 1fb7446738 Merge "Re-label the formula inspector to not be LaTeX" 2013-12-11 23:12:01 +00:00
jenkins-bot 9489984127 Merge "Strip empty spans after style attributes have been removed" 2013-12-11 23:11:00 +00:00
Ed Sanders dc5269f249 Strip empty spans after style attributes have been removed
We already do this for removeHtmlAttributes mode.

Add tests in ElementLinearData and ce.Surface. Get rid of unused
clipboardHtml param in ce.Surface tests as it is unused and replace
with clipboardKey flag which tests the VE->VE paste path.

Change-Id: I0cd82a37d6e765ecab489dc22f642ebbcfbb5387
2013-12-11 23:01:23 +00:00
jenkins-bot 67dad75ddd Merge "Format MW example HTML" 2013-12-11 22:28:31 +00:00
jenkins-bot 5009eaed5b Merge "Move removeHtmlAttribute into ve.dm.Model" 2013-12-11 22:27:20 +00:00
Ed Sanders 0da40d1c09 Format MW example HTML
For readability

Change-Id: I7e58fd71a0a34e2e11bf93b1f088e4c87795b748
2013-12-11 22:03:15 +00:00
Ed Sanders a1c1016bae Move removeHtmlAttribute into ve.dm.Model
Make available only as a static method so you don't accidentally
change a node without using a transaction.

Change-Id: If27442b502ec176a58e75ef4f9afa5119d06dcc5
2013-12-11 22:02:36 +00:00
James D. Forrester 68d077fa70 Re-label the formula inspector to not be LaTeX
Because users like to understand labels.

Bug: 53251
Change-Id: Iab24371161f278f07e516478a864d957859c32ae
2013-12-11 13:05:27 -08:00
Translation updater bot 942946cec1 Merge "Localisation updates from https://translatewiki.net." 2013-12-11 20:31:05 +00:00
Translation updater bot f6c5722b1f Localisation updates from https://translatewiki.net.
Change-Id: Ia3cd64ae99a564324c09a134eb32aacbbf269e75
2013-12-11 20:29:53 +00:00
jenkins-bot 04c9f79834 Merge "Don't select nodes inserted by a dialog, but drop cursor after" 2013-12-11 20:25:50 +00:00
Roan Kattouw 970cf03cc8 Followup 5d7673eb: still adjust width/height when positioning fails
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
2013-12-11 19:54:44 +00:00
jenkins-bot 447fcb94c7 Merge "Add language code to language dialog" 2013-12-11 19:38:14 +00:00
Ed Sanders 60262b883e Move resetting of paste state variables to after afterPaste
So that if the function bails with a return they are still run.

Bug: 58346
Change-Id: Ibd0f194e9c31e2b023dbd00a13ade51785f78ae6
2013-12-11 19:22:42 +00:00
Ed Sanders a38b1d9420 Allow tables to contain captions!
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
2013-12-11 15:42:09 +00:00
Roan Kattouw 536df35ed1 Add language code to language dialog
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
2013-12-11 02:42:20 +00:00
jenkins-bot 286f2b1581 Merge "Rename big/small stack to undoStack & newTransactions" 2013-12-11 02:41:28 +00:00
jenkins-bot cc65c7a704 Merge "Text style icon" 2013-12-11 01:46:50 +00:00
jenkins-bot b45107021a Merge "Put the shim from 9abad038 back (was reverted in b9bbf60f)" 2013-12-11 00:34:46 +00:00
jenkins-bot e4668d4c63 Merge "Remove ve-pasteProtect class when falling back to clipboardData" 2013-12-10 22:02:08 +00:00
Translation updater bot c6cf993c2d Localisation updates from https://translatewiki.net.
Change-Id: Ic5d1dee35d8347ea461681eacc51f1e2e0789e81
2013-12-10 20:44:55 +00:00
Ed Sanders c1f88f50ee Remove ve-pasteProtect class when falling back to clipboardData
We already do this on the pasteTarget.

Change-Id: Idcc7ed34daebfb5ed14925eb5ee8526d1001a2f1
2013-12-10 20:11:35 +00:00
Ed Sanders 333166e818 Fix paste sequence in Firefox
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
2013-12-10 19:17:12 +00:00
Roan Kattouw 728077039d Put the shim from 9abad038 back (was reverted in b9bbf60f)
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
2013-12-10 11:11:10 -08:00
jenkins-bot 7e9f214acd Merge "Add missing tests to FlatLinearData" 2013-12-10 17:58:59 +00:00
jenkins-bot 04377b5cac Merge "Organise Flat/ElementLinearData methods and tests" 2013-12-10 17:56:45 +00:00
jenkins-bot 8ce640f263 Merge "Remove references to 'document' in LinearData classes" 2013-12-10 17:55:12 +00:00
Ed Sanders 2e0b523ddc Add missing tests to FlatLinearData
Change-Id: I5a5f2c55928359951c4b811b75662517cec07540
2013-12-10 17:52:37 +00:00
Ed Sanders 6c231be8ab Organise Flat/ElementLinearData methods and tests
Move containsElementData to FlatLinearData next to isElementData. Move
tests for both methods to FlatLinearData.test.js.

Change-Id: I07a192f5925da7cc763efe5e41427f1f47d85850
2013-12-10 17:51:36 +00:00
jenkins-bot 094326fedd Merge "Sync JSON i18n for 1a5bdd5" 2013-12-10 17:28:52 +00:00
Roan Kattouw b6a35aa96d Sync JSON i18n for 1a5bdd5
Change-Id: Ib9c7219e4f9ae5893439eec7059519d2f24cd5f2
2013-12-10 09:09:45 -08:00
Ed Sanders 191d610b21 Remove references to 'document' in LinearData classes
This is left over from when all these methods where in ve.dm.Document.

Change-Id: Iec18aeddc7c8575f72550053c6278ff37a1d6000
2013-12-10 17:07:44 +00:00
jenkins-bot 41397bba1d Merge "Check the selection has collapsed after pasting" 2013-12-10 17:03:15 +00:00
jenkins-bot 9bf0f5b93e Merge "Show full language names in the MW language dialog" 2013-12-10 17:00:53 +00:00
Ed Sanders 80f5f12451 Check the selection has collapsed after pasting
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
2013-12-10 15:52:27 +00:00
jenkins-bot 150a9586eb Merge "Revert "Shim for VisualEditor.i18n.php that reads JSON blobs"" 2013-12-10 02:44:16 +00:00
Jforrester b9bbf60ffb Revert "Shim for VisualEditor.i18n.php that reads JSON blobs"
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
2013-12-10 02:41:25 +00:00
Roan Kattouw 96000558a2 Don't select nodes inserted by a dialog, but drop cursor after
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
2013-12-09 18:02:18 -08:00
jenkins-bot d2250acc59 Merge "Don't move the cursor to the top of the page after closing a dialog" 2013-12-09 23:21:18 +00:00
Roan Kattouw 29532f15db Don't move the cursor to the top of the page after closing a dialog
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
2013-12-09 15:17:53 -08:00
jenkins-bot 273ce5086c Merge "Only strip style attributes on rich paste from VE" 2013-12-09 22:59:06 +00:00
Translation updater bot 711d578486 Localisation updates from https://translatewiki.net.
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
2013-12-09 22:30:48 +00:00
Ed Sanders 6a52fba643 Only strip style attributes on rich paste from VE
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
2013-12-09 22:25:43 +00:00
Roan Kattouw 9abad0385d Shim for VisualEditor.i18n.php that reads JSON blobs
For performance we might also want to provide a conversion script
that generates a static PHP file.

Change-Id: I6a72bb3ec23c90fc5740327a7e46b4d805562779
2013-12-09 13:20:29 -08:00
Roan Kattouw 2fa725599c Add missing specialcharacters messages to JSON blobs
These were accidentally dropped when I rebased my commit
that imported all i18n messages into the JSON files.

Change-Id: I2f5611f3dbe1a31134426184a9d5648ffc751947
2013-12-09 13:19:17 -08:00