Commit graph

3174 commits

Author SHA1 Message Date
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
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
jenkins-bot b67a22998d Merge "Introduction of setup and teardown events for ve.ce.View nodes" 2013-05-14 19:50:59 +00:00
jenkins-bot 3d2a5417e7 Merge "ve.Element refactor" 2013-05-14 19:49:40 +00:00
jenkins-bot 3212d4468c Merge "Floating toolbar cleanup" 2013-05-14 19:48:13 +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
jenkins-bot b47b0db374 Merge "Updating to Rangy 1.3 alpha" 2013-05-13 22:51:27 +00:00
Christian Williams 69e1cc3280 Updating to Rangy 1.3 alpha
We previously tried Rangy 1.3 alpha but rolled back due to a bug
with getting cursor position in IE. Rangy developer Tim Down fixed
the issue here:
https://code.google.com/p/rangy/source/detail?r=780

Both 1.2 (filenames without file versions) and 1.3 in the repo
for now.

Change-Id: I26263fc1d10e3c2bdda7f1c9135544ca3bc05d97
2013-05-13 14:44:16 -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