override Range To Blueprint Range
Type: Function
Convert an OverrideRange from command/custom mutation arguments to a BlueprintRange.
This can be used in a custom mutation to create a BlueprintRange for performing the mutations on, instead of the selectionRange. Be sure to also update argument.overrideRange at the end of the custom mutation using blueprintRangeToOverrideRange.
Example usage
JavaScript
var range = selectionRange;
if (argument.overrideRange) {
range = overrideRangeToBlueprintRange(argument.overrideRange, blueprint);
}
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
override
Range (Required)
Type: OverrideRange
A override range object to containing nodeIds and offsets
blueprint
(Required)
Type: Blueprint
The blueprint in which to consider the range
Returns
Type: BlueprintRange
The blueprint range based on the OverrideRange