mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 10:35:48 +00:00
Fixed scope issue when inserting at structural offsets
This commit is contained in:
parent
b5d822ec1d
commit
38bc605f66
|
@ -256,8 +256,15 @@ es.TransactionProcessor.prototype.retain = function( op ) {
|
||||||
};
|
};
|
||||||
|
|
||||||
es.TransactionProcessor.prototype.insert = function( op ) {
|
es.TransactionProcessor.prototype.insert = function( op ) {
|
||||||
var node = this.model.getNodeFromOffset( this.cursor ),
|
var node;
|
||||||
offset;
|
// If the cursor is on the left of a structural offset, it's going to the the parent node of
|
||||||
|
// the element we want to be inserting into
|
||||||
|
if ( es.DocumentModel.isStructuralOffset( this.model.data, this.cursor ) ) {
|
||||||
|
node = this.model.getNodeFromOffset( this.cursor + 1 );
|
||||||
|
} else {
|
||||||
|
node = this.model.getNodeFromOffset( this.cursor );
|
||||||
|
}
|
||||||
|
var offset;
|
||||||
if ( node.getParent() === this.model ) {
|
if ( node.getParent() === this.model ) {
|
||||||
offset = this.model.getOffsetFromNode( node );
|
offset = this.model.getOffsetFromNode( node );
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue