Commit graph

539 commits

Author SHA1 Message Date
Ed Sanders d17dc86f51 Fix escapeParams in transclusions to not escape other transclusions
Use a stack counter to work out if we are inside a another template
call.

Bug: 49854
Change-Id: Ic0b97520b1696c3cf292111c7052502d5ccad648
2013-06-27 21:19:51 +01:00
jenkins-bot afe99d400a Merge "Fix comparison of MW internal links" 2013-06-27 17:30:00 +00:00
jenkins-bot 370caaf1ef Merge "Separate out MW specific converter tests" 2013-06-27 17:28:14 +00:00
Ed Sanders 14fa3b0999 Fix comparison of MW internal links
We need to normalise titles so 'user:foo_bar' == 'User:Foo bar', and
we also need to some HTML attribute removal as links from Parsoid
will have href and rel set (again, this should be fixed in by Parsoid
when the do the merging at their end).

Bug: 49985
Change-Id: I5fb5bfc69c344ca4ce4803d7b6116074648a8d7e
2013-06-27 17:43:34 +01:00
Ed Sanders d1aca4503e Separate out MW specific converter tests
They are only run in the MW test runner, where the MW dependencies
are available. Create a ve.test namespace for storing shared
test runners.

Change-Id: I079cb18b1c73614d25a12c5d6afcf0700469e52e
2013-06-27 17:10:25 +01:00
Trevor Parscal 6b5310c562 ve.ui.ViewRegistry annihilation
Objectives:
* Associate models with tools, rather than dialogs and inspectors
* Move tool/model association utilities to ve.ui.ToolFactory
* Obliterate the view registry

Notes:

The only special case for leaving modelClasses definitions in place is
for the linkInspector. It uses these for selection expansion.
Because tools can now override the static canEditModel method, we can
dynamically evaluate a model, rather than be restricted to only
comparing classes. This will be useful for disabling editors for models
that are for some reason incomplete or otherwise broken and cannot be
safely edited.

Change-Id: I7adf254990112d90f1f808593a9111afc7a116b5
2013-06-26 16:52:10 -07:00
Roan Kattouw 92ffa0739d Fix reserialization of mw-data.body.html
This bug caused all references containing complex content (e.g. links
or templates) to be dirty-DOMed and reformatted by Parsoid.

ve.dm.MWReferenceNode.js:
* Parse the original body.html and check if it's semantically equal to
  the new value. If so, don't set it.

ve.dm.Converter.js:
* .normalize() the converter output to remove empty text nodes and
  merge adjacent text nodes

ve.dm.example.js:
* Update reused reference test to have body.html absent, not empty
* Add a link to one of the reference tests so this bug is triggered
** The link's attributes are ordered specifically so that toDomElements
   will reorder them, at least in Chrome (may behave differently in
   other browsers)
** This test fails without this fix in place

Change-Id: Idc091a14422fbb117a3d06fc6bb9497768086fc3
2013-06-25 19:24:18 -07:00
jenkins-bot 2b7e47b8ab Merge "Don't drop annotated comments in wrappers" 2013-06-25 22:54:42 +00:00
jenkins-bot 324e7558c9 Merge "Revert "ve.dm.Transaction: Implement newFromDocumentInsertion"" 2013-06-25 22:14:15 +00:00
Catrope 721f8e0443 Revert "ve.dm.Transaction: Implement newFromDocumentInsertion"
Broke reference insertion because it removed
newFromNodeReplacement(), which is still in use.

This reverts commit 1765e39b40

Change-Id: I043997715474ad4850329ff903eb7a8c61c8b453
2013-06-25 22:08:37 +00:00
Roan Kattouw f9e698db22 Don't drop annotated comments in wrappers
HTML like <td><span>Foo<!--bar--></span></td> would lose the comment
when converting to linmod, and so we'd drop the comment when converting
back to HTML.

This happened because we were queueing up meta items to possibly move
them and their whitespace out of the wrapper paragraph even if we were
inside of an annotation and there was no way we could move things out
at all. The fix is simply to detect these case and not queue up meta
items in that case.

[12:11]	marktraceur	Let the comments hit the floor, let the comments hit the floor
[12:11]	marktraceur	(to the tune of the Drowning Pool "Let the Bodies Hit the Floor")

Bug: 50071
Change-Id: I5a844e2e0655bc1db152b3805718324ca0bb04df
2013-06-25 12:38:17 -07:00
Roan Kattouw c48af4de1f Don't set rel="mw:thumb" on the <a> inside a block image
Causes DOM diffs

Change-Id: I54bd90cfcbdff4baa06f67cbeb2865dca357be19
2013-06-24 17:02:54 -07:00
jenkins-bot eea2f640d7 Merge "Preserve the class attribute for block images" 2013-06-24 23:51:51 +00:00
jenkins-bot 904cdbbb79 Merge "Preserve the <a> inside of a reference <span>" 2013-06-24 23:46:17 +00:00
Roan Kattouw eafbac3412 Preserve the <a> inside of a reference <span>
This was a big gaping DOM diff that's been in there since the beginning,
but which we only found today.

Change-Id: Ie4e791b212ddd3210bc1d5c11308452bb57ae3ce
2013-06-24 16:20:45 -07:00
Roan Kattouw 5212505648 Preserve the class attribute for block images
Build the new set of classes as an array (avoiding the leading space),
and only set it if it differs from what was there before. This avoids
reordering the class attribute.

Change-Id: I863ec8de2e7637f76690c4e0b7db5e153fb7e408
2013-06-24 12:34:15 -07:00
Ed Sanders 2352613b66 Code style fix: (X) -> ( X )
Change-Id: I7f3ac95621f70d9a89e70e9a51905673240cb51f
2013-06-24 18:51:59 +01:00
jenkins-bot 281f91d581 Merge "Store original DOM elements of transclusions" 2013-06-24 16:02:32 +00:00
Ed Sanders 7cc8e495aa Store original DOM elements of transclusions
Prevents changing of DOM attributes on unmodified transclusions
as they can clash in the store.

Also use 'original' over 'orig' consistently.

Bug: 50079
Change-Id: Ib13bb206c49b1f5b186e40632a5c109def0f042e
2013-06-24 15:50:52 +00:00
jenkins-bot 1176f69887 Merge "ve.dm.Transaction: Implement newFromDocumentInsertion" 2013-06-24 14:22:08 +00:00
jenkins-bot cf062adbfc Merge "Pass full data (including meta) to converter in references" 2013-06-24 02:07:01 +00:00
jenkins-bot e8dabd8f37 Merge "Preserve data-mw verbatim if unchanged" 2013-06-24 02:05:44 +00:00
Ed Sanders b963747a45 Pass full data (including meta) to converter in references
Previously we were just passing a slice of the visible data, instead
of using getFullData.

Bug: 50059
Change-Id: I3bbea49132ef4a720a147ba9b170c39a0c00f711
2013-06-24 02:04:57 +00:00
Roan Kattouw 5a70aa5685 Preserve data-mw verbatim if unchanged
Previously we would reserialize the JSON blob in data-mw even if we
didn't change it, which potentially reordered keys and caused a DOM
diff.

Bug: 50066
Change-Id: If0a5bcc67d3a172de0e8839cfda11efacfbf36ff
2013-06-23 19:02:54 -07:00
jenkins-bot 2502f2e3ac Merge "mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved" 2013-06-24 01:31:43 +00:00
Timo Tijhof ef6fae606f mw.ViewPageTarget: Blacklist IE9/IE10 until blocking issues are resolved
Bug: 49187
Change-Id: I2ee2e33c89cac58863c9911fc3ad250c72a46206
2013-06-23 17:04:44 -07:00
Ed Sanders 4bcc07b120 Allow metadata to be annotated
To prevent dirty diffs when inline metadata appears inside annotations.

Bug: 50060
Change-Id: I40da3d5e8e987571195142304b1a853e177e36ff
2013-06-23 18:48:32 +01:00
jenkins-bot f10925bf79 Merge "Create ref list insertion tool" 2013-06-23 03:24:53 +00:00
Timo Tijhof 8a2c9431e6 Create ref list insertion tool
Fixes (follows-up I1b48ef5240, I6daff5c596):
* Invalid html passed to jQuery constructor.
* Use prop() instead of attr() for boolean values.
* Use append() instead of html() when appending nodes instead
  of parsing html.
* Rename shadowed variable name clash 'mw' to 'mwData'.
* Fix odd construction where we parse '{}' to create an empty
  object.
* Have ve.ce.MWReferenceListNode#update perform changes off-document
  in a detached tree.
* Fix deep property access that can fail. mwData is set to
  either JSON parse of data-mw attr or empty object.
  Accessing mwData.attrs.group needs to be guarded by whether
  mw.attrs is indeed set.
