mediawiki-extensions-Visual.../modules/ve/dm
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
..
annotations Consistent use of mw in HTML classes, and data element and annotation types 2013-05-28 13:49:56 +01:00
lineardata ve.dm.Transaction: Implement newFromDocumentInsertion 2013-06-19 17:27:50 -07:00
metaitems Copy DOM elements properly, into the correct document 2013-06-18 15:40:33 -07:00
models Transclusion editor template naming goodness 2013-06-18 18:33:58 -07:00
nodes (bug 49837) Handle correctly figure tags with typeof="mw:Image" 2013-06-19 21:15:30 +00:00
ve.dm.Annotation.js Configurable insertion annotations 2013-05-06 22:57:35 +00:00
ve.dm.AnnotationFactory.js Convert AnnotationFactory and MetaItemFactory to NamedClassFactories 2013-04-09 12:05:05 -07:00
ve.dm.AnnotationSet.js Compare objects/arrays fix 2013-05-29 00:39:04 +01:00
ve.dm.BranchNode.js Store DM nodes in InternalList 2013-06-03 22:10:07 +01:00
ve.dm.Converter.js Use indexes in .children, not .childNodes, for attribute preservation 2013-06-17 15:41:22 -07:00
ve.dm.DataString.js Code style fixes 2013-05-06 12:36:52 +01:00
ve.dm.Document.js ve.dm.Transaction: Implement newFromDocumentInsertion 2013-06-19 17:27:50 -07:00
ve.dm.DocumentSlice.js Bump copyright notice year range to -2013 over -2012 2013-02-19 15:37:34 -08:00
ve.dm.DocumentSynchronizer.js Deduplicate childUpdate events based on transaction and appliedness 2013-04-25 17:08:30 -07:00
ve.dm.IndexValueStore.js Preserve location of reference body within key 2013-06-10 02:54:26 +00:00
ve.dm.InternalList.js ve.dm.Transaction: Implement newFromDocumentInsertion 2013-06-19 17:27:50 -07:00
ve.dm.js Bump copyright notice year range to -2013 over -2012 2013-02-19 15:37:34 -08:00
ve.dm.LeafNode.js Store data in LinearData class with an index-value store for objects 2013-03-30 10:06:34 +00:00
ve.dm.LinearData.js Store data in LinearData class with an index-value store for objects 2013-03-30 10:06:34 +00:00
ve.dm.MetaItem.js Fieldsets and default sort keys 2013-05-10 16:46:08 -07:00
ve.dm.MetaItemFactory.js Make .static.storeHtmlAttributes more versatile 2013-05-07 14:45:26 -07:00
ve.dm.MetaList.js Fix breaking getLength() call 2013-05-10 17:02:07 -07:00
ve.dm.Model.js The Great ve.ui.Surface refactor of 2013 2013-05-24 14:01:02 +02:00
ve.dm.ModelRegistry.js Force about grouping for multi-element about groups 2013-05-05 00:07:29 -07:00
ve.dm.Node.js Merging and remapping of IVStores and InternalLists 2013-05-25 11:33:35 +00:00
ve.dm.NodeFactory.js ve.ce.Document: Introduce getRelativeRange method 2013-06-05 13:10:38 +01:00
ve.dm.Surface.js Only undo on MWMetaDialog close if small stack is non-empty 2013-06-18 16:55:03 +01:00
ve.dm.SurfaceFragment.js Reference name and group editing 2013-06-14 15:29:56 -07:00
ve.dm.Transaction.js ve.dm.Transaction: Implement newFromDocumentInsertion 2013-06-19 17:27:50 -07:00
ve.dm.TransactionProcessor.js Kill getOffsetFromNode() with fire 2013-05-09 17:26:22 -07:00