mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
"Is there data?" a.k.a. Insert data only if there is a data to be inserted.
Change-Id: If5957c38668f4dedcba72fc79f9a273614c6dce3
This commit is contained in:
parent
435d45cf9e
commit
4b1b63d357
|
@ -222,12 +222,15 @@ ve.ce.Surface.prototype.onContentChange = function ( node, previous, next ) {
|
|||
if ( annotations.getLength() > 0 ) {
|
||||
ve.dm.Document.addAnnotationsToData( data, annotations );
|
||||
}
|
||||
this.model.change(
|
||||
ve.dm.Transaction.newFromInsertion(
|
||||
this.documentView.model, nodeOffset + 1 + fromLeft, data
|
||||
),
|
||||
next.range
|
||||
);
|
||||
if ( data.length > 0)
|
||||
{
|
||||
this.model.change(
|
||||
ve.dm.Transaction.newFromInsertion(
|
||||
this.documentView.model, nodeOffset + 1 + fromLeft, data
|
||||
),
|
||||
next.range
|
||||
);
|
||||
}
|
||||
if ( fromLeft + fromRight < previous.text.length ) {
|
||||
this.model.change(
|
||||
ve.dm.Transaction.newFromRemoval(
|
||||
|
|
Loading…
Reference in a new issue