Catrope has uploaded a new change for review.
https://gerrit.wikimedia.org/r/203466
Change subject: [WIP] Death to InternalList
......................................................................
[WIP] Death to InternalList
Depends on Iec449e1030 in VE core.
Change-Id: Ibb2b6c0e108ddc1e63d0472962f6154e6f6f71d9
---
M .jsduck/eg-iframe.html
M VisualEditor.hooks.php
M VisualEditor.php
M modules/ve-mw/dm/models/ve.dm.MWImageModel.js
M modules/ve-mw/dm/models/ve.dm.MWReferenceModel.js
M modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
M modules/ve-mw/dm/nodes/ve.dm.MWReferenceNode.js
D modules/ve-mw/tests/dm/ve.dm.InternalList.test.js
D modules/ve-mw/tests/dm/ve.dm.Transaction.test.js
M modules/ve-mw/tests/dm/ve.dm.mwExample.js
M modules/ve-mw/ui/commands/ve.ui.MWUseExistingReferenceCommand.js
M modules/ve-mw/ui/contextitems/ve.ui.MWReferenceContextItem.js
M modules/ve-mw/ui/dialogs/ve.ui.MWCitationDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWGeneralReferenceDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
M modules/ve-mw/ui/tools/ve.ui.MWCitationDialogTool.js
17 files changed, 54 insertions(+), 710 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/66/203466/1
diff --git a/.jsduck/eg-iframe.html b/.jsduck/eg-iframe.html
index 2d8a283..61d3c78 100644
--- a/.jsduck/eg-iframe.html
+++ b/.jsduck/eg-iframe.html
@@ -170,7 +170,6 @@
<script src="lib/ve/src/dm/ve.dm.SurfaceFragment.js"></script>
<script src="lib/ve/src/dm/ve.dm.DataString.js"></script>
<script src="lib/ve/src/dm/ve.dm.Document.js"></script>
- <script src="lib/ve/src/dm/ve.dm.DocumentSet.js"></script>
<script src="lib/ve/src/dm/ve.dm.DocumentSlice.js"></script>
<script src="lib/ve/src/dm/ve.dm.LinearData.js"></script>
<script
src="lib/ve/src/dm/ve.dm.DocumentSynchronizer.js"></script>
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index 13f59dc..9be2f45 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -522,8 +522,6 @@
'modules/ve-mw/tests/dm/ve.dm.Document.test.js',
'lib/ve/tests/dm/ve.dm.DocumentSynchronizer.test.js',
'lib/ve/tests/dm/ve.dm.IndexValueStore.test.js',
- 'lib/ve/tests/dm/ve.dm.InternalList.test.js',
-
'modules/ve-mw/tests/dm/ve.dm.InternalList.test.js',
'lib/ve/tests/dm/ve.dm.Transaction.test.js',
'modules/ve-mw/tests/dm/ve.dm.Transaction.test.js',
'lib/ve/tests/dm/ve.dm.TransactionProcessor.test.js',
diff --git a/VisualEditor.php b/VisualEditor.php
index ef616a6..66d4db2 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -393,7 +393,6 @@
'lib/ve/src/dm/ve.dm.ContentBranchNode.js',
'lib/ve/src/dm/ve.dm.LeafNode.js',
'lib/ve/src/dm/ve.dm.Annotation.js',
- 'lib/ve/src/dm/ve.dm.InternalList.js',
'lib/ve/src/dm/ve.dm.MetaItem.js',
'lib/ve/src/dm/ve.dm.MetaList.js',
'lib/ve/src/dm/ve.dm.TableMatrix.js',
@@ -430,8 +429,6 @@
'lib/ve/src/dm/nodes/ve.dm.DivNode.js',
'lib/ve/src/dm/nodes/ve.dm.DocumentNode.js',
'lib/ve/src/dm/nodes/ve.dm.HeadingNode.js',
- 'lib/ve/src/dm/nodes/ve.dm.InternalItemNode.js',
- 'lib/ve/src/dm/nodes/ve.dm.InternalListNode.js',
'lib/ve/src/dm/nodes/ve.dm.ListItemNode.js',
'lib/ve/src/dm/nodes/ve.dm.ListNode.js',
'lib/ve/src/dm/nodes/ve.dm.ParagraphNode.js',
@@ -502,8 +499,6 @@
'lib/ve/src/ce/nodes/ve.ce.DivNode.js',
'lib/ve/src/ce/nodes/ve.ce.DocumentNode.js',
'lib/ve/src/ce/nodes/ve.ce.HeadingNode.js',
- 'lib/ve/src/ce/nodes/ve.ce.InternalItemNode.js',
- 'lib/ve/src/ce/nodes/ve.ce.InternalListNode.js',
'lib/ve/src/ce/nodes/ve.ce.ListItemNode.js',
'lib/ve/src/ce/nodes/ve.ce.ListNode.js',
'lib/ve/src/ce/nodes/ve.ce.ParagraphNode.js',
diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
index 03e75be..2edddbe 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
@@ -446,7 +446,7 @@
}
// Add the caption if it isn't empty
captionDoc = this.getCaptionDocument();
- if ( captionDoc.data.countNonInternalElements() > 2 ) {
+ if ( captionDoc.data.getLength() > 2 ) {
editAttributes.captionIndex =
surfaceModel.getDocument().getParentSet().addDocument( captionDoc );
}
fragment.insertContent( contentToInsert );
@@ -734,15 +734,11 @@
this.captionDoc = new ve.dm.Document(
[
{ type: 'paragraph', internal: { generated:
'wrapper' } },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
// htmlDocument
null,
// parentDocument
- null,
- // internalList
null,
// innerWhitespace
null,
diff --git a/modules/ve-mw/dm/models/ve.dm.MWReferenceModel.js
b/modules/ve-mw/dm/models/ve.dm.MWReferenceModel.js
index 21ebd9c..8401856 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWReferenceModel.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWReferenceModel.js
@@ -42,13 +42,10 @@
this.refDoc = new ve.dm.Document(
[
{ type: 'paragraph', internal: { generated:
'wrapper' } },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
/* htmlDocument */ null,
/* parentDocument */ null,
- /* internalList */ null,
/* innerWhitespace */ null,
/* lang */ this.getNodeDocument().getLang(),
/* dir */ this.getNodeDocument().getDir()
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
index 696714f..0f4e12b 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
@@ -143,8 +143,6 @@
new ve.dm.FlatLinearData(
converter.getStore(),
converter.getDataFromDomClean( caption )
- // SUBDOCUMENT TODO kill this terrible
hack
- .concat( [ { type: 'internalList' }, {
type: '/internalList' } ] )
),
converter.getTargetHtmlDocument()
);
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWReferenceNode.js
b/modules/ve-mw/dm/nodes/ve.dm.MWReferenceNode.js
index ea35e52..7d293df 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWReferenceNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWReferenceNode.js
@@ -87,8 +87,6 @@
new ve.dm.FlatLinearData(
converter.getStore(),
converter.getDataFromDomClean(
ve.createDocumentFromHtml( body ).body )
- // SUBDOCUMENT TODO kill this terrible hack
- .concat( [ { type: 'internalList' }, {
type: '/internalList' } ] )
),
converter.getTargetHtmlDocument()
);
@@ -230,17 +228,6 @@
return [ el ];
};
-ve.dm.MWReferenceNode.static.remapInternalListKeys = function ( dataElement,
internalList ) {
- var suffix = '';
- // Try name, name2, name3, ... until unique
- while ( internalList.keys.indexOf( dataElement.attributes.listKey +
suffix ) !== -1 ) {
- suffix = suffix ? suffix + 1 : 2;
- }
- if ( suffix ) {
- dataElement.attributes.listKey = dataElement.attributes.listKey
+ suffix;
- }
-};
-
/**
* Gets the index label for the reference
* @static
@@ -274,9 +261,9 @@
};
/**
- * Gets the internal item node associated with this node
+ * Gets the document with the reference contents associated with this node
*
- * @return {ve.dm.InternalItemNode} Item node
+ * @return {ve.dm.Document} Reference document
*/
ve.dm.MWReferenceNode.prototype.getReferenceDocument = function () {
var refDocIndex = this.getAttribute( 'refDocIndex' );
@@ -359,21 +346,6 @@
delete clone.attributes.mw;
delete clone.attributes.originalMw;
return clone;
-};
-
-ve.dm.MWReferenceNode.prototype.onAttributeChange = function ( key, from, to )
{
- if (
- ( key !== 'listGroup' && key !== 'listKey' ) ||
- ( key === 'listGroup' && this.registeredListGroup === to ) ||
- ( key === 'listKey' && this.registeredListKey === to )
- ) {
- return;
- }
-
- // Need the old list keys and indexes, so we register them in
addToInternalList
- // They've already been updated in this.element.attributes before this
code runs
- this.removeFromInternalList();
- this.addToInternalList();
};
/* Registration */
diff --git a/modules/ve-mw/tests/dm/ve.dm.InternalList.test.js
b/modules/ve-mw/tests/dm/ve.dm.InternalList.test.js
deleted file mode 100644
index 6ebca86..0000000
--- a/modules/ve-mw/tests/dm/ve.dm.InternalList.test.js
+++ /dev/null
@@ -1,239 +0,0 @@
-/*!
- * VisualEditor DataModel MediaWiki-specific InternalList tests.
- *
- * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
- * @license The MIT License (MIT); see LICENSE.txt
- */
-
-QUnit.module( 've.dm.InternalList (MW)' );
-
-/* Tests */
-
-QUnit.test( 'addNode/removeNode', 6, function ( assert ) {
- var doc = ve.dm.mwExample.createExampleDocument( 'references' ),
- newInternalList = new ve.dm.InternalList( doc ),
- referenceNodes = [
- doc.getDocumentNode().children[0].children[0],
- doc.getDocumentNode().children[1].children[1],
- doc.getDocumentNode().children[1].children[3],
- doc.getDocumentNode().children[1].children[5],
- doc.getDocumentNode().children[2].children[0],
- doc.getDocumentNode().children[2].children[1]
- ],
- expectedNodes = {
- 'mwReference/': {
- keyedNodes: {
- 'auto/0': [ referenceNodes[0] ],
- 'literal/bar': [ referenceNodes[1],
referenceNodes[3] ],
- 'literal/:3': [ referenceNodes[2] ],
- 'auto/1': [ referenceNodes[4] ]
- },
- firstNodes: [
- referenceNodes[0],
- referenceNodes[1],
- referenceNodes[2],
- referenceNodes[4]
- ],
- indexOrder: [ 0, 1, 2, 3 ],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- },
- 'mwReference/foo': {
- keyedNodes: {
- 'auto/2': [ referenceNodes[5] ]
- },
- firstNodes: [ undefined, undefined, undefined,
undefined, referenceNodes[5] ],
- indexOrder: [ 4 ],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- }
- };
-
- assert.deepEqualWithNodeTree(
- doc.internalList.nodes,
- expectedNodes,
- 'Document construction populates internal list correctly'
- );
-
- newInternalList.addNode( 'mwReference/', 'auto/0', 0, referenceNodes[0]
);
- newInternalList.addNode( 'mwReference/', 'literal/bar', 1,
referenceNodes[1] );
- newInternalList.addNode( 'mwReference/', 'literal/:3', 2,
referenceNodes[2] );
- newInternalList.addNode( 'mwReference/', 'literal/bar', 1,
referenceNodes[3] );
- newInternalList.addNode( 'mwReference/', 'auto/1', 3, referenceNodes[4]
);
- newInternalList.addNode( 'mwReference/foo', 'auto/2', 4,
referenceNodes[5] );
- newInternalList.onTransact();
-
- assert.deepEqualWithNodeTree(
- newInternalList.nodes,
- expectedNodes,
- 'Nodes added in order'
- );
-
- newInternalList = new ve.dm.InternalList( doc );
-
- newInternalList.addNode( 'mwReference/foo', 'auto/2', 4,
referenceNodes[5] );
- newInternalList.addNode( 'mwReference/', 'auto/1', 3, referenceNodes[4]
);
- newInternalList.addNode( 'mwReference/', 'literal/bar', 1,
referenceNodes[3] );
- newInternalList.addNode( 'mwReference/', 'literal/:3', 2,
referenceNodes[2] );
- newInternalList.addNode( 'mwReference/', 'literal/bar', 1,
referenceNodes[1] );
- newInternalList.addNode( 'mwReference/', 'auto/0', 0, referenceNodes[0]
);
- newInternalList.onTransact();
-
- assert.deepEqualWithNodeTree(
- newInternalList.nodes,
- expectedNodes,
- 'Nodes added in reverse order'
- );
-
- newInternalList.removeNode( 'mwReference/', 'literal/bar', 1,
referenceNodes[1] );
- newInternalList.onTransact();
-
- assert.deepEqualWithNodeTree(
- newInternalList.nodes,
- {
- 'mwReference/': {
- keyedNodes: {
- 'auto/0': [ referenceNodes[0] ],
- 'literal/bar': [ referenceNodes[3] ],
- 'literal/:3': [ referenceNodes[2] ],
- 'auto/1': [ referenceNodes[4] ]
- },
- firstNodes: [
- referenceNodes[0],
- referenceNodes[3],
- referenceNodes[2],
- referenceNodes[4]
- ],
- indexOrder: [ 0, 2, 1, 3 ],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- },
- 'mwReference/foo': {
- keyedNodes: {
- 'auto/2': [ referenceNodes[5] ]
- },
- firstNodes: [ undefined, undefined, undefined,
undefined, referenceNodes[5] ],
- indexOrder: [ 4 ],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- }
- },
- 'Keys re-ordered after one item of key removed'
- );
-
- newInternalList.removeNode( 'mwReference/', 'literal/bar', 1,
referenceNodes[3] );
- newInternalList.onTransact();
-
- assert.deepEqualWithNodeTree(
- newInternalList.nodes,
- {
- 'mwReference/': {
- keyedNodes: {
- 'auto/0': [ referenceNodes[0] ],
- 'literal/:3': [ referenceNodes[2] ],
- 'auto/1': [ referenceNodes[4] ]
- },
- firstNodes: [
- referenceNodes[0],
- undefined,
- referenceNodes[2],
- referenceNodes[4]
- ],
- indexOrder: [ 0, 2, 3 ],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- },
- 'mwReference/foo': {
- keyedNodes: {
- 'auto/2': [ referenceNodes[5] ]
- },
- firstNodes: [ undefined, undefined, undefined,
undefined, referenceNodes[5] ],
- indexOrder: [ 4 ],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- }
- },
- 'Keys truncated after last item of key removed'
- );
-
- newInternalList.removeNode( 'mwReference/', 'auto/0', 0,
referenceNodes[0] );
- newInternalList.removeNode( 'mwReference/foo', 'auto/2', 4,
referenceNodes[5] );
- newInternalList.removeNode( 'mwReference/', 'auto/1', 3,
referenceNodes[4] );
- newInternalList.removeNode( 'mwReference/', 'literal/:3', 2,
referenceNodes[2] );
- newInternalList.onTransact();
-
- assert.deepEqualWithNodeTree(
- newInternalList.nodes,
- {
- 'mwReference/': {
- keyedNodes: {},
- firstNodes: new Array( 4 ),
- indexOrder: [],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- },
- 'mwReference/foo': {
- keyedNodes: {},
- firstNodes: new Array( 5 ),
- indexOrder: [],
- uniqueListKeys: {},
- uniqueListKeysInUse: {}
- }
- },
- 'All nodes removed'
- );
-} );
-
-QUnit.test( 'getItemInsertion', 4, function ( assert ) {
- var insertion, index,
- doc = ve.dm.mwExample.createExampleDocument( 'references' ),
- internalList = doc.getInternalList();
-
- insertion = internalList.getItemInsertion( 'mwReference/',
'literal/foo', [] );
- index = internalList.getItemNodeCount();
- assert.strictEqual( insertion.index, index, 'Insertion creates a new
reference' );
- assert.deepEqual(
- insertion.transaction.getOperations(),
- [
- { type: 'retain', length: 91 },
- {
- type: 'replace',
- remove: [],
- insert: [
- { type: 'internalItem' },
- { type: '/internalItem' }
- ],
- insertedDataOffset: 0,
- insertedDataLength: 2
- },
- { type: 'retain', length: 1 }
- ],
- 'New reference operations match' );
-
- insertion = internalList.getItemInsertion( 'mwReference/',
'literal/foo', [] );
- assert.strictEqual( insertion.index, index, 'Insertion with duplicate
key reuses old index' );
- assert.strictEqual( insertion.transaction, null, 'Insertion with
duplicate key has null transaction' );
-} );
-
-QUnit.test( 'getUniqueListKey', 7, function ( assert ) {
- var generatedName,
- doc = ve.dm.mwExample.createExampleDocument( 'references' ),
- internalList = doc.getInternalList();
-
- generatedName = internalList.getUniqueListKey( 'mwReference/',
'auto/0', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:0', '0 maps to 0' );
- generatedName = internalList.getUniqueListKey( 'mwReference/',
'auto/1', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:1', '1 maps to 1' );
- generatedName = internalList.getUniqueListKey( 'mwReference/',
'auto/2', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:2', '2 maps to 2' );
- generatedName = internalList.getUniqueListKey( 'mwReference/',
'auto/3', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:4', '3 maps to 4 (because
a literal :3 is present)' );
- generatedName = internalList.getUniqueListKey( 'mwReference/',
'auto/4', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:5', '4 maps to 5' );
-
- generatedName = internalList.getUniqueListKey( 'mwReference/',
'auto/0', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:0', 'Reusing a key reuses
the name' );
-
- generatedName = internalList.getUniqueListKey( 'mwReference/foo',
'auto/4', 'literal/:' );
- assert.strictEqual( generatedName, 'literal/:0', 'Different groups are
treated separately' );
-} );
diff --git a/modules/ve-mw/tests/dm/ve.dm.Transaction.test.js
b/modules/ve-mw/tests/dm/ve.dm.Transaction.test.js
deleted file mode 100644
index ff9b353..0000000
--- a/modules/ve-mw/tests/dm/ve.dm.Transaction.test.js
+++ /dev/null
@@ -1,188 +0,0 @@
-/*!
- * VisualEditor DataModel MediaWiki-specific Transaction tests.
- *
- * @copyright 2011-2015 VisualEditor Team and others; see AUTHORS.txt
- * @license The MIT License (MIT); see LICENSE.txt
- */
-
-QUnit.module( 've.dm.Transaction (MW)' );
-
-// FIXME: Duplicates test runner; should be using a data provider
-QUnit.test( 'newFromDocumentInsertion with references', function ( assert ) {
- var i, j, doc2, tx, actualStoreItems, expectedStoreItems, removalOps,
doc,
- complexDoc = ve.dm.mwExample.createExampleDocument(
'complexInternalData' ),
- comment = { type: 'alienMeta', originalDomElements: $( '<!--
hello -->' ).toArray() },
- withReference = [
- { type: 'paragraph' },
- 'B', 'a', 'r',
- { type: 'mwReference', attributes: {
- mw: {},
- about: '#mwt4',
- listIndex: 0,
- listGroup: 'mwReference/',
- listKey: 'auto/0',
- refGroup: '',
- contentsUsed: true
- } },
- { type: '/mwReference' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: 'internalItem' },
- { type: 'paragraph', internal: { generated: 'wrapper' }
},
- 'B',
- 'a',
- 'z',
- { type: '/paragraph' },
- { type: '/internalItem' },
- { type: '/internalList' }
- ],
- cases = [
- {
- msg: 'metadata insertion',
- doc: 'complexInternalData',
- offset: 0,
- range: new ve.Range( 0, 7 ),
- modify: function ( newDoc ) {
- newDoc.commit(
ve.dm.Transaction.newFromMetadataInsertion(
- newDoc, 4, 0, [ comment ]
- ) );
- },
- removalOps: [
- {
- type: 'replace',
- remove: complexDoc.getData( new
ve.Range( 0, 7 ) ),
- insert: [],
- removeMetadata:
complexDoc.getMetadata( new ve.Range( 0, 7 ) ),
- insertMetadata: []
- },
- { type: 'retain', length: 26 }
- ],
- expectedOps: [
- {
- type: 'replace',
- remove: [],
- insert: complexDoc.getData( new
ve.Range( 0, 4 ) )
- // Reference gets
(unnecessarily) renumbered from auto/0 to auto/1
- .concat( [
-
ve.extendObject( true, {}, complexDoc.data.data[4],
- {
attributes: { listKey: 'auto/1' } }
- )
- ] )
- .concat(
complexDoc.getData( new ve.Range( 5, 7 ) ) ),
- removeMetadata: [],
- insertMetadata:
complexDoc.getMetadata( new ve.Range( 0, 4 ) )
- .concat( [ [ comment ]
] )
- .concat(
complexDoc.getMetadata( new ve.Range( 5, 7 ) ) )
- },
- { type: 'retain', length: 1 },
- {
- type: 'replace',
- remove: complexDoc.getData( new
ve.Range( 8, 32 ) ),
- insert: complexDoc.getData( new
ve.Range( 8, 32 ) ),
- removeMetadata:
complexDoc.getMetadata( new ve.Range( 8, 32 ) ),
- insertMetadata:
complexDoc.getMetadata( new ve.Range( 8, 32 ) )
- },
- { type: 'retain', length: 1 }
- ]
- },
- {
- msg: 'metadata removal',
- doc: 'complexInternalData',
- offset: 24,
- range: new ve.Range( 24, 31 ),
- modify: function ( newDoc ) {
- newDoc.commit(
ve.dm.Transaction.newFromMetadataRemoval(
- newDoc, 6, new ve.Range( 0, 1 )
- ) );
- },
- removalOps: [
- { type: 'retain', length: 24 },
- {
- type: 'replace',
- remove: complexDoc.getData( new
ve.Range( 24, 31 ) ),
- insert: [],
- removeMetadata:
complexDoc.getMetadata( new ve.Range( 24, 31 ) ),
- insertMetadata: []
- },
- { type: 'retain', length: 2 }
- ],
- expectedOps: [
- { type: 'retain', length: 8 },
- {
- type: 'replace',
- remove: complexDoc.getData( new
ve.Range( 8, 24 ) )
- .concat(
complexDoc.getData( new ve.Range( 31, 32 ) ) ),
- insert: complexDoc.getData( new
ve.Range( 8, 32 ) ),
- removeMetadata:
complexDoc.getMetadata( new ve.Range( 8, 24 ) )
- .concat(
complexDoc.getMetadata( new ve.Range( 31, 32 ) ) ),
- insertMetadata:
complexDoc.getMetadata( new ve.Range( 8, 30 ) )
- .concat( [ [] ] )
- .concat(
complexDoc.getMetadata( new ve.Range( 31, 32 ) ) )
- },
- { type: 'retain', length: 1 }
- ]
- },
- {
- msg: 'inserting a brand new document; internal
lists are merged and items renumbered',
- doc: 'complexInternalData',
- offset: 7,
- newDocData: withReference,
- removalOps: [],
- expectedOps: [
- { type: 'retain', length: 7 },
- {
- type: 'replace',
- remove: [],
- insert: withReference.slice( 0,
4 )
- // Renumber listIndex
from 0 to 2
- // Renumber listKey
from auto/0 to auto/1
- .concat( [
-
ve.extendObject( true, {}, withReference[4],
- {
attributes: { listIndex: 2, listKey: 'auto/1' } }
- )
- ] )
- .concat(
withReference.slice( 5, 7 ) )
- },
- { type: 'retain', length: 1 },
- {
- type: 'replace',
- remove: complexDoc.getData( new
ve.Range( 8, 32 ) ),
- insert: complexDoc.getData( new
ve.Range( 8, 32 ) )
- .concat(
withReference.slice( 8, 15 ) ),
- removeMetadata:
complexDoc.getMetadata( new ve.Range( 8, 32 ) ),
- insertMetadata:
complexDoc.getMetadata( new ve.Range( 8, 32 ) )
- .concat( new Array( 7 )
)
- },
- { type: 'retain', length: 1 }
- ]
- }
- ];
- QUnit.expect( 3 * cases.length );
- for ( i = 0; i < cases.length; i++ ) {
- doc = ve.dm.mwExample.createExampleDocument( cases[i].doc );
- if ( cases[i].newDocData ) {
- doc2 = new ve.dm.Document( cases[i].newDocData );
- removalOps = [];
- } else if ( cases[i].range ) {
- doc2 = doc.cloneFromRange( cases[i].range );
- cases[i].modify( doc2 );
- tx = ve.dm.Transaction.newFromRemoval( doc,
cases[i].range, true );
- doc.commit( tx );
- removalOps = tx.getOperations();
- }
-
- assert.deepEqualWithDomElements( removalOps,
cases[i].removalOps, cases[i].msg + ': removal' );
-
- tx = ve.dm.Transaction.newFromDocumentInsertion( doc,
cases[i].offset, doc2 );
- assert.deepEqualWithDomElements( tx.getOperations(),
cases[i].expectedOps, cases[i].msg + ': transaction' );
-
- actualStoreItems = [];
- expectedStoreItems = cases[i].expectedStoreItems || [];
- for ( j = 0; j < expectedStoreItems.length; j++ ) {
- actualStoreItems[j] = doc.store.value(
doc.store.indexOfHash(
- OO.getHash( expectedStoreItems[j] )
- ) );
- }
- assert.deepEqual( actualStoreItems, expectedStoreItems,
cases[i].msg + ': store items' );
- }
-} );
diff --git a/modules/ve-mw/tests/dm/ve.dm.mwExample.js
b/modules/ve-mw/tests/dm/ve.dm.mwExample.js
index eac751d..3ca9e08 100644
--- a/modules/ve-mw/tests/dm/ve.dm.mwExample.js
+++ b/modules/ve-mw/tests/dm/ve.dm.mwExample.js
@@ -333,9 +333,7 @@
[ ']', [ ve.dm.mwExample.mwNowikiAnnotation ] ],
[ ']', [ ve.dm.mwExample.mwNowikiAnnotation ] ],
'B', 'a', 'z',
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
];
ve.dm.mwExample.mwNowikiHtml = '<body><p>Foo<span
typeof="mw:Nowiki">[[Bar]]</span>Baz</p></body>';
@@ -430,9 +428,7 @@
type: 'mwAlienMeta',
originalDomElements: $( '<meta typeof="mw:Placeholder"
data-parsoid="foobar" />' ).toArray()
},
- { type: '/mwAlienMeta' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwAlienMeta' }
];
ve.dm.mwExample.withMetaPlainData = [
@@ -446,9 +442,7 @@
'B',
'a',
'z',
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
];
ve.dm.mwExample.withMetaMetaData = [
@@ -641,116 +635,8 @@
group: ''
}
},
- { type: '/mwReferencesList' },
- { type: 'internalList' },
- { type: 'internalItem' },
- { type: 'paragraph' },
- 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '1',
- { type: '/paragraph' },
- { type: '/internalItem' },
- { type: 'internalItem' },
- { type: 'paragraph' },
- 'B', 'a', 'r',
- { type: '/paragraph' },
- { type: '/internalItem' },
- { type: 'internalItem' },
- { type: 'paragraph' },
- 'Q', 'u', 'u', 'x',
- { type: '/paragraph' },
- { type: '/internalItem' },
- { type: 'internalItem' },
- { type: 'paragraph' },
- 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '2',
- { type: '/paragraph' },
- { type: '/internalItem' },
- { type: 'internalItem' },
- { type: 'paragraph' },
- 'N', 'o', ' ', 'n', 'a', 'm', 'e', ' ', '3',
- { type: '/paragraph' },
- { type: '/internalItem' },
- { type: '/internalList' }
+ { type: '/mwReferencesList' }
];
-
-ve.dm.mwExample.complexInternalData = [
- // 0
- { type: 'alienMeta', originalDomElements: $( '<!-- before -->'
).toArray() },
- { type: '/alienMeta' },
- { type: 'paragraph' },
- 'F', ['o', [ve.dm.example.bold]], ['o', [ve.dm.example.italic]],
- // 4
- { type: 'mwReference', attributes: {
- mw: {},
- about: '#mwt1',
- refDocIndex: 1,
- docSetName: 'auto/0',
- group: '',
- contentsUsed: true
- } },
- // 5
- { type: '/mwReference' },
- // 6
- { type: '/paragraph' },
- { type: 'alienMeta', originalDomElements: $( '<!-- after -->'
).toArray() },
- { type: '/alienMeta' },
- // 7
- { type: 'internalList' },
- // 8
- { type: 'internalItem' },
- // 9
- { type: 'paragraph', internal: { generated: 'wrapper' } },
- 'R', ['e', [ve.dm.example.bold]], 'f',
- // 13
- { type: 'alienMeta', originalDomElements: $( '<!-- reference -->'
).toArray() },
- { type: '/alienMeta' },
- 'e', ['r', [ve.dm.example.italic]], ['e', [ve.dm.example.italic]],
- // 16
- { type: 'mwReference', attributes: {
- mw: {},
- about: '#mwt2',
- refDocIndex: 2,
- docSetName: 'foo',
- group: '',
- contentsUsed: true
- } },
- // 17
- { type: '/mwReference' },
- 'n', 'c', 'e',
- // 21
- { type: '/paragraph' },
- // 22
- { type: '/internalItem' },
- // 23
- { type: 'internalItem' },
- { type: 'alienMeta', originalDomElements: $( '<!-- beginning -->'
).toArray() },
- { type: '/alienMeta' },
- // 24
- { type: 'preformatted' },
- { type: 'alienMeta', originalDomElements: $( '<!-- inside -->'
).toArray() },
- { type: '/alienMeta' },
- // 25
- { type: 'mwEntity', attributes: { character: '€' } },
- // 26
- { type: '/mwEntity' },
- '2', '5', '0',
- { type: 'alienMeta', originalDomElements: $( '<!-- inside2 -->'
).toArray() },
- { type: '/alienMeta' },
- // 30
- { type: '/preformatted' },
- { type: 'alienMeta', originalDomElements: $( '<!-- end -->' ).toArray()
},
- { type: '/alienMeta' },
- // 31
- { type: '/internalItem' },
- // 32
- { type: '/internalList' }
- // 33
-];
-
-ve.dm.mwExample.complexInternalData.internalItems = [
- { group: 'mwReference', key: null, body: 'First reference' },
- { group: 'mwReference', key: 'foo', body: 'Table in ref:
<table><tr><td>because I can</td></tr></table>' }
-];
-
-ve.dm.mwExample.complexInternalData.internalListNextUniqueNumber = 1;
ve.dm.mwExample.domToDataCases = {
'adjacent annotations': {
@@ -801,9 +687,7 @@
attributes: { nodeName: 'b' }
} ]
],
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
normalizedBody: '<b>a</b><b data-parsoid="1">b</b><b>c</b><b
data-parsoid="2">d</b> ' +
'<b>ab</b> ' +
@@ -816,9 +700,7 @@
{ type: 'paragraph' },
ve.dm.mwExample.MWInlineImage.data,
{ type: '/mwInlineImage' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'mwHeading and mwPreformatted nodes': {
@@ -834,9 +716,7 @@
{ type: '/mwHeading' },
{ type: 'mwPreformatted' },
'B', 'a', 'r',
- { type: '/mwPreformatted' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwPreformatted' }
]
},
'mwTable with duplicate class attributes': {
@@ -860,18 +740,14 @@
{ type: '/tableCell' },
{ type: '/tableRow' },
{ type: '/tableSection' },
- { type: '/mwTable' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwTable' }
]
},
'mw:Transclusion (block level)': {
body: ve.dm.mwExample.MWTransclusion.blockOpen +
ve.dm.mwExample.MWTransclusion.blockContent,
data: [
ve.dm.mwExample.MWTransclusion.blockData,
- { type: '/mwTransclusionBlock' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwTransclusionBlock' }
],
storeItems: [
ve.dm.mwExample.MWTransclusion.blockStoreItems
@@ -884,9 +760,7 @@
body: ve.dm.mwExample.MWTransclusion.blockOpen +
ve.dm.mwExample.MWTransclusion.blockContent,
data: [
ve.dm.mwExample.MWTransclusion.blockData,
- { type: '/mwTransclusionBlock' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwTransclusionBlock' }
],
storeItems: [
ve.dm.mwExample.MWTransclusion.blockStoreItems
@@ -904,9 +778,7 @@
{ type: 'paragraph', internal: { generated: 'wrapper' }
},
ve.dm.mwExample.MWTransclusion.inlineData,
{ type: '/mwTransclusionInline' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
storeItems: [
ve.dm.mwExample.MWTransclusion.inlineStoreItems
@@ -921,9 +793,7 @@
{ type: 'paragraph', internal: { generated: 'wrapper' }
},
ve.dm.mwExample.MWTransclusion.inlineData,
{ type: '/mwTransclusionInline' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
storeItems: [
ve.dm.mwExample.MWTransclusion.inlineStoreItems
@@ -991,9 +861,7 @@
originalIndex: 0
}
},
- { type: '/mwTransclusionBlock' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwTransclusionBlock' }
],
storeItems: [
{
@@ -1033,9 +901,7 @@
}
},
{ type: '/mwTransclusionInline' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'mw:AlienBlockExtension': {
@@ -1070,9 +936,7 @@
},
originalDomElements: $( '<div about="#mwt1"
data-parsoid="1"></div>' ).toArray()
},
- { type: '/mwAlienBlockExtension' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwAlienBlockExtension' }
],
modify: function ( model ) {
model.data.data[0].attributes.mw.attrs.lang = 'php5';
@@ -1109,9 +973,7 @@
originalDomElements: $( '<img src="Foo"
width="100" height="20" alt="Bar" about="#mwt1" data-parsoid="1"></img>'
).toArray()
},
{ type: '/mwAlienInlineExtension' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
modify: function ( model ) {
model.data.data[1].attributes.mw.body.extsrc =
'\\relative c\' { d d d e e e }';
@@ -1301,13 +1163,11 @@
mw: { name: 'ref', attrs: { group:
'g1', name: 'foo' }, body: { html: 'Ref in refs' } },
originalMw:
'{"name":"ref","body":{"html":"Ref in
refs"},"attrs":{"group":"g1",name":"foo"}}',
group: 'g1'
- },
+ }
},
{ type: '/mwReference' },
{ type: '/paragraph' },
- { type: '/mwReferencesList' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwReferencesList' }
]
},
'mw:Reference with metadata': {
@@ -1346,10 +1206,8 @@
}
},
{ type: '/mwReference' },
- { type: '/paragraph' },
+ { type: '/paragraph' }
// SUBDOCUMENT TODO: assert data for subdocuments, both
for refs and captions
- { type: 'internalList' },
- { type: '/internalList' }
]
},
'internal link with ./ and ../': {
@@ -1396,9 +1254,7 @@
}
} ]
],
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'internal link with absolute path': {
@@ -1417,9 +1273,7 @@
'o',
[ ve.dm.mwExample.MWInternalLink.absoluteData ]
],
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
normalizedBody: '<p><a rel="mw:WikiLink"
href="Foo/Bar">Foo</a></p>',
mwConfig: {
@@ -1442,9 +1296,7 @@
'o',
[
ve.dm.mwExample.MWInternalSectionLink.absoluteData ]
],
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
normalizedBody: '<p><a rel="mw:WikiLink"
href="Foo#Bar">Foo</a></p>',
mwConfig: {
@@ -1469,9 +1321,7 @@
}
} ]
],
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'numbered external link (empty mw:Extlink)': {
@@ -1487,9 +1337,7 @@
},
{ type: '/link/mwNumberedExternal' },
'B', 'a', 'r',
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'URL link': {
@@ -1516,9 +1364,7 @@
}
} ]
],
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'whitespace preservation with wrapped comments and language links': {
@@ -1552,9 +1398,7 @@
},
internal: { whitespace: [ '\n' ] }
},
- { type: '/mwLanguage' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwLanguage' }
]
},
'document with meta elements': {
@@ -1581,9 +1425,7 @@
{ type: 'paragraph', internal: { generated: 'wrapper' }
},
ve.dm.mwExample.MWTransclusion.mixedDataOpen,
ve.dm.mwExample.MWTransclusion.mixedDataClose,
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
storeItems: [
ve.dm.mwExample.MWTransclusion.mixedStoreItems
@@ -1610,9 +1452,7 @@
attributes: { character: '™' }
},
{ type: '/mwEntity' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'wrapping with mw:Entity': {
@@ -1636,9 +1476,7 @@
attributes: { character: '™' }
},
{ type: '/mwEntity' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'whitespace preservation with mw:Entity': {
@@ -1672,9 +1510,7 @@
attributes: { character: '™' }
},
{ type: '/mwEntity' },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'category default sort key': {
@@ -1688,17 +1524,12 @@
},
{ type: '/mwDefaultSort' },
{ type: 'paragraph', internal: { generated: 'empty' } },
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
]
},
'thumb image': {
body: ve.dm.mwExample.MWBlockImage.html,
- data: ve.dm.mwExample.MWBlockImage.data.concat( [
- { type: 'internalList' },
- { type: '/internalList' }
- ] )
+ data: ve.dm.mwExample.MWBlockImage.data
},
'attribute preservation does not crash due to text node split': {
body:
@@ -1735,9 +1566,7 @@
}
},
// SUBDOCUMENT TODO assert caption data
- { type: '/mwBlockImage' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwBlockImage' }
]
},
'mw:Nowiki': {
@@ -1762,9 +1591,7 @@
'mwHeading with no content': {
data: [
{ type: 'mwHeading', attributes: { level: 1 } },
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
normalizedBody: '<p></p>'
},
@@ -1772,9 +1599,7 @@
data: [
{ type: 'mwHeading', attributes: { level: 2 } },
' ', ' ', '\t', ' ',
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
normalizedBody: '<p> \t </p>'
},
@@ -1783,9 +1608,7 @@
{ type: 'mwHeading', attributes: { level: 3 } },
{ type: 'alienMeta', originalDomElements: $( '<meta />'
).toArray() },
{ type: '/alienMeta' },
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
normalizedBody: '<p><meta /></p>'
},
@@ -1797,9 +1620,7 @@
},
{ type: 'alienInline', originalDomElements: $( '<span
rel="ve:Alien">Alien</span>' ).toArray() },
{ type: '/alienInline' },
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
body: '<h4><span rel="ve:Alien">Alien</span></h4>'
},
@@ -1812,9 +1633,7 @@
noconvert: true
}
},
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
body: '<h5></h5>'
},
@@ -1827,9 +1646,7 @@
noconvert: true
}
},
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
modify: function ( doc ) {
doc.data.data.splice( 1, 0, ' ' );
@@ -1848,9 +1665,7 @@
},
{ type: 'alienMeta', originalDomElements: $( '<meta />'
).toArray() },
{ type: '/alienMeta' },
- { type: '/mwHeading' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/mwHeading' }
],
modify: function ( doc ) {
doc.metadata.data[1].splice( 0, 1 );
diff --git a/modules/ve-mw/ui/commands/ve.ui.MWUseExistingReferenceCommand.js
b/modules/ve-mw/ui/commands/ve.ui.MWUseExistingReferenceCommand.js
index 8bb8218..801f2d3 100644
--- a/modules/ve-mw/ui/commands/ve.ui.MWUseExistingReferenceCommand.js
+++ b/modules/ve-mw/ui/commands/ve.ui.MWUseExistingReferenceCommand.js
@@ -30,6 +30,7 @@
* @inheritdoc
*/
ve.ui.MWUseExistingReferenceCommand.prototype.isExecutable = function (
fragment ) {
+ // SUBDOCUMENT TODO: port this
// Parent method
if (
!ve.ui.MWUseExistingReferenceCommand.super.prototype.isExecutable.apply( this,
arguments ) ) {
return false;
diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWReferenceContextItem.js
b/modules/ve-mw/ui/contextitems/ve.ui.MWReferenceContextItem.js
index 2488125..6a797f6 100644
--- a/modules/ve-mw/ui/contextitems/ve.ui.MWReferenceContextItem.js
+++ b/modules/ve-mw/ui/contextitems/ve.ui.MWReferenceContextItem.js
@@ -48,6 +48,7 @@
* @return {jQuery} DOM rendering of reference
*/
ve.ui.MWReferenceContextItem.prototype.getRendering = function () {
+ // SUBDOCUMENT TODO: port this
var ref = ve.dm.MWReferenceModel.static.newFromReferenceNode(
this.model ),
view = new ve.ce.InternalItemNode(
this.model.getDocument().getInternalList().getItemNode(
ref.getListIndex() )
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWCitationDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWCitationDialog.js
index b3c850a..f7581a4 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWCitationDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWCitationDialog.js
@@ -160,6 +160,7 @@
* @inheritdoc
*/
ve.ui.MWCitationDialog.prototype.getActionProcess = function ( action ) {
+ // SUBDOCUMENT TODO: port this
var dialog = this;
if ( action === 'apply' || action === 'insert' ) {
return new OO.ui.Process( function () {
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGeneralReferenceDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWGeneralReferenceDialog.js
index cab206e..b68f54d 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWGeneralReferenceDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGeneralReferenceDialog.js
@@ -161,6 +161,7 @@
* @return {boolean} There are references
*/
ve.ui.MWGeneralReferenceDialog.prototype.doReferencesExist = function () {
+ // SUBDOCUMENT TODO: port this; unify with MWUseExistingReferenceCommand
var groupName,
groups =
this.getFragment().getDocument().getInternalList().getNodeGroups();
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index 45444c5..90313bc 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -1181,15 +1181,13 @@
} else {
captionDocument = new ve.dm.Document( [
{ type: 'paragraph', internal: { generated: 'wrapper' }
},
- { type: '/paragraph' },
- { type: 'internalList' },
- { type: '/internalList' }
+ { type: '/paragraph' }
],
// The ve.dm.Document constructor expects
- // ( data, htmlDocument, parentDocument, internalList,
innerWhitespace, lang, dir )
+ // ( data, htmlDocument, parentDocument, innerWhitespace, lang,
dir )
// as parameters. We are only interested in setting up
language, hence the
// multiple 'null' values.
- null, null, null, null, doc.getLang(), doc.getDir() );
+ null, null, null, doc.getLang(), doc.getDir() );
}
this.store = doc.getStore();
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
index 311db1d..0d82b5a 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWReferenceDialog.js
@@ -143,7 +143,7 @@
*/
ve.ui.MWReferenceDialog.prototype.documentHasContent = function () {
// TODO: Check for other types of empty, e.g. only whitespace?
- return
this.referenceModel.getReferenceDocument().data.countNonInternalElements() > 2;
+ return this.referenceModel.getReferenceDocument().data.getLength() > 2;
};
/*
diff --git a/modules/ve-mw/ui/tools/ve.ui.MWCitationDialogTool.js
b/modules/ve-mw/ui/tools/ve.ui.MWCitationDialogTool.js
index 6f0a8f3..8705eb1 100644
--- a/modules/ve-mw/ui/tools/ve.ui.MWCitationDialogTool.js
+++ b/modules/ve-mw/ui/tools/ve.ui.MWCitationDialogTool.js
@@ -52,8 +52,7 @@
// Check if the reference contains only a template with
the same name as
// this.template
branches = refDoc.getDocumentNode().getChildren();
- // SUBDOCUMENT TODO: once the internalList is killed,
remove this
- if ( branches.length === 2 && branches[1].isInternal()
&& branches[0].canContainContent() ) {
+ if ( branches.length === 1 &&
branches[0].canContainContent() ) {
leaves = branches[0].getChildren();
if ( leaves.length === 1 && leaves[0]
instanceof ve.dm.MWTransclusionNode ) {
return leaves[0].isSingleTemplate(
this.template );
--
To view, visit https://gerrit.wikimedia.org/r/203466
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb2b6c0e108ddc1e63d0472962f6154e6f6f71d9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Catrope <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits