blueprintRangeToOverrideRange

Type: Function

Convert a BlueprintRange from a command/mutation to a OverrideRange for the arguments.

This can be used in a command/custom mutation to make a OverrideRange object for passing along in the argument to the next step in an operation. Make sure to do this at the very end, after any and all mutations have been done. To convert a overrideRange to a BlueprintRange see overrideRangeToBlueprintRange.

Example usage

JavaScript

if (argument.overrideRange) {
	argument.overrideRange = blueprintRangeToOverrideRange(range).
}

Custom mutation example

JavaScript

function myCustomMutation (argument, blueprint, format, selectionRange) {
	var range = selectionRange;
	if (argument.overrideRange) {
		range = overrideRangeToBlueprintRange(argument.overrideRange, blueprint);
	}

	var success = performDomMutationsHere();

	optionallyCorrectRangeAfterMutations(range);

	if (success && argument.overrideRange) {
		argument.overrideRange = blueprintRangeToOverrideRange(range).
	}

	return success ? CustomMutationResult.ok() : CustomMutationResult.notAllowed();
}

Refer to baseFlowUtils for more information on how to import and use this function.

Arguments

  1. blueprintRange

    (Required)

    Type: Range

    A BlueprintRange from which to create a OverrideRange

Returns

The blueprint range based on the OverrideRange