Commit graph

1372 commits

Author SHA1 Message Date
Catrope 87125aaf36 Fix MetaList tests, were totally broken
They worked fine with just one group, but once Rob added a second group
everything came falling down.

* Index the return value of findItem() into the correct array
  (list.items for all, list.groups[groupname] for groups)
* Expect null if there is something at the coordinates but it's in the
  wrong group
* Keep track of the next index and expect that for forInsertion when
  findItem() returned null, as well as at the end of each offset

Change-Id: I76438f583cea5694ce04fa2f4e7e88f8f8f236d1
2013-04-09 12:46:04 +01:00
jenkins-bot 5029ee29ea Merge "Great Annotation Refactor of 2013" 2013-04-09 11:28:06 +00:00
Catrope 1645fe01e6 Be resilient against an unset hrefPrefix in MWCategoryMetaItem
(or any unset attribute for that matter)

Change-Id: I59364354c64fbce016090e17aa9683ec0a0fea9b
2013-04-08 21:44:59 -07:00
Catrope 2eb0d2a6b2 Great Annotation Refactor of 2013
This changes the annotation API to be the same as the node API, sans
a few boolean flags that don't apply. The APIs were different, but
there was really no good reason why, so this makes things simpler for
API users. It also means we'll be able to factor a bunch of things out
because they're now duplicated between nodes, meta items and annotations.

Linear model annotations are now objects with 'type' and 'attributes'
properties (rather than 'name' and 'data'), for consistency with elements.
They now also contain html/0/* attributes for HTML attribute preservation,
which obsoletes the htmlTagName and htmlAttributes properties.
dm.Annotation subclasses take a reference to such an object and implement
conversion using .static.toDataElement and .static.toDomElements just
like nodes do. The custom .getHash() functions are no longer necessary
because of the way HTML attribute preservation was reimplemented.

CE rendering has been moved out of dm.Annotation (it never made sense to
have CE rendering functions in DM classes, this was bothering me) and into
separate ce.Annotation subclasses. These are very similar to CE nodes in
that they have a this.$ generated based on something in the DM; the main
difference is that nodes listen to events and update themselves, whereas
annotations are static and are simply destroyed and rebuilt when they
change. This change also adds whitelisted HTML attribute rendering for
annotations, as well as class="ve-ce-FooAnnotation" attributes.

Now that annotation classes produce real DOM nodes rather than weird
objects describing HTML tags, we can't generate HTML as a string in
ce.ContentBranchNode anymore. getRenderedContents() has been rewritten
to be much more similar to the way the converter renders annotations;
in fact, significant parts of it were copied from the converter, so that
should be factored out in the future. This change actually fixes an
annotation rendering discrepancy between ce.ContentBranchNode and
dm.Converter; see the diff of ve.ce.ContentBranchNode.test.js.

ve.ce.MWEntityNode.js:
* Remove stray property

ve.dm.MWExternalLinkAnnotation.js:
* Store 'rel' attribute

ve.dm.TextStyleAnnotation.js:
* Put all the conversion logic in the abstract base class

ve.dm.Converter.js:
* Also feed annotations through getDomElementsFromDataElement() and
  createDataElement()

ve.dm.Node.js:
* Fix undocumented property

ve.ce.ContentBranchNode.test.js:
* Add descriptive messages for each test case
* Compare DOM trees, not HTML strings
* Compare without all the class="ve-ce-WhateverAnnotation" clutter

ve.ui.LinkInspector.js:
* Replace direct .getHash() calls (evil!) with ve.getHash()

Bug: 46464
Bug: 44808
Change-Id: I31991488579b8cce6d98ed8b29b486ba5ec38cdc
2013-04-08 18:10:16 -07:00
Catrope 9bac935c7d Fix ModelRegistry bugs
* In matchTypeRegExps(), skip string types
** Didn't break because we currently have mixes of strings and regexes
* Combine types from rel, typeof and property rather than picking one
** Added test case in ve.dm.example that resembles actual Parsoid output
* If the element has extension-specific types, not only restrict type
  matching to extension-specific types, but also require that *all* types
  present on the element be matched

Change-Id: Iacf3851a0ca9081d2c813b42435484a47cec6230
2013-04-08 18:05:34 -07:00
Christian Williams 23ac4b79bb Clickable inline images
Clicking an inline image will select it, or expand the selection.

Change-Id: I505665f2dac2e52140cc049e63e3355190dcbfec
2013-04-08 17:58:46 -07:00
Christian Williams 4c1934b19d Prevent IE from editing ce="false"
This is a redux of logic already in master.
Moved from keydown to keypress because IE
fires keydown multiple times for held keys.
Changed the logic to determine that the current
offset is just after an element that should not be
directly edited.

Change-Id: I5206d8919abde740d92f636b0c8618c4ebb6f6ff
2013-04-08 17:53:31 -07:00
Ed Sanders 93bbe93829 Fix for custom hash with keys in different order
Instead of returning val when a custom hash is found,
feed it back into val and let the object sorting take
place if required.

Bug: 46895
Change-Id: I6a9b42facd97fbf49042d3a082121ec93659b9f1
2013-04-09 00:20:44 +01:00
Ed Sanders 277c4f6c28 Change custom .getHash functions to .getHashObject
As described in the bug, ve.getHash performs JSON.stringify so to
customise a hash the object should just return an object to be
hashed, not the hash string itself.

Bug: 46895
Change-Id: If11071d4b04a01e25102ffb57240882f650ee10d
2013-04-08 23:29:56 +01:00
Trevor Parscal f7335d4729 Support loading stylesheets into frames from different locations
This is one of the blockers for splitting VE up into separate
repositories or extending VE with an extension.

ve.ui.Frame.js

  It's critical that we don't emit initialize from ve.ui.Frame until
  it's completely loaded, especially its styles, because we will
  begin measuring it straight away.

  Involved loading the stylesheets using $.ajax and setting base
  URL of the iframe to the ve.ui styles directory so all the image
  URLs still worked. This won't work for stylesheets from multiple
  locations, so we needed a more robust solution.

  The new solution uses some trickery described in the code
  documentation, but essentially no longer depends on all
  stylesheets being located in the same folder.

ve.ui.Dialog.js, ve.ui.Inspector.js, ve.ui.Window.js

  Static methods are now being used to extend a window class to
  include different stylesheets rather than simple array
  concatenation.

Change-Id: I619238732f975d41305f81f8f818a577a40f49da
2013-04-08 13:58:50 -07:00
jenkins-bot b47310238d Merge "Quick fix for IE typing after generated content" 2013-04-05 23:14:40 +00:00
Christian Williams de49bf2bf7 Quick fix for IE typing after generated content
The previous check was incorrect and was setting selection
too often.

Change-Id: I1ac393c149b6f814949b84e47faa04906c94f6af
2013-04-05 16:12:12 -07:00
Trevor Parscal 148b6bf8a8 Media dialog support
*/index.php
* Added links to new files

VisualEditor.php
* Added links to new files
* Removed keys of non-existent messages

ve.ui.ContentDialog.js, ve.ui.MetaDialog.js
* Removed redundant comments

ve.ui.MediaDialog.js
* New dialog, just for media

icons.ai, picture.png, picture.svg, ve.ui.Icons-*.css
* Added picture icon

ve.ui.MediaButtonTool.js
* New button, just for media (shows up in the context toolbar)

ve.ui.DialogButtonTool.js
* New base class for dialog buttons

ve.ui.Context.js
* Added basic support for showing dialog buttons, in addition to
  annotation buttons, in the context toolbar - to test, select only an
  image node

ve.ui.Dialog.js
* Prevent clicks on the click-block from changing focus
* Moved initialize to below the event handlers and updated its
  documentation

ve.ui.DialogFactory.js
* Added a way to get the names of dialogs that can be used to edit a
  node

ve.ui.Inspector.js
* Removed close handler which set focus, this is done already in window

ve.ui.InspectorFactory.js
* Fixed comment so it's not telling lies anymore

ve.ui.Window.js
* Removed auto-focus on frame, it's changing the focus in the parent
  document which blows-away the focus in CE, and it really isn't needed
  as it turns out

VisualEditor.18n.php
* Added media dialog title message
* Added media tool tooltip message

Bug: 37870
Change-Id: I9150c46b3e292910fed899fa60d6da433049ca45
2013-04-05 11:52:57 -07:00
Timo Tijhof 1513c23be6 Test: Disable circular reference test for ve.getHash.
Change-Id: Idbad334ed21247c3f4d442f6aad62a0b9347cfc6
2013-04-04 03:31:26 +02:00
jenkins-bot 4b2e33aba4 Merge "ve.init: Fix broken dependency between ve.js and ve.init.platform" 2013-04-04 00:15:32 +00:00
Catrope a0c7d90f65 Fix a bug where trimOuterSpaceFromRange() didn't trim an all-whitespace range
Also add tests for it

Change-Id: I713626bd778f45b5f7bfb6ca4ba2057f84c0a0c5
2013-04-03 16:58:51 -07:00
Timo Tijhof 306680efd5 ve.init.mw.ViewPageTarget: Use original label for replaced tab
To verify
* Save "MediaWiki:Edit" with "Edit page" (anything not "Edit")
* Set this.tabLayout = 'replace';
* Observe that the ve-edit tab is now "Edit" (msg: vector-view-edit)
  instead of "Edit page" (msg: edit)

