mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeMirror
synced 2024-11-23 22:03:28 +00:00
Merge "ve.ui.CodeMirror.v6: update gutter width after CM view is updated"
This commit is contained in:
commit
7d56c5ee8a
|
@ -222,12 +222,6 @@ ve.ui.CodeMirrorAction.prototype.onDocumentPrecommit = function ( tx ) {
|
|||
store = this.surface.getModel().getDocument().getStore();
|
||||
let offset = 0;
|
||||
|
||||
const documentNode = document.querySelector( '.ve-ce-documentNode' );
|
||||
const guttersWidth = parseInt( document.querySelector( '.cm-gutters' ).offsetWidth );
|
||||
const marginProperty = this.surface.getModel().getDocument().getDir() === 'rtl' ? 'margin-right' : 'margin-left';
|
||||
// XXX: Why 6px?
|
||||
documentNode.style[ marginProperty ] = ( guttersWidth - 6 ) + 'px';
|
||||
|
||||
tx.operations.forEach( ( op ) => {
|
||||
if ( op.type === 'retain' ) {
|
||||
offset += op.length;
|
||||
|
@ -245,6 +239,8 @@ ve.ui.CodeMirrorAction.prototype.onDocumentPrecommit = function ( tx ) {
|
|||
for ( let i = replacements.length - 1; i >= 0; i-- ) {
|
||||
this.surface.mirror.view.dispatch( { changes: replacements[ i ] } );
|
||||
}
|
||||
|
||||
action.updateGutterWidth( this.surface.getModel().getDocument().getDir() );
|
||||
};
|
||||
|
||||
/* Registration */
|
||||
|
|
Loading…
Reference in a new issue