mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-12 09:09:25 +00:00
Use cloneWithData
Change-Id: I7ffe3c7ab20d5f785a6642c8293f271f4dc08ff8
This commit is contained in:
parent
eb9c346221
commit
35c0a0dc69
|
@ -821,26 +821,12 @@ ve.dm.MWImageModel.prototype.getCurrentDimensions = function () {
|
||||||
*/
|
*/
|
||||||
ve.dm.MWImageModel.prototype.getCaptionDocument = function () {
|
ve.dm.MWImageModel.prototype.getCaptionDocument = function () {
|
||||||
if ( !this.captionDoc ) {
|
if ( !this.captionDoc ) {
|
||||||
this.captionDoc = new ve.dm.Document(
|
this.captionDoc = this.parentDoc.cloneWithData( [
|
||||||
[
|
{ type: 'paragraph', internal: { generated: 'wrapper' } },
|
||||||
{ type: 'paragraph', internal: { generated: 'wrapper' } },
|
{ type: '/paragraph' },
|
||||||
{ type: '/paragraph' },
|
{ type: 'internalList' },
|
||||||
{ type: 'internalList' },
|
{ type: '/internalList' }
|
||||||
{ type: '/internalList' }
|
] );
|
||||||
],
|
|
||||||
// htmlDocument
|
|
||||||
this.parentDoc.getHtmlDocument(),
|
|
||||||
// parentDocument
|
|
||||||
null,
|
|
||||||
// internalList
|
|
||||||
null,
|
|
||||||
// innerWhitespace
|
|
||||||
null,
|
|
||||||
// lang
|
|
||||||
this.parentDoc.getLang(),
|
|
||||||
// dir
|
|
||||||
this.parentDoc.getDir()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return this.captionDoc;
|
return this.captionDoc;
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,7 +55,8 @@ ve.ui.MWExtensionPreviewDialog.prototype.getSetupProcess = function ( data ) {
|
||||||
doc = this.selectedNode.getDocument().cloneFromRange( this.selectedNode.getOuterRange() );
|
doc = this.selectedNode.getDocument().cloneFromRange( this.selectedNode.getOuterRange() );
|
||||||
} else {
|
} else {
|
||||||
element = this.getNewElement();
|
element = this.getNewElement();
|
||||||
doc = new ve.dm.Document( [
|
// We assume that WindowAction pass
|
||||||
|
doc = data.fragment.getDocument().cloneWithData( [
|
||||||
element,
|
element,
|
||||||
{ type: '/' + element.type },
|
{ type: '/' + element.type },
|
||||||
{ type: 'internalList' },
|
{ type: 'internalList' },
|
||||||
|
|
|
@ -1271,17 +1271,12 @@ ve.ui.MWMediaDialog.prototype.resetCaption = function () {
|
||||||
if ( this.imageModel ) {
|
if ( this.imageModel ) {
|
||||||
captionDocument = this.imageModel.getCaptionDocument();
|
captionDocument = this.imageModel.getCaptionDocument();
|
||||||
} else {
|
} else {
|
||||||
captionDocument = new ve.dm.Document( [
|
captionDocument = doc.cloneWithData( [
|
||||||
{ type: 'paragraph', internal: { generated: 'wrapper' } },
|
{ type: 'paragraph', internal: { generated: 'wrapper' } },
|
||||||
{ type: '/paragraph' },
|
{ type: '/paragraph' },
|
||||||
{ type: 'internalList' },
|
{ type: 'internalList' },
|
||||||
{ type: '/internalList' }
|
{ type: '/internalList' }
|
||||||
],
|
] );
|
||||||
// The ve.dm.Document constructor expects
|
|
||||||
// ( data, htmlDocument, parentDocument, internalList, 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() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.store = doc.getStore();
|
this.store = doc.getStore();
|
||||||
|
|
Loading…
Reference in a new issue