mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #3430 from overleaf/msm-filetree-open-selected-entity
[ReactFileTree] Use Local Storage for Open/Closed state of folders and selected doc GitOrigin-RevId: 55073c92fef6c6e1d538a42b22d60d8657b92153
This commit is contained in:
+10
@@ -24,6 +24,16 @@ moment.updateLocale('en', {
|
||||
}
|
||||
})
|
||||
|
||||
let inMemoryLocalStorage = {}
|
||||
global.localStorage = {
|
||||
// localStorage returns `null` when the item does not exist
|
||||
getItem: key =>
|
||||
inMemoryLocalStorage[key] !== undefined ? inMemoryLocalStorage[key] : null,
|
||||
setItem: (key, value) => (inMemoryLocalStorage[key] = value),
|
||||
clear: () => (inMemoryLocalStorage = {}),
|
||||
removeItem: key => delete inMemoryLocalStorage[key]
|
||||
}
|
||||
|
||||
// node-fetch doesn't accept relative URL's: https://github.com/node-fetch/node-fetch/blob/master/docs/v2-LIMITS.md#known-differences
|
||||
const fetch = require('node-fetch')
|
||||
global.fetch = (url, ...options) => fetch('http://localhost' + url, ...options)
|
||||
|
||||
Reference in New Issue
Block a user