@@ -17,21 +17,21 @@ KdbxWeb is a high-performance javascript library for reading/writing KeePass v2
1717 - [ Loading] ( #loading )
1818 - [ Saving] ( #saving )
1919 - [ File info] ( #file-info )
20- - [ Changing credentials ] ( #changing-credentials )
20+ - [ Changing Credentials ] ( #changing-credentials )
2121 - [ Creation] ( #creation )
2222 - [ Maintenance] ( #maintenance )
2323 - [ Merge] ( #merge )
2424 - [ Groups] ( #groups )
25- - [ Group creation ] ( #group-creation )
26- - [ Group deletion ] ( #group-deletion )
27- - [ Group move ] ( #group-move )
25+ - [ Group Creation ] ( #group-creation )
26+ - [ Group Deletion ] ( #group-deletion )
27+ - [ Group Move ] ( #group-move )
2828 - [ Recycle Bin] ( #recycle-bin )
29- - [ Recursive traverse ] ( #recursive-traverse )
29+ - [ Recursive Traverse ] ( #recursive-traverse )
3030 - [ Entries] ( #entries )
31- - [ Entry creation ] ( #entry-creation )
32- - [ Entry modification ] ( #entry-modification )
33- - [ Entry deletion ] ( #entry-deletion )
34- - [ Entry move ] ( #entry-move )
31+ - [ Entry Creation ] ( #entry-creation )
32+ - [ Entry Modification ] ( #entry-modification )
33+ - [ Entry Deletion ] ( #entry-deletion )
34+ - [ Entry Move ] ( #entry-move )
3535 - [ ProtectedValue] ( #protectedvalue )
3636 - [ Errors] ( #errors )
3737 - [ Consts] ( #consts )
@@ -158,7 +158,7 @@ db.meta
158158
159159See the corresponding type fields inside, they should be obvious.
160160
161- ### Changing credentials
161+ ### Changing Credentials
162162
163163``` ts
164164const db = await kdbxweb .Kdbx .load (data , credentials );
@@ -211,14 +211,18 @@ let db = await kdbxweb.Kdbx.load(data, credentials); // load local db
211211db .save (); // save local db
212212let editStateBeforeSave = db .getLocalEditState (); // save local editing state (serializable to JSON)
213213db .close (); // close local db
214+
214215db = kdbxweb .Kdbx .load (data , credentials ); // reopen it again
215216db .setLocalEditState (editStateBeforeSave ); // assign edit state obtained before save
217+
216218// work with db
217219let remoteDb = await kdbxweb .Kdbx .load (remoteData , credentials ); // load remote db
218220db .merge (remoteDb ); // merge remote into local
219221delete remoteDb ; // don't use remoteDb anymore
222+
220223let saved = await db .save (); // save local db
221224editStateBeforeSave = db .getLocalEditState (); // save local editing state again
225+
222226let pushedOk = pushToUpstream (saved ); // push db to upstream
223227if (pushedOk ) {
224228 db .removeLocalEditState (); // clear local editing state
@@ -238,7 +242,7 @@ let deepGroup = defaultGroup.groups[1].groups[2];
238242
239243<br />
240244
241- ### Group creation
245+ ### Group Creation
242246
243247``` ts
244248let group = db .createGroup (db .getDefaultGroup (), ' New group' );
@@ -247,15 +251,15 @@ let anotherGroup = db.createGroup(group, 'Subgroup');
247251
248252<br />
249253
250- ### Group deletion
254+ ### Group Deletion
251255
252256``` ts
253257db .remove (group );
254258```
255259
256260<br />
257261
258- ### Group move
262+ ### Group Move
259263
260264``` ts
261265db .move (group , toGroup );
@@ -275,7 +279,7 @@ if (!recycleBin) {
275279
276280<br />
277281
278- ### Recursive traverse
282+ ### Recursive Traverse
279283
280284``` ts
281285for (const entry of group .allEntries ()) { /* ... */ }
@@ -295,15 +299,15 @@ entry.fields.Pin = kdbxweb.ProtectedValue.fromString('4321');
295299
296300<br />
297301
298- ### Entry creation
302+ ### Entry Creation
299303
300304``` ts
301305let entry = db .createEntry (group );
302306```
303307
304308<br />
305309
306- ### Entry modification
310+ ### Entry Modification
307311
308312``` ts
309313// push current state to history stack
@@ -326,15 +330,15 @@ entry.removeHistory(index, count);
326330
327331<br />
328332
329- ##### Entry deletion
333+ ### Entry Deletion
330334
331335``` ts
332336db .remove (entry );
333337```
334338
335339<br />
336340
337- ### Entry move
341+ ### Entry Move
338342
339343``` ts
340344db .move (entry , toGroup );
0 commit comments