@electerm/electerm-react 1.38.43 → 1.38.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -162,18 +162,24 @@ export default (Store) => {
162
162
  const pass = store.getSyncPassword(type)
163
163
  const objs = {}
164
164
  for (const n of names) {
165
- let str = JSON.stringify(store.getItems(n))
165
+ let str = store.getItems(n)
166
+ const order = await getData(`${n}:order`)
167
+ if (order && order.length) {
168
+ str.sort((a, b) => {
169
+ const ai = findIndex(order, r => r === a.id)
170
+ const bi = findIndex(order, r => r === b.id)
171
+ return ai - bi
172
+ })
173
+ }
174
+ str = JSON.stringify(str)
166
175
  if (n === settingMap.bookmarks && pass) {
167
176
  str = await window.pre.runGlobalAsync('encryptAsync', str, pass)
168
177
  }
169
178
  objs[`${n}.json`] = {
170
179
  content: str
171
180
  }
172
- const order = await getData(`${n}:order`)
173
- if (order && order.length) {
174
- objs[`${n}.order.json`] = {
175
- content: JSON.stringify(order)
176
- }
181
+ objs[`${n}.order.json`] = {
182
+ content: 'empty'
177
183
  }
178
184
  }
179
185
  const res = await fetchData(type, 'update', [gistId, {
@@ -315,11 +321,19 @@ export default (Store) => {
315
321
  update('lastDataUpdateTime', store.lastDataUpdateTime)
316
322
  }, 1000)
317
323
 
318
- Store.prototype.handleExportAllData = function () {
324
+ Store.prototype.handleExportAllData = async function () {
319
325
  const { store } = window
320
326
  const objs = {}
321
327
  for (const n of names) {
322
328
  objs[n] = store.getItems(n)
329
+ const order = await getData(`${n}:order`)
330
+ if (order && order.length) {
331
+ objs[n].sort((a, b) => {
332
+ const ai = findIndex(order, r => r === a.id)
333
+ const bi = findIndex(order, r => r === b.id)
334
+ return ai - bi
335
+ })
336
+ }
323
337
  }
324
338
  objs.config = pick(store.config, [
325
339
  'theme',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "1.38.43",
3
+ "version": "1.38.50",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",