mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-25 14:56:20 +00:00
Wait for onDocumentFocus to happen before setting section range
Bug: 65928 Change-Id: If76408b6b89541f0ecb065d4860e0652b6bdebb5
This commit is contained in:
parent
1c0f331c70
commit
71395e1fa4
|
@ -1453,7 +1453,11 @@ ve.init.mw.Target.prototype.restoreEditSection = function () {
|
|||
offset = surfaceModel.getDocument().data.getNearestContentOffset(
|
||||
offsetNode.getModel().getOffset(), 1
|
||||
);
|
||||
surfaceModel.setSelection( new ve.Range( offset ) );
|
||||
// onDocumentFocus is debounced, so wait for that to happen before setting
|
||||
// the model selection, otherwise it will get reset
|
||||
this.surface.getView().once( 'focus', function () {
|
||||
surfaceModel.setSelection( new ve.Range( offset ) );
|
||||
} );
|
||||
// Scroll to heading:
|
||||
// Wait for toolbar to animate in so we can account for its height
|
||||
setTimeout( function () {
|
||||
|
|
Loading…
Reference in a new issue