mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 23:05:35 +00:00
54a232a92b
For data->DOM, this is easy: .toDataElements() can optionally return an array instead of an object, and that will be treated as the data to insert. If this happens, the converter won't descend. The node handler can recursively invoke the converter if it needs to (although I suspect the current implementation is broken when converting block content in an inline context). For DOM->data, this is a bit more complex. The node sets .static.handlesOwnChildren = true; , which triggers the converter to pass a data slice rather than a single data element, and not to descend. The node handler can invoke the converter to recursively convert DOM subtrees to data. ve.dm.Converter (data->DOM): * Renamed createDataElement() to createDataElements() ** .toDataElement() may return element or array, handle this * Renamed childDataElement to childDataElements, is now an array * Actually alienate if .toDataElement() returns null ** Shockingly, this claimed to be supported before but wasn't * Rather than pushing to data, concat to it ** Add closing if needed * Don't descend if .toDataElement() returned an array of length >1, or if the node has .handlesOwnChildren = true ve.dm.Converter (DOM->data): * Split getDomSubtreeFromData() and getDomFromData() * When converting a node that handles its own children, pass in a data slice and skip over that data Change-Id: I196cb4c0895cbf0b428a189adb61b56565573ab3 |
||
---|---|---|
.. | ||
annotations | ||
lineardata | ||
metaitems | ||
nodes | ||
ve.dm.Annotation.js | ||
ve.dm.AnnotationFactory.js | ||
ve.dm.AnnotationSet.js | ||
ve.dm.BranchNode.js | ||
ve.dm.Converter.js | ||
ve.dm.DataString.js | ||
ve.dm.Document.js | ||
ve.dm.DocumentSlice.js | ||
ve.dm.DocumentSynchronizer.js | ||
ve.dm.IndexValueStore.js | ||
ve.dm.js | ||
ve.dm.LeafNode.js | ||
ve.dm.LinearData.js | ||
ve.dm.MetaItem.js | ||
ve.dm.MetaItemFactory.js | ||
ve.dm.MetaList.js | ||
ve.dm.Model.js | ||
ve.dm.ModelRegistry.js | ||
ve.dm.Node.js | ||
ve.dm.NodeFactory.js | ||
ve.dm.Surface.js | ||
ve.dm.SurfaceFragment.js | ||
ve.dm.Transaction.js | ||
ve.dm.TransactionProcessor.js |