Internal nodes should eventually be in a separate document ("sub-documents")
Open, Stalled, HighPublic160 Story Points

Details

Reference
bz47344

Related Objects

bzimport raised the priority of this task from to High.
bzimport set Reference to bz47344.
Catrope created this task.Apr 18 2013, 12:32 AM

This is the notorious "sub-documents" concept.

Jdforrester-WMF renamed this task from VisualEditor: Internal nodes should eventually be in a separate document ("sub-documents") to Internal nodes should eventually be in a separate document ("sub-documents").Dec 3 2014, 12:32 AM
Jdforrester-WMF set Security to None.
Jdforrester-WMF lowered the priority of this task from High to Normal.Jan 15 2015, 12:19 AM

Change 179940 had a related patch set uploaded (by Jforrester):
[VERY VERY WIP] DocumentSet and subdocuments

https://gerrit.wikimedia.org/r/179940

Jdforrester-WMF moved this task from Freezer to Blocked on the VisualEditor board.Mar 10 2015, 5:43 PM
Neil_P._Quinn_WMF removed Catrope as the assignee of this task.May 8 2015, 5:54 PM
Jdforrester-WMF moved this task from Blocked to Freezer on the VisualEditor board.Jun 18 2015, 1:27 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 21 2015, 6:15 PM
Jdforrester-WMF moved this task from To Triage to Epics on the VisualEditor board.Jul 21 2015, 7:17 PM
Jdforrester-WMF raised the priority of this task from Normal to High.Nov 19 2015, 7:36 PM
Jdforrester-WMF updated the task description. (Show Details)
Krinkle removed a subscriber: Krinkle.Mar 8 2016, 10:09 PM
Jdforrester-WMF changed the task status from Open to Stalled.Jun 29 2016, 4:40 PM
Deskana removed DLynch as the assignee of this task.Dec 11 2017, 2:29 PM
Magol added a subscriber: Magol.Dec 28 2017, 10:15 AM
dchan added a subscriber: dchan.May 18 2018, 2:10 PM

Here is a proposal for refinement:

  • Conceptually, an article is a set of documents, of which one is the "main document" and the others are "sub-documents". In code terms there is barely any difference between the main document and sub-documents. Documents do not contain other documents, but can reference them, and the references can form cycles. (Essentially the approach from https://gerrit.wikimedia.org/r/269449/ )
  • Each document has a unique immutable ID (probably a random string) that never gets re-used for another document.
  • In the linear model, documents are appear in creation order (so the main document first), wrapped in an outer 'document' tag:
{ type: 'document', attributes: { id: 'main' } },
...,
{ type: '/document' },
{ type: 'document', attributes: { id: 'xXvWksy' } },
...,
{ type: '/document' },
...
  • In the linear model, references into another document contain that document's ID:
{ type: 'mwReference', attributes: { ..., docId: 'xXvWksy', ... } },
{ type: '/mwReference' }
  • In memory, each document can be represented as a separate ve.dm.Document and node tree.
  • The ve.ce.Document tree for the main document is rendered into a DOM tree using information from the other documents as necessary. The same goes for rendering any sub document as required (e.g. when editing a reference).
  • There is *no* special infrastructure in ve.dm.Transaction to handle these extensions, and the document history remains a single transaction list. Rebasing valid transactions over valid transactions will preserve validity (which is what the unique immutable ID was for).