Bug: 42117
Change-Id: I2e7dd85cd14049101e2d49751d37797d77bc7c9d
2013-04-04 00:16:46 +02:00
jenkins-bot 19383f77f4 Merge "Test: Fix 404 errors in example images." 2013-04-03 20:52:44 +00:00
Inez Korczyński fea3273cad Make ve.ce.Document.getSiblingWordBoundary compatible with new linmod
Change-Id: I746fb8ad761e68cb3c8a76550e2dd4cb540be4e6
2013-04-03 18:07:11 +00:00
Timo Tijhof 1ec8ba3e24 Remove superfluous spaces in function invocations.
Find-Exec: ack '\.[a-zA-Z]+\ \(' --js modules/ve modules/unicodejs
Change-Id: Ib7d0a6514f3321f1d09fbf7cf52c2a9c2cecde88
2013-04-03 17:48:34 +00:00
Timo Tijhof 93b5e174f1 ve.init: Fix broken dependency between ve.js and ve.init.platform
Depencency tree looked like this
* ext.visualEditor.viewPageTarget
  - ve.init.platform
  - ve.init.target
** ext.visualEditor.core
   - (most ve.* classes)
*** ext.visualEditor.base
    - ve.js

Some of the ve classes are calling ve.msg from the global scope
at load time (e.g. in the definition of static properties or in
constructors of classes that were immediately instantiated in
the same file).

Platform needs to be initialised in the base module.
ve.init.Platform.js was already there, but that's just an
abstract base class. The the ve.init.platform property is set
from the implementation classes' files.

Updated makeStaticLoader.php and re-ran for test and demo html.
The fake "Standalone Init" module is now gone, which shows that
this was needed as test/ and demo/ already put their platform
code in/after the 'ext.visualEditor.base' module in the html.

Bug: 45175
Change-Id: I47d7d92495974572194700c98a219d22ecbfaf4b
2013-04-03 05:47:40 +02:00
jenkins-bot 50f84e341e Merge "Re-run makeStaticLoader for index.php (fix 404 ve.ui.FlaggableElements.js)" 2013-04-03 01:58:40 +00:00
Trevor Parscal 96c39e07fc Add left/right/center alignment to popups
This allows the popup to be aligned to the callout in 3 different ways, center is still default.

Change-Id: I3f2a4672da62d7d4cd4c7d20df640d6390f00c9f
2013-04-02 17:36:54 -07:00
Timo Tijhof 6123661736 Re-run makeStaticLoader for index.php (fix 404 ve.ui.FlaggableElements.js)
Change-Id: Ifba82e644e6ad4b2fe69f2632df7935756dd275c
2013-04-02 23:56:25 +02:00
Timo Tijhof 42f4ecc854 Test: Fix 404 errors in example images.
Consistently refer to example.png for <img> tests.
And "Wiki.png" for MediaWiki image tests.

Change-Id: I799654b66bb586338e807a84bb84f7ec0b486728
2013-04-02 23:52:02 +02:00
jenkins-bot 85f6177543 Merge "Add overlay to frame" 2013-04-02 19:22:26 +00:00
jenkins-bot 2f0c091bf2 Merge "Stack panel, element mixins, cleanup" 2013-04-02 19:22:08 +00:00
Trevor Parscal 8e273b7d9f Add overlay to frame
This is where we can add popups and stuff.

Accessible through: this.$$.frame.$overlay

Change-Id: Icbc9a114006804a1b9ab74144f0aaf59a15c5466
2013-04-02 12:10:31 -07:00
Ed Sanders fb534ebedc Script tag for LinearData test not renamed after file move.
Change-Id: I89f7c2afd815f3050a2d837de67189cd628c03c6
2013-04-01 15:39:53 +01:00
jenkins-bot 4d41a23b61 Merge "Store data in LinearData class with an index-value store for objects" 2013-03-30 10:17:39 +00:00
Ed Sanders fdf30b1ac8 Store data in LinearData class with an index-value store for objects
Created an IndexValueStore class which can store any object and return
an integer index to its hash map.

Linear data is now stored in ve.dm.LinearData instances. Two subclasses
for element and meta data contain methods specific to those data types
(ElementLinearData and MetaLinearData).

The static methods in ve.dm.Document that inspected data at a given
offset are now instance methods of ve.dm.ElementLinearData.

AnnotationSets (which are no longer OrderedHashSets) have been moved
to /dm and also have to be instantiated with a pointer the store.

Bug: 46320
Change-Id: I249a5d48726093d1cb3e36351893f4bff85f52e2
2013-03-30 10:06:34 +00:00
Ed Sanders 5b168bdbad Fix MWImageNode dimensions and implement toDomElements
Using element.height was returning 0 if the attribute was empty
when in fact what we mean to store is null (i.e. auto height).

This takes care of the writing of attributes in CE as jQuery
ignores an attribute-set command if the value is null.

Also in this commit I've implemented a basic toDomElements
that outputs the original HTML (code copied from AlienNode).
This stops the code from throwing an exception but will
eventually need to be rewritten to rebuild the HTML from
the attributes stored in the DM.

Bug: 56336
Change-Id: I297a1d0a07e9ebf9d0110fb1cdf266f8415f25b7
2013-03-29 12:51:43 +00:00
jenkins-bot 7b9618ebc2 Merge "Typing support after Aliens and Entities for IE" 2013-03-29 02:19:15 +00:00
Inez Korczyński 836fa82155 Make sure that rangy is initialized only once and that it is initialized before it is used.
Change-Id: Ia318908d34e82ae97ae1bf662ad9fc5dc28bf6ba
2013-03-28 14:50:43 -07:00
Christian Williams 48f6403504 Typing support after Aliens and Entities for IE
When the cursor is between ce="false" elements and an editable next
sibling, IE often sets the anchorNode to be the ce="false" element
(or text node within). This change returns aliens to ce="false"
(abandoning the former true within true IE trick), and ensures that
the cursor is in the right place on keydown by programmatically
setting the selection.

Change-Id: I952488510f32b096b27e8e55d4afc7df930e0072
2013-03-28 14:49:09 -07:00
jenkins-bot f6c50d70a5 Merge "Fix for live preview in jsduck" 2013-03-28 21:11:25 +00:00
Trevor Parscal 3dfbda60d1 Fix for live preview in jsduck
This got out of sync, pretty simple fix.

Change-Id: Ib21e63399f184de1b182f20b9d35307e2c73a0df
2013-03-28 13:26:15 -07:00
Timo Tijhof c53685b865 Doc: Replace "@property @type {Type}" with "@property {Type}".
Also removed a few redundant headings in class documentation
comments. There is already an @class and it looks a bit odd  in
the generated pages:
 <h2>TextString</h2>
 <p>TextString</p>
 <p>This class provides a ...</p>

Change-Id: Ie311c6993ed02e79272dbde71f6a1bc252ef3037
2013-03-28 21:21:56 +01:00
jenkins-bot 9c9675f778 Merge "Fix: focus method should be called on jQuery object not on ve.ui.TextInputWidget object itself." 2013-03-28 20:11:37 +00:00
Inez Korczyński 497b6947e5 Fix: focus method should be called on jQuery object not on ve.ui.TextInputWidget object itself.
Change-Id: I70b6553245b68e6de465eb3434bce4c4228f1764
2013-03-28 13:09:27 -07:00
Inez Korczyński 21e4fdc014 Added support for displaying inline images.
Change-Id: Ieecbca8ed864585e8eaa99598d4bfdb5ac9bfec7
2013-03-28 13:05:57 -07:00
Trevor Parscal a2e59f7c86 Stack panel, element mixins, cleanup
*.php
* Updated links to files

ve.ui.MetaDialog
* Added stack panel that now contains category and language editor panels
* Attached outline widget to stack panel

ve.ui.FlaggableWidget -> ve.ui.FlaggableElement
* Moved to elements

ve.ui.GroupWidget -> ve.ui.GroupElement
* Moved to elements
* Removed invalid event documentation

ve.ui.LabledWidget -> ve.ui.LabledElement
* Moved to elements

ve.ui.StackPanelLayout.js
* New class, mutually exclusive panel container

ve.ui.TitledPanelLayout
* Remvoed, using labeled element instead

ve.ui.Element.css
* Added for elements
* Moved label style here, from widget styles

*.css, ve.ui.ButtonWidget.js, ve.ui.InputLabelWidget, ve.ui.OptionWidget, ve.ui.SelectWidget
* Adjusted class names to reflect widget -> element migration

Change-Id: I32f504c844dba7aae1b286eef06ca046627bdc8d
2013-03-28 12:40:01 -07:00
jenkins-bot 0a8697808e Merge "Removed static "overrides", which were only setting defaults" 2013-03-27 18:34:37 +00:00
jenkins-bot ff38fcd4ef Merge "New popup widget" 2013-03-27 18:30:37 +00:00
Trevor Parscal d25a04b35b New popup widget
This will make the popup with callout functionality easy to reuse elsewhere - in the first case most likely the popup menus for the category widget.

*.php
* Added links to the new widget

ve.ui.Context.css, ve.ui.Widget.css
* Moved styles to the widget stylesheet

ve.ui.Context.js, ve.ui.PopupWidget
* Moved "popup" specific stuff to the new popup widget

Change-Id: I823c6e2c5e1ec11088898e9621d93e983c3b76f3
2013-03-27 11:27:25 -07:00
jenkins-bot 686d4ddc71 Merge "Added layouts and fixed up dialog styling issues" 2013-03-27 18:15:05 +00:00
Inez Korczyński 47691cf586 Initialize rangy once and globally instead of doing it in constructor of every surface.
Change-Id: I06e331021ff8af63e76ceccc005319fc9ce96619
2013-03-27 11:05:29 -07:00
jenkins-bot b20de29fe8 Merge "Small cleanup in CE" 2013-03-27 18:02:06 +00:00
Inez Korczyński fe0fdcd67c Small cleanup in CE
Better comments for:
* ve.ce.Document.getRelativeOffset,
* ve.ce.Document.getSiblingWordBoundary.
Convert ve.ce.Surface.getSelectionRect to a static method.
Moved getNodeAndOffset from ve.ce.Surface to ve.ce.Document.

Change-Id: Ic00221fa463205d04c9b52150c0dd15904493b1e
2013-03-27 10:50:02 -07:00
Ed Sanders 4988efd35e UnicodeJS library to implement Unicode standards
Initially just with a Wordbreak module to implement Unicode standard
on 'Default Word Boundaries'. Due to it's standaloneability this has
been written as a separate library. Non-BMP characters are currently
not supported.

Bug: 44085
Change-Id: Ieafa070076f4c36855684f6bc179667e28af2c25
2013-03-27 17:44:22 +00:00
Trevor Parscal 63567654a2 Link inspector suggestion sections
ve.ui.Widget.css
* Made sections use a default cursor - they aren't clickable so they shouldn't appear to be

Change-Id: Id74288040080c18b8595f2903239bc82e8bc1ab2
2013-03-26 16:57:30 -07:00
Trevor Parscal 482db3763c Removed static "overrides", which were only setting defaults
The default widget element type is already 'div', no need to override that.

Change-Id: Ief6ee9a7a2e2384ea26276483a5d8e33ab70dacf
2013-03-26 16:51:35 -07:00
jenkins-bot a5dcf7cd1b Merge "Prevent adding content to aliens in IE" 2013-03-26 23:04:41 +00:00
Christian Williams a8a5c74d8b Prevent adding content to aliens in IE
The phantoms prevent direct clicking into aliens,
and the recent selection changes prevent keyboard
navigation into aliens, but one issue remained.
Clicking to place the cursor just after an alien
would actually focus within the alien. Typing
modified the alien content. By nesting ce="true"
within ce="true", IE ceases this behavior.

Dragging state is now set to false when blurring
the document. The mouseup event sets dragging to
false, but the event is cancelled because blur
happens between mousedown and mouseup. Phantom
display logic uses on this property.

Change-Id: I162dea89838756fd28d63ff66cc4a5e5bda2873a
2013-03-26 16:01:13 -07:00
Trevor Parscal 168fcec387 Added layouts and fixed up dialog styling issues
ve.ui.Dialog.css
* Fix issue where the use of margin auto on the outer dialog wrapper
  would expose parts of the underlying content - this is resolved by
  making the outer wrapper cover the whole screen and making the
  window frame use margin auto

ve.ui.Icons*.css
* Added missing settings icon rule

ve.ui.Layout.css
* Added styles for editor panel

ve.ui.Window.css
* Removed default height, setting it specifically in inspector now

ve.ui.EditorPanelLayout.js
* New layout, adds a title and icon above the content

ve.ui.TitledEditorLayout.js
* Similar to labeled widget, but for panels

ve.ui.MetaDialog.js
* Using settings icon now
* Switched to using a specific layout - still hard-coded for
  categories

ve.ui.Frame.js
* Modified style loader to guarantee order of style rules, no matter
  what order they load in

*.php
* Moved layouts to be included after widgets so they can use widgets
* Added links to new layouts

Change-Id: I7ff5f5f095460fd4f6cf841f4182bfb92bf034da
2013-03-26 20:52:35 +00:00
Catrope 7e65e3becf Add insert and remove events to MetaList
These events occur when an item is inserted or removed by onTransact(),
so both for insertions/removals done through the MetaList mutators and
insertions/removals done by any other means.

We have to gather these events and batch them up because we have to allow
offset translation and index recomputation to occur first (otherwise
calling .getOffset() and .getIndex() on inserted items doesn't work).

Change-Id: I74a9a21398eca4e9afd7148171af20d439cf7ebd
2013-03-26 15:09:52 +00:00
jenkins-bot 34cc39bf9f Merge changes I4b62a310,I7c9f22a1
* changes:
  Add mutators in MetaList
  Move .commit()/.rollback() from TransactionProcessor to Document
2013-03-26 14:31:44 +00:00
jenkins-bot 8d207b43e7 Merge "Add support for slugs in ve.ce.Document.prototype.getRelativeOffset" 2013-03-25 23:47:03 +00:00
jenkins-bot 14132aeb4e Merge "Docs: Primitive -> primitive." 2013-03-25 23:46:07 +00:00
Inez Korczyński 2108030cfd Add support for slugs in ve.ce.Document.prototype.getRelativeOffset
Also removed ve.ce.Surface.prototype.adjustCursor because it is not being used anymore

Change-Id: Ib7dd8f4f6eaa688995d33247600875a45fc5a602
2013-03-25 16:43:57 -07:00
jenkins-bot e3fd32923f Merge "Cleanup in ve.ce.Surface." 2013-03-25 23:32:32 +00:00
Inez Korczyński 0339a92284 Cleanup in ve.ce.Surface.
Mostly by extracting parts of onDocumentKeyDown method into separated methods: handleLeftOrRightArrowKey and handleUpOrDownArrowKey

Change-Id: If19abf2218bc667c729f7bf388074061cec3031c
2013-03-25 16:23:39 -07:00
jenkins-bot 6178b3bf56 Merge "Fix documentation to place @emits in the correct place" 2013-03-25 22:22:01 +00:00
Catrope 8baf7a1df9 Add mutators in MetaList
Add .insertMeta() and .removeMeta() methods to insert and remove
metadata through the meta list. For convenience, there is also a
.remove() method in MetaItem that wraps around removeMeta().

Also rename insertItem() and removeItem() to addInsertedItem() and
deleteRemovedItem() to avoid confusion, and make the MetaList
constructor take a dm.Surface rather than a document so we can call
change().

Change-Id: I4b62a3109404cfd56f5de68938e1db908b03e678
2013-03-25 21:12:20 +00:00
Ed Sanders 1cec447b59 Fix documentation to place @emits in the correct place
@emits, @returns, @chainable & @throws should always appear
in that order, according to CODING.md.

Change-Id: I9b192e018a028a8b32730c288cc4e3108800fb58
2013-03-25 21:06:05 +00:00
Catrope 1176bf9677 Move .commit()/.rollback() from TransactionProcessor to Document
Previously these were static functions in TransactionProcessor
which instantiated a TP called .process() on it. These are now
methods of ve.dm.Document.

Also moved the emission of the 'transact' event on the document from
TransactionProcessor to Document itself, and moved the tests asserting
double application is protected against from TP to Document (because
the corresponding code moved as well).

Change-Id: I7c9f22a14accaf0ba1f70d5aa4f0573bb7e677d0
2013-03-25 21:03:44 +00:00
jenkins-bot 47dee2a685 Merge "Small cleanup/refactoring to getSiblingWordBoundary" 2013-03-25 20:48:06 +00:00
Inez Korczyński 92ea103153 Small cleanup/refactoring to getSiblingWordBoundary
CPU time + memory optimization + make inexpensive comparison first

Change-Id: I7f504f741b4d90201e40bbc40ae2e88fe0db2e33
2013-03-25 20:38:24 +00:00
Timo Tijhof b19a2010d8 Docs: Primitive -> primitive.
Only one left, thought there were more.

Change-Id: Ifdf490854ea138daf01319ed58cdba4182481c85
2013-03-25 18:55:08 +01:00
jenkins-bot a75b463794 Merge "Add MW-specific meta items for categories and language links" 2013-03-23 21:52:31 +00:00
Inez Korczyński 3b8cdfe2a0 Programmatic handling for selection (arrow up and arrow down only).
This is only for IE and only for backwards selection.

Change-Id: Ifdcd2d404d1018057b5ba16753fc964b07738879
2013-03-22 17:06:41 -07:00
jenkins-bot 59e9c3f65e Merge "Programmatic handling for selection (arrow left and arrow right only)." 2013-03-22 19:34:48 +00:00
jenkins-bot f34407b31a Merge "Introduce helper functions." 2013-03-22 19:28:34 +00:00
Inez Korczyński 8b2d3caebb Programmatic handling for selection (arrow left and arrow right only).
Change-Id: I6ccbecdeafbe189dbe052e4e9ce8f926dad14aea
2013-03-22 12:24:31 -07:00
jenkins-bot e45df0df11 Merge "Introduce method ve.ce.Document.getRelativeOffset." 2013-03-22 19:18:28 +00:00
Inez Korczyński 5b9964878d Introduce helper functions.
* ve.ce.isLeftOrRightArrowKey
* ve.ce.isUpOrDownArrowKey
* ve.ce.isArrowKey

Change-Id: Id9fd7975e98085d01e545d1d0fc6086a06648031
2013-03-22 11:43:18 -07:00
Inez Korczyński c8819742eb Introduce method ve.ce.Document.getRelativeOffset.
Change-Id: If2b8675b4604fc5ec1430497f2d55b2f3584a453
2013-03-22 11:41:26 -07:00
Timo Tijhof 573aea477d ve.init.mw.ViewPageTarget: Fix exception in deactivate().
This caused the page to stay in a dimmed state because it would
throw an exception before tearDownSurface() and showPageContent()
would be called.

Bug: 46456
Change-Id: I91ad2b110c2c523a4bb367407e3f33a953328ab4
2013-03-22 19:32:56 +01:00
Inez Korczyński c636ae138d Cleanup to ve.dm.SurfaceFragment.wordBoundaryPattern
Change-Id: I475fc0c97d5af646f51fe779c4b3136ddd3f83d0
2013-03-21 15:24:23 -07:00
Inez Korczyński 8199f2a1c1 Removed ve.dm.Document.getIEStyleWordBoundary method.
Added ve.ce.Document.getSiblingWordBoundary method.

Change-Id: I44b53273429aede5be10f39c2ee2f70d96cdc6fb
2013-03-21 14:46:13 -07:00
Catrope b39576b433 Add MW-specific meta items for categories and language links
Also rename MWMetaItem to MWAlienMetaItem, because that's what it
really is.

Change-Id: I70695bfa3b8449c936a63f7b2a248b90c49dcea1
2013-03-21 12:18:52 -07:00
Trevor Parscal c2e1350fe0 Remove more periods
Tags don't need periods at the end, these are not complete sentences.

Change-Id: I8efa931862149e892d08b370e70aff8d86a6db7d
2013-03-20 22:55:50 +00:00
Trevor Parscal fb22e4df50 Group, Select, Option, Outline and MenuSection widgets
Objective: Refactor menu widgets so that the majority of their code can be reused, and then add an outline widget which shares the same base classes.

ve.ui.Dialog.css
* Make dialog a fixed width and have a minimum and maximum height while always being centered in the window.
* Add style for the outline panel
* Add border below the title
* Move font-size adjustment to child elements to preserve layout scale

ve.ui.Inspector.css
* Make inspectors fade in when being opened (will happen after the size transition is complete)
* Add initial size for inspector to prevent the default size of the unfinished contents from making it too large while loading

ve.ui.Tool.css
* Update classes according to changes in labeled widgets

ve.ui.Widget.css
* Add display: block to widget labels to support use of autoEllipsis on them
* Update classes according to changes in labeled widgets
* Add styles for new select, option and outline item widgets
* Remove unused group and items classes for menu widgets (which are now subclasses of the select widget and no longer have grouping built-in)

ve.ui.Window.css.js
* Moved selection disabling rules up to the head to prevent selection drawing around the title

ve.ui.GroupWidget.js
* New widget that manages "items", allowing getting, adding, removing and clearing

ve.ui.MenuSectionItemWidget.js
* New widget that can be used inside a menu to create an unselectable, unhighlightable item that describes a section of the menu

ve.ui.OptionWidget.js
* New widget to be used with select widgets, provides select and highlight functionality

ve.ui.OutlineItemWidget.js
* New widget to be used with outline widgets, extends option and adds support for an icon to be rendered to the left of the label

ve.ui.OutlineWidget.js
* New widget that provides a vertically stacked list of mutually exclusive options, extends select

ve.ui.SelectWidget.js
* New widget that implements most of what menu once did, only now it also handles all the events for it's child elements internally

ve.ui.MetaDialog.js
* Hacked in support for an outline widget in the outline pane
* Added classes for styling purposes

ve.ui.FormatDropDownTool.js
* Modified call to menu item constructor as per changes therein
* Reorganized options config to make construction simpler
* Changed to setLabel after selecting the item to prevent the label from being changed to the wrong value as a side-effect of setting the item

ve.ui.DropDownTool.js
* Added $$ in config for menu widget - just in case later on we use a drop-down inside of a frame
* Using jQuery .text() method to propagate the selected item's text to the label rather than keeping around a plain text copy of the label in a property

ve.ui.Context.js
* Improve context/inspector behavior in regards to initial sizing

ve.ui.js
* Added context property to $$ returned by get$$ so it's easy to get the document object (for event binding) wherever you have a $$

ve.ui.Window.js
* Fixed incorrect case for boolean type in comment
* Added getFrame method

ve.ui.ButtonWidget.js
* Removed extra class being set on label

ve.ui.LabeledWidget.js
* Added class on label
* Added fitLabel method which uses autoEllipsis internally

ve.ui.MenuItemWidget.js
* Moved nearly all of the implementation to option so it could be reused

ve.ui.Menu.js
* Moved most of the implementation to select and group

ve.ui.MWLinkTargetInputWidget
* Prevent aborting and re-querying if the value hasn't actually changed
* Updated populateMenu method as per changes in menu class

*.php
* Added links to new files

Change-Id: I2271b5cc0554973b13cfbff94caf16901c02caa5
2013-03-20 22:55:32 +00:00
Trevor Parscal db6cede4d4 Fix transition animation between context menu/inspector
This removes the "grow from nothing" effect (which may have been a
little overkill) but fixes the situation where the inspector is open
and you click to a new location and it moves to the new location and
then transitions down to the menu (which looks bad).

Change-Id: I19d27da6fea7c36965c83aa73836b1bc870c9bcc
2013-03-20 15:43:32 -07:00
jenkins-bot 0cf80096fe Merge "Document and clean up events in all the things" 2013-03-20 16:59:29 +00:00
Timo Tijhof 4e64187beb Document and clean up events in all the things
* Document them consistently between secetions Inheritance and
  Static Properties under their own (new) section Events.
* Removed any quotes or brackets around the event name in existing
  @emit annotations
  Search: @emit.*['"{}(){}]
* For every call to this.emit() anywhere, added @emits.
* Fixed all warnings for references to undefined events
  (introduced as a result of the previous point).
  Event handler parameter documented based on the emit() call
  and actual handlers using the event. Usually the latter is
  more elaborate.
* Extend coverage of jQuery as needed
  (copied from mwcore/maintenance/jsduck/external.js
  written by me, hereby implicitly and explicitly released under MIT).

Specifics
* ve.ce.Surface#onContentChange: Fixed type of range from Object to ve.Range.
* ve.ce.SurfaceObserver#poll: Fix syntax for code from {} to `backticks`.
* ve.ui.Toolbar#onContextChange: Doesn't actually emit "clearState" event.
  Removed #onClearState in Tool, ButtonTool and DropdownTool.

Bug: 45872
Change-Id: Id879aa769b2c72d86a0322e75dddeb868211ce28
2013-03-20 09:58:27 -07:00
jenkins-bot a559d0d180 Merge "Create basic tests for AnnotationSet." 2013-03-20 16:35:15 +00:00
Inez Korczyński 1c62a63bbf Introducing method ve.dm.Document.getIEStyleWordBoundary
This is just a prototype - if it will be as useful as I expect
then it will get refactored (and probably get a better name +
location).

Change-Id: Ice1a2bd7d498d9d8438c35239216f01bd3db1826
2013-03-20 16:32:38 +00:00
Ed Sanders 62dacf17be Minor comment and licence fixes
Change-Id: I7fb632e56291b136e3e7b83ea6335474f1521d05
2013-03-19 20:54:01 +00:00
Ed Sanders 62318f9c61 Create basic tests for AnnotationSet.
Also covers methods inherited from OrderedHashSet.

Bug: 46320
Change-Id: I632e4cf1b87312179a9ce52df0d590ff42f56325
2013-03-19 15:31:50 +00:00
jenkins-bot 223617ecdf Merge "Add MetaList" 2013-03-15 22:58:10 +00:00
jenkins-bot 0ad90791e0 Merge "Layouts, grids and panels" 2013-03-15 22:41:21 +00:00
Trevor Parscal c535d7c5df Layouts, grids and panels
Layouts
* Makes widget inherit from element
* Adds layout which also inherits from element
* Adds grid and panel layouts
* Uses grid layout in meta dialog

Other changes
* Corrects issues with several of the stand-alone files by fixing and using makeStaticLoader.php

Change-Id: I6b92c0204e176c914c26eff8c03ea417578e080c
2013-03-15 15:12:56 -07:00
Catrope 00a109b4a1 Add MetaList
A MetaList is a collection of MetaItems representing all of the
metadata in a ve.dm.Document, and it updates itself live as the
underlying document changes.

Currently this interface is read-only, I'll add mutators next.

Change-Id: If7bfc9563af37e22dcdca9a682d6decc2f6f1872
2013-03-15 15:03:10 -07:00
jenkins-bot 9acd22330d Merge "Added categories and language icons" 2013-03-15 21:24:04 +00:00
Trevor Parscal b58465dead Added categories and language icons
These are not used yet, but will be for inspectors and dialogs to come.

Change-Id: I503c889d137f8a804f627446af861e6b94442e2b
2013-03-15 14:17:42 -07:00
Trevor Parscal 5e7f538a63 Toolbar style fixes
demo.css
* Removed toolbar floating styles, which were out of sync and essentially a duplication of those in ve.Surface.css

ve.Surface.css
* Reorganized rules
* Fixed some CSS syntax issues

Change-Id: I94eb83fa74312266817f8932f54fc9b89332c524
2013-03-15 12:48:49 -07:00
jenkins-bot d73797d087 Merge "Remove 1px left margin from toolbar in Vector" 2013-03-15 18:25:10 +00:00
jenkins-bot 4a27e78813 Merge changes Ieffb108b,I334f7db2
* changes:
  Remove unused .data()
  Link inspector menu not appearing in the right place
2013-03-15 18:24:40 +00:00
Ed Sanders 0e973815ee Remove 1px left margin from toolbar in Vector
Apparently this is left over code from when Vector drew
the left border as a background.

Change-Id: I3a9829ed7ab1bb1f2ad1a1c88aff82b1a2fc456d
2013-03-15 18:14:18 +00:00