Commit graph

1708 commits

Author SHA1 Message Date
Inez Korczyński 1b4b6663c3 Introduce createPage method in ve.ui.MWTemplateDialog and even use it!
Change-Id: I7b063a9380742e157a4c7128c1654abcf3ad8c6f
2013-05-15 16:22:12 -07:00
Inez Korczyński ba5c4f104d Build TemplateDialog based on parameters that are passed to template
(instead of TemplateData as before).

Change-Id: I50b0e6ef1936c4b56f40fa73bd42b03587bdf979
2013-05-15 22:47:59 +00:00
jenkins-bot 4875a4ec0b Merge "Content for Template Dialog" 2013-05-15 22:18:38 +00:00
jenkins-bot 30fb94e94f Merge "Implement ve.dm.MWTemplateNode.getWikitext()" 2013-05-15 22:18:01 +00:00
Catrope 54cd04c391 Implement ve.dm.MWTemplateNode.getWikitext()
Escapes }} and | by wrapping them in <nowiki> tags, and steps around
<nowiki> tags so as to not double-wrap things.

Change-Id: Ia50906524c1fcf55c9f390a114856bc7f20b2d3a
2013-05-15 15:16:34 -07:00
Christian Williams f238683341 Content for Template Dialog
Initial commit of page content.

Change-Id: Iffdf4f4179c6f3b04611d4bd9548e7cf23188856
2013-05-15 15:13:38 -07:00
jenkins-bot 943301f2c9 Merge "Multiline option for ve.ui.TextInputWidget.js" 2013-05-15 21:47:25 +00:00
jenkins-bot e21f8edb60 Merge "Process example template data and add pages to PagedDialog based on it." 2013-05-15 21:44:07 +00:00
jenkins-bot e75f63f279 Merge "Added clearPages method to ve.ui.PagedDialog." 2013-05-15 21:41:34 +00:00
Trevor Parscal 96e49858fa Multiline option for ve.ui.TextInputWidget.js
Objective:

* Add multiline option to text input widget which uses a text area instead of a text input

Changes:

ve.ui.Widget.css
* Add text area support for styles otherwise only targeting input elements

