MCPcopy Create free account
hub / github.com/facebook/Rapid / commit

Method commit

modules/core/EditSystem.js:403–422  ·  view source on GitHub ↗

* commit * This finalizes the `staging` work-in-progress edit. * (It's somewhat like what `git commit` does.) * - Set annotation, sources, and other edit metadata properties * - Add the `staging` edit to the end of the history (at this point `staging` becomes `stable`) * - Finally,

(options = {})

Source from the content-addressed store, hash-verified

401 * @param {Array} options.selectedIDs - Array of selectedIDs
402 */
403 commit(options = {}) {
404 d3_select(document).interrupt('editTransition'); // complete any transition already in progress
405
406 const context = this.context;
407 const staging = this.staging;
408
409 const annotation = options.annotation ?? '';
410 staging.annotation = annotation;
411 staging.selectedIDs = options.selectedIDs ?? [];
412 staging.sources = this._gatherSources(annotation);
413 staging.transform = context.viewport.transform.props;
414
415 // Discard forward/redo history if any, and add `staging` after `stable`
416 this._history.splice(this._index + 1, Infinity, staging);
417 this._index++;
418 // (At this point `stable` === `staging`)
419
420 this._replaceStaging();
421 this._updateChanges();
422 }
423
424
425 /**

Callers 15

_doDoubleClickMethod · 0.80
_doPasteMethod · 0.80
lineTaggedAsAreaIssueFunction · 0.80
lineToAreaDynamicFixesFunction · 0.80
extractPointDynamicFixesFunction · 0.80
validationFunction · 0.80
makeIssueFunction · 0.80
makeAddRoleFixFunction · 0.80
getWayIssueIfAnyFunction · 0.80
oldTagIssuesFunction · 0.80
oldMultipolygonIssuesFunction · 0.80

Calls 3

_gatherSourcesMethod · 0.95
_replaceStagingMethod · 0.95
_updateChangesMethod · 0.95

Tested by 1

prepareTestHistoryFunction · 0.64