* Have `mw` and `about` attribtue in references list roundtrip
  (especially mw which can data we aren't editing/re-creating).
* Add missing 'refGroup' property to MWReferenceListNode's
  data element (similar to what MWReferenceNode already has).

Change-Id: I67e4f378ccd04e97361d8e58ae57db5353075756
2013-06-22 20:23:22 -07:00
jenkins-bot f1aba583a9 Merge "getRenderedContents() optimizations" 2013-06-23 03:09:58 +00:00
Roan Kattouw fe5f4fdce0 getRenderedContents() optimizations
* Use plain text rather than HTML in TextNode
** Bypasses HTML parsing, and doesn't cause regeneration of nodes like
   appending to .innerHTML does
** We were only using HTML so we could use entities, so replace those
   with \uNNNN sequences
* Use native DOM functionality rather than jQuery
* Inline flushBuffer()

Change-Id: I7c6376b55cc0f1420a01a77b365b073fe1636263
2013-06-22 19:37:10 -07:00
Timo Tijhof fb007eb4f5 ve.dm.example: Use jQuery#toArray instead of jQuery#get
Better for performance (lower level, #get calls #toArray when
called without arguments) and more semantically correct.

Change-Id: I8e615674e51fd148367fd397bd169fa203a240ad
2013-06-21 18:03:59 -07:00
jenkins-bot 4d73aaa737 Merge "Change nested annotation test to test recursiveness" 2013-06-21 18:53:48 +00:00
Ed Sanders bf621b3454 Change nested annotation test to test recursiveness
Change-Id: I16f39bd0f6e2b6719ff26f69a561145bb4ca0c2b
2013-06-21 19:47:10 +01:00
jenkins-bot f16e641ab4 Merge "Handle nested empty annotations" 2013-06-21 18:23:22 +00:00
Ed Sanders 8bfbef1c5e Handle nested empty annotations
At the moment we create an alien meta item if an annotation
wraps contents of zero length, however we also need to handle
nested empty annotations, i.e. where the contents is other
empty annotations (i.e. alien meta items).

As alien meta items simply preserve DOM elements we don't
mind what type of alien meta items they are, so this also fixes
the case of an annotation wrapping another alien meta
e.g. a comment or <meta> tag.

Bug: 48605

Change-Id: I98d88b341efcd6384ee1fda5d6d7e1e1acb107aa
2013-06-21 17:20:06 +01:00
James D. Forrester eb35b92f8f Update initialisation scripts for demo, test
Apparently we should be keeping these up-to-date by
running makeStaticLoader :-)

Change-Id: I06f5cdad64b67bb10b6c6a470c818fc9c688560f
2013-06-20 22:10:57 +00:00
Catrope 1765e39b40 ve.dm.Transaction: Implement newFromDocumentInsertion
This function builds a transaction that takes a document slice and
inserts it back into the document it came from, applying any changes
that were made.

This makes editing document slices simple:
    slicedDoc = doc.getDocumentSlice( captionNode );
    // Edit slicedDoc using a surface
    tx = ve.dm.Transaction.newFromDocumentInsertion( doc, captionNode, slicedDoc );
    surface.change( tx );

Specifically, newFromDocumentInsertion replaces the node's contents
with the document's contents (meaning any changes made to the node in
the meantime are lost). It also merges the stores internal lists
of the two documents and remaps indexes accordingly. This means editing
of references inside of references is supported.

This functionality is not specific to slices, and can also be used to
safely insert data from a paste buffer, with internal list data being
transplanted correctly.

ve.dm.MetaLinearData:
* Make merge( [ undefined, undefined, ... ] ) return undefined rather
  than [].

ve.dm.Document:
* In getDocumentSlice, store a pointer to the original dm.Document in
  the new one, and also store the length of the internal list. This
  allows us to figure out which internal list items the two documents
  have in common when we insert the modified slice back into the main
  document.
* In getMetadataReplace, optionally take the inserted metadata as a
  parameter, to allow for operations that insert both data and metadata.
  Per Ed's review, rewrite this function to return null rather than {}
  if no metadata needs to be replaced.

ve.dm.InternalList:
* Add method to merge two internal lists

ve.dm.Transaction:
* Remove newFromNodeReplacement and replace it with newFromDocumentInsertion.
* In pushReplace, optionally take the inserted metadata as a parameter.

Change-Id: I786ee7bad796aa54bc242993b4de3ad18ad0773e
2013-06-19 17:27:50 -07:00
jenkins-bot 8e4177c960 Merge "Only undo on MWMetaDialog close if small stack is non-empty" 2013-06-18 19:34:15 +00:00
Ed Sanders 84fbd1db2c Only undo on MWMetaDialog close if small stack is non-empty
Added return boolean to ve.dm.Surface#breakpoint to indicate if
and transactions were pushed to the big stack. Use this value in
MWMetaDialog to see if we need to undo on close.

Added tests for ve.dm.Surface#breakpoint.

Bug: 49630
Change-Id: Ieb2e9e361afe057af93c4d374acc85df58bfb4c3
2013-06-18 16:55:03 +01:00
Ed Sanders 81bdb7cf3e Store originalIndex instead of mwOriginal in Transclusions
Slightly more efficient way of seeing if the template has changed,
and results in a cleaner set of data element attributes.

Change-Id: I1507520005bfb8a88bfa6038dac5c3b15506425d
2013-06-18 15:23:37 +01:00
Roan Kattouw 177159b388 Test case for 95733390dc
Change-Id: I8c2e239e945466f3e46c92efab03f7e615bc6887
2013-06-17 17:13:45 -07:00
Roan Kattouw d32abe903e Fix selectNodes() bug with empty non-content branch nodes
These kinds of empty nodes shouldn't occur since the converter fills
them with empty paragraphs, but selectNodes() should still behave
correctly for them.

Change-Id: Ia37f3db1c2a84b842e2311cf70642fa66af04d91
2013-06-17 19:09:12 +00:00
Roan Kattouw df97f759b1 Refactor selectNodes tests
* Move them from ve.example.js to ve.dm.example.js
** Also move lookupNode() and createDomElement() there
** Delete ve.example.js because there's nothing left in it
* Make main example document implicit, but allow override
* Specify nodes as arrays and do the lookup later
* Specify range and mode separately rather than calling selectNodes()
  during construction
* Construct statically rather than in a function
* Use expect( cases.length );

Change-Id: I620e949c5e612b32eaa57c5d9b60cc91f9ddbf02
2013-06-17 20:08:08 +01:00
jenkins-bot 4cad5463d4 Merge "Code style fix: @return -> @returns" 2013-06-17 17:53:54 +00:00
jenkins-bot e02d9445b2 Merge "Build the internalList linmod even if it's empty" 2013-06-17 14:09:39 +00:00
Roan Kattouw 393925a868 Build the internalList linmod even if it's empty
Otherwise fun exceptions occur when you have a <references /> tag
with no <ref>s, for instance.

Also disregard the internalList in the data->DOM conversion, to prevent
a nasty interaction where the whitespace information on the last element
is considered invalid because it doesn't match the internalList's.

Plus test updates from hell because this touches ve.dm.example.data

Change-Id: I62881d9fc27fa081123856d1b35a6021af469271
2013-06-17 13:23:20 +01:00
Ed Sanders dcbea2328c Code style fix: @return -> @returns
Change-Id: I26daca6313bf09055af8f980ba0065782257fd54
2013-06-17 11:50:24 +01:00
David Chan a1eb56c14f splitClusters uses Grapheme Cluster Boundary rules
unicodejs.graphemebreak.js
* New file: singleton class with splitClusters method
* On load, builds graphemeBreakRegexp from unicodejs.graphemebreakproperties.js

unicodejs.js
* Remove old splitClusters method (was just a placeholder)
* Change "conjunction" -> "disjunction", for consistency and correctness

unicodejs.textstring.js
* Use new splitClusters method

modules/ve/ve.js
* Use new splitClusters method

unicodejs.wordbreak.text.js
* Add new splitClusters test
* Refactor charRangeArrayRegexp test to use splitClusters

PHP files
* add unicodejs.graphemebreak.js, unicodejs.graphemebreakproperties.js

.docs/categories.json
* add unicodeJS.wordbreak class

Change-Id: I8f512e2fc2c46eb4b5f00994a8dac88f3c8f7dd2
2013-06-16 21:46:02 +01:00
Trevor Parscal fc8c46dd74 Reference name and group editing
Objective:

* Allow editing reference groups and names in the reference dialog

Bonus:

* Modify attribute transaction builder to support multiple attribute
  changes in a single transaction

Changes:

ve.ui.MWReferenceDialog.js
* Load ref name and group from model
* Save ref name and group, if changed, to model

ve.ui.ListAction.js, ve.ui.Transaction.test.js, ve.ce.ResizableNode.js
* Update use of newFromAttributeChange to newFromAttributeChanges

ve.dm.SurfaceFragment.test.js
* Add test for new changeAttributes method

ve.dm.InternalList.js
* Missing new line at end of file

ve.dm.Transaction.js
* Change newFromAttributeChange to accept an list of attribute changes and
  produce a single transaction that applies one or more attribute changes
  at once

ve.dm.SurfaceFragment.js
* Fix bug in getCoveredNodes where the wrong mode name was being used
* Add changeAttributes method, which applies attributes to all covered
  nodes and allows filtering of which types of nodes the attributes are
  applied to

ve.dm.MWReferenceNode.js
* Actually write key and group back to DOM
* Separate onRoot functionality into addToInternalList so it can be called
  separately (similarly onUnroot/removeFromInternalList)

ve.ce.MWReferenceListNode.js
* Clone internal item CE node before appending to avoid rendering bug.

*.php
* Add links to messages and sort them

Change-Id: Ic4121e4fcfc09265d5863af6f078cdeb77926c8e
2013-06-14 15:29:56 -07:00
jenkins-bot 86406d5e48 Merge "Outline controls" 2013-06-14 21:47:36 +00:00
Trevor Parscal ac26f5fc69 Outline controls
Objectives:

* Allow reordering items in outline widgets using an outline control
  widget
* Use an outline control widget to reorder transclusion parts

Changes:

ve.ui.SelectWidget.js
* Emit add and remove events

ve.ui.OutlineItemWidget.js
* Add movable config options
* Add isMovable method

ve.ui.OutlineControlsWidget.js
* New class
* Displays move up/down buttons which are synchronized with an outline
  widget
* Doesn't actually move items (since an outline widget is probably
  data-driven) just emits events

ve.ui.Widget.css
* Add disabled style for icon button widgets
* Add styles for outline controls widget

ve.ui.Icons*.css
* Add missing icon styles

ve.ui.Dialog.css
* Add styles for outline and controls in editable paged dialogs

ve.ui.GroupElement.js
* Fix bug where items are insertions are in the wrong place when "moving"
  them

ve.ui.PagedDialog.js
* Add editable config option which shows outline controls under the
  outline
* Pass through movable config option when creating pages

ve.ui.MWTranclusionDialog.js
* Configure paged dialog outline as editable
* Add initialize method to connect outline controls widget events
* Make addPart method automatically add parameters when templates are
  added
* Add handler for outline controls move event which re-orders parts
* Make parts movable (params are automatically ordered, so they aren't
  movable)

ve.dm.MWTransclusionModel.js
* Add addPart method and use it within the addContent and addTemplate
  methods
* Fix documentation lies
* Add getPartFromId method

*.php
* Add links to new files and messages

Change-Id: I919d4c3e9b85d07a97a99c0b2e8739a859bdf2b1
2013-06-14 11:56:30 -07:00
Roan Kattouw 0c16066eb3 Kill attribute order preservation
Per the bug report, it's useless because Firefox does not preserve order
in the .attributes array (but sorts it alphabetically instead), and so we
actually get the same exact behavior regardless of whether we use ordering
cleverness or just a straight-up plain object: order is preserved in Chrome,
and alphabetized in Firefox.

Bug: 48980
Change-Id: I1463d06db4900083dd4c565292bbabef09194b43
2013-06-13 23:17:08 -07:00
Trevor Parscal d3a2fab2c4 Transclusion editing
Objectives:

* Rename just about every use of "template" to "transclusion"
* Make a proper data structure for transclusions
* Abstract away template data
* Use more template data in the user interface
* Allow adding parameters
* Allow removing templates, parameters and content

Changes:

ve.ui.Dialog.css
* Add rule to place add param controls on a single line

ve.ui.MWTemplateDialogs.js
* Move template spec loading into transclusion class
* Add remove button for parts and parameters
* Add parameter adding form
* Use template data for labels and descriptions

ve.dm.*
* Add new transclusion data structures

*.php
* Add links to new files

*.*
* Rename all things "template" to "transclusion"

Bug: 39598
Bug: 49403
Change-Id: I3bcf924a3e179cb65f19e833277a39dfd3dad8bd
2013-06-12 16:39:13 -07:00
James D. Forrester 9d40239e06 Media display and insertion no longer an experimental feature
Media item dialog for settings; drag-and-drop placement; caption
editing still to come.

Bug: 37870
Change-Id: I547e06dcdb92e19f0159660314187c4f1a62f3ed
2013-06-12 12:39:35 -07:00
jenkins-bot ed2018e58c Merge "Store empty annotations as alienMeta nodes" 2013-06-12 18:55:50 +00:00
jenkins-bot ddd88043fa Merge "Store alien meta items' dom nodes only" 2013-06-12 18:54:00 +00:00
Trevor Parscal 8f9d2a607e Cleanup unused dialogs
Objectives:
* Remove unused dialogs

Changes:

*.js
* Remove unused stuff
*.php
* Cleanup links to files and messages

Change-Id: Ie670afa3aef1757151e385bf922464b85f662a7d
2013-06-12 11:49:44 -07:00
Ed Sanders da51566d56 Store empty annotations as alienMeta nodes
Not a perfect solution, but better than deleting them completely.

Bug: 48605
Change-Id: I0f3a194f629b054f193a61af105733a555775d79
2013-06-12 19:46:41 +01:00
Ed Sanders 59bfc081df Store alien meta items' dom nodes only
We don't need to decompose and rebuild alien meta items
as they are uneditable, so just store the dom node and return that
in toDomElements.

Update test cases and several tests now need to use
assert.deepEqualWithDomElements.

Change-Id: I4d2eed267dac7855cb929a17d7aef566eaf0e287
2013-06-12 16:37:37 +01:00
jenkins-bot 03ed1a5a7f Merge "Match non-BMP characters in wordbreak regexes" 2013-06-10 22:19:15 +00:00
David Chan 6dacf615c0 Match non-BMP characters in wordbreak regexes
unicodejs.js:
* charRangeArrayRegexp to write surrogate-aware regexps
* private helper functions

unicodejs.wordbreak.test.js:
* test charRangeArrayRegexp
* corrected tests for non-BMP wordbreaks

unicodejs.wordbreak.js:
* use new surrogate-aware regexps

unicodejs.wordbreakproperties.js:
* generated from Unicode data

unicodejs.graphemebreakproperties.js:
* generated from Unicode data

unicodejs.wordbreak.groups.js:
* delete as no longer used

unicodejs-properties.py:
* generate unicodejs.wordbreakproperties.js from Unicode data
* generate unicodejs.graphemebreakproperties.js from Unicode data

index.php:
* update script tag links

/VisualEditor.php:
* update script tag links

/demos/ve/index.php:
* update script tag links

/maintenance/makeStaticLoader.php:
* update script tag links

Change-Id: I39c0386a85b0cf21d68d3385b84018a5d7648de5
2013-06-10 23:16:23 +01:00
Trevor Parscal 8039b1c2f8 Insert Reference
Objective:

* Allow opening reference dialog with arbitrary selection
* Auto-insert reference when selection is not a reference node

Changes:

ve.init.mw.ViewPageTarget.js
* Added reference button to toolbar

ve.init.Target.js
* Add getToolbarSubset so we can exclude the reference button from
  the toolbar in the reference dialog (nested references are not
  allowed).

ve.ui.MWReferenceDialog.js
* Stop storing referenceNode (not needed)
* Only store internalItem on open if there's a focused node that's a
  reference
* Use wrapper paragraph when creating a new reference
* Create new reference on dialog close if required

ve.dm.InternalList.js
* Major rewrite to support key less references.
* Add new method for creating a transaction to insert a new iternal
  item. Also returns the index of the new item to be passed to the
  reference node.

Change-Id: I839ae165c299248484ce93d4ab087318a95fbb94
2013-06-10 20:14:08 +01:00
Ed Sanders 1a86cb9c61 Preserve location of reference body within key
Previously we populated the reference body into all <ref> tags
with the same key. Now we store an internal attribute marking
which element originally had the data.

If that tag is deleted the body is moved to the first <ref> tag
with that name.

Change-Id: If9f12bfb699e6ce85bb8f7d2ea9e6df528610a3d
2013-06-10 02:54:26 +00:00
jenkins-bot cd2f411a93 Merge "Support for inline images" 2013-06-07 23:13:19 +00:00
Inez Korczyński 2f15cb0067 Support for inline images
Handles typeof mw:Image and mw:Image/Frameless

Change-Id: Ie2fbd4a3e12fb6faa4ab8e6dd0aa8d1334ff6498
2013-06-07 23:09:32 +00:00
jenkins-bot 45b970c8dc Merge "Remove tests for OOJS methods" 2013-06-06 23:44:13 +00:00
jenkins-bot 351af0f5fe Merge "oojs: Integrate with OOJS v1.0.0" 2013-06-06 23:42:47 +00:00
Timo Tijhof ce8133cca6 Remove tests for OOJS methods
Change-Id: I6443e773fd2baf7e186ab4be0e227e78dd05b4b7
2013-06-06 23:41:52 +00:00
jenkins-bot 002e8d9095 Merge "Pending input refactor" 2013-06-06 21:47:09 +00:00
jenkins-bot 72f661dc69 Merge "ve.dm.MWBlockImageNode: Make toDomElements add more information to its output so round-tripping can work properly." 2013-06-06 21:46:21 +00:00
Trevor Parscal 8a8a337ce5 Pending input refactor
Objective:

* Make all text inputs have the ability to be "pending", not just ones
  with a special mixin

Changes:

* Delete pending input widget
* Move pending input widget implementation to text input widget
* Update all uses of pending input widget
* Make pending image a reusable "texture"
* Update styles of text input widget for pending state
* Get rid of checking for mixin since all text inputs can be pending now

Bonus:

* Get rid of unused images, including .psd and .ai files
* Add transparency texture
* Fix input widget not using documented config value
* Fix documentation in select widget (lies!)

Change-Id: Ib46ab01dc39d706e5c25fd473dee0edce51b7e44
2013-06-06 21:17:35 +00:00
Timo Tijhof 908d1a8c19 oojs: Integrate with OOJS v1.0.0
To make integration and testing easier keeping references and
tests unchanged.

Change-Id: Ie808eaf0ffb754ba9c6be13810cfec2385d8de36
2013-06-06 17:29:55 +02:00
jenkins-bot 8c20fb278f Merge "'typeof' for templates changed in Parsoid, it is 'Transclusion' now and used to be 'Object/Template'" 2013-06-05 23:06:15 +00:00
Inez Korczyński 2f58dd3d40 'typeof' for templates changed in Parsoid, it is 'Transclusion' now and used to be 'Object/Template'
Change-Id: Ia5b826bc1a2a648a8e618642697484000b68bfc2
2013-06-05 15:31:51 -07:00
jenkins-bot 0730e4af6e Merge "Update reference lists and inline numberings automatically." 2013-06-05 22:13:31 +00:00
Ed Sanders 22d1908bd4 Update reference lists and inline numberings automatically.
The easy part is getting the correct numbers from the InternalList
and generating the ordered list HTML. The tricky part is connecting
up the events to make sure the renumberings/list generations are
triggered when required.

InternalList can emit an update event on document transaction, which
triggers the renumbering/relisting if any references have been
added or deleted during that transaction.

ve.ce.MWReferenceListNode also listens to changes on the
InternalListNode (i.e. changes to the contents of the references)
and always triggers a rebuild.

Change-Id: I1b48ef5240e433c3b314259aa68cde13841ea98b
2013-06-05 15:11:16 -07:00
James D. Forrester 96b007eb7b Make the mwMeta dialog trigger a toolbar action, not a button
This has the secondary impact of moving mwMeta dialog out of experimental mode.

Change-Id: I3bb61d536826c6ba139661861092cd63423d99a4
2013-06-05 15:02:19 -07:00
Inez Korczyński d14b2c514d ve.dm.MWBlockImageNode: Make toDomElements add more information to its output so round-tripping can work properly.
Change-Id: Ieacf9187371a1687869bcb4bb0244f1bc251a803
2013-06-05 14:37:28 -07:00
jenkins-bot 4c6b02719d Merge "ve.ce.Document: Introduce getRelativeRange method" 2013-06-05 15:29:51 +00:00
jenkins-bot 453c627922 Merge "Unit tests for browser compatibility list" 2013-06-05 12:33:42 +00:00
Ed Sanders 3b62ffe7c8 Unit tests for browser compatibility list
This test only runs in MW context.

Change-Id: I25315607d208a923aa28f8b34f099440ba311d9d
2013-06-05 14:30:13 +02:00
Inez Korczyński 1cd93f11ca ve.ce.Document: Introduce getRelativeRange method
A new method to be used for cursor left and right movement.

Change-Id: I9b32ccf6800d34f94793fc9086ba2c7341e30c61
2013-06-05 13:10:38 +01:00
jenkins-bot e9a1acdebd Merge "makeStaticLoader: Incorporate hardcoded changes and re-sync" 2013-06-05 11:54:43 +00:00
Timo Tijhof 1b9637123f makeStaticLoader: Incorporate hardcoded changes and re-sync
Follows-up 2e76271 and 231a50f which made manual changes to
the static-loading files without updating makeStaticLoader
(thus causing the load order and if-statement to be out of
sync between different index.php files).

Updating makeStaticLoader to include those changes and applying
it to the other index.php file.

Change-Id: I9bbe97d85f663b1cffeb384d52b5cc54e2f6601b
2013-06-05 13:30:35 +02:00
Timo Tijhof b463c5d377 jshint: Fix trailing comma
Due to the "es5: true" jshint option we enabled, these
warnings were surpressed. I've disabled the option since
we no longer require it. It was enabled in 07c86fc to fix
a bug with jshint. This bug has now been fixed.

Change-Id: I55b7d031eb5581af5f733f050cf2ea98dacb2af6
2013-06-05 13:00:49 +02:00
jenkins-bot 3dfc960576 Merge "Store DM nodes in InternalList" 2013-06-04 17:06:24 +00:00
Ed Sanders 2925966944 Store DM nodes in InternalList
Also keep items in the order they appear in the document
and grouped by group and key.

Additions and removals are triggered by the new root/unroot events.

Change-Id: Ia3e90ccfdab88f352b89992b90554e5f03ff9952
2013-06-03 22:10:07 +01:00
Inez Korczyński 394a40f27c Convert GeneratedContentNode into a mixing (instead of an abstract class).
Change-Id: I280d2a59326bd83357c7a09c3a188a70fbc75335
2013-05-29 14:54:57 -07:00
Inez Korczyński 0b46b44809 Add class mw-figcaption to figcaption tag inside mwimage
This is currently required by Parsoid in order to serialize
(HTMLDOM -> wikitext) correctly.

Change-Id: I827f63420d05c62d689902c9b348d234f20a5d19
2013-05-28 23:21:59 +00:00
Inez Korczyński 476d10b1c3 Adjust coverter getDomSubtreeFromData method call inside ve.dm.MWBlockImageNode to pass correct arguments (there was an API change).
Change-Id: I1918aee714363babf5182c699fd96ef9fd4fce55
2013-05-28 16:01:16 -07:00
Ed Sanders c1136ca8e2 Add tests for ve.dm.InternalLists
Also fix clone method when no document supplied.

Change-Id: I7b24e8622049c6293fa0ef813696d5d91a901e75
2013-05-28 22:08:52 +01:00
jenkins-bot 5add8cc4c0 Merge "Cleanup internalList method names and data stores" 2013-05-28 14:39:14 +00:00
Ed Sanders aa6eca10db Cleanup internalList method names and data stores
Rename some methods and erase the HTML data after conversion.

Change-Id: Ic7317db2c7693591fda4bea459631981a69003f3
2013-05-28 15:11:17 +01:00
Trevor Parscal 8511f8ab3e Treat acronyms like words in camel case names
No matter what the W3C says, getDomFromHtmlString is more legible than
getDOMFromHTMLString.

Change-Id: Ic843b6671871024cce8acd82b6be435599ed168b
2013-05-28 12:51:41 +00:00
Trevor Parscal 3be13a7cbc Consistent use of mw in HTML classes, and data element and annotation types
MWfooBar or MWfoobar should be mwFooBar

Change-Id: I30f0ef05960c9df218ef6f1cb161ff6ccd529bc7
2013-05-28 13:49:56 +01:00
Catrope c36df77e3f Make reference editing work
The only reason it doesn't save correctly right now is because Parsoid
doesn't serialize reference edits correctly.

Change-Id: Ia0f272c07cc28ee829372eb848f23aec99eb92f0
2013-05-25 18:06:57 +02:00
jenkins-bot e25aa4f199 Merge "Add getDocumentSlice" 2013-05-25 11:36:37 +00:00
Catrope 6562b32aa7 Add getDocumentSlice
A document slice is a document built from a data slice of an existing
document. It's completely separate from the original document and has
its own store and internalList. The new document's data also contains
the entirety of the original document's internal list. It's possible
to create a document slice of data located inside the internal list,
in which case the resulting document will contain that data twice (one
mutable copy at the top level, and one immutable copy in the internal
list).

ve.dm.Document.js:
* Optionally take an internalList in the constructor. This allows us to
  create a document with a clone of an existing internalList rather than
  an empty one.
* Add edgeMetadata flag to getFullData()

ve.dm.IndexValueStore.js, ve.dm.InternalList.js:
* Make these classes cloneable

Change-Id: I93e06f764ace16aee9df941b07f8c2bff1a28e2b
2013-05-25 11:33:14 +00:00
jenkins-bot d6b801aa7d Merge "Store multi byte characters as one element" 2013-05-25 09:00:49 +00:00