ve.ui.InputWidget.js
* Initialize input element using a method, so it can be fully customized (like making a text area or select input
* Use val() to set the initial value, using jQuery's abstraction around inputs of various types

ve.ui.TextInputWidget.js
* Add multiline option which uses a text area instead of an input

Change-Id: I1bf17c8c76b7f1708c57ee5e95160c071ddd00e9
2013-05-15 14:41:22 -07:00
Inez Korczyński de203cb871 Process example template data and add pages to PagedDialog based on it.
Change-Id: I34ee42e66df26000842f9b1540a577b2621f8839
2013-05-15 14:36:44 -07:00
Inez Korczyński 3895a3ea11 Added clearPages method to ve.ui.PagedDialog.
Change-Id: Ie55f727f649b2dcd4189489c7baa9f524aa5d1c7
2013-05-15 14:31:20 -07:00
jenkins-bot bd0d61c143 Merge "Fix for default sort key crash" 2013-05-15 21:10:57 +00:00
Trevor Parscal 79df2232a5 Fix for default sort key crash
The existing default sort key was being cached when the dialog was
constructed, but on the 2nd time launching it the reference was broken.
This change gets rid of the caching and always grabs a fresh copy when
we need one.

Also, the flag indicating the default sort key has changed wasn't being
reset properly.

Change-Id: I8fb3b088f25212b8c542df65bb5a248550ff6f27
2013-05-15 21:04:10 +00:00
Christian Williams 3f6e127423 Pages in template dialog
Just a starting point for Inez to loop.

Change-Id: I6d418ba955f0904d34b474c984eef7f97be257e9
2013-05-15 13:39:34 -07:00
jenkins-bot f888b79056 Merge "Add level option to ve.ui.OutlineItemWidget" 2013-05-15 20:35:06 +00:00
Trevor Parscal 55f28eecce Add level option to ve.ui.OutlineItemWidget
Objective:

* Add indentation feature to outline items

Changes:

ve.ui.PagedDialog.js
* Pass level argument through addPage method

ve.ui.Widget.css
* Add styles for non-zero levels of outline items

ve.ui.OutlineItemWidget.js
* Add missing config documentation for icon option
* Add level option, with getLevel/setLevel methods
* Add statically configurable number of levels and level class

Change-Id: Ie24761c64918fdc6cd28070b3cf56743c6288970
2013-05-15 12:54:19 -07:00
jenkins-bot d97114ad10 Merge "Implement ve.ui.MWTemplateDialog" 2013-05-15 19:38:20 +00:00
Trevor Parscal 231a50f2b6 Implement ve.ui.MWTemplateDialog
Objective:

* Add button to launch template dialog
* Add template dialog

Changes;

*.php
* Add messages and links to files

ve.ce.Node.css
* Make inline templates display as inline-block to contain their
  contents (allowing shields to work properly)

ve.ui.MWTemplateDialog.js
* New empty dialog for templates

ve.ui.MWTemplateButtonTool.js
* New template button, appears in context and launches dialog

Change-Id: I9174ed7c9012522246a6defc859276bf36763f5b
2013-05-15 19:36:18 +00:00
Timo Tijhof 25d6e6f136 ve.ce.Surface: Append phantoms to overlay instead of surface
Surface can be deep inside a skin layout of which it is not
unlikely for one or more of the parents to have position
relative.

Change-Id: Ie202fa43b837650fd296fa6804d035622e2599e1
2013-05-15 21:28:56 +02:00
Trevor Parscal a56e795f58 ve.Editor
Objectives:

* Split ve.Surface into ve.Editor and ve.ui.Surface
* Move actions, triggers and commands to ve.ui
* Move toolbar wrapping, floating, shadow and actions functionality to configurable options of ve.ui.Toolbar
* Make ve.ce.Surface and ve.ui.Surface inherit ve.Element and use this.$$ for iframe friendliness
* Make the toolbar separately initialized so it's possible to have a surface without one, as well as control where the toolbar is

Some change notes:

VisualEditor.php
* Added standalone module for mediawiki integrated unit testing

ve.ce.Surface.js
* Remove requirement to pass in an attached container to construct object
* Inherit ve.Element and use this.$$ instead of $
* Make getSelectionRect iframe friendly
* Move most of the initialize stuff to a new initialize method to be called after the surface is attached to the DOM

ve.init.mw.ViewPageTarget.js
* Merge toolbar functions into setup/teardown methods
* Add toolbar manually (since it's not added by the surface anymore)

ve.init.sa.Target.js
* Update new init procedure for editor, surface and toolbar separately
* Move toolbar floating stuff to ve.Toolbar

Change-Id: If91a9d6e76a8be8d1b5a2566394765a37d29a8a7
2013-05-15 10:39:12 -07:00
jenkins-bot 44e0b7e345 Merge "Make ve.ce.ProtectedNode use setup (for setup) and teardown (for teardown) events so it is going to work well after node is rewrapped (example: MWBlockImageNode)." 2013-05-15 17:31:53 +00:00
Inez Korczyński 2a53329f0d Make ve.ce.ProtectedNode use setup (for setup) and teardown (for teardown) events so it is going to work well after node is rewrapped (example: MWBlockImageNode).
Change-Id: Ibd539813f4302d8bbf8eaa35af71817a55fb1f4b
2013-05-15 10:28:56 -07:00
jenkins-bot 3bed4284dd Merge "Make MWBlockImageNode a ProtectedNode (by adding mixin)." 2013-05-15 17:27:54 +00:00
jenkins-bot cc0f530479 Merge "Added method getDataFromDomRecursionClean to ve.dm.Converter - used by nodes that handle their own children." 2013-05-15 17:27:08 +00:00
jenkins-bot 7cc65631bf Merge "Return proper error if parsoid is unavailable on serialize" 2013-05-15 17:26:18 +00:00
jenkins-bot e6004016ca Merge "Use new options format for toolbar in mw init" 2013-05-15 17:20:53 +00:00
Inez Korczyński abe81d42d7 Added method getDataFromDomRecursionClean to ve.dm.Converter - used by nodes that handle their own children.
Change-Id: I604cf201515152824ec159b8c86f2010afcd3369
2013-05-15 10:02:08 -07:00
Inez Korczyński b8d81f5238 Make MWBlockImageNode a ProtectedNode (by adding mixin).
Change-Id: Ib15efaf4964f16b86020367e42848d228efd09ba
2013-05-15 10:01:19 -07:00
Ed Sanders 201a1ac478 Return proper error if parsoid is unavailable on serialize
Previously was just returning an empty result.

Bug: 47581
Change-Id: I6bdd177bc9b5a0af9107cf08d8e46470c6778e12
2013-05-15 16:28:51 +01:00
Ed Sanders cc943418cf Use new options format for toolbar in mw init
Wasn't updated after change 63095 and so wasn't setting options.

Bug: 48509
Change-Id: Icda3305e422bedaf0d490b8fbe51f55b8c8e79e8
2013-05-15 14:52:39 +01:00
Ed Sanders eeb1f3a142 Implement 'minordefault' user preference
Marks all edits as minor by default if the user preference is set.

Bug: 48347
Change-Id: Ib5cdcb9433be5ff7b9179d3833f42e5c3453285a
2013-05-15 13:40:54 +01:00
jenkins-bot 3109e96bb1 Merge "Better support for MediaWiki block level images (thumb and frame)" 2013-05-15 02:58:23 +00:00
Christian Williams 991859d5d1 MWInlineImageNode should be img
Change-Id: I0cc43c59031f970b879b64696e824ebaa28a4b53
2013-05-14 17:36:04 -07:00
Inez Korczyński c6c7af5a62 Better support for MediaWiki block level images (thumb and frame)
Change-Id: Id6f65e4e1971e21035c89f32fa7ab0009c84695c
2013-05-14 17:14:36 -07:00
Ed Sanders f675d73204 Move no changes message to separate save dialog slide
Previously it was just being returned as the diff html, which
looked weird becacuse 1: it was the wrong width and 2: the
save buttons were still there.

Bug: 43754
Change-Id: I537bcae91f51a3f30ca4736c41f7a5619bbf321d
2013-05-14 16:40:14 -07:00
Ed Sanders ea6e1b26ed Move edit conflict notice to a save dialog slide
Previously used a confirm() dialog which is a bit ugly.

Bug: 42522
Change-Id: I709d936d998b130515b62de880c6e7aa7978786b
2013-05-14 16:31:58 -07:00
Trevor Parscal cce80e63c0 Fix for crashing on save
converter.documentData contains the full data with metadata interleaved,
but it was being sliced using offsets relevant to the element data.

Change-Id: Iddbef23212da818a2a399b4abdc223aad130eb4e
See: I6daff5c5969e5fdc871f8f346cf790b4302ae080
2013-05-14 21:34:06 +00:00
Inez Korczyński a3f6008bd4 Introduction of setup and teardown events for ve.ce.View nodes
* modules/ve/ve.Node.js - remove ve.EventEmitter mixin
* modules/ve/ve.dm.Node.js - added ve.EventEmitter mixin
* modules/ve/ce/ve.ce.BranchNode.js - make updateTagName use newly added
  events

Change-Id: I349155b8e986fe09b615bb5f0617409d723936ef
2013-05-14 19:47:40 +00:00
Trevor Parscal c2defc9783 ve.Element refactor
Objectives:

* Move ve.ui.Element to ve.Element
* Make CE nodes inherit from ve.Element

Changes:

ve.ui.Element.js, ve.Element.js
* Move and rename
* Move ve.ui.get$$ to ve.Element.static.get$$
* Add static getDocument and getWindow methods
* Add instance getElementDocument and getElementWindow methods
* Add getTagName method, which by default reads the static tagName property, but when overridden can return a tag name based on other factors

*.php
* Updated file link

ve.ce.*Annotation.js, ve.ce.*Node.js, ve.ce.View.js, ve.ce.Document
* Added config options pass through
* Replaced passing elements through constructor with defining static tag names
* Added getTagName overrides where needed that derive tag name from model
* Refactore dom wrapper methods, now consistently using getTagName

ve.ce.Surface.js
* Removed static initialization (not needed)

ve.dm.Model.js, ve.ui.Window.js
* Added missing docs

ve.ui.GroupElement.js, ve.ui.Layout.js, ve.ui.Widget.js,
* Updated class name for elements

ve.ui.Frame.js, ve.ui.LookupInputWidget.js
* Updated location of get$$

ve.ui.js
* Move get$$ to ve.Element

ve.js
* Add auto-init of static properties to mixinClass

Change-Id: I39ae14966456903728e4d9e53f806ddce9ca2b70
2013-05-14 19:47:32 +00:00
Trevor Parscal 5012ed101b Floating toolbar cleanup
Objective:

Move toolbar floating functionality to ve.init and clean it up

As a bonus:

demo.css
* Fix CSS path to set width of inputs properly

Changes:

demos/ve/index.php
* Allow ve.init.sa.Target to construct it's own surface object

ve.ce.Surface.js
* Move object resizing and table editing disabling commands from ve.Surface
* Add method for getting the currently focused node

ve.init.mw.ViewPageTarget.js
* Remove initializing surface property (now done in parent class)
* Normalize all uses of "setup" to "setUp"
* Replace uses of getDocumentModel with getModel().getDocument()
* Add calls to set up and tear down for toolbar floating

ve.init.mw.Target.js
* Replace uses of getDocumentModel with getModel().getDocument()

ve.init.sa.Target.js
* Move example from ve.Surface
* Change constructor to accept document model
* Create ve.Surface object in constructor
* Add set up for toolbar floating

ve.ui.init.Target.js
* Initialize surface property
* Move and cleanup toolbar floating functionality from ve.Surface

ve.ui.Surface.js
* Remove example now that init.sa creates it's own surface (moved)
* Document options
* Simplify toolbar options and remove the concept of multiple toolbars
* No longer cache the options object
* Move toolbar initialization to constructor
* Change setupCommands to addCommands, making it useful after construction
* Inline selection initialization
* Move and cleanup toolbar floating functionality to ve.ce.Surface
* Reorganize a few methods
* Move toolbar floating to ve.init.Target.js

Change-Id: I393a426e35567d57c048122bf64a83c1ef45e6e8
2013-05-14 12:43:30 -07:00
Trevor Parscal 67a2613a12 Reference dialog
Objective:

Add a basic (empty) dialog for mediawiki references. Editor to follow.

Changes:

*.php
* Added file links and messages

ve.ui.MWMetaDialog.js
* Moved initialize method to the top (for consistent ordering)

ve.ui.MWReferenceDialog.js
* New class, basic empty dialog for references

ve.ui.LinkInspector.js, ve.ui.MWLinkInspector.js, ve.ui.MediaButtonTool.js
* Cleanup documentation
* Whitespace

icons.ai, reference.png, reference.svg
* Switch to reference icon being 3 books on a shelf

ve.ui.MWReferenceButtonTool.js
* New class, basic dialog button for references

Change-Id: Ia4e30e9239fa1e3b28c0a1ef1ca0a6515a8103ef
2013-05-13 13:10:59 -07:00
jenkins-bot d3d695ef03 Merge "Send a full document back to Parsoid" 2013-05-13 19:24:41 +00:00
jenkins-bot 3fc753e39b Merge "Fix categories with multiple ../ in their hrefPrefix" 2013-05-13 19:00:02 +00:00
jenkins-bot 3c8c8da311 Merge "ListAction tests" 2013-05-13 18:26:33 +00:00
Catrope 9611bf9f64 Send a full document back to Parsoid
To do this, we take the document generated by the converter and
transplant things from the original Parsoid document into it.

Change-Id: I2f5058220669526130a360cec3389c3f42b41771
2013-05-13 11:23:34 -07:00
Catrope f586d3ea8f Fix categories with multiple ../ in their hrefPrefix
Was already fixed for links.

Bug: 48408
Change-Id: I84d2b23a05585890b2d5023c7c7f38a43889fd7f
2013-05-13 11:10:02 -07:00
Ed Sanders 89b0dce8ec ListAction tests
Unwrap and wrap cases.

Change-Id: If4df07eae1d70347dc55b57dc117f2ff5c7385df
2013-05-13 18:59:53 +01:00
jenkins-bot 2dddb90731 Merge "Fix indent action when acting on multiple list items" 2013-05-13 17:49:00 +00:00
jenkins-bot 0d006f5976 Merge "Use consistent capitalisation of Html" 2013-05-13 17:33:33 +00:00
Ed Sanders a9d0a5c7ef Fix indent action when acting on multiple list items
Same as https://gerrit.wikimedia.org/r/#/c/63394/ but for
indentation, as well as unindentation.

Bug: 48390
Change-Id: I5ce0c385214f30c5e5c66b5b5b755c9937267cd0
2013-05-13 18:27:21 +01:00
jenkins-bot d380186c8f Merge "Optimise code for first/last child detection in fixupInsertion" 2013-05-13 17:26:39 +00:00
jenkins-bot 78bbd60a0c Merge "Fix unindent action when acting on multiple list items" 2013-05-13 16:04:11 +00:00
Inez Korczyński 9f8ababfa9 Fix inability to split lists
Fixes change made in I7a8d6c474ecca5af02b72b6453c900ed61acea58 by using
DOM_VK_ENTER instead of DOM_VK_RETURN (which is not defined anymore).

Bug: 48386
Change-Id: I8d7aeffc8166487806e3489b054f508c5e9418ff
2013-05-13 14:59:16 +00:00
Ed Sanders 2c782fba92 Optimise code for first/last child detection in fixupInsertion
The code to record the first/last child stacks was written before
I decided on using a recursive call going only one step when such
a stack was encountered.

As we only ever test the length of the stack most of the code around
calculating the stack can be thrown away, and all we need is a simple
test to see if we are the first/last child of the immediate parent.

Change-Id: Iffb03c649e166c9f89061a4d944fa07633f16aba
2013-05-13 12:37:01 +01:00
Ed Sanders 1261a5f471 Fix unindent action when acting on multiple list items
This is caused by a limitation of surface fragments in that they
always expand to include insertions touching them. In this case
we build surface fragments contain adjacent listItems, so when
the first listItem is de-listed a transaction is first created to
split the list. This insertion of ('/list', 'list') is adjacent
to the second surface fragment and so becomes part of that fragment.

This then causes the wrong node to be passed to unindentListItem.

The workaround is to use the inner range of the listItem, not
the outer range.

Bug: 48390

Change-Id: I7418910412d292ef4953e294a97f66e48d6f776f
2013-05-12 22:15:09 +01:00
Ed Sanders 634947198a Use consistent capitalisation of Html
If the previous commit properInnerHTML was renamed to
properInnerHtml, but its invocations weren't (a bug).
While DOM uses .innerHTML we use Html throughout the
rest of our code so we should be consistent either way.

Change-Id: If46bb256e938a097951c159b7a278667fd8e06a6
2013-05-11 13:04:00 +01:00
jenkins-bot 50e6f052c7 Merge "Add ve.properOuterHtml" 2013-05-11 10:57:02 +00:00
Ed Sanders 375a7fceff Access keys for edit and edit source
Set up 'v' for edit, and 'e' for edit source as access keys.

Bug: 48107
Change-Id: I598177bc75ed84dea35952a3b2b1b2111aac89b2
2013-05-10 17:10:26 -07:00
Catrope 606baacc1b Add ve.properOuterHtml
Like ve.properInnerHtml but for outerHTML. Factored out the shared code
into ve.fixupPreBug.

Change-Id: I5c5b6d017936c6c2e71631fb8859ba1dbd95615a
2013-05-10 17:03:04 -07:00
Catrope 9d99cdbb67 Fix breaking getLength() call
Change-Id: Iaa6cb22bf93a677aff077ce38ee11e606430cee5
2013-05-10 17:02:07 -07:00
jenkins-bot db644e915f Merge "Fieldsets and default sort keys" 2013-05-10 23:58:17 +00:00
jenkins-bot 89aebd5112 Merge "Edit and Edit source tab were reversed in RTL in the Vector integration" 2013-05-10 23:49:30 +00:00
Trevor Parscal 8409d16f0f Fieldsets and default sort keys
Objective:
* Add default sort key field to meta dialog
* Replace PagePanelLayout with a generic panel containing one or more FieldsetLayout elements

Changes:

*.php
* Added/removed file links

ve.dm.MWDefaultSortMetaItem.js
* Added getContent method

ve.dm.MetaItem.js
* Added replaceWith method

ve.dm.MetaList.js
* Allow insertion at the end by omitting offset and index

ve.dm.MWMetaDialog.js
* Added default sort key field
* Put category and default sort fields inside fieldsets
* Added loading/saving default sort key

ve.ui.PagedLayout.js
* Changed class used for pages to generic panel layout

ve.ui.PagePanelLayout
* Moved title/icon stuff to field set

ve.ui.FieldsetLayout.js
* New class, adds fieldset with legend

ve.ui.StackPanelLayout.js
* Moved up to the layouts directory

ve.ui.Dialog.css
* Moved style for paged panel from layout stylesheet

ve.ui.Layout.css
* Added styles for fieldsets

ve.ui.Widget.css
* Adjusted margins of input label widgets

ve.ui.MWCategoryWidget.js, ve.ui.MWCategoryPopupWidget.js
* Added setDefaultSortKey method

Change-Id: I979f5e3f08a688790c9f54086206ed1999af13ea
2013-05-10 16:46:08 -07:00
jenkins-bot 5f8db49a9f Merge "(bug 48022) Ignore certain function keys in key press handler" 2013-05-10 21:33:52 +00:00
Inez Korczyński b32b5702d4 (bug 48022) Ignore certain function keys in key press handler
This is a temporary solution that still may some function keys go through.

Change-Id: I7a8d6c474ecca5af02b72b6453c900ed61acea58
2013-05-10 13:51:23 -07:00
jenkins-bot 57b05aa433 Merge "Clean up variable initialization in setupSkinTabs()" 2013-05-10 20:31:03 +00:00
Catrope 2efd4f0061 Edit and Edit source tab were reversed in RTL in the Vector integration
If we're in RTL mode and the skin is Vector-based, we need to reverse
the order of the tabs in the DOM, because that's a weird thing that
Vector does to render tabs in RTL.

See https://bugzilla.wikimedia.org/show_bug.cgi?id=46947 for discussion
about the Vector behavior.

Bug: 48017
Change-Id: Ie1214b08450aefed893739a2b862cb1e9b23a2ef
2013-05-10 11:43:05 -07:00
Catrope b295dc8d99 Clean up variable initialization in setupSkinTabs()
Change-Id: Ic596f1c98162557f33f5ca398d2358e91a3d5cb0
2013-05-10 11:43:01 -07:00
Ed Sanders 634714bab9 Remove hack for old version of Parsoid
Removing check for parsoid returning document fragments.

Change-Id: I5a8729d93907d13c699a1f3cf43ffd3e0c45b003
2013-05-10 19:42:35 +01:00
jenkins-bot 326879b75b Merge "Use pageLanguage rather than pageViewLanguage for the surface's lang&dir" 2013-05-10 18:13:09 +00:00
Catrope a65ff4fdb9 Use pageLanguage rather than pageViewLanguage for the surface's lang&dir
Bug: 33175
Change-Id: Ica006404227dcd286c387de4f637036341b17eae
2013-05-10 11:04:31 -07:00
jenkins-bot fa73dbeca5 Merge "Make reference list nodes render contents again" 2013-05-10 17:49:30 +00:00
Trevor Parscal 8858ed932f Make reference list nodes render contents again
Really Roan? How dare you!

See I3f5116d7dfbaa5889b7c5cac01d7341272749c58

Change-Id: Ia0ae514fc07752edb7b7100716e09163d3bfacba
2013-05-10 10:47:10 -07:00
jenkins-bot 51388095e2 Merge "Category UI improvements" 2013-05-10 17:32:34 +00:00
jenkins-bot 8bac303893 Merge "When removing an empty list item, also remove the list if it's now empty" 2013-05-10 17:17:36 +00:00
jenkins-bot ff15fbf21b Merge "Whitespace between unwrapped inline nodes assigned to paragraph" 2013-05-10 17:13:15 +00:00
Ed Sanders 328dd8e21f Whitespace between unwrapped inline nodes assigned to paragraph
In stopWrapping we assign any left over whitespace to the paragraph
in position 3, however we weren't clearing this whitespace buffer
if an inline content node followed it.

Change-Id: I8b3ee3915044abd6bafda386430bf7f992ca4aa8
2013-05-10 16:40:11 +01:00
jenkins-bot f966e9c41d Merge "Clone template dom elements being sent to converter" 2013-05-10 15:37:24 +00:00
jenkins-bot d7c3dd8ec6 Merge "Reduction of renderContents calls" 2013-05-10 15:35:37 +00:00
Catrope 811721f1e1 When removing an empty list item, also remove the list if it's now empty
When the user presses Enter in an empty list item, we remove it. But if
the list item was the only child of the list, that leaves an empty list
which then gets a block slug, leading to all sorts of weird things, and
even pawns in Firefox. So check whether the list item was the last child
and if so, remove the list.

Bug: 48287
Change-Id: If22d9b904b8861e24d56944d791545635b2e4254
2013-05-09 17:47:36 -07:00
Inez Korczyński 1e85621bd9 Reduction of renderContents calls
There is no need to call renderContents in ContentBranchNode constructor
because it is going to be called anyways in onSplice

Change-Id: Id1ab983668299658ecd6e89a37667cc34c701689
2013-05-10 00:28:30 +00:00
Catrope 9372ca60ad Kill getOffsetFromNode() with fire
The way it operated was evil. It did a depth-first search from the root,
finding the node using reference equality. For documents with deep
structures, this could take a long time. Inez did some profiling and
found it was called tens of millions of times on a complex document.

Kill getOffsetFromNode() and move its functionality to getOffset().
The logic has been completely rewritten: getOffset() now traverses
up from the node rather than down from the root, and pretty much does
the reverse of what getNodeFromOffset() does. This should be much more
efficient even without offset caching in the node objects (which we may
still implement later).

Change-Id: I125f9fa423c40db6472e2c4a7c94214218ba3bc7
2013-05-09 17:26:22 -07:00
Trevor Parscal e888d7b985 Category UI improvements
Objectives:
* Ensure items don't get moved to the end when their sort-key is edited
* Add placeholder text and pending styling to input
* Auto-expand input to the end of the line
* Make the minimum input width smaller

Changes:

ve.ui.MWMetaDialog.js
* Added calls to fitInput on initialize
* Fixed sort key update and insert handlers to maintain item position when updating

ve.ui.GroupElement.js
* Added index argument to addItems, allowing items to be inserted at a specific location

ve.ui.PagePanelLayout.js
* Fixed CSS class name

ve.ui.StackPanelLayout.js, ve.ui.MenuWidget.js, ve.ui.SelectWidget.js
* Passed index argument through to group element

ve.ui.PanelLayout.js
* Fixed overflow direction for scrolling option

ve.ui.Inspector.css
* Moved border-box properties to text input widget class
* Set input widget within inspectors to be 100% by default

ve.ui.Layout.css
* Updated CSS class name
* Whitespace fixes

ve.ui.Widget.css
* Made text input widgets's wrapper default to 20em wide and the input inside it be 100%, using border-box to ensure proper sizing
* Adjusted category list item and input styles to make input appear more like a category item
* Whitespace fixes

ve.ui.MWCategoryInputWidget.js
* Made category input widget inherit text input widget, rather than just input widget

ve.ui.MWCategoryWidget.js
* Replaced group functionality by mixing in group element
* Added fitInput, which automatically make the input fill the rest of the line or take up the entire next line depending on how much space is left

VisualEditor.i18n.php
* Adjusted placeholder text for category input

Change-Id: I79a18a7b849804027473084a42c36133fdacad57
2013-05-10 00:19:46 +00:00
jenkins-bot 2cbc5045b6 Merge "Move completeHistory from dm.Surface to dm.Document" 2013-05-09 22:19:58 +00:00
Catrope 3d21609ca9 Move completeHistory from dm.Surface to dm.Document
Per IRL conversation with Trevor, that's where it belongs.

Change-Id: I9eae05380597ed83122f29864b77d2278d3dd863
2013-05-09 14:54:25 -07:00
Ed Sanders 3495c6f747 Clone template dom elements being sent to converter
The dom elements in the IV store are used for rendering, so if they
are sent by reference to the converter they get re-attached, causing
all templates to disappear from the page whenever you press 'review
and save'.

Fix is to run it through ve.copyArray, which clones all the nodes.

Change-Id: I1b03351a28ac82e0fdb7e94e761cf65d6548e501
2013-05-09 13:42:44 +01:00
Ed Sanders cced110c3e Mo' vectors (mo' problems)
Serve vectors to any browser which supports them, instead
of just high dpi devices.

Bug: 48148
Change-Id: Iafe8cd290fb195369776f51a96b6de4a51577b89
2013-05-09 11:22:32 +01:00
jenkins-bot cf99b23219 Merge "Fixing shields" 2013-05-08 19:54:06 +00:00
Christian Williams 30cfe6998f Fixing shields
Shields were being added twice. Switched the blank png to gif
because the red IE background couldn't be replicated. Changed
some styles from Alien to Protected.

Change-Id: I9c62665e4e0dc54b8511749b9d2a629db7990a16
2013-05-08 12:29:25 -07:00
Timo Tijhof 6467a5a0e4 ViewPageTarget: Bind callback in onSerialize like in onShowChanges
init.mw.Target#serialize is an odd one because it is the only
target method that has a callback parameter (instead of
emitting the event on Target and having ViewPageTarget get
the event through that).

This line from onShowChanges needed to be added to onSerialize

  // Invalidate the viewer wikitext on next change
  this.surface.getModel().connect( this, { 'transact': 'onSurfaceModelTransact' } );

Though onSerialize is currently bound manually from the
serialize callback, it should be refactored to be like the others.

Bug: 44446
Change-Id: I9eddebbdf9294ee3d46286bdf1b157e00252d300
2013-05-08 20:28:28 +02:00
jenkins-bot 5c9b24eb1f Merge "Also render attributes of the form html/i-j/attrName in CE" 2013-05-08 18:14:33 +00:00
jenkins-bot 3c9dd89f89 Merge "Preserve HTML attributes recursively" 2013-05-08 18:12:46 +00:00
Catrope 31c2165770 Also render attributes of the form html/i-j/attrName in CE
Factored the parsing of html/* attributes out into a static function.
Factored attribute (re)rendering out into ce.View, attribute updates
are much simpler now.

Change-Id: I4caa6d5e1e2c21c28ddff61c3c864e47f66cc6b2
2013-05-08 18:10:46 +00:00
Catrope 05828cc3f1 Preserve HTML attributes recursively
For nodes that handle their own children (as well as leaf nodes and
meta items), store the first child's attributes in html/0-0/*, the
second child's attributes in html/0-1/*, the second element's third
child's fourth child's attributes in html/1-2-3/* , etc.

This obsoletes the ad-hoc code that basically did the same thing in
MWInlineImageNode.

Change-Id: If5abd2d5d9c361b359617ff4b0f3d6ba4c9b0142
2013-05-08 11:10:07 -07:00
Ed Sanders 4a4cf34a86 Convert DOM elements to stringifiable objects for reporting
We already do this in unit test so moving getDomElementSummary
and convertDomElements from ve.qunit.js to ve.js.

Apply ve.convertDomElements to report data before serialising.

Bug: 47948
Change-Id: Id807ccc6ff31d063be815ed4988cb35684adb76a
2013-05-08 14:42:43 +01:00
Catrope 85d67ce44f Do proper HTML preservation in ve.dm.MWReferenceListNode
Store the HTML as a domElements array like everywhere else, rather than
as a string. Also disable HTML attribute preservation because there's
no point doing that when we're already preserving all of the HTML.

Also fixed a misnamed attribute (<li li="foo"> --> <li id="foo">) in
the test case.

Change-Id: I36bf8bade8118e07a75eb6f3a2427a00ef4915d7
2013-05-07 21:41:29 -07:00
jenkins-bot 9f06258b8e Merge "ve.test: Import K-JS test suite for object utilities" 2013-05-08 00:18:28 +00:00
Timo Tijhof 36e29c12f6 ve.test: Import K-JS test suite for object utilities
We've housed these utilities for a while and changed some of
them quite a bit. Importing them to avoid regressions and
ensure we keep them in sync with our fork of it.

Removed references back through `@source`. They are sufficiently
different that the reference no longer adds any value.

Imported from https://github.com/Krinkle/K-js/blob/v0.1.2/test/K.test.js.

Change-Id: I9e71297246b7c248c1f032ba6b6ae1123519f3c1
2013-05-08 02:13:16 +02:00
jenkins-bot 638bf98e98 Merge "Fix ContentBranchNode test broken by ve.ce.ProtectedNode" 2013-05-07 21:54:18 +00:00