mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
Merge "ve.dm.MWTransclusionModel: Remove workaround for T135127"
This commit is contained in:
commit
27a596e4f0
|
@ -70,7 +70,6 @@
|
||||||
function insertNode( isInline, generatedContents ) {
|
function insertNode( isInline, generatedContents ) {
|
||||||
var hash, store, nodeClass,
|
var hash, store, nodeClass,
|
||||||
type = isInline ? baseNodeClass.static.inlineType : baseNodeClass.static.blockType,
|
type = isInline ? baseNodeClass.static.inlineType : baseNodeClass.static.blockType,
|
||||||
range = surfaceFragment.getSelection().getCoveringRange(),
|
|
||||||
data = [
|
data = [
|
||||||
{
|
{
|
||||||
type: type,
|
type: type,
|
||||||
|
@ -90,16 +89,8 @@
|
||||||
store.hash( generatedContents, hash );
|
store.hash( generatedContents, hash );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( range.isCollapsed() ) {
|
surfaceFragment.insertContent( data );
|
||||||
surfaceFragment.insertContent( data );
|
|
||||||
} else {
|
|
||||||
// Generate a replacement transaction instead of using surfaceFragment.insertContent
|
|
||||||
// (which generates a removal and insertion) as blanking a reference triggers T135127.
|
|
||||||
// TODO: Once T135127 is fixed, revert to using surfaceFragment.insert.
|
|
||||||
surfaceFragment.getSurface().change(
|
|
||||||
ve.dm.TransactionBuilder.static.newFromReplacement( surfaceFragment.getDocument(), range, data )
|
|
||||||
);
|
|
||||||
}
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue