mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 08:34:54 +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 |
||
---|---|---|
.docs | ||
demos | ||
maintenance | ||
modules | ||
.gitignore | ||
.gitreview | ||
.jshintignore | ||
.jshintrc | ||
ApiVisualEditor.php | ||
AUTHORS.txt | ||
CODING.md | ||
LICENSE.txt | ||
README.txt | ||
VisualEditor.hooks.php | ||
VisualEditor.i18n.php | ||
VisualEditor.php | ||
VisualEditorMessagesModule.php |
VisualEditor provides a visual editor for wiki pages. It is written in JavaScript and runs in a web browser. It uses the Parsoid parser to convert wikitext documents to annotated HTML which the VisualEditor is able to load, modify and emit back to Parsoid at which point it is converted back into wikitext. For more information about these projects, check out the wiki: * http://www.mediawiki.org/wiki/VisualEditor * http://www.mediawiki.org/wiki/Parsoid