@electerm/electerm-react 1.38.42 → 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.
|
@@ -56,6 +56,10 @@ export default class InfoModal extends Component {
|
|
|
56
56
|
)
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
formatJSON = (jsonStr) => {
|
|
60
|
+
return JSON.stringify(JSON.parse(jsonStr), null, 2)
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
render () {
|
|
60
64
|
const { store } = this.props
|
|
61
65
|
const {
|
|
@@ -216,7 +220,11 @@ export default class InfoModal extends Component {
|
|
|
216
220
|
<div className='pd1b' key={i + '_os_' + k}>
|
|
217
221
|
<b className='bold'>{k}</b>:
|
|
218
222
|
<span className='mg1l'>
|
|
219
|
-
{
|
|
223
|
+
{
|
|
224
|
+
v.length > 30
|
|
225
|
+
? <pre>{this.formatJSON(v)}</pre>
|
|
226
|
+
: v
|
|
227
|
+
}
|
|
220
228
|
</span>
|
|
221
229
|
</div>
|
|
222
230
|
)
|
package/client/store/sync.js
CHANGED
|
@@ -162,16 +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 =
|
|
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
181
|
objs[`${n}.order.json`] = {
|
|
174
|
-
content:
|
|
182
|
+
content: 'empty'
|
|
175
183
|
}
|
|
176
184
|
}
|
|
177
185
|
const res = await fetchData(type, 'update', [gistId, {
|
|
@@ -240,7 +248,7 @@ export default (Store) => {
|
|
|
240
248
|
arr = fixBookmarks(arr)
|
|
241
249
|
}
|
|
242
250
|
let strOrder = get(gist, `files["${n}.order.json"].content`)
|
|
243
|
-
if (strOrder) {
|
|
251
|
+
if (isJSON(strOrder)) {
|
|
244
252
|
strOrder = JSON.parse(strOrder)
|
|
245
253
|
arr.sort((a, b) => {
|
|
246
254
|
const ai = findIndex(strOrder, r => r === a.id)
|
|
@@ -313,11 +321,19 @@ export default (Store) => {
|
|
|
313
321
|
update('lastDataUpdateTime', store.lastDataUpdateTime)
|
|
314
322
|
}, 1000)
|
|
315
323
|
|
|
316
|
-
Store.prototype.handleExportAllData = function () {
|
|
324
|
+
Store.prototype.handleExportAllData = async function () {
|
|
317
325
|
const { store } = window
|
|
318
326
|
const objs = {}
|
|
319
327
|
for (const n of names) {
|
|
320
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
|
+
}
|
|
321
337
|
}
|
|
322
338
|
objs.config = pick(store.config, [
|
|
323
339
|
'theme',
|