mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/SyntaxHighlight_GeSHi
synced 2024-11-23 22:13:40 +00:00
Avoid dirty diffs when editing code blocks with line numbers
Steps to reproduce: * Make a wikitext page with <syntaxhighlight line="sure">…</…>. * Edit with VisualEditor and make an unrelated change to the content. * Save. * Before the attribute was always replaced with line="1". * With this patch the old value stays untouched. Change-Id: I433a206905c1a0a1bc06ef8b4037f6db9d935810
This commit is contained in:
parent
fb95fb983b
commit
0b13847937
|
@ -179,6 +179,11 @@ ve.ui.MWSyntaxHighlightWindow.prototype.updateMwData = function ( mwData ) {
|
|||
startLine = this.startLineNumber.getValue();
|
||||
|
||||
mwData.attrs.lang = language || undefined;
|
||||
mwData.attrs.line = showLines ? '1' : undefined;
|
||||
if ( !showLines ) {
|
||||
delete mwData.attrs.line;
|
||||
// Keep whatever value was there before to not cause dirty diffs
|
||||
} else if ( !( 'line' in mwData.attrs ) ) {
|
||||
mwData.attrs.line = '1';
|
||||
}
|
||||
mwData.attrs.start = startLine !== '' ? startLine : undefined;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue