Transform Property Values
When you register a tool, you can also create a transformer for that tool. Transformer is a function that is called each time any of the properties is changed and gives you an opportunity to modify any or all of the values in the tool.
unlayer.registerTool({
transformer: (values, source) => {
const { name, value, data } = source;
// Transform the values here
let newValues = {
values
};
// Return updated values
return newValues;
}
);
The arguments passed to the transformer are these:
Option | Description |
---|---|
values | Current property values for the tool |
source | An object that contains information for the property that triggered this call: name of the property value of the property data is the optional metadata passed by the updateValue function of the property editor |
Updated over 4 years ago
Did this page help you?