Skip to content

Instantly share code, notes, and snippets.

@ljmotta
Created October 13, 2020 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljmotta/c83184593c1805dcb71c810b659dc6b3 to your computer and use it in GitHub Desktop.
Save ljmotta/c83184593c1805dcb71c810b659dc6b3 to your computer and use it in GitHub Desktop.
Base64Png Editor Tweak State Control
/**
* Create a Base64PngEdit and update the state control stack with it. We've updated the receive_newEdit notification with the Base64Edit in case the needs any additional information.
*/
const tweakInvert = useCallback((value: string) => {
setInvert(value);
const command: Base64PngEdit = {
id: new Date().getTime().toString(),
filter: `invert(${value})`,
invert: value,
};
stateControl.updateCommandStack(JSON.stringify(command));
props.envelopeContext.channelApi.notifications.receive_newEdit(command);
}, [invert, stateControl]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment