Commit graph

3638 commits

Author SHA1 Message Date
jenkins-bot 3160e8c838 Merge "Fix 404 on iframe styles by standardizing get and set modules methods." 2013-04-10 17:25:58 +00:00
Rob Moen 1db76c392f Fix 404 on iframe styles by standardizing get and set modules methods.
Change-Id: Iebc2a9fc7db00d661f685c28dbc345fb561bb15e
2013-04-10 10:18:39 -07:00
jenkins-bot 46c079f281 Merge "Added icon for reference, switched from category to tag icons" 2013-04-10 00:10:40 +00:00
Catrope 316fdab450 Actually use the doc parameter in toDomElements()
It's been passed in for a while, but nothing ever used it. As we know
some browsers don't like it when we create elements in the wrong
document, and this ensures we always use the correct document for
createElement().

Change-Id: Ia3d2fabe0516956105ad2b5625ed2f76c015c26e
2013-04-09 23:48:03 +00:00
jenkins-bot 906f4cf21d Merge "Clickable inline images" 2013-04-09 23:46:45 +00:00
jenkins-bot c56363912c Merge "Reduce code duplication for annotation rendering" 2013-04-09 23:46:21 +00:00
jenkins-bot 053d0a86a0 Merge "Prevent IE from editing ce="false"" 2013-04-09 23:43:03 +00:00
Catrope 27875c8220 Reduce code duplication for annotation rendering
ve.dm.Converter and ve.ce.ContentBranchNode were duplicating a fair bit
of logic for annotation rendering. Moved the annotation opening and
closing logic into ve.dm.Converter.openAndCloseAnnotations, and
implemented both annotation rendering code paths in terms of that
function with callbacks for caller-specific behavior.

Change-Id: I7cba7d2fda7002287b07949a1b8120ba80bfe854
2013-04-09 23:38:03 +00:00
jenkins-bot 05f4579a53 Merge "Convert AnnotationFactory and MetaItemFactory to NamedClassFactories" 2013-04-09 23:20:20 +00:00
jenkins-bot 9cc2d69a27 Merge "Rename ve.NodeFactory to ve.NamedClassFactory" 2013-04-09 23:03:55 +00:00
jenkins-bot 1f0cca41a1 Merge "Add ve.ce.View as a common base class for ce.Node and ce.Annotation" 2013-04-09 22:50:29 +00:00
Trevor Parscal e647e22317 Added icon for reference, switched from category to tag icons
Change-Id: I15e988eebd4d10f07e60895e9a14f87f4af9e7ea
2013-04-09 15:30:20 -07:00
jenkins-bot 206a2c673c Merge "Implement next/prevBreakOffset and word skipping" 2013-04-09 22:24:41 +00:00
Ed Sanders f36e68c333 Implement next/prevBreakOffset and word skipping
This provides the functionality for keyboard word skipping
(i.e. pressing ctrl/alt + arrow key).

Bug: 46794
Change-Id: Ib0861fa075df805410717a148b8a6e166d947849
2013-04-09 21:55:57 +00:00
Catrope 162f1b4119 Convert AnnotationFactory and MetaItemFactory to NamedClassFactories
Change-Id: Ic6e3a336050a335c88ef41735c0f4e470c5b75b6
2013-04-09 12:05:05 -07:00
Catrope 9c967267e6 Rename ve.NodeFactory to ve.NamedClassFactory
We weren't really using it exclusively for nodes any more, and the only
functionality in there was for using .static.name

Change-Id: Ie26928cd01faee95a10912201663b45f1f20fb19
2013-04-09 12:05:05 -07:00
Catrope 2eb77c1298 Add ve.ce.View as a common base class for ce.Node and ce.Annotation
Just like ve.dm.Model is a common base class for dm.Node, dm.Annotation
and dm.MetaItem.

ce.View abstracts the this.model and this.$ behavior, including liveness,
whitelisted HTML attribute rendering and adding a back reference in
.data(). The back reference has been renamed from .data( 'node' ) to
the more generic .data( 'view' ).

At this point this means ce.Annotation is just a shell around ce.View
(except where it defaults to a span rather than a div), but that could
change in the future.

Change-Id: I0eef5b80718e0b0fcd3f8bba096b452f0bb680d0
2013-04-09 12:05:05 -07:00
Catrope 0b55bb8cdc Move common Node/Annotation/MetaItem code into ve.dm.Model
ve.dm.Model is now the common base class for these three. ve.dm.Node
inherited from ve.Node before, so it now uses it as a mixin instead.
This required changing ve.Node's usage of ve.EventEmitter from
inhertiance to a mixin as well, because inherited methods apparently
don't get mixed in correctly.

* Change annotation terminology from linmodAnnotation to element for
  consistency with Node, MetaItem and Model
* Reimplement getClonedElement() in Node for .internal treatment

Change-Id: Ifd3922af23557c0b0f8984d36b31c8a1e2ec497e
2013-04-09 12:05:05 -07:00
jenkins-bot 9ff221b60a Merge "Fix MetaList tests, were totally broken" 2013-04-09 13:39:43 +00:00
jenkins-bot 237dbe7fde Merge "Fix a bug where trimOuterSpaceFromRange() didn't trim an all-whitespace range" 2013-04-09 11:58:50 +00:00
jenkins-bot 3d0ce68893 Merge "Fix ModelRegistry bugs" 2013-04-09 11:56:14 +00:00
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
jenkins-bot 60de496201 Merge "Support loading stylesheets into frames from different locations" 2013-04-08 21:07:27 +00: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
Translation updater bot 20a1a7d541 Localisation updates from http://translatewiki.net.
Change-Id: I35da34be26ff883143802d73c83af3083ad3c100
2013-04-08 20:07:31 +00:00
Translation updater bot 46b875952c Localisation updates from http://translatewiki.net.
Change-Id: I62770f638377f21bb7b701f08feebc78ecaf0a57
2013-04-07 20:59:24 +00: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
Translation updater bot 22b507ba94 Localisation updates from http://translatewiki.net.
Change-Id: I4a080a31c5102cea5b14b05e89d93db6a7c12bb9
2013-04-05 22:29:45 +00: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