Merge "Fix regression to auto-save"

This commit is contained in:
jenkins-bot 2024-10-29 13:09:52 +00:00 committed by Gerrit Code Review
commit 685fdefd4e
2 changed files with 5 additions and 6 deletions

View file

@ -47,15 +47,15 @@ OO.mixinClass( ve.dm.MWDocumentReferences, OO.EventEmitter );
*/
ve.dm.MWDocumentReferences.static.refsForDoc = function ( doc ) {
let docRefs;
// Only use cache if we're working with the full document.
if ( !doc.getOriginalDocument() ) {
// Only use cache if we're working with the full document.
docRefs = doc.getStorage( 'document-references-store' );
docRefs = doc.extCiteDocumentReferences;
}
if ( docRefs === undefined ) {
docRefs = new ve.dm.MWDocumentReferences( doc );
}
if ( !doc.getOriginalDocument() ) {
doc.setStorage( 'document-references-store', docRefs );
doc.extCiteDocumentReferences = docRefs;
}
return docRefs;
};

View file

@ -9,9 +9,8 @@ function getFragmentMock( hasRefs ) {
return {
getDocument: () => ( {
getOriginalDocument: () => undefined,
getStorage: () => docRefsMock,
setStorage: () => undefined
extCiteDocumentReferences: docRefsMock,
getOriginalDocument: () => undefined
} ),
getSelection: () => ( {
getName: () => 'linear'