mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-28 08:10:35 +00:00
ve.dm.MWImageModel: Drop back-compatibility with old versions of VE selections
Change-Id: I38b309ca240b8305a0b29e11f822e1ad6e1ed3da
This commit is contained in:
parent
8ce083a832
commit
17377ce65c
|
@ -438,7 +438,7 @@ ve.dm.MWImageModel.prototype.updateImageNode = function ( node, surfaceModel ) {
|
|||
* @throws {Error} Unknown image node type
|
||||
*/
|
||||
ve.dm.MWImageModel.prototype.insertImageNode = function ( fragment ) {
|
||||
var offset, contentToInsert, selectedNode, linearSelection,
|
||||
var offset, contentToInsert, selectedNode,
|
||||
nodeType = this.getImageNodeType(),
|
||||
surfaceModel = fragment.getSurface();
|
||||
|
||||
|
@ -467,16 +467,7 @@ ve.dm.MWImageModel.prototype.insertImageNode = function ( fragment ) {
|
|||
offset = fragment.getDocument().data.getNearestContentOffset( fragment.getSelection().getRange().start );
|
||||
}
|
||||
if ( offset > -1 ) {
|
||||
try {
|
||||
// Old interface
|
||||
// TODO: Remove this code once deployed on top of
|
||||
// I715ae805f63f575249d7534112f4e30937d92e74
|
||||
linearSelection = new ve.dm.LinearSelection( fragment.getDocument(), new ve.Range( offset ) );
|
||||
} catch ( ex ) {
|
||||
// New interface
|
||||
linearSelection = new ve.dm.LinearSelection( new ve.Range( offset ) );
|
||||
}
|
||||
fragment = fragment.clone( linearSelection );
|
||||
fragment = fragment.clone( new ve.dm.LinearSelection( new ve.Range( offset ) ) );
|
||||
}
|
||||
fragment.insertContent( contentToInsert );
|
||||
return fragment;
|
||||
|
@ -485,16 +476,7 @@ ve.dm.MWImageModel.prototype.insertImageNode = function ( fragment ) {
|
|||
// Try to put the image in front of the structural node
|
||||
offset = fragment.getDocument().data.getNearestStructuralOffset( fragment.getSelection().getRange().start, -1 );
|
||||
if ( offset > -1 ) {
|
||||
try {
|
||||
// Old interface
|
||||
// TODO: Remove this code once deployed on top of
|
||||
// I715ae805f63f575249d7534112f4e30937d92e74
|
||||
linearSelection = new ve.dm.LinearSelection( fragment.getDocument(), new ve.Range( offset ) );
|
||||
} catch ( ex ) {
|
||||
// New interface
|
||||
linearSelection = new ve.dm.LinearSelection( new ve.Range( offset ) );
|
||||
}
|
||||
fragment = fragment.clone( linearSelection );
|
||||
fragment = fragment.clone( new ve.dm.LinearSelection( new ve.Range( offset ) ) );
|
||||
}
|
||||
fragment.insertContent( contentToInsert );
|
||||
// Add contents of new caption
|
||||
|
|
Loading…
Reference in a new issue