Commit graph

5024 commits

Author SHA1 Message Date
James D. Forrester 00088bbf05 Use the same new toolbar for media and reference dialogs
With blocks comment out where they're not wanted.

Bonus: Actually make the pasteSpecial command available in these
contexts.

Bug: 58404
Change-Id: Ic77c252ddc9ae54019b2d86ee5f8a6f4febf4292
2013-12-12 19:22:50 +00:00
jenkins-bot 46c708df2f Merge "Make commands aware of their symbolic names" 2013-12-12 18:48:07 +00:00
jenkins-bot cf03ad7616 Merge "Render CE MWBlockImageNodes as styled <figure>s" 2013-12-12 18:47:12 +00:00
jhall d35cc1e573 [Browser test] Update to use new text styling menu
Also removed some duplicated code and
added test cases for bold and italic styling.

Change-Id: I181c208dd1165ea52bd4c49eb00c2eaae41ef05f
2013-12-12 10:37:48 -05:00
jenkins-bot aad149fa43 Merge "Add getDomSubtreeFromModel to converter API" 2013-12-12 17:41:00 +00:00
jenkins-bot 67bd5488da Merge "Rename getDataFromDom to getDataFromDomSubtree" 2013-12-12 17:37:04 +00:00
Ed Sanders 92dab00f60 Add getDomSubtreeFromModel to converter API
This means we no longer have to inject the store/internalList etc.
state into the converter manually before generating DOM.

Change-Id: I9d1f5f2592a7c5bf4ad404416b79ad65afd83b9c
2013-12-12 14:37:18 +00:00
Ed Sanders 1e83bd03b3 Rename getDataFromDom to getDataFromDomSubtree
To match its inverse getDomSubtreeFromData, and to make clear
that the input can be any subtree, not just a full document.

Change-Id: I4853bb6def0059eda43f86f0dcb6dd44309dc35d
2013-12-12 11:58:41 +00:00
Roan Kattouw 4c98f753a0 makeStaticLoader: Update fake standalone init module
* Don't add ext.visualEditor.base to it, and strip of ve-mw stuff
** .base doesn't contain ve-mw stuff any more, so no stripping needed
** Instead of appending .base, just load .base and create a
   separate fake module for Standalone init.

* Don't manually register .sa files
** Instead use ext.visualEditor.standalone, it's right there.
** Add missing CSS file to .standalone.

* Documented the purpose of 'Dependencies' and removed scripts
  from that fake module that don't fall under that rationale and
  instead add them as regular modules (rangy, unicodejs).

* Removed weird 'jquery' dependency in 'ext.visualEditor.core'
  module. This is strongly recommended against, and might
  actually cause jQuery to be reloaded due to outstanding bugs
  in core with the state machine in the startup queue (jquery, mediawiki).

* Unlist unused 'jquery.client' dependency in makeStaticLoader.
  As per the module definitions in VisualEditor.php, this is
  only used by the .mediawiki module. Grepped modules/ve/ and
  found 0 uses.

* Update dependency order to roughly match the dependency tree
  as it is specified in ResourceLoader (e.g. rangy is for .core,
  not .base).

* Keep fake modules out of ResourceLoader.

Change-Id: I2a31543e5ad2fc39f5980fea855172108eda4428
2013-12-12 03:34:42 +01:00
Roan Kattouw e754b07539 Rebuild static loaders
Had apparently gotten out of sync

Change-Id: Ib2d576ec5b5db2fe6fec468fd053dfc8a029747a
2013-12-12 01:32:33 +00:00
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
Moriel Schottlender f1123f87f5 Render CE MWBlockImageNodes as styled <figure>s
This change is meant to transform the current block image node rendering
in ContentEditable from the nested <div> structure to a <figure> tag more
closely matching Parsoid's output, with CSS to style it the same. This is
mostly so we can work with and display attribute changes, like 'type' and
'alignment', without constantly destroying and rebuilding nested <div>
structures.

This change also includes all the attribute changes that will be called
when the media edit dialog changes image type, alignment, size, etc.

Node: The mw-classes 'thumb', 'thumbinner' and 'thumbcaption' are
preserved in the structure of the <figure> but CSS designers should note
these styles are no longer necessarily attached to <div> elements.

Bug: 53436
Change-Id: I40065acd9fd59d30f94b5336736d4986e8de15aa
2013-12-11 15:54:55 -08: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
Kyle Florence 638e4f65b6 Make commands aware of their symbolic names
This introduces a small reorginization of how commands are registered so
that they are associated with their corresponding symbolic names.
This change is mainly to aid with event tracking, but it might be
generally useful for other things as well.

Change-Id: I2ccf4522f786a54c1f5395008b7b0333a1fa6072
2013-12-11 15:34:20 -08: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 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
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